Open davelab6 opened 6 years ago
@davelab6 , @m4rc1e : I got the same error. Now I know why
the hmtx table has advance widths and left side bearings, works for both TTF and CFF-flavored OpenType. The _TTGlyph
objects that you get with TTFont.getGlyphSet()
already expose width
and lsb
attributes (from htmx) for both the OT flavors.
https://github.com/fonttools/fonttools/blob/7d59b729ab996af6fe08411267eaad0bec1a2615/Lib/fontTools/ttLib/ttFont.py#L732
The right side bearings can be inferred from the advance width and the bounding box xMax coordinate (from glyf table). For CFF you need to compute the bounds, e.g. see https://github.com/fonttools/fonttools/blob/7d59b729ab996af6fe08411267eaad0bec1a2615/Lib/fontTools/ttLib/tables/_h_h_e_a.py#L66-L70
Thanks for the pointers @anthrotype!
What needs to be done to support comparing OTF? Are we able to enumerate the tasks or do we currently have no idea?
Off the top of my head, I can only think of:
I originally wrote this tool only with ttfs in mind. If we want otf support, I'll need to refactor some of the logic so it's more flexible. Luckily, most of it is kept inside the diffenator.font module.
I also don't know how well hb, freetype and fonttools.varLib support otf fonts. I need to check this.
When will otf support arrive in Google Fonts?
We support and ship OTFs today.
We can now diff and dump otfs.
Still not sure how well it will work for CFF VFs so I'm going to leave this open.
great news. @m4rc1e : thanks
We only compare TTFs for now, not OTFs.
glyf
table (even a filename catcher on.otf
would be better than today)Example error when passing in OTFs: