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, New)]
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    /// Whether a fixed-pitch monospace typeface is requested.
16    #[new(skip)]
17    #[get(type(copy))]
18    pub(crate) monospace: bool,
19    /// Whether an italic typeface is requested.
20    #[new(skip)]
21    #[get(type(copy))]
22    pub(crate) italic: bool,
23}
24
25/// Rasterized alpha-coverage glyph bitmap ready for software blitting or GPU atlas upload.
26#[derive(Clone, Debug, Default, Eq, Getter, New, PartialEq)]
27pub struct RasterizedGlyph {
28    /// Bitmap width in physical pixels.
29    #[get(type(copy))]
30    pub(crate) width: u32,
31    /// Bitmap height in physical pixels.
32    #[get(type(copy))]
33    pub(crate) height: u32,
34    /// Horizontal advance in physical pixels.
35    #[get(type(copy))]
36    pub(crate) advance: u32,
37    /// Alpha coverage values in row-major order (`0..=255`).
38    pub(crate) coverage: Vec<u8>,
39}