Skip to main content

euv_core/font/glyph/
struct.rs

1use super::*;
2
3/// Cache key uniquely identifying a rasterized glyph bitmap.
4#[derive(Clone, Copy, Debug, Default, Eq, Getter, Hash, New, Ord, PartialEq, PartialOrd)]
5pub struct GlyphKey {
6    /// Unicode scalar value of the character.
7    #[get(type(copy))]
8    pub(crate) codepoint: char,
9    /// Quantized pixel height in tenths of a pixel.
10    #[get(type(copy))]
11    pub(crate) size_tenths: u16,
12    /// Whether bold stroke thickening is active.
13    #[get(type(copy))]
14    pub(crate) bold: bool,
15}
16
17/// Rasterized alpha-coverage glyph bitmap ready for software blitting or GPU atlas upload.
18#[derive(Clone, Debug, Default, Eq, Getter, New, PartialEq)]
19pub struct RasterizedGlyph {
20    /// Bitmap width in physical pixels.
21    #[get(type(copy))]
22    pub(crate) width: u32,
23    /// Bitmap height in physical pixels.
24    #[get(type(copy))]
25    pub(crate) height: u32,
26    /// Horizontal advance in physical pixels.
27    #[get(type(copy))]
28    pub(crate) advance: u32,
29    /// Alpha coverage values in row-major order (`0..=255`).
30    pub(crate) coverage: Vec<u8>,
31}