Selecting text in a Japanese or Chinese layout now shows a menu above
the selection: Ruby, Emphasis, and for Japanese, Warichu and Combine.
Ruby opens an input to add, change or remove the reading; Emphasis
opens a list of marks with icons; Warichu and Combine toggle on the
selection. The renderer exports the selection bounds so the menu can
centre on them, and new icons draw each emphasis mark.
A reading had to cover a single span, so putting emphasis on part of a
word blocked furigana on it. A reading can now cover adjacent spans of
different styles:
- Applying a reading gives the selected spans one new ruby-group id.
Splitting a span keeps the id. Spans without one, as in every
existing file, keep one base per span; matching readings alone never
join, so per-character readings such as 天天 stay apart.
- The span binary marks a span that joins the previous base with bit 2
of the ruby flags byte, so the format keeps its size.
- Paragraph::ruby_groups defines a base for the renderer. Horizontal
placement, long-reading spacing, paint, bounds, justification,
overflow and line breaks use it, as do the vertical base units, ruby
layout and column breaks.
- The editor accepts a reading over any selection without readings or
warichu, or over a whole base. Warichu still needs one span.
- HTML and foreignObject draw one ruby per base, CSS code generation
writes one set of rules per base, and SVG export draws one reading
per line of a base through the new ruby-x and ruby-width keys.
AI-assisted-by: claude-opus-5-5
Render Japanese annotations in HTML and SVG and expose their styles
in CSS code generation. Preserve vertical position data from WASM,
while keeping the legacy SVG renderer on its horizontal layout path.
Cover generated markup, styles and copied SVG output.