Expand description
GPU Multi-Channel Signed Distance Field (MSDF) Font Atlas & Zero-Heap UTF-8 Text Shaper (ui_msdf_text.rs)
Re-exports the canonical zero-heap MSDF font atlas and text shaper from etalon_render::ui_canvas::msdf_text.
Structs§
- Msdf
Glyph Metrics - Normalized glyph metrics for a single codepoint in the MSDF font atlas (normalized to 1.0 em).
- Msdf
Text Quad - GPU-ready MSDF glyph quad instance (
#[repr(C)], 48 bytes,Pod, Zeroable). - Shaped
Text RunMetrics - Summary statistics returned by zero-heap text shaping.
Constants§
- MAX_
MSDF_ TEXT_ QUADS - Maximum shaped glyph quads emitted in a single UI canvas frame.
- MSDF_
ATLAS_ COLS - Columns in the procedural MSDF atlas grid.
- MSDF_
ATLAS_ GLYPH_ COUNT - Number of glyph slots in the embedded procedural MSDF font atlas (16 columns × 8 rows = 128).
- MSDF_
ATLAS_ HEIGHT - Full texture height in pixels (
8 * 16 = 128). - MSDF_
ATLAS_ ROWS - Rows in the procedural MSDF atlas grid.
- MSDF_
ATLAS_ WIDTH - Full texture width in pixels (
16 * 16 = 256). - MSDF_
CELL_ PX - Pixel width/height of a single glyph cell in the procedural MSDF atlas.
- MSDF_
PIXEL_ RANGE - Distance field pixel range used by the MSDF shader.
- MSDF_
TEXT_ WGSL - Embedded WGSL shader snippet for MSDF median-of-three text rendering with screen-space
derivative (
fwidth) anti-aliasing.
Functions§
- generate_
procedural_ msdf_ atlas_ into - Generates a procedural Multi-Channel Signed Distance Field (MSDF) RGBA8 atlas texture
(
MSDF_ATLAS_WIDTH×MSDF_ATLAS_HEIGHT× 4 = 131,072 bytes) intoout_rgba8with zero heap. - glyph_
metrics_ for_ char - Returns the
MsdfGlyphMetricsfor any UnicodecharinO(1)with zero heap allocation. - glyph_
slot_ for_ char - Maps a Unicode
charto its slot index[0..128)in the embedded MSDF atlas. Slots0..95cover printable ASCII0x20..=0x7E; slots95..128cover Latin-1 and QualiaDB 10D technical symbols (α,μ,σ,Δ,Ω,π,±,°,→,↔,≤,≥). - kerning_
advance_ em - Returns the horizontal kerning adjustment in em units for an adjacent
(left, right)glyph pair. - msdf_
median_ of_ three - Evaluates the CPU reference median-of-three MSDF reconstruction
max(min(r, g), min(max(r, g), b)). - shape_
text_ zero_ heap - Shapes a UTF-8 string into GPU-ready
MsdfTextQuadinstances in zero heap, performing pair kerning and greedy word-wrapping atmax_width_px(whenmax_width_px > 0.0).