Skip to content

fontlabapp.fontui._font_reads

_font_reads

A font view that keeps whole-font reads until the font may have changed.

Why: a TMetrics keystroke reshapes the text, and shaping, the kerning readout and the change fingerprint each read the whole font: glyph names, every glyph's Unicodes, all kerning pairs, groups and features. On a live 3000-glyph FontLab font one kerning read alone costs over a second, so typing lagged by seconds. Typing and view settings never change the font, so those reads can be reused until a font change, an Undo, or a write of our own.

What: FontReads(font) answers keys(), in, kerning, groups, features.text, info, glyphOrder, defaultLayerName and glyph_summaries() and font[name] from memory after the first read. On an older Fontport every font[name] re-lists the whole layer to check that the name exists, so a per-glyph loop costs a scan per glyph; remembering each glyph object keeps later keystrokes free of those scans. Every other attribute passes straight through to font. reset() forgets everything. Write through view.font; the one exception is view.info, whose attribute writes go to the font's info and drop that cached value.

Classes