[−][src]Trait wgpu_glyph::GlyphCruncher
Common glyph layout logic.
Required methods
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>>>,
&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.
fn glyphs_custom_layout<'a, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'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.
Generally only drawable glyphs will be returned as invisible glyphs, like spaces, are discarded during layout.
Benefits from caching, see caching behaviour.
fn fonts(&self) -> &[Font<'font>]
Returns the available fonts.
The FontId
corresponds to the index of the font data.
Provided methods
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>> where
S: Into<Cow<'a, VariedSection<'a>>>,
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.
fn glyphs<'a, S>(
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
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.
Implementations on Foreign Types
impl<'font, V, H> GlyphCruncher<'font> for GlyphBrush<'font, V, H> where
H: BuildHasher,
V: 'static + Clone,
[src]
H: BuildHasher,
V: 'static + Clone,
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>>>,
[src]
&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, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn fonts(&self) -> &[Font<'font>]
[src]
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs<'a, S>(
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
impl<'font, '_, H> GlyphCruncher<'font> for GlyphCalculatorGuard<'_, 'font, H> where
H: BuildHasher,
[src]
H: BuildHasher,
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>>>,
[src]
&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, S, L>(
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn fonts(&self) -> &[Font<'font>]
[src]
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs<'a, S>(
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
Implementors
impl<'font, H: BuildHasher> GlyphCruncher<'font> for wgpu_glyph::GlyphBrush<'font, H>
[src]
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>>>,
[src]
&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>>>,
[src]
&'b mut self,
section: S,
custom_layout: &L
) -> PositionedGlyphIter<'b, 'font> where
L: GlyphPositioner + Hash,
S: Into<Cow<'a, VariedSection<'a>>>,
fn fonts(&self) -> &[Font<'font>]
[src]
fn pixel_bounds<'a, S>(&mut self, section: S) -> Option<Rect<i32>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
S: Into<Cow<'a, VariedSection<'a>>>,
fn glyphs<'a, S>(
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,
[src]
&'b mut self,
section: S
) -> Map<Iter<'b, (PositionedGlyph<'font>, [f32; 4], FontId)>, fn(&'b (PositionedGlyph<'font>, [f32; 4], FontId)) -> &'b PositionedGlyph<'font>> where
S: Into<Cow<'a, VariedSection<'a>>>,