pub struct GlyphRunRenderer<'a, 'b, Glyphs: Iterator<Item = Glyph> + Clone> {
prepared_run: PreparedGlyphRun<'a>,
outline_cache: &'b mut OutlineCache,
underline_span_cache: &'b mut Vec<(f64, f64)>,
glyph_iterator: Glyphs,
atlas_cacher: AtlasCacher<'b>,
}Expand description
Helper struct for rendering a prepared glyph run.
Fields§
§prepared_run: PreparedGlyphRun<'a>§outline_cache: &'b mut OutlineCache§underline_span_cache: &'b mut Vec<(f64, f64)>§glyph_iterator: Glyphs§atlas_cacher: AtlasCacher<'b>Implementations§
Source§impl<'a, 'b, Glyphs: Iterator<Item = Glyph> + Clone> GlyphRunRenderer<'a, 'b, Glyphs>
impl<'a, 'b, Glyphs: Iterator<Item = Glyph> + Clone> GlyphRunRenderer<'a, 'b, Glyphs>
Sourcepub fn fill_glyphs(&mut self, renderer: &mut impl GlyphRenderer)
pub fn fill_glyphs(&mut self, renderer: &mut impl GlyphRenderer)
Fills the glyphs with the current configuration.
Sourcepub fn stroke_glyphs(&mut self, renderer: &mut impl GlyphRenderer)
pub fn stroke_glyphs(&mut self, renderer: &mut impl GlyphRenderer)
Strokes the glyphs with the current configuration.
Sourcefn draw_glyphs(&mut self, style: Style, renderer: &mut impl GlyphRenderer)
fn draw_glyphs(&mut self, style: Style, renderer: &mut impl GlyphRenderer)
Core rendering loop shared by fill_glyphs and
stroke_glyphs.
Each glyph is resolved through a priority cascade: COLR > bitmap > outline. The first matching representation wins. Within each branch the atlas cache is checked before falling through to the slow path (rasterization / path construction).
Sourcepub fn stroke_adjustment(&self) -> f64
pub fn stroke_adjustment(&self) -> f64
Return the scaling factor that should be applied to the stroke width when stroking this glyph run.
Sourcepub fn render_decoration(
&mut self,
x_range: RangeInclusive<f32>,
baseline_y: f32,
offset: f32,
size: f32,
buffer: f32,
renderer: &mut impl DrawSink,
)
pub fn render_decoration( &mut self, x_range: RangeInclusive<f32>, baseline_y: f32, offset: f32, size: f32, buffer: f32, renderer: &mut impl DrawSink, )
Render a decoration (like an underline) that skips over glyph descenders.
This implements text-decoration-skip-ink-like behavior, where the decoration line is interrupted where it
would overlap with glyph outlines.
The x_range specifies the horizontal position of the decoration, and the offset and size specify its
vertical position and height (relative to the baseline). The buffer specifies how much horizontal space to
leave around each descender.