#include <hikogui/font/font_book.hpp>
font_book keeps track of multiple fonts.
The font_book is instantiated during application startup and is available through Foundation_globals->font_book.
◆ find_family()
Find font family id.
This function will always return a valid font_family_id by walking the fallback-chain.
◆ find_font() [1/2]
Find a font closest to the variant.
This function will always return a valid font_id.
- Parameters
-
family_id | a valid family id. |
variant | The variant of the font to select. |
- Returns
- a valid font id.
◆ find_font() [2/2]
Find a font closest to the variant.
This function will always return a valid font_id.
- Parameters
-
family_name | A name of a font family, which may be invalid. |
weight | The weight of the font to select. |
style | If the font to select should be italic or not. |
- Returns
- A pointer to a font, or nullptr when the family was not found.
◆ find_glyph() [1/2]
Find a glyph using the given code-point.
This function will find a glyph matching the grapheme in the selected font, or find the glyph in the fallback font.
- Parameters
-
font | The font to use to find the grapheme in. |
grapheme | The Unicode grapheme to find in the font. |
- Returns
- A list of glyphs which matched the grapheme.
◆ find_glyph() [2/2]
Find a glyph using the given code-point.
This function will find a glyph matching the grapheme in the selected font, or find the glyph in the fallback font.
- Parameters
-
font | The font to use to find the grapheme in. |
grapheme | The Unicode grapheme to find in the font. |
- Returns
- A list of glyphs which matched the grapheme.
◆ post_process()
void v1::font_book::post_process |
( |
| ) |
|
|
inlinenoexcept |
Post process font_book Should be called after a set of register_font() calls This calculates font fallbacks.
◆ register_family()
font_family_id v1::font_book::register_family |
( |
std::string_view | family_name | ) |
|
|
inlinenoexcept |
Register font family id.
If the family already exists the existing family_id is returned.
◆ register_font_directory()
void v1::font_book::register_font_directory |
( |
std::filesystem::path const & | path, |
|
|
bool | post_process = true ) |
|
inline |
Register all fonts found in a directory.
- See also
- register_font()
◆ register_font_file()
font & v1::font_book::register_font_file |
( |
std::filesystem::path const & | path, |
|
|
bool | post_process = true ) |
|
inline |
Register a font.
Duplicate registrations will be ignored.
When a font file is registered the file will be temporarily opened to read and cache a set of properties:
- The English font Family from the 'name' table.
- The weight, width, slant & design-size from the 'fdsc' table.
- The character map 'cmap' table.
- Parameters
-
path | Location of font. |
post_process | Calculate font fallback |
The documentation for this class was generated from the following file: