pub struct ShapedGlyph {
pub kind: GlyphKind,
pub glyph_id: u16,
pub cluster_offset: u32,
pub advance: f32,
pub kerning: f32,
pub offset: Point,
pub vertical_advance: f32,
pub vertical_offset: Point,
pub script: Script,
pub style: Arc<StyleProperties>,
pub font_hash: u64,
pub font_metrics: LayoutFontMetrics,
}Expand description
A single, shaped glyph with its essential metrics.
Fields§
§kind: GlyphKindThe kind of glyph this is (character, hyphen, etc.).
glyph_id: u16Glyph ID inside of the font
cluster_offset: u32The byte offset of this glyph’s source character(s) within its cluster text.
advance: f32The horizontal advance for this glyph (for horizontal text) - this is the BASE advance from the font metrics, WITHOUT kerning applied
kerning: f32The kerning adjustment for this glyph (positive = more space, negative = less space) This is separate from advance so we can position glyphs absolutely
offset: PointThe horizontal offset/bearing for this glyph
vertical_advance: f32The vertical advance for this glyph (for vertical text).
vertical_offset: PointThe vertical offset/bearing for this glyph.
script: Script§style: Arc<StyleProperties>§font_hash: u64Hash of the font - use LoadedFonts to look up the actual font when needed
font_metrics: LayoutFontMetricsCached font metrics to avoid font lookup for common operations
Implementations§
Source§impl ShapedGlyph
impl ShapedGlyph
pub fn into_glyph_instance<T: ParsedFontTrait>( &self, writing_mode: WritingMode, loaded_fonts: &LoadedFonts<T>, ) -> GlyphInstance
Sourcepub fn into_glyph_instance_at<T: ParsedFontTrait>(
&self,
writing_mode: WritingMode,
absolute_position: LogicalPosition,
loaded_fonts: &LoadedFonts<T>,
) -> GlyphInstance
pub fn into_glyph_instance_at<T: ParsedFontTrait>( &self, writing_mode: WritingMode, absolute_position: LogicalPosition, loaded_fonts: &LoadedFonts<T>, ) -> GlyphInstance
Convert this ShapedGlyph into a GlyphInstance with an absolute position. This is used for display list generation where glyphs need their final page coordinates.
Sourcepub fn into_glyph_instance_at_simple(
&self,
_writing_mode: WritingMode,
absolute_position: LogicalPosition,
) -> GlyphInstance
pub fn into_glyph_instance_at_simple( &self, _writing_mode: WritingMode, absolute_position: LogicalPosition, ) -> GlyphInstance
Convert this ShapedGlyph into a GlyphInstance with an absolute position. This version doesn’t require fonts - it uses a default size. Use this when you don’t need precise glyph bounds (e.g., display list generation).
Trait Implementations§
Source§impl Clone for ShapedGlyph
impl Clone for ShapedGlyph
Source§fn clone(&self) -> ShapedGlyph
fn clone(&self) -> ShapedGlyph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ShapedGlyph
impl RefUnwindSafe for ShapedGlyph
impl Send for ShapedGlyph
impl Sync for ShapedGlyph
impl Unpin for ShapedGlyph
impl UnwindSafe for ShapedGlyph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more