pub struct GlyphRun<'a> { /* private fields */ }
Expand description
A sequence of positioned glyphs with effects
Yielded by TextDisplay::runs
.
Implementations§
Source§impl<'a> GlyphRun<'a>
impl<'a> GlyphRun<'a>
Sourcepub fn dpem(&self) -> f32
pub fn dpem(&self) -> f32
Get the font size used for this run
Units are dots-per-Em (see crate::fonts).
Sourcepub fn glyphs(&self) -> impl Iterator<Item = Glyph> + '_
pub fn glyphs(&self) -> impl Iterator<Item = Glyph> + '_
Get an iterator over glyphs for this run
This method ignores effects; if you want those call
Self::glyphs_with_effects
instead.
Sourcepub fn glyphs_with_effects<F, G>(&self, f: F, g: G)
pub fn glyphs_with_effects<F, G>(&self, f: F, g: G)
Yield glyphs and effects for this run
The callback f
receives glyph, e
where e
is the Effect::e
value (defaults to 0).
The callback g
receives positioning for each underline/strike-through
segment: x1, x2, y_top, h
where h
is the thickness (height). Note
that it is possible to have h < 1.0
and y_top, y_top + h
to round to
the same number; the renderer is responsible for ensuring such lines
are actually visible. The last parameter is e
as for f
.
Note: this is more computationally expensive than GlyphRun::glyphs
,
so you may prefer to call that. Optionally one may choose to cache the
result, though this is not really necessary.