Vector Graphics in Lil
2 days ago
- #Lil programming
- #digital typography
- #vector graphics
- Dr. Allen Vincent Hershey developed early digital typefaces using straight line-segments, described in his 1967 report Calligraphy for Computers.
- The hershey module in Decker is used for laying out text with these typefaces, leveraging the APL-influenced Lil scripting language for 2D vector graphics.
- Points in Lil are represented as (x,y) coordinate pairs, strokes as lists of points forming polylines, and paths as lists of strokes that can represent shapes or text.
- The hershey.textpath[] function creates paths from text strings using font glyphs, which can be drawn on a canvas with canvas.line[] via loops or shorthand operators.
- Lil supports collective operations, allowing scaling, translation, shearing, rotation, and other affine transformations of paths using arithmetic operators and primitives like mag, heading, and unit.
- Examples of path manipulations include non-uniform scaling, mirroring, shearing (using peels), transposition, rotation via polar coordinates, and generating shapes like regular polygons.
- Creative effects like perspective distortion, random offsets for line-boil, and sinusoidal wiggles can be applied to paths, demonstrating Lil's flexibility for graphics.