pub trait FontFuncs {
// Provided methods
fn nominal_glyph(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
c: u32,
) -> Option<GlyphId> { ... }
fn variant_glyph(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
c: u32,
vs: u32,
) -> Option<GlyphId> { ... }
fn advance_width(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> i32 { ... }
fn populate_advance_widths(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
batch: AdvanceWidthBatch<'_>,
) { ... }
fn advance_height(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> i32 { ... }
fn vertical_origin(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> (i32, i32) { ... }
fn extents(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> Option<GlyphExtents> { ... }
}Expand description
Customizable font callback surface.
§Metrics scaling
All font metrics returned by these callbacks must be consistent with the
scale factor configured via
ShapeOptions::scale.
If no scale is set, values must be in unscaled font units (i.e. the same
coordinate space as the font’s units_per_em). If a scale is set —
for example font_size * 64 for FreeType-style 26.6 — then all returned
values must already be in that scaled coordinate space.
Provided Methods§
Sourcefn nominal_glyph(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
c: u32,
) -> Option<GlyphId>
fn nominal_glyph( &mut self, builtin: &BuiltinFontFuncs<'_>, c: u32, ) -> Option<GlyphId>
Nominal character-to-glyph mapping callback.
Sourcefn variant_glyph(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
c: u32,
vs: u32,
) -> Option<GlyphId>
fn variant_glyph( &mut self, builtin: &BuiltinFontFuncs<'_>, c: u32, vs: u32, ) -> Option<GlyphId>
Variation-selector mapping callback.
Sourcefn advance_width(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> i32
fn advance_width( &mut self, builtin: &BuiltinFontFuncs<'_>, glyph: GlyphId, ) -> i32
Horizontal advance callback.
See “Metrics scaling” in the trait-level docs for details on what value this method should return.
Sourcefn populate_advance_widths(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
batch: AdvanceWidthBatch<'_>,
)
fn populate_advance_widths( &mut self, builtin: &BuiltinFontFuncs<'_>, batch: AdvanceWidthBatch<'_>, )
Batch horizontal-advance callback.
See “Metrics scaling” in the trait-level docs for details on what value this method should return.
Sourcefn advance_height(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> i32
fn advance_height( &mut self, builtin: &BuiltinFontFuncs<'_>, glyph: GlyphId, ) -> i32
Vertical advance callback.
See “Metrics scaling” in the trait-level docs for details on what value this method should return.
Sourcefn vertical_origin(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> (i32, i32)
fn vertical_origin( &mut self, builtin: &BuiltinFontFuncs<'_>, glyph: GlyphId, ) -> (i32, i32)
Vertical origin callback.
Returns the (x, y) coordinates of the vertical origin for the given glyph.
See “Metrics scaling” in the trait-level docs for details on what values this method should return.
Sourcefn extents(
&mut self,
builtin: &BuiltinFontFuncs<'_>,
glyph: GlyphId,
) -> Option<GlyphExtents>
fn extents( &mut self, builtin: &BuiltinFontFuncs<'_>, glyph: GlyphId, ) -> Option<GlyphExtents>
Glyph extents callback.
See “Metrics scaling” in the trait-level docs for details on what values this method should return.