Layout and styles

You say what is on a page; the system decides how it looks. Everything is in points on a 360 point wide phone, and the same code draws in either style.

How a page is laid out

ztCoolStyle and who picks the style

ztCoolStyle is the name of this UI system. Its only styles are Metro and DotMatrix. An app cannot pick one, so it never differs from what is around it, and the two never mix. In order (pick_style in core.c):

  1. ZUI_STYLE in the environment, for renders and tests only. This is what --style sets.
  2. The session's ZTRF_SHELL_STYLE.
  3. style = in ~/.config/ztmetro/config.
  4. Metro.

zui_app_set_style and zui_app_set_theme are kept for the ABI and change nothing for a user: both styles are black, and there is no light theme.

section rendered in Metro
Metro
section rendered in DotMatrix
DotMatrix

Metro

The same widgets as ZrnMetroCore draws them: black, white Segoe UI, the app's name in capitals over a 48 pt lowercase title fixed at the top, pivots whose next titles run grey off the edge, rectangular toggles, outlined buttons that fill when pressed, round buttons with a word under them, Messaging's thread rows and bubbles, the tilt on press and the turnstile between pages.

DotMatrix

The same widgets in the same places. Everything filled is drawn by one fragment shader as dots 2.3 pt apart on one lattice, lit where the shape covers the cell's centre. Text is a 3x5 dot type drawn for this library, in upper case with no shaping, so scripts other than Latin come out as ?, as in ztMETRO. Pictures are dots of the palette's main colour at their brightness. Compared with the shell's own DotMatrix it lacks the ghost field and the glow.

dotmatrix_palette = in the same config file picks one of six palettes, by number or by name: Mono, Amber, Green, Ice, White, Red. The accent is the palette's, so set_accent is ignored.

The same page in DotMatrix's six palettes

The numbers

From .m in style-metro.c, in points, the same for both styles.

WhatValue
Page margin, gap16, 12
Title, header48, fixed, in a 108 pt header
Body, heading, caption16, 25.5, 13
Row height, with a second line52, 66
Row title, second line21, 13
Button height40, or 72 round with its word
Field height44, plus a 22 pt caption outside a footer
Corners, card padding0
Line spacing1.25

Fonts and colour

zui_app_set_accent(app, 0x0050ef);   /* DotMatrix ignores this; the style rules say leave it */
app.set_accent(0x0050ef);
app.set_accent(0x0050ef);
app = zrnui.App("io.github.you.notes", "Notes", accent=0x0050ef)

Style rules

Other scripts

In Metro, HarfBuzz shapes Sinhala, Tamil, Greek and Cyrillic, and CJK comes from fontconfig fallback. Bidirectional text is not reordered, so Arabic and Hebrew will not read correctly yet. DotMatrix shows Latin only.

Checked against zrn-sdk commit ea16771. Pictures are real renders of code that compiled. Source and proof.