silnrsi / font-ttf-scripts

Font::TTF::Scripts perl module
Artistic License 2.0
19 stars 7 forks source link

ttfsubset - coverage and rule table clean up is altering the relationship between these tables #13

Open bobh0303 opened 7 years ago

bobh0303 commented 7 years ago

In subset_lookup, there is processing to remove deleted elements from the coverage table hash and the rule array (for glyphs that aren't in the subset). The algorithm seems like it should work (and it obviously does in most cases), but it failed on a GPOS type 4 lookup..

The code was rewritten to eliminate the deleted elements in a way that more clearly maintains the relationship between the coverage table indexes and the rules. I tried to preserve all the previous functionality of the code since I don't understand all the GPOS lookup types where this code is applied. This fixed the problem for the Roman font subsettting.

The fix I applied only impacts base glyph AP data. It seems to me that the same elimination of deleted elements needs to be applied to the MATCH and MARKS structures (which hold diacritic AP data). I don't know all the lookup types and formats where this should be done, so I added a comment.

ref: FTLS-41