-
Notifications
You must be signed in to change notification settings - Fork 14
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
excessive number of unused lookups generated for NotoSansGrantha.glyphs #1046
Comments
There's definitely something funny going on here; our GSUB is about 190kb, versus 67.5kb for fontmake. It might be that |
Does fontmake prune layout (e.g. drop dead lookups)? Which code does that? |
Strengthens case for #972 I suppose! |
I don't think it explicitly does, no. Something else must be going on. After much debugging, I think I have isolated the snippet of FEA that is generating the hundreds of seemingly unreferenced lookups in fontc (it's self contained): @class2 = [bha_gran bha_gran.flat cha_gran da_gran dda_gran ddha_gran ga_gran ga_gran.flat h_ma_gran ha_gran ha_gran.flat j_j_nya_gran j_ja_gran j_nya_gran ja_gran k_ssa_gran k_ssa_gran.flat la_gran lla_gran m_ma_gran ma_gran n_tha_gran nga_gran nna_gran ny_cha_gran nya_gran pha_gran sa_gran ss_tta_gran ssa_gran t_tha_gran tha_gran ttha_gran ttha_gran.alt];
@class3 = [ba_gran.below bha_gran.below bha_gran.flat.below ca_gran.below cha_gran.below d_dha_gran.below d_va_gran.below da_gran.below dda_gran.below ddha_gran.below dha_gran.below ga_gran.below ga_gran.flat.below gha_gran.below h_ma_gran.below ha_gran.below ha_gran.flat.below j_ja_gran.below j_nya_gran.below ja_gran.below jha_gran.below k_ssa_gran.below k_ssa_gran.flat.below k_t_va_gran.below k_ta_gran.below k_ta_gran.flat.below ka_gran.below kha_gran.below la_gran.below lla_gran.below m_ma_gran.below ma_gran.below n_da_gran.below n_dha_gran.below n_ma_gran.below n_na_gran.below n_na_gran.flat.below n_t_va_gran.below n_ta_gran.below n_ta_gran.flat.below n_tha_gran.below n_va_gran.below na_gran.below na_gran.flat.below nga_gran.below nna_gran.below ny_ca_gran.below ny_cha_gran.below ny_ja_gran.below nya_gran.below pa_gran.below pha_gran.below ra_gran.below sa_gran.below sh_ca_gran.below sh_ra_gran.below sha_gran.below ss_tta_gran.below ssa_gran.below ssa_gran.flat.below t_ra_gran.below t_tha_gran.below t_va_gran.below ta_gran.below ta_gran.flat.below tha_gran.below tta_gran.below ttha_gran.below ttha_gran.below.alt va_gran.below ya_gran.below];
@markAttachmentSet1 = [virama_gran virama_gran.alt virama_gran.s1];
# Prefix: Languagesystems
languagesystem DFLT dflt;
languagesystem gran dflt;
languagesystem tml2 dflt;
feature abvs {
lookupflag MarkAttachmentType @markAttachmentSet1;
sub @class2 [virama_gran virama_gran.s1]' by virama_gran.alt;
sub @class2 @class3' @class3' [repha_gran repha_yaPhalaa repha_yaPhalaa.alt repha_yaPhalaa.short]' [virama_gran virama_gran.s1]' by virama_gran.alt;
sub @class2 @class3' [repha_gran repha_yaPhalaa repha_yaPhalaa.alt repha_yaPhalaa.short]' [virama_gran virama_gran.s1]' by virama_gran.alt;
sub @class2 @class3' @class3' [virama_gran virama_gran.s1]' by virama_gran.alt;
sub @class2 @class3' [virama_gran virama_gran.s1]' by virama_gran.alt;
sub @class2 [repha_gran repha_yaPhalaa repha_yaPhalaa.alt repha_yaPhalaa.short]' [virama_gran virama_gran.s1]' by virama_gran.alt;
} abvs; Fontmake only builds 7 lookups in total from the snippet above, whereas fontc builds 722, most of which never actually called upon. Maybe there's something going badly with offset overflow resolution, I don't know yet. |
fontc_crater reports that grantha/sources/NotoSansGrantha.glyphs's GSUB table as built by fontc is strikingly different from fontmake's:
Inspecting the built fonts leads me to think this is because fontc ends up building hundreds of additional lookups that are not used nor referenced from anywhere, somehow more than 700+ lookups are just dead weight.
Try to run the following python script (which in turns uses the fonttools subsetter
prune_lookups
method to remove all the unused lookups in GSUB or GPOS tables) on the NotoSansGrantha font built by fontc:https://gist.github.com/anthrotype/4facc66668c1dca9414180e4e276b922
you'll notice how the LookupList.LookupCount decreases from a whopping 830 to 114. That's a lot
I'm still not sure how/why this happens.
Running the same above script on the same font as generated by fontmake only gets rid of 1 lookup out of 115 in total. Much better than fontc even though not perfect.
The text was updated successfully, but these errors were encountered: