euv-core 0.52.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Native bitmap glyph width in source texels.
pub const BITMAP_GLYPH_WIDTH: usize = 5;

/// Native bitmap glyph height in source texels.
pub const BITMAP_GLYPH_HEIGHT: usize = 7;

/// Minimum physical glyph rasterization size in pixels.
pub const GLYPH_MIN_PHYSICAL_PX: f32 = 6.0;

/// Maximum physical glyph size rasterized directly by native OS font engines (`512px`).
pub const GLYPH_DIRECT_RASTER_MAX_PX: f32 = 512.0;

/// Maximum physical glyph size supported via analytic SDF reconstruction (`4096px`).
pub const GLYPH_ANALYTIC_MAX_PHYSICAL_PX: f32 = 4096.0;

/// Canonical reference rasterization size in pixels used to generate exact SDF fields for gigantic text.
pub const GLYPH_SDF_CANONICAL_PX: f32 = 128.0;

/// Default signed-distance spread radius in canonical pixels when building a `SdfGlyphField`.
pub const GLYPH_SDF_DEFAULT_SPREAD_PX: f32 = 8.0;

/// Horizontal advance ratio relative to font size for proportional UI text.
pub const PROPORTIONAL_ADVANCE_RATIO: f32 = 0.58;

/// Horizontal advance ratio relative to font size for monospace text.
pub const MONOSPACE_ADVANCE_RATIO: f32 = 0.60;

/// Horizontal advance ratio relative to font size for bold proportional UI text.
pub(crate) const BOLD_PROPORTIONAL_FACTOR: f32 = 1.08;

/// Horizontal advance ratio relative to font size for CJK, Kana, Hangul, and fullwidth characters.
pub(crate) const WIDE_CJK_ADVANCE_RATIO: f32 = 1.00;

/// Horizontal advance ratio relative to font size for pictographic emoji and symbol characters.
pub(crate) const WIDE_EMOJI_ADVANCE_RATIO: f32 = 1.15;

/// Horizontal advance ratio relative to font size for proportional non-ASCII Latin/Greek/symbol glyphs.
pub(crate) const NON_ASCII_ADVANCE_RATIO: f32 = 0.64;

/// Sentinel squared distance used when initializing the 1D Euclidean distance transform.
pub(crate) const GLYPH_EDT_INF: f32 = 1.0e12;

/// Compile-time proportional advance ratio lookup table for ASCII bytes `0..128`.
pub(crate) const ASCII_ADVANCE_LUT: [f32; 128] = build_ascii_advance_lut();

/// Exact alpha coverage values for `0..=4` hits in a 2x2 supersampled glyph pixel (`(hits * 255) / 4`).
pub(crate) const SUBPIXEL_ALPHA_LUT: [u8; 5] = [0, 63, 127, 191, 255];

/// Maximum glyph output width whose non-italic horizontal column shifts are cached on the stack.
pub(crate) const GLYPH_STACK_COL_CACHE: usize = 64;

/// First printable ASCII code point present in the built-in font table.
pub(crate) const ASCII_FIRST_PRINTABLE: u32 = 0x20;

/// Last printable ASCII code point present in the built-in font table.
pub(crate) const ASCII_LAST_PRINTABLE: u32 = 0x7E;

/// Fallback glyph bitmap rendered for code points outside printable ASCII.
pub(crate) const FALLBACK_GLYPH_ROWS: [u8; BITMAP_GLYPH_HEIGHT] = [
    0b11111, 0b10001, 0b10101, 0b10001, 0b10101, 0b10001, 0b11111,
];

/// Crisp 5x7 bitmap font covering printable ASCII `0x20..=0x7E` for pixel-identical rendering.
pub(crate) const ASCII_FONT_5X7: [[u8; BITMAP_GLYPH_HEIGHT]; 95] = [
    [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
    [0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04],
    [0x0A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00],
    [0x0A, 0x1F, 0x0A, 0x0A, 0x1F, 0x0A, 0x00],
    [0x04, 0x0F, 0x14, 0x0E, 0x05, 0x1E, 0x04],
    [0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03],
    [0x0C, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0D],
    [0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00],
    [0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02],
    [0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08],
    [0x00, 0x04, 0x15, 0x0E, 0x15, 0x04, 0x00],
    [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00],
    [0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x08],
    [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00],
    [0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C],
    [0x01, 0x01, 0x02, 0x04, 0x08, 0x10, 0x10],
    [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E],
    [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E],
    [0x0E, 0x11, 0x01, 0x06, 0x08, 0x10, 0x1F],
    [0x0E, 0x11, 0x01, 0x06, 0x01, 0x11, 0x0E],
    [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02],
    [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E],
    [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E],
    [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08],
    [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E],
    [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C],
    [0x00, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00],
    [0x00, 0x0C, 0x0C, 0x00, 0x0C, 0x04, 0x08],
    [0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02],
    [0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00],
    [0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08],
    [0x0E, 0x11, 0x01, 0x02, 0x04, 0x00, 0x04],
    [0x0E, 0x11, 0x17, 0x15, 0x17, 0x10, 0x0E],
    [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
    [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E],
    [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E],
    [0x1C, 0x12, 0x11, 0x11, 0x11, 0x12, 0x1C],
    [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F],
    [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10],
    [0x0E, 0x11, 0x10, 0x17, 0x11, 0x11, 0x0F],
    [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
    [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
    [0x07, 0x02, 0x02, 0x02, 0x12, 0x12, 0x0C],
    [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11],
    [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F],
    [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11],
    [0x11, 0x19, 0x15, 0x13, 0x11, 0x11, 0x11],
    [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
    [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10],
    [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D],
    [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11],
    [0x0E, 0x11, 0x10, 0x0E, 0x01, 0x11, 0x0E],
    [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04],
    [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
    [0x11, 0x11, 0x11, 0x11, 0x0A, 0x0A, 0x04],
    [0x11, 0x11, 0x11, 0x15, 0x15, 0x1B, 0x11],
    [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11],
    [0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04],
    [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F],
    [0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E],
    [0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x01],
    [0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E],
    [0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00],
    [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F],
    [0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00],
    [0x00, 0x00, 0x0E, 0x01, 0x0F, 0x11, 0x0F],
    [0x10, 0x10, 0x1E, 0x11, 0x11, 0x11, 0x1E],
    [0x00, 0x00, 0x0E, 0x10, 0x10, 0x11, 0x0E],
    [0x01, 0x01, 0x0F, 0x11, 0x11, 0x11, 0x0F],
    [0x00, 0x00, 0x0E, 0x11, 0x1F, 0x10, 0x0E],
    [0x06, 0x08, 0x1E, 0x08, 0x08, 0x08, 0x08],
    [0x00, 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x0E],
    [0x10, 0x10, 0x1E, 0x11, 0x11, 0x11, 0x11],
    [0x04, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x0E],
    [0x02, 0x00, 0x06, 0x02, 0x02, 0x12, 0x0C],
    [0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12],
    [0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
    [0x00, 0x00, 0x1A, 0x15, 0x15, 0x11, 0x11],
    [0x00, 0x00, 0x1E, 0x11, 0x11, 0x11, 0x11],
    [0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E],
    [0x00, 0x00, 0x1E, 0x11, 0x1E, 0x10, 0x10],
    [0x00, 0x00, 0x0F, 0x11, 0x0F, 0x01, 0x01],
    [0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10],
    [0x00, 0x00, 0x0F, 0x10, 0x0E, 0x01, 0x1E],
    [0x08, 0x08, 0x1E, 0x08, 0x08, 0x09, 0x06],
    [0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0D],
    [0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04],
    [0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A],
    [0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11],
    [0x00, 0x00, 0x11, 0x11, 0x0F, 0x01, 0x0E],
    [0x00, 0x00, 0x1F, 0x02, 0x04, 0x08, 0x1F],
    [0x02, 0x04, 0x04, 0x08, 0x04, 0x04, 0x02],
    [0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x04],
    [0x08, 0x04, 0x04, 0x02, 0x04, 0x04, 0x08],
    [0x00, 0x08, 0x15, 0x02, 0x00, 0x00, 0x00],
];