FontInfo
ClassDataClassSource
FontInfo(names: dict[FontLanguage, FontNameInfo], index: int = 0, path: str)
The basic font information.
Fields
| Name | Type | Required | |
|---|---|---|---|
names | dict[FontLanguage, FontNameInfo] | The multi-lingual names of this font. All font names here are "full" names. | |
index | int | The font index. This value is used only when the font is ttc. Otherwise, this value should be 0. | |
path | str | The full path to the font file. |
Methods
get_font
v_1: FreeTypeFont = self.get_font(size: int = 10)
Load the Pillow FreeTypeFont.
Requires
| Name | Type | Required | |
|---|---|---|---|
size | int | The font size. |
Returns
| Name | Type | |
|---|---|---|
v_1 | FreeTypeFont | The loaded font. |
get_name
v_1: str = self.get_name(lang: str | FontLanguage = FontLanguage.en)
Get the best name of this font.
Will use the given language to search the font name. If not found, use the English language to search the font name. If still not found, will use the first available language of the font to get the font name.
Requires
| Name | Type | Required | |
|---|---|---|---|
lang | str | FontLanguage | The language name or code used for searching he font. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The best string name of the font. |
Properties
langs
langs: list[FontLanguage] = self.langs
List the supported languages.