pub struct KernedFont { /* private fields */ }Expand description
A face paired with the pair kerning ab_glyph cannot read for itself,
and with the single glyph substitutions of the OpenType features a text
style enables.
This is a Font rather than a lookup the call sites reach for, because
there are nine of them across measuring, line breaking, alignment and
drawing, several behind impl Font generics that never see a
SoftwareTextFont. Overriding kern_unscaled puts the rule under every
existing scaled_font.kern(..) at once — including any this change did not
go looking for — and keeps a caller from having to remember which width is
the kerned one. Overriding glyph_id does the same for substitution: every
glyph a run measures, kerns and draws is the substituted one.
Substitution covers GSUB single substitutions only (lookup type 1, and
type 7 extensions of it), which is what tnum, pnum, onum, lnum,
zero, smcp, c2sc, case, sups, subs, salt and ss01–ss20
use. A feature with any other lookup type (ligature, multiple, alternate,
contextual) is not applied at all, so none is ever half applied, and no
feature is on unless the style’s font_feature_settings turns it on.
Implementations§
Source§impl KernedFont
impl KernedFont
pub fn new(font: FontArc, kerning: Option<Arc<GposKerning>>) -> Self
Sourcepub fn read_kerning(
bytes: &[u8],
variations: &[([u8; 4], f32)],
) -> Option<Arc<GposKerning>>
pub fn read_kerning( bytes: &[u8], variations: &[([u8; 4], f32)], ) -> Option<Arc<GposKerning>>
Reads the GPOS pair kerning for a face instanced at variations.
variations are the (tag, user value) pairs actually applied to the
face, in the same units the caller handed set_variation; normalizing
them is ttf_parser’s job and doing it a second way here would be a
second answer.
Trait Implementations§
Source§impl Clone for KernedFont
impl Clone for KernedFont
Source§impl Font for KernedFont
impl Font for KernedFont
Source§fn ascent_unscaled(&self) -> f32
fn ascent_unscaled(&self) -> f32
Source§fn descent_unscaled(&self) -> f32
fn descent_unscaled(&self) -> f32
Source§fn line_gap_unscaled(&self) -> f32
fn line_gap_unscaled(&self) -> f32
Source§fn italic_angle(&self) -> f32
fn italic_angle(&self) -> f32
Source§fn h_advance_unscaled(&self, id: GlyphId) -> f32
fn h_advance_unscaled(&self, id: GlyphId) -> f32
Source§fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
Source§fn v_advance_unscaled(&self, id: GlyphId) -> f32
fn v_advance_unscaled(&self, id: GlyphId) -> f32
Source§fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
Source§fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
Source§fn outline(&self, id: GlyphId) -> Option<Outline>
fn outline(&self, id: GlyphId) -> Option<Outline>
Source§fn glyph_count(&self) -> usize
fn glyph_count(&self) -> usize
0..self.glyph_count()Source§fn codepoint_ids(&self) -> CodepointIdIter<'_> ⓘ
fn codepoint_ids(&self) -> CodepointIdIter<'_> ⓘ
(GlyphId, char) pairs. Not ordered. Read moreSource§fn glyph_raster_image2(
&self,
id: GlyphId,
pixel_size: u16,
) -> Option<GlyphImage<'_>>
fn glyph_raster_image2( &self, id: GlyphId, pixel_size: u16, ) -> Option<GlyphImage<'_>>
Source§fn glyph_svg_image(&self, id: GlyphId) -> Option<GlyphSvg<'_>>
fn glyph_svg_image(&self, id: GlyphId) -> Option<GlyphSvg<'_>>
Source§fn font_data(&self) -> &[u8] ⓘ
fn font_data(&self) -> &[u8] ⓘ
FontArc::try_from_slice. Read moreSource§fn height_unscaled(&self) -> f32
fn height_unscaled(&self) -> f32
Source§fn glyph_raster_image(
&self,
id: GlyphId,
pixel_size: u16,
) -> Option<GlyphImage<'_>>
fn glyph_raster_image( &self, id: GlyphId, pixel_size: u16, ) -> Option<GlyphImage<'_>>
Deprecated in favor of glyph_raster_image2
Source§fn glyph_bounds(&self, glyph: &Glyph) -> Rectwhere
Self: Sized,
fn glyph_bounds(&self, glyph: &Glyph) -> Rectwhere
Self: Sized,
Source§fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph>where
Self: Sized,
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph>where
Self: Sized,
Source§fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self>
fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self>
Source§fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self>
fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self>
PxScaleFont associated with the given pixel scale.