Fonts and Faces#
The terms fonts and faces are borrowed from the Harfbuzz library: A face represents a font file like an OpenType font or a TrueType font and a font is a face in a specific size.
In order to put text into the PDF, you first load a face:
and from that face, you can create a font:
which is just a wrapper for
in the font backend/font library.
Turning text into a series of glyph ids (code points) is the process of shaping.
The harfbuzz.Feature slice is important. For example the text
fish can be turned into different glyph ids depending on the
explain how to create the harfbuzz.Feature slice.
Shape() method returns a slice of
Atoms which is the following type:
|The width of the glyph
|Height above the base line
|Height below the base line
|Indicates that this is a Unicode category L (letter)
|The font codepoint (glyph id) that should be placed in the PDF
|The amount of kerning that should be applied after this glyph