Change method of determining glyph height#1074
Change method of determining glyph height#1074aaronbell wants to merge 2 commits intogooglefonts:mainfrom
Conversation
- Updating name of function to drop the "typo" portion as it no longer automatically pulls the typo values - Now attempts to pull values from the BASE table first - Barring that, will evaluate if the sTypo values are larger than the font upm to determine padding and correct position - otherwise, will follow previous approach
forgot to include default state
|
I didn't look at the code, yet. But it doesn't sound right to use the Base table for the. I would rather define a custom parameter (or even a proper metrics setting) for this. Something like |
|
@schriftgestalt there does need to be both a proper ascender and descender value set since they are used for both the advanceHeight and verOrigin entries, so do keep that in mind. I’m open to new custom parameters / metrics though. The BASE table is a useful tool in that it usually provides these values directly, or easily determinable as the values are set by the designer rather than “guessing”. |
|
It is also worth noting that even if a new field is added, it is helpful to have a backwards compatible methodology to determine this correctly. |
|
Then we add two values. |
Closes #1071
In order to make glyphsLib assign the correct glyph height to every glyph on conversion, it needs a more intelligent approach than simply copying the
sTypovalues. In this PR, I updated the logic to initially attempt to use data from aBASEtable in the font .fea file to determine the correct height values. Barring that, evaluate if the sum of the sTypo metrics are larger than the font upm (which implies some variance from the 'standard' approach). And if all of the above is not usable, or False, then to fall back to the existing logic of using the sTypo metrics or master.ascender / master.descender values.Implementing this logic will help avoid the need for a post-production script to address problems in the
vmtxandvheatables.Notes
Glyphs does not currently use this approach to determine glyph heights on output. However, I am proposing such a modification to it as well.
This code is horribly un-optimized and could be greatly improved for speed. I am providing this PR primarily as a proof of concept of the approach, since plumbing it properly would be more involved.