pub struct PositionedGlyph {
glyph_ts: Transform,
cluster_ts: Transform,
span_ts: Transform,
units_per_em: u16,
font_size: f32,
pub id: GlyphId,
pub text: String,
pub font: ID,
}
Expand description
A glyph that has already been positioned correctly.
Note that the transform already takes the font size into consideration, so applying the transform to the outline of the glyphs is all that is necessary to display it correctly.
Fields§
§glyph_ts: Transform
Returns the transform of the glyph itself within the cluster. For example, for zalgo text, it contains the transform to position the glyphs above/below the main glyph.
cluster_ts: Transform
Returns the transform of the whole cluster that the glyph is part of.
span_ts: Transform
Returns the transform of the span that the glyph is a part of.
units_per_em: u16
The units per em of the font the glyph belongs to.
font_size: f32
The font size the glyph should be scaled to.
id: GlyphId
The ID of the glyph.
text: String
The text from the original string that corresponds to that glyph.
font: ID
The ID of the font the glyph should be taken from. Can be used with the font database of the tree this glyph is part of.
Implementations§
Source§impl PositionedGlyph
impl PositionedGlyph
Sourcepub fn outline_transform(&self) -> Transform
pub fn outline_transform(&self) -> Transform
Returns the transform of glyph, assuming that an outline
glyph is being used (i.e. from the glyf
or CFF/CFF2
table).
Sourcepub fn cbdt_transform(
&self,
x: f32,
y: f32,
pixels_per_em: f32,
height: f32,
) -> Transform
pub fn cbdt_transform( &self, x: f32, y: f32, pixels_per_em: f32, height: f32, ) -> Transform
Returns the transform for the glyph, assuming that a CBTD-based raster glyph is being used.
Sourcepub fn sbix_transform(
&self,
x: f32,
y: f32,
x_min: f32,
y_min: f32,
pixels_per_em: f32,
height: f32,
) -> Transform
pub fn sbix_transform( &self, x: f32, y: f32, x_min: f32, y_min: f32, pixels_per_em: f32, height: f32, ) -> Transform
Returns the transform for the glyph, assuming that a sbix-based raster glyph is being used.
Sourcepub fn svg_transform(&self) -> Transform
pub fn svg_transform(&self) -> Transform
Returns the transform for the glyph, assuming that an SVG glyph is being used.
Sourcepub fn colr_transform(&self) -> Transform
pub fn colr_transform(&self) -> Transform
Returns the transform for the glyph, assuming that a COLR glyph is being used.
Trait Implementations§
Source§impl Clone for PositionedGlyph
impl Clone for PositionedGlyph
Source§fn clone(&self) -> PositionedGlyph
fn clone(&self) -> PositionedGlyph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more