pub struct GlyphPosition {
pub id: u32,
pub x: f32,
pub y: f32,
pub advance: f32,
pub byte_start: u32,
pub byte_end: u32,
}Expand description
One positioned glyph within a shaped run.
Fields§
§id: u32Glyph index into the resolved font.
x: f32X position of the glyph’s leading edge, from the run origin, in
logical pixels. cosmic-text emits glyphs in visual order, so
in a mixed-script paragraph glyphs[i].x can be smaller than
glyphs[i-1].x when the run crosses a BiDi boundary.
y: f32Y offset from the run’s baseline, in logical pixels.
advance: f32X advance (the leading edge of the next glyph would land at
x + advance). Critical for caret placement: kerning makes
next.x - this.x slightly different from this.advance, and
trailing whitespace produces no glyph at all unless we record
the advance separately.
byte_start: u32Byte range in the source string that produced this glyph cluster
(start..end). Empty range = synthesised (e.g. ellipsis).
Stored so the renderer can map logical byte ranges to visual
glyph clusters for caret + selection in mixed-script text.
byte_end: u32Byte range end (exclusive). See Self::byte_start.
Trait Implementations§
Source§impl Clone for GlyphPosition
impl Clone for GlyphPosition
Source§fn clone(&self) -> GlyphPosition
fn clone(&self) -> GlyphPosition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more