HeadlinesBriefing favicon HeadlinesBriefing.com

Lil Scripting Language Brings Vector Graphics to Decker

Hacker News •
×

Lil, the scripting language for the Decker ecosystem, takes an unusual APL-influenced approach to 2D vector graphics. The hershey module handles text layout using digital typefaces originally developed by Dr. Allen Vincent Hershey in his 1967 Calligraphy for Computers report. These early computer fonts used simple straight line-segments rather than curves.

Points in Lil are (x,y) coordinate pairs represented as 2-element lists. Strokes connect multiple points with sequential lines, while paths group strokes into complete shapes like letters or words. The hershey.textpath[] function builds complex paths from Lil strings using font glyphs, which developers can render with canvas.line[] through explicit loops or the @ operator shorthand.

Lil excels at path manipulation through its implicit conforming behavior. Arithmetic operators recursively descend nested list structures, enabling uniform scaling with simple multiplication. Non-uniform scaling requires careful list enclosure to properly distribute x and y scale factors across all points. Translation, shearing, and rotation all follow similar idioms using basic arithmetic operators.

The language provides primitives like mag, heading, and unit for polar coordinate calculations and geometric constructions. Developers can create complex effects like perspective distortion by scaling points proportionally to their magnitude. These built-in capabilities eliminate boilerplate code for common vector operations.

Lil demonstrates how thoughtful language design can make vector graphics programming more intuitive while maintaining mathematical precision.