You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I have noticed that for various ttf fonts the kerning table does not seem to get populated (example: https://fonts.google.com/specimen/Luxurious+Roman).
When I load the font with the stb_truetype library I get non-zero kerning values for character pairs such as ('A', 'V'), but if I load the same ttf file with fontdue, Font::horizontal_kern returns None for all glyph pairs.
Example:
let bytes = std::fs::read("LuxuriousRoman-Regular.ttf").unwrap();
let font = fontdue::Font::from_bytes(&bytes[..], FontSettings::default()).unwrap();
dbg!( font.horizontal_kern('A', 'V', 40.0)); // is None, but shouldn't be!
No kerning as visible here:
How is should look like:
Edit: I think the issue is with how the kerning is loaded: face.raw_face().table(Tag::from_bytes(&b"kern"))?;
This just looks at the kern table, but a lot of fonts omit this table and put the kerning information into the gpos table instead, which contains records such as:
Hello! I have noticed that for various ttf fonts the kerning table does not seem to get populated (example: https://fonts.google.com/specimen/Luxurious+Roman).
When I load the font with the stb_truetype library I get non-zero kerning values for character pairs such as ('A', 'V'), but if I load the same ttf file with fontdue,
Font::horizontal_kern
returns None for all glyph pairs.Example:
No kerning as visible here:
How is should look like:
Edit: I think the issue is with how the kerning is loaded:
face.raw_face().table(Tag::from_bytes(&b"kern"))?;
This just looks at the
kern
table, but a lot of fonts omit this table and put the kerning information into thegpos
table instead, which contains records such as:For example stb_truetype is doing this:
The text was updated successfully, but these errors were encountered: