GoForge — Build | Test | Ship | Collaborate GoForge — Build | Test | Ship | Collaborate
v0.5.0

scribe

Layout lines between the pixels, not on them

$ go install goforge.dev/scribe/cmd/scribe@latest

A metalworker’s scriber scratches dimensionless layout lines on metal before any cut is made. scribe draws the same way: coordinates name the grid lines between pixels, not the pixels themselves. A rect from (0,0) to (4,4) covers exactly 16 pixels, width is exactly right minus left, and scaling never pixelates. Corners are table-driven cubic Beziers, the mechanism QuickDraw used and PostScript kept.

Use

scribe icon -size 1024 -style continuous -fill '#FF6A00' -o icon.png
scribe icon -set -o ./icons               # 16..1024 Apple size ladder
scribe render drawing.scr -o out.png      # PostScript-homage language
scribe render drawing.scr -svg out.svg    # exact vector output
scribe render drawing.scr -term           # kitty, sixel, or half-block

The drawing language is a postfix homage to PostScript:

#ff6a00 setcolor
0 0 512 512 114.7 continuous roundrect
fill

The model

  • Corner-grid coordinates. Pixel (x, y) is the unit square from (x, y) to (x+1, y+1). Strokes centered on grid lines straddle pixels symmetrically, so antialiasing renders them crisply with no special cases.
  • Table-driven corners. Circular corners come from the kappa table; continuous corners are Apple’s G2 squircle table. No trigonometry anywhere in the library.
  • Exact coverage antialiasing. A pixel half-covered by an edge on a grid line has alpha exactly 128.
  • Deterministic. Identical input produces byte-identical PNGs on every platform.
  • Drawing as data. Every drawing is a serializable display list; the raster, SVG, and terminal backends all interpret the same program.

License

MIT.

Built as part of the GoForge suite, in Go.