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

stb_truetype: GPOS advance always 0 (while GPOS and KERN tables exist), while KERN works fine #1598

Open
Bohaterowicz opened this issue Jan 23, 2024 · 0 comments

Comments

@Bohaterowicz
Copy link

Describe the bug
I am trying to get kerning advance positions for 'Times New Roman' font from Window 11 fonts. The stbtt_fontinfo seems to be correctly populated and I get proper glyphs and advance/lsb values, but when getting kerning offsets it always results in 0 even though both kern and gpos tables are set. While investigating this I manually disabled gpos table in 'stbtt_GetGlyphKernAdvance' which resulted in getting offset value from kern table which resulted in proper (seemingly correct) offset. From quick debugging session it seems that the code gets stuck in 'stbtt__GetGlyphGPOSInfoAdvance' and never gets past the 'if (lookupType != 2)' check. My test case I used while debugging was to try and get 'stbtt_GetGlyphKernAdvance' value between 'T' and 'e' codepoints with a 'Times new roman' font. The result is 0 (it uses GPOS by default), when forced to use KERN it returns -143.
To Reproduce

  1. Init "Times New Roman" font.
  2. Call 'stbtt_GetGlyphKernAdvance' with the initialized font and codepoints of 'T' and 'e'
  3. Result should be 0, if one forces 'kern' and not 'gpos' result should be non-zero.

Expected behavior
Advanace should be non-zero when calling 'stbtt_GetGlyphKernAdvance' with 'Times new roman' and codepoints 'T' and 'e', as the 'e' glyph is slightly pushed into the 'T' glyph bounding box

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