Skip to content

Image labels for alphabet symbols (RFC 0014) - #52

Merged
willwade merged 2 commits into
mainfrom
feat/image-labels
Aug 1, 2026
Merged

Image labels for alphabet symbols (RFC 0014)#52
willwade merged 2 commits into
mainfrom
feat/image-labels

Conversation

@willwade

@willwade willwade commented Jul 31, 2026

Copy link
Copy Markdown

Adds optional image attribute on alphabet XML nodes, exposed via two C API functions. Frontends query once at startup, cache, and substitute images for text labels during rendering.

Changes

  • AlphInfo.h: character.Image field + GetImage() getter
  • AlphIO.cpp: parse optional image attribute (1 line)
  • dasher.h + CAPI.cpp: two C API functions:
    • dasher_get_alphabet_symbol_image() — image path for a symbol
    • dasher_get_alphabet_symbol_display() — display label (needed to key the image map; opcode 5 strings carry display text, not output text)
  • test_image_labels.cpp: backward compat, error handling, round-trip (258 assertions, all pass)

Design

  • Frontend queries once, caches [displayText → image], substitutes during render
  • Works identically for Strand 1 and Strand 2 frontends
  • No new opcodes, no Label class changes, no node_info changes
  • Backward compatible: alphabets without image attributes return empty strings

Proof of concept

Validated end-to-end in Dasher-Apple PR #30 (phoneme branch) with SVG phoneme symbols. Experimental — not merged to Dasher-Apple main yet.

RFC

willwade added 2 commits July 31, 2026 22:27
Optional 'image' attribute on alphabet XML nodes, exposed via
dasher_get_alphabet_symbol_image(). Frontends query once, cache,
substitute images for text labels during rendering.

- AlphInfo.h: character.Image field + GetImage() getter
- AlphIO.cpp: parse optional 'image' attribute on <node>
- dasher.h + CAPI.cpp: dasher_get_alphabet_symbol_image() C API function
- test_image_labels.cpp: backward compat, error handling, round-trip tests

Signed-off-by: Will Wade <will.wade@aactools.org>
Needed for image label map keying — opcode 5 strings carry display
text, not output text.

Signed-off-by: Will Wade <will.wade@aactools.org>
@willwade
willwade merged commit 541c6bc into main Aug 1, 2026
14 checks passed
@willwade
willwade deleted the feat/image-labels branch August 1, 2026 21:44
willwade added a commit to dasher-project/Dasher-Apple that referenced this pull request Aug 1, 2026
…30)

**This is experimental and partially a proof of concept.** It
demonstrates two RFCs working together:

## RFC 0014: Image labels in alphabets
- Optional `image` attribute on alphabet XML nodes
- `dasher_get_alphabet_symbol_image()` +
`dasher_get_alphabet_symbol_display()` in DasherCore (PR
dasher-project/DasherCore#52)
- Frontend queries at alphabet switch, caches `[displayText: NSImage]`,
substitutes in opcode 5 render path
- Works for both Strand 1 and Strand 2 frontends

## Phoneme Dasher
- X-SAMPA phoneme alphabet with PPM prediction + SpeechMarkdown TTS
- Two variants:
  - **English X-SAMPA Phonetic**: text labels (IPA glyphs)
  - **English X-SAMPA Phonetic (Symbols)**: SVG phoneme images in boxes
- 46 SVG phoneme symbols from `phonemeSymbols/svg/semantic/`
- Training data: 57K lines / 1.5M (combined hand-transcribed + espeak-ng
auto-converted)

## What's proven
- The alphabet XML `image` attribute parses correctly through AlphIO
- The C API exposes image paths to frontends
- SVG images load and render inside Dasher boxes on macOS
- The phoneme alphabet works with Dasher's PPM language model (expanded
training data)
- TTS speaks phonemes correctly via SpeechMarkdown X-SAMPA wrapping

## Known limitations
- **Image sizing**: uses `fontSize * 1.5` (engine-computed, stable).
Proper box-fit would need Strand 2 node bounds (`screen_x1/y1/x2/y2`) —
future work.
- **No iOS/visionOS image rendering yet** (macOS only in this PoC)
- **No user-importable image sets yet**
- **Phoneme-to-word prediction** (as in Trinh et al.) is not implemented

## Depends on
- DasherCore PR #52 (`feat/image-labels` branch)
- governance PR #21 (RFC 0014)

Signed-off-by: Will Wade <will.wade@aactools.org>
Signed-off-by: will wade <willwade@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant