googlefonts / fontdiffenator

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

Glyph center of mass + glyph area as compiled font glyph diff approach - POC #6

Closed chrissimpkins closed 6 years ago

chrissimpkins commented 6 years ago

Initially discussed in https://github.com/googlefonts/fontdiffenator/issues/4#issuecomment-395632392

Source and test files stored in https://github.com/chrissimpkins/center-of-mass-diff (see branches for different test conditions)

Analysis source file: https://github.com/chrissimpkins/center-of-mass-diff/blob/master/source/com-analysis.py

Compile process: fontmake v1.4 from UFO source with/without the --keep-overlaps flag to *.ttf binaries

Test conditions:

  1. Original baseline design +/- overlaps
  2. Modified glyph x- or y-position, maintained same contour (= same area) +/- overlaps
  3. Modified glyph contour (=different area in these tests) +/- overlaps

Test designs:

  1. 'plus'
  2. 'period'

Artistic license invoked with both designs for testing purposes. Those were the named glyph positions in the source and compiled fonts. I used two overlapping circles for the 'period' shape. The 'plus' was mangled to change the contour.

Screenshots of the 'plus' glyphs in the compiled binaries are in this thread: https://github.com/chrissimpkins/center-of-mass-diff/issues/1

Screenshots of the 'period' glyphs in the compiled binaries are in this thread: https://github.com/chrissimpkins/center-of-mass-diff/issues/2

Calculations:

  1. Glyph center of mass x-value
  2. Glyph center of mass y-value
  3. Glyph area

These values were calculated with the fontTools.pens.statisticsPen.StatisticsPen using the analysis script linked above.

Summary:

Results:

GLYPH: uni002B

Font 1 - Original design WITHOUT overlaps area: -0.054145 meanX: 0.2875 meanY: 0.3405

Font 2 - Original design WITH overlaps area: 0.06137 meanX: 0.2875 meanY: 0.3405

Font 3 - Modified position, same glyph contour WITHOUT overlaps area: -0.054145 meanX: 0.4175 meanY: 0.3405

Font 4 - Modified position, same glyph contour WITH overlaps area: 0.06137 meanX: 0.4175 meanY: 0.3405

Font 5 - Modified contour WITHOUT overlaps area: -0.091545 meanX: 0.299896 meanY: 0.3405

Font 6 - Modified contour WITH overlaps area: 0.09877 meanX: 0.300086 meanY: 0.3405

GLYPH: uni002E

Font 1 - Original design WITHOUT overlaps area: -0.0634622 meanX: 0.127 meanY: 0.25388

Font 2 - Original design WITH overlaps area: 0.0768443 meanX: 0.127 meanY: 0.253892

Font 3 - Modified position, same glyph contour WITHOUT overlaps area: -0.0634622 meanX: 0.127 meanY: 0.34388

Font 4 - Modified position, same glyph contour WITH overlaps area: 0.0768443 meanX: 0.127 meanY: 0.343892

Font 5 - Modified contour WITHOUT overlaps area: -0.0872055 meanX: 0.127 meanY: 0.250842

Font 6 - Modified contour WITH overlaps area: 0.100588 meanX: 0.127 meanY: 0.251256

chrissimpkins commented 6 years ago

Any interest in developing this as part of the diff used in this project? If not, I'll work on it in a different repository. I'd like to use it as part of our QA process. I am hoping that it will provide automated reassurances about shape stability with updates to build tools and transitions to new build tools which will be happening in the near term. I can't keep up with @anthrotype 's daily commit push rate and all of the various changelogs in dependencies of dependencies :)

chrissimpkins commented 6 years ago

@anthrotype as an associated side note, it might be helpful on your end to use a tool like this across scheduled "nightly builds" of all/select typeface projects in Google Fonts that are compiled with fontmake and the HEAD of master branches of associated libraries in order to perform integration testing all the way down the stream of dependency changes that occur on a given day? It's a deep rabbit hole with lots of moving parts :)

This should be simple with CI cron jobs and the Google Fonts collection would provide a broad range of different font compile issues to test against.

m4rc1e commented 6 years ago

@chrissimpkins sorry I've been away for the past week or so. Thank you for the very detailed write up. I'll get back to you on this (have a lot of other stuff to finish first). I'm really keen for this to become the differ to end all differs.

chrissimpkins commented 6 years ago

@m4rc1e no worries! Look forward to hearing what you think.

m4rc1e commented 6 years ago

@chrissimpkins Have you been able to test this diff approach out? also, you going AtypI?

chrissimpkins commented 6 years ago

Only the data as presented here. Unfortunately won't be able to make Belgium trip but hope to meet you at another conference over the upcoming year!