Skip to main content

concinnity_core/gfx/
font.rs

1//! Per-glyph metrics of a compiled font atlas: where a glyph sits in the atlas
2//! texture and how the pen moves across it. Shared by the build-time rasteriser
3//! that writes the payload, the decoder that reads it back, and the text layout
4//! that turns it into quads, none of which owns the layout.
5
6/// Per-glyph metrics stored in the compiled payload.
7#[derive(Debug, Clone, Copy)]
8pub struct GlyphMetrics {
9    /// The Unicode code point this glyph renders.
10    pub char_code: u32,
11    /// Glyph's left edge in the atlas, in pixels.
12    pub atlas_x: u16,
13    /// Glyph's top edge in the atlas, in pixels.
14    pub atlas_y: u16,
15    /// Glyph width in the atlas, in pixels.
16    pub atlas_w: u16,
17    /// Glyph height in the atlas, in pixels.
18    pub atlas_h: u16,
19    /// Pen advance after this glyph, in pixels.
20    pub advance_px: f32,
21    /// Horizontal offset from the pen to the glyph's left edge.
22    pub bearing_x: f32,
23    /// Vertical offset from the baseline to the glyph's top edge.
24    pub bearing_y: f32,
25}