-
Notifications
You must be signed in to change notification settings - Fork 487
[TSI0, TSI5] Derive number of entries to decompile from data length #2477
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
Conversation
but do you not also update maxp.numGlyphs when you add a glyph to the font? |
oh I see, you do update maxp.numGlyphs, hence the TSI tables become too short. what about the other TSI tables? |
to fix the |
The other tables don't use the maxp.numGlyphs value. TSI2 uses the code from the TSI0 class and inherits the fix. |
Are there still interest in merging this PR? |
# Conflicts: # Lib/fontTools/ttLib/tables/T_S_I__0.py # Lib/fontTools/ttLib/tables/T_S_I__5.py
Sure! I'll look at the comments and add some tests. |
I added another detail: When making a test font with VTT hinting, I noticed that VTT will add zero-length I've added tests and log warnings when the number of TSI0/5 entries and glyphs don't match. Should be good to go now. |
When you add glyphs to a font containing VTT source tables, the number of glyphs will not match the number of entries in the VTT source tables anymore. This causes the decompilation of VTT source tables to fail.
This change fixes this by deriving the number of entries to decompile from the length of the table data in TSI0 and TSI5.
VTT itself also accepts TSI0 and TSI5 tables that are "too short" for the current number of glyphs.