Repository navigation
artwork text
Working manual · 0.0.1-alpha · source snapshot 16 November 2026
This page documents the development Glyph Editor text tool. It is not a runtime controller scene.
Open a CTG, choose TEXT beside PROGRAMMER, or press T with canvas focus. For a composition still inside a bank, use SAVE CTG first.
- Choose a visible, unlocked layer with empty cells where the label will go. Other layers can contain artwork underneath the text.
- Click its starting cell, or use NEW TEXT / EDIT TEXT. Type your text.
- Choose 6X6 or 12X12, select a colour from the existing theme palette, then click APPLY TEXT. Arrow keys or the sidebar arrows adjust its position.
- SAVE / Ctrl+S saves the glyph, generated bank masks and editable wording. Save also applies a pending text draft after validation.
Click an existing label on its layer to edit it again. PREV/NEXT select labels across the document's frames/layers. Changing the wording, font size, colour or position and applying updates that label. CANCEL EDIT discards the pending draft. DELETE TEXT removes the label and its cells. Undo/redo restores applied text and its editing properties while the corresponding editor history is retained.
BACK TO GLYPH applies any pending text and returns to the brush. The brush, eraser, fill, picker, selection and pan shortcuts also apply text before leaving. If placement is invalid, correct it or press Escape to discard the pending draft and return to the brush; already applied text stays intact. When the text entry field is open, the first Escape closes that field and the second exits the Text tool.
The entry dialog supports Left/Right, Home/End, Backspace/Delete, Ctrl+A and copy/cut/paste. Shift+Enter inserts a newline; Enter accepts the field; Escape cancels it. Labels allow up to 256 printable ASCII characters and 32 lines.
6X6 uses exactly the compact UI font's 6×6 pixels, with a seven-pixel advance
and line spacing. It renders lowercase letters as uppercase and supports A–Z,
0–9, spaces and + - : / % ( ) .. Unsupported characters produce an error before
any artwork changes.
12X12 uses the active bank's printable ASCII character masks at 12×12. Banks without a requested letter fall back to the bundled font masks. An 8×8 source is enlarged by the existing nearest-neighbour sampling convention; a 12×12 source is used at native size. Its character and line advance is 12 pixels.
Both choices work in 8×8 and 12×12 bank sessions. Text is packed across tile boundaries at its true pixel size, rather than making each small letter occupy a full 12-pixel tile. Position is in composition cells on the selected layer; the existing layer offset, zoom, pan and rendering transform apply normally.
Text requires empty destination cells on its layer. It never erases unrelated artwork to make room. Its blank spacing cells also belong to the label. Text that would leave the canvas, overwrite another label, or edit a hidden/locked layer is rejected without partial changes. Apply or cancel a draft before changing its layer/frame or switching workspaces.
Generated monochrome chunks are ordinary CTB sprites referenced by ordinary CTG cells. Rendering, exports and Contour runtime use the existing compositor, with the chosen semantic colour and normal shadow alpha. Existing sprites are never rewritten when text changes; matching custom masks can be reused. Unused old masks remain in the bank to preserve shared references and undo.
A sibling Example.ctg.text file retains the editable labels. This is bounded,
versioned JSON (contour-glyph-text, version 1), separate from Programmer's
Example.txt. It stores wording, font size, frame/layer, cell position, colour
and generated cell IDs. CTG/CTB/CTF schemas remain unchanged. Keep this companion
with the CTG if you want to edit the wording after reopening. Without it, the
artwork still loads and renders as ordinary cells.
Saving uses SaveManager's safe file replacement. Bank, CTG and text metadata are separate transactions; a companion failure is reported and retains dirty metadata. Save As creates a companion under the new name and keeps the source. Malformed/unknown companions leave artwork available and are preserved. Existing Save As companions or external changes to a loaded companion are not overwritten.
Ordinary painting/transforms can change a label's generated cells. The text tool checks those cells before re-editing or deleting and refuses to erase unrelated changes. DETACH TEXT removes only its editing association, preserving the artwork, so it can be replaced deliberately. Frame/canvas edits that invalidate old text bounds likewise require detaching rather than silently remapping labels.
-
src/core/graphics/CompactFont.hppshares the existing compact bitmap source;src/render/TileFont.cppreads it without changing runtime text output. -
TextLabels.hppcontains raster preparation, tile stamping and metadata. -
TextEditor.incintegrates existing tool selection, fields, canvas, colours, undo and CTG lifecycle.TextUiTests.hppexercises those paths with SDL events. - The existing main editor, workspace, shortcuts, linked-glyph lifecycle and CMake files connect the tool; no separate editor or runtime text-object system.
Build cmake --build build --config Debug --target contour_GlyphEditor.
Run ctest --test-dir build -C Debug --output-on-failure -R "^glyph_text$".
The test covers both sizes in both bank resolutions, exact cross-tile pixels,
entry editing, font changes, immutable bank masks, undo/redo, save/reopen,
Save As, invalid placements, detach and malformed companions. It produces
build/src/Editor/glyphEditor/text-test/text-tool.bmp.
| Documentation still to add |
|---|
| Annotated current-build screenshots and a recorded controller walkthrough for this topic. |
Repository sources used for this page:
docs/glyph-text-tool.md
This is a documentation/source review, not a new runtime or hardware test. Physical response, screenshots and listening examples still need verification on a recorded build.