Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Advance Width on TTF characters #96

Open
soypat opened this issue Nov 24, 2024 · 0 comments
Open

Incorrect Advance Width on TTF characters #96

soypat opened this issue Nov 24, 2024 · 0 comments

Comments

@soypat
Copy link

soypat commented Nov 24, 2024

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))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant