googlefonts / fontdiffenator

Font comparison tool
Apache License 2.0
79 stars 13 forks source link

Beginnings of a low-level table data diff #87

Open simoncozens opened 3 years ago

simoncozens commented 3 years ago

fontdiffenator is deliberately aimed at the semantic level - what are the user-facing differences between two font files? However, it's also a good basis for asking structural questions: how does the data in these two fonts differ? This adds a "structural" test which reports on differences within the OpenType tables. It isn't on by default, but can be asked for with --td structural. I plan to extend it to cover all the tables in the OT spec.

Here's some sample output:

****fvar table: 2****

field               before              after
wdth DefaultValu... 100.0               80.0
wght MinValue       1.0                 12.0

****avar table: 11****

axis                before              after
wdth                5 segments          0 segments
wdth                -1.0 => -1.0        No mapping
wdth                -0.5 => -0.61426... No mapping
wdth                -0.26 => -0.1571... No mapping
wdth                0.0 => 0.0          No mapping
wdth                1.0 => 1.0          No mapping
wght                11 segments         10 segments
wght                0.1667 => 0.1053... 0.1667 => 0.12
wght                0.6667 => 0.5684... 0.8333 => 0.7895...
wght                0.8333 => 0.7895... 1.0 => 1.0
wght                1.0 => 1.0          No mapping
****OS/2 table: 24****

field               before              after
ySuperscriptYSiz... 600                 1331
yStrikeoutSize      50                  102
sTypoDescender      -220                -555
version             4                   3
yStrikeoutPositi... 290                 512
usLastCharIndex     64260               65533
fsSelection         192                 64
usWinAscent         1052                2146
sxHeight            484                 1082
sTypoAscender       937                 2146
ulUnicodeRange2     0000000000000000... 0101000000000000...
ulUnicodeRange1     0010000000000000... 1110000000000000...
panose              SerifStyle=0,Let... SerifStyle=0,Let...
xAvgCharWidth       562                 1162
usWinDescent        224                 555
ySubscriptYSize     600                 1331
ySuperscriptXSiz... 650                 1434
ySubscriptYOffse... 75                  287
achVendID           PLAY                GOOG
usDefaultChar       0                   32
ySubscriptXSize     650                 1434
ySuperscriptYOff... 350                 977
ulUnicodeRange3     0000000000000000... 0000000000000000...
sCapHeight          649                 1456

****head table: 9****

field               before              after
created             Wed Mar  1 09:58... Fri Sep 12 12:29...
fontRevision        2.101               2.14
yMax                1035                2163
xMin                -524                -1825
xMax                1259                4188
lowestRecPPEM       7                   9
yMin                -220                -555
flags               0000000000000111... 0000000000011001...
unitsPerEm          1000                2048
m4rc1e commented 3 years ago

fontdiffenator is deliberately aimed at the semantic level - what are the user-facing differences between two font files?

Yep.

I like what you're doing here however, we already check the hhea, head, OS/2 tables etc. They're bundled together in the diff category attribs.

Screenshot 2021-03-19 at 10 08 05

Perhaps breaking apart this attribs table into their actual tables like you're doing is the better approach.

If this is a feature you desperately need, I have no qualms in merging this. However, we could do a tidy up but I'm going to rewrite some parts of this tool this year (will consult you first about the design) so I'm not sure it's worth the effort to get it 100%.

simoncozens commented 3 years ago

I do need a good tool to help me understand any differences between fonts produced by my toolchain and fontmake, and I find this helps me. But maybe it doesn't need to be added to fontdiffenator if you're going to work on a new approach; I'm happy just to run the test from my own fork.