pub struct ShapedSegment {
pub font_id: u64,
pub font_data: Arc<Vec<u8>>,
pub font_index: u32,
pub normalized_coords: Vec<i16>,
pub level: u8,
pub glyphs: Vec<GlyphPosition>,
pub width: f32,
}Expand description
One maximal (font_id, BiDi level) slice within a shaped run.
Emitted in logical source order so callers can walk the segment
list and snap selection ranges at boundaries. Each segment’s
glyphs are still in cosmic-text’s visual order - the renderer paints
them in that order, while caret/selection math uses
GlyphPosition::byte_start / GlyphPosition::byte_end to map
back to logical bytes.
Fields§
§font_id: u64Opaque font identifier from the shaper’s font database. Two
segments with the same font_id resolve through the same
font_data so the renderer can cache by id.
font_data: Arc<Vec<u8>>TTF/OTF bytes of the resolved face for this segment.
font_index: u32Face index inside the font file.
normalized_coords: Vec<i16>Normalized variation coordinates of the instance this segment was shaped at, in the face’s axis order, as F2Dot14 raw bits. Empty for a static face, which has one instance and needs none.
A variable face shapes at the instance the authored font-weight
selects, and the advances in glyphs come from that instance. The
renderer hands these coordinates to the glyph rasterizer so the
outlines it paints belong to the same one; without them the outlines
come from the face’s default instance and the text pairs one weight’s
spacing with another weight’s strokes.
level: u8BiDi embedding level (Unicode BiDi algorithm). Even = LTR, odd =
RTL. From cosmic-text’s LayoutGlyph.level (unicode-bidi crate).
glyphs: Vec<GlyphPosition>Glyphs belonging to this segment, in cosmic-text’s visual
order. The renderer issues one draw_glyphs(&font_data) per
segment.
width: f32Total visual advance of this segment in logical pixels.
Implementations§
Trait Implementations§
Source§impl Clone for ShapedSegment
impl Clone for ShapedSegment
Source§fn clone(&self) -> ShapedSegment
fn clone(&self) -> ShapedSegment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more