Softanza
StartFrançais
Softanza
Visual & spatial

Graphics

One Zig engine across twelve lanes, text, colour, cartography, GPU, under one governed system.

6 Strong · 3 Solid · 2 Partial · 1 Emerging

Measured against: Skia · D3 · Graphviz · Folders: base/graphics(opens in a new tab) · For programmers: this area's reference

an orrery from the artwork gallery
an orrery from the artwork gallery. rendered by the library's guard gg_gallery and committed with it at 0e72e2e2c as gallery_4_orrery.png · the source(opens in a new tab)

Rethought from first principles

What Softanza kept from what works, and what it rethought, as the library wrote it down in its design documents and narrations.

The Softanza wayGraphics is not a new engine: it is the GPU layer Softanza already owns, taught to draw as well as compute.

Kept from the best practice

  • Text shaping is delegated to HarfBuzz and bidirectional order to SheenBidi. Correct Arabic shaping is a specialty built over many years, not something to rewrite. source(opens in a new tab)
  • Windows on all three desktop systems come from GLFW, a small proven library, instead of three hand-written windowing layers. source(opens in a new tab)
  • The colour system keeps proven ideas. Each shade step names its job (surface, border, text), and every fill comes with a paired colour readable on it. source(opens in a new tab)

Rethought

  • Computing and drawing share one GPU device, so a simulation feeds the picture without copies. In one test, 16 bytes per frame went to the card instead of 1.7 MB. source(opens in a new tab)
  • Unicode text is required from day one, with Arabic as the acceptance test. One layout serves every output, so the vector and pixel pictures cannot disagree. source(opens in a new tab)
  • Every drawing can always become SVG with no GPU, so pictures can be produced and checked anywhere. Without a device, a PNG request is refused and counted. source(opens in a new tab)
  • Colour ramps are computed in OKLCH, so each step is evenly lighter and never out of order. Contrast becomes a number that can make a theme fail. source(opens in a new tab)

Most of the field ships one lane well: Skia renders, D3 charts the web, Graphviz lays out graphs, spatstat does the statistics and draws nothing. Softanza is one Zig engine behind declarative Haro faces that reaches across twelve of those lanes at once; its advantage is being coherent across twelve lanes under one governed colour and text system, which no single competitor is.

What a crafter does with it, and what stands out

  • coherent across twelve lanes under one governed colour and text system
  • Arabic kashida justification at font-declared points
  • the rare lane where a graphics library also computes the statistics it draws
  • compute and render zero-copy on one wgpu device

What is owed

  • general paths, curves & transforms
  • complete the chart family
  • colour-blindness simulation
  • PDF export & the raster floor

The Softanza way, run

What Softanza does differently in this area, shown by code taken from its narrations and guards, and run for this page.

The Arabic spelling of Softanza is shaped into one right-to-left run of eight glyphs, and placed between Latin words it splits into three runs.

Softanza
# the guard's fixture: a committed Arabic font subset
cFixture = "../gpu/fixtures/amiri_arabic_subset.ttf"
oF = new stzFont(cFixture)
cAr = char(0xD8)+char(0xB3) + char(0xD9)+char(0x88) + char(0xD9)+char(0x81) +
      char(0xD8)+char(0xAA) + char(0xD8)+char(0xA7) + char(0xD9)+char(0x86) +
      char(0xD8)+char(0xB2) + char(0xD8)+char(0xA7)
chk("Arabic measures positive (a real shaped advance)", oF.WidthOf(cAr, 24) > 0)
chk("Arabic is ONE visual run", oF.RunCountOf(cAr, 24) = 1)
chk("mixed script is THREE runs", oF.RunCountOf("abc " + cAr + " xyz", 24) = 3)
chk("8 Arabic codepoints shape to 8 glyphs", len(oF.GlyphsOf(cAr, 24)) = 8)
Output
  [OK] Arabic measures positive (a real shaped advance)
  [OK] Arabic is ONE visual run
  [OK] mixed script is THREE runs
  [OK] 8 Arabic codepoints shape to 8 glyphs

run on 2026-10-01 21:17 inside the library at commit 0e72e2e2c; taken from base/test/graphics/graphics_faces_narrated.ring(opens in a new tab)

Legibility is a number that can say no: mid-grey text on white is refused, black on white passes, and a colour on itself is refused.

Softanza
chk("mid-grey on white is REFUSED", NOT StzIsLegible("#999999", :White))
chk("black on white passes", StzIsLegible(:Black, :White))
chk("a colour on itself is refused", NOT StzIsLegible(:Danger, :Danger))
Output
  [OK] mid-grey on white is REFUSED
  [OK] black on white passes
  [OK] a colour on itself is refused

run on 2026-10-01 21:17 inside the library at commit 0e72e2e2c; taken from base/test/graphics/gg_color_c3.ring(opens in a new tab)

The articles of this area (2)

The lanes, one by one

Lanes and their notes are quoted as they were read at the source, on Read from the source on 2026-09-15.

Text & typography
Strong
SheenBidi -> HarfBuzz -> stb_truetype: bidi reorder, OpenType shaping, Arabic kashida justification at font-declared points, fallback chains, vertical CJK
Colour system
Strong
OKLCH/Oklab throughout, monotonic ramps, a five-value semantic family under a constitution, ten themes, WCAG 2 + APCA contrast as gate-able numbersStzIsLegible / StzContrastLc; SOFTANZA_COLOR_SYSTEM.md
Cartography & projections
Strong
44 projections with inverses, WGS84 geodesy, GeoJSON/TopoJSON, choropleth/symbol/flow/hex-bin, insets, Tissot, scale bar, north arrow, terminatorstz_geo.dll
Spatial statistics
Strong
Clark-Evans z-test, Ripley K/L, G & F, envelopes, kernel density, contours, IDW, variograms, ordinary kriging with variance; seven null models
Diagramming
Strong
25+ notations all closed (DN0-DN24), many constraint-solved; own deterministic layout engine (GG1-GG6) plus a live picture-as-input modeSOFTANZA_GRAPH_PLANE_PLAN.md (DN0-DN24, GG1-GG6)
GPU compute + render
Strong
In-house wgpu surface: instanced multi-texture render and compute (matmul, fft, softmax, topk, pairdist) zero-copy on one device, W-string -> WGSLstz_gpu.dll
2D vector rendering
Solid
Retained display-list canvas with an SVG floor that always answers, GPU-backed PNG; no Bezier/arc/AddPath, no transform stack, CPU rasteriser never written
Accessibility
Solid
An accessibility tree with roles, names, reading order and ToJSON, a screen-reader bridge, contrast maths gating colour; CVD simulation owed
Output & portability
Solid
SVG everywhere, lossless PNG with a returned encode decision, native window and browser tiers; no PDF/JPEG/WebP, only Windows runtime-verified
Charts & data-viz
Partial
Bar, multi-bar, line, scatter, histogram, surface, treemap with SVG/PNG/terminal renderers; no pie/donut, area, heatmap, box/violin, candlestickstzDataSet
Interactivity & animation
Partial
Canvas hit-testing (Pick), SVG ids/classes for hover, a drag-driven live diagram; animation and tweening explicitly deferred to GUI G5
Perception — the plane can draw, not yet see
Emerging
VISION plane's first rung: a draw->read round trip through Windows.Media.Ocr and onnxruntime (10 ms, glyph-accurate incl. Arabic shaping)