euv-core 0.47.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::*;

/// Optional process-wide native glyph rasterizer hook registered by mobile/OS host bridges.
pub(crate) static EXTERNAL_GLYPH_RASTERIZER: AtomicPtr<()> = AtomicPtr::new(null_mut());

/// Process-wide single persistent `OnceLock` FreeType 2 dynamic library handle initialized lazily on first glyph miss.
#[cfg(any(target_os = "linux", target_os = "android"))]
pub(crate) static FREETYPE_LIB: OnceLock<Option<FreeTypeLib>> = OnceLock::new();

/// Process-wide single persistent `OnceLock` Android NDK `AFontMatcher` library handle initialized lazily on first glyph miss.
#[cfg(target_os = "android")]
pub(crate) static ANDROID_FONT_MATCHER_LIB: OnceLock<Option<AndroidFontMatcherLib>> =
    OnceLock::new();

/// Process-wide single persistent `OnceLock` Windows DirectWrite (`dwrite.dll`) library handle initialized lazily on first glyph miss.
#[cfg(target_os = "windows")]
pub(crate) static DWRITE_LIB: OnceLock<Option<DirectWriteLib>> = OnceLock::new();

thread_local! {
    /// Per-thread count of lazy primary OS font face binds for zero-sync-probe cold-start telemetry and testing.
    pub(crate) static THREAD_PRIMARY_FONT_BINDS: Cell<usize> = const { Cell::new(0) };
    /// Per-thread count of lazy native fallback font loads (CJK / symbol cascades) for telemetry and testing.
    pub(crate) static THREAD_FALLBACK_FONT_LOADS: Cell<usize> = const { Cell::new(0) };
}

#[cfg(any(target_os = "macos", target_os = "ios"))]
thread_local! {
    /// Per-thread fixed O(1) Clock-LRU cache of Apple CoreText `CTFontRef` handles, grayscale `CGColorSpaceRef`, and scratch bitmap context.
    pub(crate) static CORETEXT_FONT_CACHE: RefCell<CoreTextFontCache> = const { RefCell::new(CoreTextFontCache::new()) };
}

#[cfg(target_os = "windows")]
thread_local! {
    /// Per-thread fixed O(1) Clock-LRU cache of Windows Win32 `HDC`, `HFONT` handles, lazy `IDWriteFactory`, and outline scratch storage.
    pub(crate) static WIN32_FONT_CACHE: RefCell<Win32FontCache> = const { RefCell::new(Win32FontCache::new()) };
}

#[cfg(any(target_os = "linux", target_os = "android"))]
thread_local! {
    /// Cached per-thread FreeType library and lazily loaded system font faces (`None` = uninitialized, `Some(None)` = unavailable).
    pub(crate) static FREETYPE_RUNTIME_CACHE: RefCell<Option<Option<FreeTypeRuntime>>> = const { RefCell::new(None) };
}

#[cfg(target_arch = "wasm32")]
thread_local! {
    /// Reusable offscreen `<canvas>` surfaces and pre-cached CSS font strings for zero-churn Web glyph rasterization.
    pub(crate) static WEB_FONT_SCRATCH: RefCell<WebFontScratch> = const { RefCell::new(WebFontScratch::new()) };
}