tituli.features¶
OpenType features a style asks for, applied without a shaper where they can be (tituli#4).
A style may ask for features by tag (TextStyle(features=("tnum",)): tabular
figures, so the digits of a changing number do not change width). Whether the
font HAS a feature is a property of its bytes, so a face records which of the
requested ones it applies (tituli.fonts.Face.applied_features); a
feature the font lacks is not applied, and the caller can say so.
Pillow applies features only through libraqm, which is often absent, and its
embedded face always lays out without it. So the features that are glyph
SUBSTITUTIONS one for one (GSUB lookup type 1, also inside an extension lookup:
tnum, lnum, onum, pnum, zero, smcp …) are applied here,
from the font’s own tables: featured_glyphs() gives the substituted glyph
names and featured_length() their advances. Measurement
(length()) and outlines (tituli.run_outline())
read both, so they cannot disagree. A requested feature built from any other
kind of lookup needs a shaper and is refused (FeatureError).
Needs fontTools (tituli[outlines]), like the outlines.
Functions
|
The GSUB feature tags a font declares. |
|
The face's requested features that its font has, in request order. |
|
The glyph name each character of |
|
Advance width of |
Exceptions
A requested feature cannot be applied as asked; the message says what would. |
- exception tituli.features.FeatureError[source]¶
Bases:
ValueErrorA requested feature cannot be applied as asked; the message says what would.
- tituli.features.applied_features(face)[source]¶
The face’s requested features that its font has, in request order.
- tituli.features.featured_glyphs(face, text)[source]¶
The glyph name each character of
textdraws with the face’s applied features (Nonewhere the font has no glyph for it).