Skip to content

Validate

validate

Validate the built fonts against upstream Roboto Mono and Fira Code (run with uv).

Checks tables and metadata, that only declared glyphs differ from upstream, ligature outlines, and real HarfBuzz shaping with and without ligatures.

SYSTEMS = ((None, None), ('Latn', None), ('Cyrl', None), ('Grek', None), ('Latn', 'ca'), ('Latn', 'ro'), ('Latn', 'tr'), ('Cyrl', 'sr')) module-attribute

SAMPLES = ('if (x, y; z) { return a[i] + b[j]; }', 'yield: y_axis, fix(ij);', '**`example.json`**', 'x`x', '```', '$HOME ${value} $100.00', 'é ä ñ ö ỵ ї', 'ỵ у ў Ҋ Ӆ') module-attribute

OS2_FIELDS = ('version', 'xAvgCharWidth', 'usWeightClass', 'usWidthClass', 'fsType', 'fsSelection', 'ySubscriptXSize', 'ySubscriptYSize', 'ySubscriptXOffset', 'ySubscriptYOffset', 'ySuperscriptXSize', 'ySuperscriptYSize', 'ySuperscriptXOffset', 'ySuperscriptYOffset', 'yStrikeoutSize', 'yStrikeoutPosition', 'sFamilyClass', 'ulUnicodeRange1', 'ulUnicodeRange2', 'ulUnicodeRange3', 'ulUnicodeRange4', 'sTypoAscender', 'sTypoDescender', 'sTypoLineGap', 'usWinAscent', 'usWinDescent', 'ulCodePageRange1', 'ulCodePageRange2', 'sxHeight', 'sCapHeight', 'usDefaultChar', 'usBreakChar') module-attribute

ValidationError

Bases: AssertionError

Shaper

font = hb.Font(hb.Face(hb.Blob.from_file_path(str(path)))) instance-attribute

name = shaper instance-attribute

__init__(path, shaper='ot')

shape(text, features=None, script=None, language=None)

require(condition, message)

outline(glyphs, name)

Decomposed contours, sorted: flattening a composite may reorder them.

bounds(glyphs, name, transform=None)

validate_tables(font, upstream)

validate_names(font, style, upstream)

validate_glyphs(font, upstream, manifest, cell)

validate_ligature_outlines(font, fira, shaper, specs, transforms)

coretext_shaper(path)

A CoreText shaper on macOS, where apps may shape with it instead of HarfBuzz.

validate_ligatures(shaper, texts, names, cell, script=None, language=None)

validate_shaping(shaper, reference, coretext, texts, cell, cmap)

validate_style(args, style, specs)

main()