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.
- Localized
String - String containing a name or other font metadata in a specific language.
- Localized
Strings - Iterator over a collection of localized strings for a specific identifier.
- String
Id - Identifier for an informational string (or name).
Enumsยง
- Language ๐
Constantsยง
- LANGUAGE_
ID_ ๐TO_ BCP47 - Mapping of OpenType name table language identifier to BCP-47 language tag. Borrowed from Skia: https://skia.googlesource.com/skia/+/refs/heads/main/src/sfnt/SkOTTable_name.cpp#98
- MAX_
INLINE_ ๐LANGUAGE_ LEN - This value is chosen arbitrarily to accommodate common language tags that are almost always <= 11 bytes (LLL-SSSS-RR where L is primary language, S is script and R is region) and to keep the Language enum at a reasonable 32 bytes in size.
Functionsยง
- language_
id_ ๐to_ bcp47 - Converts an OpenType language identifier to a BCP-47 language tag.