Variable Font Validation

Is there a validator tool?

Obviously overlaps are ok, but do winding directions make a difference in variable fonts? I ask because I believe that flipped composites are ok. (?)

Comments

  • Adam Jagosz
    Adam Jagosz Posts: 689
    edited December 2019
    I wanted to ask the same question. So I assume it is safer to care about winding directions? Is there a reasonable way to test for them in FontLab 7? (FontAudit doesn't include it, since it's supposed to be fixed upon export, but variable fonts seemingly can't be manipulated with predictable results this way). I tried scripting, but the function I tried to use doesn't work:
    <div>from FL import *;<br>f = fl.font;<br>for g in f.glyphs:<br>&nbsp; n = g.GetContoursNumber();<br>&nbsp; for i in range(0,n):<br>&nbsp;&nbsp;&nbsp; cc = g.isContourClockwise(i);<br>&nbsp;&nbsp;&nbsp; print g.name;<br>&nbsp;&nbsp;&nbsp; print cc; # returns None for all glyphs, instead of a boolean<br>&nbsp;&nbsp;&nbsp; if cc:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print g.name + "has counter-clockwise contour " + str(i);<br></div>
  • @Adam Jagosz
    import fontlab as fl
    
    
    for glyph in (fl.flGlyph(glyph) for glyph in fl.CurrentFont().glyphs):
        if glyph.activeLayer.getContours():
            print(
                "{}: {}".format(
                    glyph.name,
                    [
                        contour.clockwise
                        for contour in glyph.activeLayer.getContours()
                    ],
                )
            )
    


  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited December 2019
    Contributors to the FontBakery project are developing a set of checks for variable fonts. You are welcome to contribute ideas or code!

    GitHub.com/googlefonts/FontBakery