freetype icon indicating copy to clipboard operation
freetype copied to clipboard

Incorrect Advance Width on TTF characters

Open soypat opened this issue 1 year ago • 0 comments

This particular TTF file yields an incorrect advance width on some characters. I've tried to find the original source of the TTF to no avail so I'm including it here. The program below yields 217 advance width, should be 483. See attached image from FontDrop.info website. Other "bad" characters I've detected in this set: D, H, G, E .

What I've noticed is that their values are identical to other characters, so maybe they are out-of-phase?

image

iso-3098.tar.gz

package main

import (
	"fmt"

	"github.com/golang/freetype/truetype"
)

func main() {
	ttf, err := truetype.Parse(iso3098TTF)


	if err != nil {
		panic(err)
	}
	scale := fixed.Int26_6(ttf.FUnitsPerEm())
	hm := ttf.HMetric(scale, 'B')
	fmt.Println(hm.AdvanceWidth, int(hm.AdvanceWidth))
}

soypat avatar Nov 24 '24 14:11 soypat