Skip to content

LingenicLLC/lingenic-compose-pen-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

「‍」 Lingenic Pen-Path

A 2D stroke graphics library using the pen-and-path model.

Overview

Pen-Path provides primitives for creating stroke-based vector graphics, inspired by calligraphic and technical drawing traditions. A pen (circular, elliptical, or rectangular) traces along a path to produce filled outlines.

Core Concepts

  • Point: 2D coordinate in centipoints (7200 per inch)
  • Path: Sequence of points connected by line, curve, or corner segments
  • Pen: Shape that sweeps along a path
  • Stroke: Filled envelope from sweeping a pen along a path

Units

All coordinates use centipoints (Cp):

  • 7200 centipoints = 1 inch
  • 100 centipoints = 1 point (1/72 inch)

Integer coordinates avoid floating-point precision issues while providing sub-point accuracy.

Path Connectors

Symbol Name Description
Line Straight segment
Curve Smooth curve (Hobby's algorithm)
Corner Sharp angle break
Cycle Close path to start

Pen Types

  • Circular: Fixed-width strokes
  • Elliptical: Calligraphic variation
  • Rectangular: Technical/architectural lines

Color Models

  • RGB/RGBA: Screen display (0-255 per channel)
  • CMYK: Print output (0-100% per channel)
  • Grayscale: Single-channel with alpha
  • HSL: Hue/Saturation/Lightness
  • Spot: Named single-ink colors (Pantone-style) with tint
  • Sepia: Warm monochrome for aged document aesthetics

Usage

use pen_path::{Point, Path, Pen, Color, Stroke, StrokeOptions};
use pen_path::render::SvgOps;

// Create a path (coordinates in centipoints)
let path = Path::builder()
    .move_to(10000, 10000)
    .line_to(50000, 10000)
    .line_to(30000, 40000)
    .close();

// Create a 10pt circular pen
let pen = Pen::circular(1000);

// Stroke and render
let stroke = Stroke::new(path, pen, Color::BLACK);
let envelope = stroke.to_envelope(&StrokeOptions::default());

Output Formats

  • PDF: Direct PDF path operators
  • SVG: Standard SVG path data

License

Apache-2.0

Part of 「‍」 Lingenic Compose

Pen-Path is a component of the 「‍」 Lingenic Compose typesetting system.

http://compose.lingenic.com/

About

A 2D stroke graphics library using the pen-and-path model.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages