Struct cosmic_text::LayoutGlyph
source · pub struct LayoutGlyph {
pub start: usize,
pub end: usize,
pub x: f32,
pub w: f32,
pub rtl: bool,
pub cache_key: CacheKey,
pub x_offset: f32,
pub y_offset: f32,
pub x_int: i32,
pub y_int: i32,
pub color_opt: Option<Color>,
pub metadata: usize,
}Expand description
A laid out glyph
Fields§
§start: usizeStart index of cluster in original line
end: usizeEnd index of cluster in original line
x: f32X offset of hitbox
w: f32width of hitbox
rtl: boolTrue if the character is from an RTL script
cache_key: CacheKeyCache key, see CacheKey
x_offset: f32X offset in line
If you are dealing with physical coordinates, you will want to use Self::x_int
together with CacheKey::x_bin instead. This will ensure the best alignment of the
rasterized glyphs with the pixel grid.
This offset is useful when you are dealing with logical units and you do not care or cannot guarantee pixel grid alignment. For instance, when you want to use the glyphs for vectorial text, apply linear transformations to the layout, etc.
y_offset: f32Y offset in line
If you are dealing with physical coordinates, you will want to use Self::y_int
together with CacheKey::y_bin instead. This will ensure the best alignment of the
rasterized glyphs with the pixel grid.
This offset is useful when you are dealing with logical units and you do not care or cannot guarantee pixel grid alignment. For instance, when you want to use the glyphs for vectorial text, apply linear transformations to the layout, etc.
x_int: i32Integer component of X offset in line
y_int: i32Integer component of Y offset in line
color_opt: Option<Color>Optional color override
metadata: usizeMetadata from Attrs