MiCyte

← The wiki

42 — The glyph library

BuiltRendered from 42-glyph-library.md in the public repository. Edits belong there.

A glyph is a datum document whose rows decode to one SVG path d attribute; it is how icons are stored in the MOS store.

The codec is micyte/core/datum_ops/glyph.py.

Grammar

One M per path, followed only by A (arc) commands. C, Q, Z and a second M are refused, because every admitted command must be stored as rows of a fixed arity and re-emitted unchanged.

Three properties are fixed, not stored:

PropertyValue
Arc x-axis rotation0
ColourThe host's currentColor
ClosureThe path is never closed

Coordinates

Drawings are in a 512×512 grid.

  • A point is 18 bits (262,144 positions, 0 to 511 on each axis).
  • A length is 9 bits and is stored as value − 1, so it addresses 1 to 512. A stored 111111111 (511) is a length of 512.

Both are chains off the spatial rudi 0-0-4. The grid chain is four deep, so its babelette is at 4-1-N and a glyph's own rows begin at layer 5. The value group of a row is its tuple count.

Theming

The portal draws icons from one sprite by external <use>. Inside an external <use>, CSS fill and stroke from the page have no effect; only color reaches the drawing, which is why colour is fixed to currentColor. A <use> that names a symbol the sprite does not contain draws nothing and reports nothing, so the sprite's contents are listed in one table, micyte/state_machine/portal_shell/icon_sprite.py, and test_portal_icon_sprite rebuilds the sprite and compares it byte for byte.

Where glyphs live

The host's glyph library is a sandbox with two branches, icons and documents; an icon is drawn at rail size and a document mark at 512×512. fnd_app/scripts/bootstrap_glyph_sandbox.py creates it and fnd_app/scripts/seed_glyph_library.py fills it.

Every local domain holds copies of the eleven canonical drawings (CANONICAL_GLYPHS in micyte/core/datum_ops/local_domain.py) under its glyphs branch, in this slot order: circle, disc, dot, ring, square, document, folder, anchor mark, log, link, code brackets. They are copies, so a sandbox draws its icons without reaching the host. Every node definition row names a glyph: ordinary nodes default to circle, structural nodes use the fixed choices in STRUCTURAL_GLYPHS.

Authoring a glyph

Draw inside a 512×512 box with one M and arcs. A curve the grammar lacks must be re-expressed as arcs.