forked from 1b-agent/opencadstudio-upstream
feat(text): make SDF text the default renderer
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 <[email protected]>
This commit is contained in:
1 parent
cd7306f530
commit
96181563fb
1 file changed
+5
-4
@@ -39,12 +39,13 @@ pub fn text_atlas() -> &'static Mutex<GlyphAtlas> {
|
||||
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<bool> = 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
|
||||
|
||||
Reference in new issue
Block a user