#include <hikogui/font/font_book.hpp>
|
|
| font_book (font_book const &)=delete |
|
| font_book (font_book &&)=delete |
|
font_book & | operator= (font_book const &)=delete |
|
font_book & | operator= (font_book &&)=delete |
| font_id | register_font_file (std::filesystem::path const &path, bool post_process=true) |
| | Register a font.
|
| void | register_font_directory (std::filesystem::path const &path, bool post_process=true) |
| | Register all fonts found in a directory.
|
| void | post_process () noexcept |
| | Post process font_book Should be called after a set of register_font() calls This calculates font fallbacks.
|
| font_family_id | find_family (std::string const &family_name) const noexcept |
| | Find font family id.
|
| font_family_id | register_family (std::string_view family_name) |
| | Register font family id.
|
| font_id | find_font (font_family_id family_id, font_variant variant) const noexcept |
| | Find a font closest to the variant.
|
|
font & | get_font (font_id id) const |
| font_glyph_ids | find_glyph (font_id font, hi::grapheme grapheme) const noexcept |
| | Find a combination of glyphs matching the given grapheme.
|
|
|
static font_book & | global () noexcept |
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()
| font_family_id v1::font_book::find_family |
( |
std::string const & | family_name | ) |
const |
|
inlinenodiscardnoexcept |
Find font family id.
This function will always return a valid font_family_id by walking the fallback-chain.
◆ find_font()
| font_id v1::font_book::find_font |
( |
font_family_id | family_id, |
|
|
font_variant | variant ) const |
|
inlinenodiscardnoexcept |
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_glyph()
| font_glyph_ids v1::font_book::find_glyph |
( |
font_id | font, |
|
|
hi::grapheme | grapheme ) const |
|
inlinenodiscardnoexcept |
Find a combination of glyphs matching the given grapheme.
This function will find a combination of glyphs matching the grapheme in the selected font, or find the glyphs 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 | ) |
|
|
inlinenodiscard |
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_id 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
-
The documentation for this class was generated from the following file: