From 96181563fb021285e604f76c3c1acaa4913e50a4 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 7 Jul 2026 17:47:06 +0300 Subject: [PATCH] feat(text): make SDF text the default renderer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flip `sdf_text_enabled()` to default ON: text renders as SDF glyph quads (crisp at every zoom, no LOD, box-based snap/pick) for everyone. Set `OCS_TEXT_SDF=0` to fall back to the legacy stroke path — a kill switch kept in case a drawing or environment needs the old renderer. Off-screen text is still view-culled per entity, so dropping the text LOD ladder stays bounded. Co-Authored-By: Claude Opus 4.8 --- src/scene/text/sdf_atlas.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scene/text/sdf_atlas.rs b/src/scene/text/sdf_atlas.rs index 40b2c6b59..021678faa 100644 --- a/src/scene/text/sdf_atlas.rs +++ b/src/scene/text/sdf_atlas.rs @@ -39,12 +39,13 @@ pub fn text_atlas() -> &'static Mutex { ATLAS.get_or_init(|| Mutex::new(GlyphAtlas::new(1024, 1024))) } -/// Whether SDF text rendering is enabled (env `OCS_TEXT_SDF`), read once. -/// When on, the wire path suppresses text glyph strokes so text draws only as -/// SDF quads (no double draw); the insertion snap point is kept. +/// Whether SDF text rendering is enabled, read once. Default ON — text draws +/// as SDF glyph quads (crisp at every zoom, no LOD; the wire path suppresses +/// the glyph strokes and keeps the insertion snap). Set `OCS_TEXT_SDF=0` to +/// fall back to the legacy stroke path (kill switch for the stroke renderer). pub fn sdf_text_enabled() -> bool { static ON: OnceLock = OnceLock::new(); - *ON.get_or_init(|| std::env::var_os("OCS_TEXT_SDF").is_some()) + *ON.get_or_init(|| std::env::var("OCS_TEXT_SDF").map_or(true, |v| v != "0")) } /// Debug: when env `OCS_TEXT_BOX` is set, each SDF text run also emits a