Module string

Source
Expand description

Localized strings describing font names and other metadata.

This provides higher level interfaces for accessing the data in the OpenType name table.

§Example

The following function will print all localized strings from the set of predefined identifiers in a font:

use skrifa::{string::StringId, MetadataProvider};

fn print_well_known_strings<'a>(font: &impl MetadataProvider<'a>) {
    for id in StringId::predefined() {
        let strings = font.localized_strings(id);
        if strings.clone().next().is_some() {
            println!("[{:?}]", id);
            for string in font.localized_strings(id) {
                println!("{:?} {}", string.language(), string.to_string());
            }
        }
    }
}

Structs§

Chars
Iterator over the characters of a string.
LocalizedString
String containing a name or other font metadata in a specific language.
LocalizedStrings
Iterator over a collection of localized strings for a specific identifier.
StringId
Identifier for an informational string (or name).