[−][src]Trait glyph_brush::GlyphCruncher
Common glyph layout logic.
Example
use glyph_brush::GlyphCruncher; let default_font = glyph_brush.fonts()[0];
Required methods
pub fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
Returns an iterator over the PositionedGlyph
s of the given section with a custom layout.
Generally only drawable glyphs will be returned as invisible glyphs, like spaces, are discarded during layout.
Benefits from caching, see caching behaviour.
pub fn fonts(&self) -> &[F]
[src]
Returns the available fonts.
The FontId
corresponds to the index of the font data.
pub fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
Returns a bounding box for the section glyphs calculated using each glyph's vertical & horizontal metrics.
If the section is empty or would result in no drawn glyphs will return None
.
Invisible glyphs, like spaces, are discarded during layout so trailing ones will not affect the bounds.
The bounds will always lay within the specified layout bounds, ie that returned
by the layout's bounds_rect
function.
Benefits from caching, see caching behaviour.
Provided methods
pub fn glyphs<'a, 'b, S>(&'b mut self, section: S) -> SectionGlyphIter<'b> where
X: 'a,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
X: 'a,
S: Into<Cow<'a, Section<'a, X>>>,
Returns an iterator over the PositionedGlyph
s of the given section.
Generally only drawable glyphs will be returned as invisible glyphs, like spaces, are discarded during layout.
Benefits from caching, see caching behaviour.
pub fn glyph_bounds<'a, S>(&mut self, section: S) -> Option<Rect> where
X: 'a,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
X: 'a,
S: Into<Cow<'a, Section<'a, X>>>,
Returns a bounding box for the section glyphs calculated using each glyph's vertical & horizontal metrics.
If the section is empty or would result in no drawn glyphs will return None
.
Invisible glyphs, like spaces, are discarded during layout so trailing ones will not affect the bounds.
The bounds will always lay within the specified layout bounds, ie that returned
by the layout's bounds_rect
function.
Benefits from caching, see caching behaviour.
Implementors
impl<F, V, X, H> GlyphCruncher<F, X> for GlyphBrush<V, X, F, H> where
X: Clone + Hash,
F: Font,
V: Clone + 'static,
H: BuildHasher,
[src]
X: Clone + Hash,
F: Font,
V: Clone + 'static,
H: BuildHasher,
pub fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
pub fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
pub fn fonts(&self) -> &[F]
[src]
impl<F: Font, X: Clone + Hash, H: BuildHasher> GlyphCruncher<F, X> for GlyphCalculatorGuard<'_, F, X, H>
[src]
pub fn glyphs_custom_layout<'a, 'b, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> SectionGlyphIter<'b> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
pub fn glyph_bounds_custom_layout<'a, S, L>(
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,
[src]
&mut self,
section: S,
custom_layout: &L
) -> Option<Rect> where
X: 'a,
L: GlyphPositioner + Hash,
S: Into<Cow<'a, Section<'a, X>>>,