GlyfTable
struct · ferroui-base · v0.5.0
struct GlyfTable
Reader for the 'glyf' table. Provides on-demand access to individual glyph data using the 'loca' index. Designed for high-performance lookups on the hot path.
Members
TABLE_NAME
const TABLE_NAME: &'static str
TAG
const TAG: OpenTypeTag
glyph_count
fn glyph_count(self: &Self) -> i32
Gets the total number of glyphs defined in the font.
try_load
fn try_load(font: &dyn IFontMemory, head: &HeadTable, maxp: &MaxpTable) -> Option<GlyfTable>
Attempts to load the 'glyf' table from the specified font data.
Never fails: None when the font has no 'glyf' or no 'loca' table.
font- The font from which to retrieve the 'glyf' table.head- The 'head' table containing font header information required for loading the 'glyf' table.maxp- The 'maxp' table providing maximum profile information needed to interpret the 'glyf' table.
try_get_glyph_data
fn try_get_glyph_data(self: &Self, glyph_index: i32) -> Option<ReadOnlyMemory<u8>>
Attempts to retrieve the raw glyph data for the specified glyph index.
If the glyph exists but has no data (for example, a missing or empty
glyph), the method returns an empty memory region. If the glyph index
is invalid or out of range, the method returns None.
try_get_glyph_bounds
fn try_get_glyph_bounds(self: &Self, glyph_index: i32) -> Option<(i16, i16, i16, i16)>
Reads a glyph's bounding box (x_min, y_min, x_max, y_max) from its
'glyf' header without parsing contours.
The values are the control-point bounding box stored in the glyph header
(the min/max of all on- and off-curve points), in font design units.
This is a slight superset of the rendered ink bounds for glyphs with
off-curve points. Composite glyphs carry their overall bounding box in
the header too, so no recursion is needed. Returns all-zero bounds for
empty glyphs (e.g. whitespace); returns None when the glyph index is
out of range or the glyph data is too short to contain a header.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherCloneDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.