classic-text

Documents SDF text rendering, glyph buffer building, and font atlas loading in the classic-wgl Rust engine.

1|1|Updated Aug 18, 2021
One-click install
npx skills add https://github.com/guilledk/classic-wgl --skill classic-text-guilledk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: classic-text
Source: https://github.com/guilledk/classic-wgl/tree/main/.agents/skills/classic-text
Command: npx skills add https://github.com/guilledk/classic-wgl --skill classic-text-guilledk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It explains how SDF text rendering works in the classic-wgl Rust engine so developers can correctly render, position, justify, clip, and update text entities without misreading the render loop's behavior. ## Core Features & Use Cases - SDF Text Pipeline Reference: Covers the SdfTextRender component, build_sdf_glyph_buffer's four phases, GPU buffer caching in SdfTextGpu, and the single-pass draw_sdf call. - UI Integration Details: Documents is_ui justify offsets, scissor clipping with Y-flipped clip_rect, measure_all_ui_labels pre-measurement, and SDF text on button children. - Font Atlas Tooling: Describes the classic-assets Python atlas generator (Felzenszwalb EDT, shelf packing) producing dejavusans-sdf PNG and metrics JSON. - Use Case: When a UI label appears at the wrong position on the first frame, consult this Skill to learn that measure_all_ui_labels must run after UI init to set correct UiNode sizes before layout. ## Quick Start Ask the AI to explain why SDF text justification is not part of the dirty check and how the render loop applies the is_ui justify x-offset.

Frequently Asked Questions about classic-text

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does SDF text rendering work in the classic-wgl Rust engine?

Text entities carry an SdfTextRender component; each frame the render loop rebuilds the glyph buffer via build_sdf_glyph_buffer when text or scale changes, caches it in SdfTextGpu, and issues a single draw_sdf call with the sdf shader.

How do I generate an SDF font atlas for classic-wgl?

The atlas is produced by classic-assets using render/make_sdf_font.py, a Python port of the retired sdf-atlas crate. It outputs a power-of-two PNG atlas and a metrics JSON with per-glyph x, y, w, h, offsets, and advance.

Why does UI text appear at the wrong position on the first frame?

Text entities spawned by spawn_sdf_text start with UiNode.size of (max_width, 0), so layout anchors use stale dimensions. Calling Engine::measure_all_ui_labels after UI init pre-measures all labels and refreshes the layout before the first render.

Does build_sdf_glyph_buffer support word wrapping?

No, build_sdf_glyph_buffer does not perform word wrapping. The layout_width argument is only used as a column width for justification, and multi-line text relies on explicit newline characters.

How does scissor clipping work for SDF text in UI containers?

When a parent has clip_children enabled and the text entity has a non-zero clip_rect, the render arm computes a Y-flipped scissor rectangle, enables SCISSOR_TEST, draws, then disables it. Only SdfText draw items apply scissoring.

What are the limitations of the classic-wgl SDF text renderer?

It is single-pass only with no shadow, glow, or background rendering. Weight and gamma default to no-effect values, justification changes do not trigger buffer rebuilds, and there is no non-SDF text rendering path.