The font that a tool gets for the text of a graph
Each tool measures a text with the font that it gets, and it calculates the size of each box from that measure. Therefore the render gives the font of the slide to the tool, and the browser shows the text in the same font.
The built-in theme uses Atkinson Hyperlegible. The document holds that font
as WOFF2 files, and the tools read TTF files, so assets/fonts/ also holds
the four TTF files of the font. This module reads them at compile time, as
Expresso.Font reads the WOFF2 files, so a release does not need the
assets/ directory.
The font option of a diagram gives a directory with the TTF files of a
different font. read!/1 takes the family and the style of each file from
the name table of the file. A style that the directory does not have takes
the regular file.
Summary
Functions
The advance width of each character of text in each style of a font
The font of the built-in theme, Atkinson Hyperlegible
The files of a font, with a name for each style
The family and the style of a TTF file, from its name table
Read the TTF files of a directory
Types
Functions
The advance width of each character of text in each style of a font
The width is a part of the size of the font, such as 0.55 for a character
that is a little more than half of an em wide. The keys of the result are
the styles of Pele: 0 regular, 1 bold, 2 italic and 3 bold italic.
Each style maps the code point of a character to its width. A character that
the font does not have is not in the map, and a measurer gives it a default
width. The widths ignore kerning.
Expresso.Element.Diagram.Pele gives the widths to its measurer, so Pele
sizes each box for the text in the font of the slide.
@spec builtin() :: t()
The font of the built-in theme, Atkinson Hyperlegible
The files of a font, with a name for each style
A tool reads them from its private directory.
The family and the style of a TTF file, from its name table
The family is the name with the id 1, and the style is the name with the id
2, such as {"Atkinson Hyperlegible", "Bold"}. The function prefers the
names for Windows, in UTF-16, and it takes the names for the Mac when the
file has no other.
Read the TTF files of a directory
The function raises an ArgumentError for a directory without a TTF file
with the style Regular, and for files of more than one family.