Crate fontheight

Crate fontheight 

Source
Expand description

Font Height is a tool that provides recommendations on setting font vertical metrics based on shaped words.

§Motivation

Vertical metrics frequently decide clipping boundaries, but are not used consistently across platforms: e.g. Windows uses OS/2 WinAscent/WinDescent, whereas for system fonts Android uses TypoAscent/TypoDescent and a combination of custom heuristics.

It is often desirable to derive metrics from shaped words as opposed to individual glyphs, as words may reach greater extents:

Early versions of this specification suggested that the usWinAscent value be computed as the yMax for all characters in the Windows “ANSI” character set. For new fonts, the value should be determined based on the primary languages the font is designed to support, and should take into consideration additional height that could be required to accommodate tall glyphs or mark positioning.

⬆️ OS/2 — OS/2 and Windows Metrics Table, OpenType Specification 1.9.1

For this reason, vertical metrics must be chosen with a combination of design (e.g. aesthetic, legibility) and engineering (e.g. clipping) considerations in mind. For the latter, fontheight evaluates the extents of a corpus of shaped text across each writing system that a font intends to support.

Modules§

errors
The errors produced by Font Height.

Structs§

Exemplars
A collection of the lowest lows and highest highs.
InstanceReporter
A Font Height Reporter configured to a specific font instance.
Location
A mapping of axis tags to values.
Report
A report documenting the furthest extents reached at a location by a word list.
Reporter
Font Height’s entrypoint. Parses fonts and can check word lists at specified locations.
VerticalExtremes
The highest & lowest point on the vertical (y) axis.
WordExtremes
A word and the vertical extremes it reached when shaped.
WordExtremesIterator
An iterator of WordExtremes for one specific font, WordList, and Location.
WordList
A list of words, with optional additional metadata.

Traits§

CollectToExemplars
A helper trait to collect an iterator of WordExtremes into an Exemplars.