Struct kas_text::fonts::Database[][src]

pub struct Database { /* fields omitted */ }
Expand description

Manages the list of available fonts and font selection

This database exists as a singleton, accessible through the fonts function.

After initialisation font loading and alias adjustment is disabled. The reason for this is that font selection uses multiple caches and there is no mechanism for forcing fresh lookups everywhere.

Implementations

Access the database

Access the list of discovered font families

All family names are uppercase.

List all font family alias keys

All family names are uppercase.

List all aliases for the given family

The family parameter must be upper case (or no matches will be found). All returned family names are uppercase.

Resolve the substituted font family name for this family

The input must be upper case. The output will be the loaded font’s case. Example: SANS-SERIF

Add font aliases for family

When searching for family, all aliases will be searched too. Both the family parameter and all aliases are converted to upper case.

This method may only be used before init; if used afterwards, only a warning will be issued.

Control whether system fonts will be loaded on init

Default value: true

Loads a font data into the Database.

Will load all font faces in case of a font collection.

This method may only be used before init; if used afterwards, only a warning will be issued. By default, system fonts are loaded on init.

Loads a font file into the Database.

Will load all font faces in case of a font collection.

This method may only be used before init; if used afterwards, only a warning will be issued. By default, system fonts are loaded on init.

Loads font files from the selected directory into the Database.

This method will scan directories recursively.

Will load ttf, otf, ttc and otc fonts.

Unlike other load_* methods, this one doesn’t return an error. It will simply skip malformed fonts and will print a warning into the log for each of them.

This method may only be used before init; if used afterwards, only a warning will be issued. By default, system fonts are loaded on init.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast from Self to T

Try converting from Self to T

Cast to integer, truncating Read more

Cast to the nearest integer Read more

Cast the floor to an integer Read more

Cast the ceiling to an integer Read more

Try converting to integer with truncation Read more

Try converting to the nearest integer Read more

Try converting the floor to an integer Read more

Try convert the ceiling to an integer Read more

Convert from T to Self

Try converting from T to Self

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.