Font
A font.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Name of the font. |
required |
|
Dict[str, List[str]]
|
Glyphs for single chars. |
required |
|
Glyphs
|
Glyphs for ligatures. Defaults to None. |
None
|
|
int
|
Spacing between glyphs in number of cells. Defaults to 0. |
0
|
|
int
|
Width of space glyph in number of cells. Defaults to 1. |
1
|
|
int
|
Line index of baseline. Defaults to second to last line. |
None
|
|
Union[int, LineStyle]
|
Line index or more complex style of underline. Defaults to line below baseline. |
None
|
|
Union[int, LineStyle]
|
Line index or more complex style of underline2. Defaults to baseline. |
None
|
|
Union[int, LineStyle]
|
Line index or more complex style of overline. Defaults to first line. |
None
|
|
Union[int, LineStyle]
|
Line index or more complex style of strike. Defaults to middle line. |
None
|
from_file
cached
classmethod
from_file(path)
Load from glyphs file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[Path, str]
|
Path to .toff file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Font |
Font
|
Loaded font. |
get
get(char)
Get glyph for char or ligature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Char or group of chars (ligature). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Glyph |
Glyph
|
Glyph for char. |
get_font_names
classmethod
Return list of builtin font names. Extended fonts are prefixed with 'extended.'.
placeholder
classmethod
placeholder(line_height)
Create placeholder glyph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Height in number of lines. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Glyph |
Glyph
|
Placeholder glyph. |
space
classmethod
space(width, line_height)
Create space glyph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Width in number of cells. |
required |
|
int
|
Height in number of lines. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Glyph |
Glyph
|
Space glyph. |