pub struct DrawGlyphs<'a> { /* private fields */ }Expand description
Builder for encoding a glyph run.
Created using Scene::draw_glyphs.
Implementations§
Source§impl<'a> DrawGlyphs<'a>
impl<'a> DrawGlyphs<'a>
Sourcepub fn new(scene: &'a mut Scene, font: &FontData) -> Self
pub fn new(scene: &'a mut Scene, font: &FontData) -> Self
Creates a new builder for encoding a glyph run for the specified encoding with the given font.
Sourcepub fn transform(self, transform: Affine) -> Self
pub fn transform(self, transform: Affine) -> Self
Sets the global transform. This is applied to all glyphs after the offset translation.
The default value is the identity matrix.
Sourcepub fn glyph_transform(self, transform: Option<Affine>) -> Self
pub fn glyph_transform(self, transform: Option<Affine>) -> Self
Sets the per-glyph transform. This is applied to all glyphs prior to offset translation. This is common used for applying a shear to simulate an oblique font.
The default value is None.
Sourcepub fn brush_transform(self, transform: Option<Affine>) -> Self
pub fn brush_transform(self, transform: Option<Affine>) -> Self
Sets the transform applied to the brush contents.
This is applied after the global run transform and is encoded as the glyph run’s paint transform. It affects transformed brushes such as gradients and images; solid colors ignore it.
The default value is None.
Sourcepub fn font_size(self, size: f32) -> Self
pub fn font_size(self, size: f32) -> Self
Sets the font size in pixels per em units.
The default value is 16.0.
Sourcepub fn font_embolden(self, embolden: FontEmbolden) -> Self
pub fn font_embolden(self, embolden: FontEmbolden) -> Self
Sets synthetic embolden settings.
Sourcepub fn hint(self, hint: bool) -> Self
pub fn hint(self, hint: bool) -> Self
Sets whether to enable hinting.
The default value is false.
Sourcepub fn normalized_coords(self, coords: &[NormalizedCoord]) -> Self
pub fn normalized_coords(self, coords: &[NormalizedCoord]) -> Self
Sets the normalized design space coordinates for a variable font instance.
Sourcepub fn brush(self, brush: impl Into<BrushRef<'a>>) -> Self
pub fn brush(self, brush: impl Into<BrushRef<'a>>) -> Self
Sets the brush.
The default value is solid black.
Sourcepub fn brush_alpha(self, alpha: f32) -> Self
pub fn brush_alpha(self, alpha: f32) -> Self
Sets an additional alpha multiplier for the brush.
The default value is 1.0.
Sourcepub fn draw(
self,
style: impl Into<StyleRef<'a>>,
glyphs: impl Iterator<Item = Glyph>,
)
pub fn draw( self, style: impl Into<StyleRef<'a>>, glyphs: impl Iterator<Item = Glyph>, )
Encodes a fill or stroke for the given sequence of glyphs and consumes the builder.
The style parameter accepts either Fill or Stroke types.
This supports emoji fonts in COLR and bitmap formats.
style is ignored for these fonts.
For these glyphs, the given brush is used as the “foreground color”, and should
be Solid for maximum compatibility.