Trait glyph_brush::GlyphCruncher
source · pub trait GlyphCruncher<'font> {
fn pixel_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect<i32>>
where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>;
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font>
where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>;
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>>
where
S: Into<Cow<'a, VariedSection<'a>>>,
{ ... }
fn glyphs<'a, 'b, S>(
&'b mut self,
section: S
) -> PositionedGlyphIter<'b, 'font>
where
S: Into<Cow<'a, VariedSection<'a>>>,
{ ... }
}
Expand description
Common glyph layout logic.
Required Methods
sourcefn pixel_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect<i32>>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn pixel_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect<i32>>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
Returns the pixel bounding box for the input section using a custom layout. The box is a conservative whole number pixel rectangle that can contain the section.
If the section is empty or would result in no drawn glyphs will return None
Benefits from caching, see caching behaviour.
sourcefn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font>where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
Returns an iterator over the PositionedGlyph
s of the given section with a custom layout.
Benefits from caching, see caching behaviour.
Provided Methods
sourcefn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>>where
S: Into<Cow<'a, VariedSection<'a>>>,
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>>where
S: Into<Cow<'a, VariedSection<'a>>>,
Returns the pixel bounding box for the input section. The box is a conservative whole number pixel rectangle that can contain the section.
If the section is empty or would result in no drawn glyphs will return None
Benefits from caching, see caching behaviour.
sourcefn glyphs<'a, 'b, S>(&'b mut self, section: S) -> PositionedGlyphIter<'b, 'font>where
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs<'a, 'b, S>(&'b mut self, section: S) -> PositionedGlyphIter<'b, 'font>where
S: Into<Cow<'a, VariedSection<'a>>>,
Returns an iterator over the PositionedGlyph
s of the given section.
Benefits from caching, see caching behaviour.