pub struct Font {Show 17 fields
pub units_per_em: u16,
pub axes: Vec<Axis>,
pub masters: Vec<FontMaster>,
pub default_master_idx: usize,
pub glyphs: BTreeMap<SmolStr, Glyph>,
pub glyph_order: Vec<SmolStr>,
pub axis_mappings: UserToDesignMapping,
pub virtual_masters: Vec<BTreeMap<String, OrderedFloat<f64>>>,
pub features: Vec<FeatureSnippet>,
pub all_names: BTreeMap<String, Vec<(String, String)>>,
pub instances: Vec<Instance>,
pub version_major: i32,
pub version_minor: u32,
pub date: Option<String>,
pub kerning_ltr: Kerning,
pub kerning_rtl: Kerning,
pub custom_parameters: CustomParameters,
}Expand description
A tidied up font from a plist.
Normalized representation of Glyphs 2/3 content
Fields§
§units_per_em: u16§axes: Vec<Axis>§masters: Vec<FontMaster>§default_master_idx: usize§glyphs: BTreeMap<SmolStr, Glyph>§glyph_order: Vec<SmolStr>§axis_mappings: UserToDesignMapping§virtual_masters: Vec<BTreeMap<String, OrderedFloat<f64>>>§features: Vec<FeatureSnippet>§all_names: BTreeMap<String, Vec<(String, String)>>§instances: Vec<Instance>§version_major: i32§version_minor: u32§date: Option<String>§kerning_ltr: Kerning§kerning_rtl: Kerning§custom_parameters: CustomParametersImplementations§
Source§impl Font
impl Font
pub fn load_from_string(data: &str) -> Result<Font, Error>
pub fn load(glyphs_file: &Path) -> Result<Font, Error>
pub fn color_palettes(&self) -> Option<&Vec<Vec<Color>>>
pub fn default_palette(&self) -> Option<&[Color]>
pub fn default_master(&self) -> &FontMaster
Sourcepub fn variable_export_settings(&self, master: &FontMaster) -> Option<&Instance>
pub fn variable_export_settings(&self, master: &FontMaster) -> Option<&Instance>
Sourcepub fn get_default_name(&self, key: &str) -> Option<&str>
pub fn get_default_name(&self, key: &str) -> Option<&str>
Get the default (English) value for a name property.
Searches for a value with language “dflt”, “default”, or “ENG” in the all_names field, in order of preference: dflt > default > ENG > first value. Returns None if the property key doesn’t exist or has no values.
Sourcepub fn get_localized_names(
&self,
key: &str,
) -> impl Iterator<Item = (&str, &str)> + '_
pub fn get_localized_names( &self, key: &str, ) -> impl Iterator<Item = (&str, &str)> + '_
Get all localized values for a name property.
Returns an iterator of (language code, value) tuples. Default languages (“dflt”, “default”, “ENG”) are excluded.
Sourcepub fn default_names(&self) -> impl Iterator<Item = (&str, &str)> + '_
pub fn default_names(&self) -> impl Iterator<Item = (&str, &str)> + '_
Iterate over all default name entries.
Returns an iterator of (property key, default value) tuples. Uses priority order: dflt > default > ENG > first value.
Sourcepub fn localized_names(&self) -> impl Iterator<Item = (&str, &str, &str)> + '_
pub fn localized_names(&self) -> impl Iterator<Item = (&str, &str, &str)> + '_
Iterate over all localized name entries.
Returns an iterator of (property key, language code, value) tuples. Default languages (“dflt”, “default”, “ENG”) are excluded.
pub fn vendor_id(&self) -> Option<&str>
Source§impl Font
impl Font
Sourcepub fn propagate_all_anchors(&mut self)
pub fn propagate_all_anchors(&mut self)
Copy anchors from component glyphs into their including composites
Trait Implementations§
impl StructuralPartialEq for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.