freetype
freetype copied to clipboard
Incorrect Advance Width on TTF characters
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?
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))
}