garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

.. /docs/text-and-access.md

raw

Text, language and access

What Pinnacle does so that people who read other scripts, speak Dutch, or see less well can use it, built in session s916 (2026-11-29) from the Need-2 items of full-os.md: text shaping, right to left and fallback fonts; translations and local formats; text size, contrast and a screen reader. This says how each works and where it stops.

Text beyond Latin

A line goes through four steps before it is drawn, all in Pinnacle's own code (pinnacle-text, pinnacle_ttf::layout):

  1. Direction. Unicode's bidirectional algorithm (UAX #9) in full: explicit embeddings, overrides and isolates, weak and neutral types with paired brackets, implicit levels, the line's reordering and mirrored brackets. It passes all 91 707 lines of Unicode's BidiCharacterTest.txt; a sample of them is a test here.
  2. A font for each character. The system's sans (or mono) first, then the fallbacks in order: Noto Sans Arabic, Noto Sans Hebrew, Droid Sans Fallback (Chinese, Japanese, Korean) and Noto Emoji, on the system disk as /fonts/arabic.ttf, hebrew.ttf, cjk.ttf and emoji.ttf. Punctuation and spaces stay in their neighbours' font, marks in their letter's, and an emoji sequence (skin tones, joiners, flags) in the emoji font. A program reads a fallback only the first time a character needs it, so one that never shows Chinese never reads 4 MB of Chinese font.
  3. Joining. Arabic, Syriac and N'Ko letters take the form their neighbours ask for (alone, initial, medial, final), from Unicode's joining types.
  4. Shaping by the font's own rules. The scripts whose letters join or stack (Arabic, Hebrew, Syriac, Thaana, N'Ko) and emoji go through the font's GSUB (single, multiple, alternate, ligature, context and chained context in all formats, extension) and GPOS (single and pair adjustment, marks on bases, ligatures and marks, context). For the strings in text/tests/text.rs the glyphs and their places are exactly HarfBuzz's.

Latin, Greek, Cyrillic and CJK are set glyph by glyph from the character map, as before: a line the system font draws by itself, left to right, costs nothing more than it did.

Not yet: Indic and Southeast Asian scripts (Devanagari, Thai, …) have no font and no reordering; emoji are outlines in one colour, not colour pictures; kerning applies only within shaped scripts, not to Latin. Line breaking is the interface library's and breaks at spaces, so Chinese and Japanese text, which has none, does not wrap; a text field's caret moves in logical order, which in right-to-left text is the other way round from what one sees; a right-to-left line is aligned as the layout says, not to the right by itself.

Languages and formats

The system's texts are written in English in the programs, each through pinnacle_locale::t("…") (or tf("{} free of {}", …) with blanks), which gives it in the language chosen in Settings → Language. The English text is the key: a program reads as before, and a text with no translation shows in English. The Dutch is locale/src/nl.rs, sorted. A test fails for any text a program passes to t or tf without its Dutch, so a new text in English cannot land untranslated. A text that counts has its singular beside it: "1 note" (or "One line", "the one thing") next to "{} notes", picked by a match on the count, since a blank cannot say "1 notes"; every_counted_text_has_a_singular fails for a counted text without one (a count that is never 1 goes in its NEVER_ONE, with why). Texts that arrive at run time (an app's title from its manifest) go through tr, and are listed in RUN_TIME so the test checks them too.

The language is a file, system:/locale/language (en, nl), that every program may read. Dates are written as each language writes them (zondag 29 november 2026, Sunday 29 November 2026), times on the 24-hour clock in both, numbers with the language's separators (1.234.567,5 and 1,234,567.5).

Translated so far: the display server (status bar, lock screen, the agent's question, notifications), the launcher, Settings and Clock. The other apps still speak English until their texts go through t.

Preferences, and how apps hear of them

Settings → Language and Settings → Accessibility write the preferences (the language in system:/locale/language, the rest in /settings/access, which only system programs reach) and tell the display server, which reads them again and sends them to every app: before an app's first window, so its first frame is right, and again on every change (protocol::PREFERENCES). An app hears Event::Preferences; one built from views calls Screen::restyle and mounts its view again, in the new language, size and contrast. An app that does not handle the event takes the change at its next start.

Text size and contrast

Text size (100, 125, 150, 200 %) makes the whole interface of an app built from views larger, as a browser's zoom does: the window is laid out for so many fewer logical pixels, and the stylesheet's responsiveness reflows it. High contrast swaps the tokens: a black ground, white text, dim text that is still bright, white borders, a lighter accent, a strong focus colour.

Not yet: apps still drawn by hand (Paint, Messages, Calls, Bluetooth, the terminal; docs/interface.md) keep their size and colours, as do the display server's status and home bars.

The UI tree and the screen reader

The UI tree is an app's interface as a list of nodes in reading order, each with a role (text, heading, button, link, switch, checkbox, text field, slider, list item, image), a name, a value, a state and its place. An app built from views makes it from its elements by itself (pinnacle-view): a button is named by its text or aria-label, a switch by its row's title, a field by its label or placeholder, its password as dots, a row's words read together. It goes to the display server with the app's next present, but only while the display server asks for it (WANT_TREE), so it costs nothing while the reader is off. This is the tree of the agent's step 5 (agent-environment.md); the agent does not read it yet.

The screen reader lives in the display server, which alone sees every app and its own screens. With it on, a finger no longer acts: a tap says what it touched and draws a ring round it, a double tap anywhere acts on what has the ring (a press and a release at its centre, the person's own, so not marked synthetic), a quick swipe right or left moves to the next or previous node, a finger held and moved explores what it passes over. On a keyboard, Alt and the arrows move, Alt and Enter acts. The status bar, the home bar, the lock screen, the agent's question and the list of notifications are read too, and each app's name is said as it comes to the front.

The voice is the system's own (pinnacle-speech, the speech service system-speech): a rule-based formant synthesizer, with letter-to-sound rules for English and Dutch and numbers read as words. It is intelligible rather than natural. What the reader says is also written to the console (reader: …), which is how the tests read it.

Not yet: apps drawn by hand have no tree, so the reader says only their name; the on-screen keyboard is not read, so typing with the reader needs a physical keyboard; a node scrolled out of the window is not reached by a swipe; no braille display, no voice control.

Trying it

cargo xtask access-demo boots with the device named in five scripts, switches Settings to Dutch, makes the text larger, turns on high contrast and the screen reader, and takes a screenshot of each step (target/demo-access). The self-check's text ok shapes Arabic on the device with the font from the disk, writes a date and a number in Dutch, and sends a UI tree through its wire format.