Skip to main content

TypgFontFaceMeta

Struct TypgFontFaceMeta 

Source
pub struct TypgFontFaceMeta {
    pub names: Vec<String>,
    pub axis_tags: Vec<Tag>,
    pub feature_tags: Vec<Tag>,
    pub script_tags: Vec<Tag>,
    pub table_tags: Vec<Tag>,
    pub codepoints: Vec<char>,
    pub is_variable: bool,
    pub weight_class: Option<u16>,
    pub width_class: Option<u16>,
    pub family_class: Option<(u8, u8)>,
    pub creator_names: Vec<String>,
    pub license_names: Vec<String>,
}
Expand description

Everything we know about a single font face, extracted from its binary tables.

One font file may contain multiple faces (in a TTC/OTC collection), and each face gets its own TypgFontFaceMeta. This struct is the unit of comparison — every query filter is evaluated against one of these.

All tag vectors are sorted and deduplicated after extraction, so you can safely use set-intersection logic against them.

Fields§

§names: Vec<String>

Human-readable names for this font face.

Collected from the font’s name table: family name (“Helvetica”), typographic family name (“Helvetica Neue”), full name (“Helvetica Neue Bold”), PostScript name (“HelveticaNeue-Bold”), and subfamily (“Bold”). The file stem (e.g., “HelveticaNeue-Bold” from the filename) is always appended as a fallback, because some fonts have empty or broken name tables.

Sorted, deduplicated, trimmed of whitespace.

§axis_tags: Vec<Tag>

Variation axis tags. Empty for static (non-variable) fonts.

Common axes: wght (weight: 100=Thin, 400=Regular, 700=Bold, 900=Black), wdth (width: 75=Condensed, 100=Normal, 125=Expanded), opsz (optical size: adjusts stroke contrast for small/large rendering), ital (italic: 0=Upright, 1=Italic), slnt (slant: oblique angle in degrees).

Read from the font’s fvar (font variations) table.

§feature_tags: Vec<Tag>

OpenType layout feature tags from GSUB and GPOS tables.

These control typographic behavior: liga (standard ligatures — fi, fl become single glyphs), smcp (small capitals), onum (oldstyle numerals), kern (kerning — fine-tuned spacing between specific letter pairs), calt (contextual alternates), dlig (discretionary ligatures).

GSUB features handle glyph substitution (replacing one glyph with another). GPOS features handle glyph positioning (adjusting placement). Both are merged here because the query doesn’t distinguish them.

§script_tags: Vec<Tag>

Script tags declaring which writing systems this font supports.

Read from GSUB and GPOS script lists. Common values: latn (Latin), arab (Arabic), cyrl (Cyrillic), grek (Greek), hani (CJK ideographs), deva (Devanagari), thai (Thai).

A font can render characters from a script’s Unicode range without declaring script support here — the script tag means the font has shaping rules (substitutions, positioning) specifically for that writing system.

§table_tags: Vec<Tag>

Every top-level table present in the font file.

Useful for structural queries: does this font have CFF (PostScript outlines) or glyf (TrueType outlines)? Does it have SVG (color SVG glyphs) or COLR (color layer glyphs)? Does it have fvar (variable font axes)?

Read directly from the font’s table directory — the index at the start of every OpenType file.

§codepoints: Vec<char>

Unicode codepoints this font can render, from its cmap table.

The cmap (character map) is the font’s promise: “give me this Unicode codepoint, I’ll give you a glyph.” If U+00F1 (ñ) is in this list, the font has a glyph for it.

Sorted and deduplicated. Can be large — a CJK font may cover 20,000+ codepoints.

§is_variable: bool

Whether this font has an fvar table, making it a variable font.

Variable fonts contain continuous design axes (weight, width, etc.) instead of discrete named instances. A single variable font file can replace an entire family of static fonts.

§weight_class: Option<u16>

OS/2 usWeightClass value. Indicates visual weight on a 1–1000 scale.

Standard values: 100=Thin, 200=ExtraLight, 300=Light, 400=Regular, 500=Medium, 600=SemiBold, 700=Bold, 800=ExtraBold, 900=Black. None if the font has no OS/2 table (rare in modern fonts).

§width_class: Option<u16>

OS/2 usWidthClass value. Indicates visual width on a 1–9 scale.

Values: 1=UltraCondensed, 2=ExtraCondensed, 3=Condensed, 4=SemiCondensed, 5=Normal, 6=SemiExpanded, 7=Expanded, 8=ExtraExpanded, 9=UltraExpanded. None if the font has no OS/2 table.

§family_class: Option<(u8, u8)>

OS/2 sFamilyClass split into (major class, subclass).

The major class groups fonts by general style: 0=No classification, 1=Oldstyle Serifs, 2=Transitional Serifs, 3=Modern Serifs, 4=Clarendon Serifs, 5=Slab Serifs, 7=Freeform Serifs, 8=Sans Serif, 9=Ornamentals, 10=Scripts, 12=Symbolic.

The subclass provides finer detail within each major class. For example, within Sans Serif (8): 1=IBM Neo-Grotesque Gothic, 2=Humanist, 3=Low-x Round Geometric, etc.

None if the font has no OS/2 table.

§creator_names: Vec<String>

Creator and provenance strings from the font’s name table.

Includes: copyright notice (name ID 0), trademark (7), manufacturer (8), designer (9), description (10), vendor URL (11), designer URL (12), license description (13), license URL (14).

Useful for searching by foundry (“Adobe”), designer (“Matthew Carter”), or license type (“OFL”).

§license_names: Vec<String>

License-specific strings from the font’s name table.

A subset of creator info focused on licensing: copyright notice (name ID 0), license description (13), license info URL (14).

Useful for compliance checks: “show me all fonts with an SIL Open Font License” or “find fonts with no license URL.”

Trait Implementations§

Source§

impl Clone for TypgFontFaceMeta

Source§

fn clone(&self) -> TypgFontFaceMeta

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypgFontFaceMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypgFontFaceMeta

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TypgFontFaceMeta

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,