Skip to content

App: label rich text with headings, sub- and superscripts, images, tables and pre - #205

Open
vadi2 wants to merge 1 commit into
mainfrom
ccr-14671218-tf96z6-scriptui-richtext
Open

vadi2 wants to merge 1 commit into
mainfrom
ccr-14671218-tf96z6-scriptui-richtext

Conversation

@vadi2

@vadi2 vadi2 commented Nov 18, 2026

Copy link
Copy Markdown
Member

Brief overview of PR changes/additions

A label's text now draws more of what Qt's rich text draws in a desktop Mudlet label (Phase F item 6, app only, no
protocol change):

  • Headings h1-h5 bold at Qt's 2, 1.5, 1.2, 1 and 0.8 times the label's size (h6 plain, as Qt leaves it), over
    any size set inside them; <font size> 1-7 at Qt's factors, a size with a unit read as Qt reads it.
  • <sub>/<sup> at 2/3 size, shifted.
  • <img> in the line, through the engine's getImage (as label backgrounds already are), or a data: URL's
    base64 image decoded locally (percent-escapes too), cached apart from engine images, bounded by bytes, out of memory
    caught. Width/height rounded and clamped as Qt does them (a side Qt reads no number from at the file's size, 0 hides
    it, each side at most 4096 px).
  • Tables: a row to a line, its cells set apart; unclosed cells and rows end at the next. <pre> keeps its
    spaces in monospace.
  • TalkBack: a label of only images is read by its tool tip as Mudlet reads it, else, where they are links, by an
    image's alt/title or its link's target, so the links stay reachable.

What differs from Qt (the table grid, the room headings and tables get, SVG data: images, files over 4096 px a side,
Qt's broken-image icon) is in docs/divergences.md; docs/phase-f.md and docs/architecture.md are updated.

Motivation for adding to Mudlet

Scripts draw HUDs and status panels in labels with headings, icons and tables. On Android these lost their images
and layout, so the labels read differently from the desktop.

Other info (issues closed, discussion etc)

  • Tests: JVM RichTextTest (headings, fonts, sub/sup, images and their sizes, data: URLs, tables, pre);
    instrumented ScriptLabelsTest (an image and a heading drawn, image-only labels read by alt or tool tip).
  • Bite branch ccr-14671218-tf96z6-scriptui-richtext-bite: one commit breaking each feature; it fails only its
    mapped tests (9 RichTextTest cases on the JVM, the app-only breaks in the instrumented tests).
  • Qt behaviour checked against Qt 6.4.2's QTextHtmlParser/QTextHtmlImporter and painted-pixel probes.

Generated by Claude Code

@vadi2
vadi2 force-pushed the ccr-14671218-tf96z6-scriptui-richtext branch from c5bff04 to 45b4a40 Compare November 19, 2026 16:07
…bles and pre

A label's text now draws what Qt's rich text draws of these, as Qt 6's
QTextDocument does: h1 to h5 bold at 2, 1.5, 1.2, 1 and 0.8 times the
label's own size, over any size a style sets in them (h6 plain, as Qt
leaves it); a font size 1 to 7 at Qt's 0.7 to 2.4 times the label's
size, over any size set in it, read as Qt reads it, a whole number or
else 0, so one with a unit is the smallest; sub and sup at 2/3 size,
shifted; an img in the line through the engine's getImage, or a data:
URL's image in base64, percent-escapes decoded first as Qt does, decoded
once for all labels and kept apart from what the engine is asked for,
with the engine's images, which are let go of by bytes as well as by
count, out of memory caught and one that fails forgotten, at its width
and height or its own size, each side rounded as Qt rounds it, a side Qt
reads no number off at the file's own, -1 none given, and a 0, given or
rounded to, hiding it but keeping its room along the other side, each
side 4096 pixels at most, in a font of any size; an image read as
nothing as Mudlet reads it, but a label of only images read by its tool
tip, as Mudlet reads it, else, where they are links, by an image's alt
or title, else its link's target, so TalkBack reaches the links; a
table a row to a line with its cells apart, a paragraph in a cell kept
in its row, a cell or row left open ended at the next; pre with its
spaces in monospace. These and the rest of what differs from Qt, among
them the table's lost grid, the room headings and tables do not get, an
SVG data: image or a file over 4096 pixels a side not drawn and the file
icon Qt draws for an image that does not load, are in
docs/divergences.md. A log line no longer names an image's path, which a
script chose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ujaeGdi2MHnkoicGsDqhg
@vadi2
vadi2 force-pushed the ccr-14671218-tf96z6-scriptui-richtext branch from 45b4a40 to 47ad7a7 Compare November 19, 2026 18:35

This branch has not been deployed

No deployments
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.

2 participants