Options

compare point placement

hi, anyone know of a tool to compare and diff point placement between two ttf files?

Comments

  • Options
    fontdiffenator has a visual comparison; not exactly what you have in mind, I suppose, but still useful. I suppose you could ttx/ufo the files, or use fonttools directly, diff the parsed output.

    Compare the first contour of /A in old.ttf to new.ttf:
    from fontTools.ttLib import TTFont
    from difflib import ndiff

    old = TTFont("old.ttf")
    new = TTFont("new.ttf")

    old_A = old["glyf"]["A"].getCoordinates(old["glyf"])
    new_A = old["glyf"]["A"].getCoordinates(new["glyf"])

    print("\n".join(ndiff(
        [str(p) for p in old_A[0]],
        [str(p) for p in new_A[0]])))
    Expand for all glyphs, composite glyphs and all contours, and play with difflib to get the output you want.
  • Options
    Thank you Johannes!
Sign In or Register to comment.