TypeRig
Proxy API and Font Development Toolkit for FontLab
Install / Use
/learn @kateliev/TypeRigREADME
TypeRig
A Python framework for font design and engineering. Started as a personal toolkit for working inside FontLab, grew over the years into a standalone geometry and interpolation core with a bunch of GUI tools on top.
TypeRig has objects for manipulating font outlines — points, nodes, contours, shapes, layers and glyphs — plus math helpers for interpolation, adaptive scaling and curve processing. A proxy layer wraps FontLab internals so the same code works both standalone and inside the host app. On top of that sits a collection of GUI panels, toolbars, and dialog tools that cover most of what I need in a daily font production workflow. Experimental, evolving, and perpetually work-in-progress.
FontLab Scripts and Tools
The FontLab-facing part of TypeRig is the biggest chunk in practice — a collection of GUI tools that cover most of the font design and production workflow. Built with PythonQt, hooked into FontLab's undo, multi-master aware.
TypeRig Panel (typerig-panel.py)
The main interface is a dockable panel that loads sub-panels as tabs. Layer selectors and glyph-scope controls in the masthead. Panel visibility persisted via JSON. The available sub-panels are:
Node — The panel I use most. Node insertion (at arbitrary time, at extremes, at contour start), removal, conversion between on/off-curve types. Smart node movement with multiple methods: plain shift, proportional (LERP), italic-angle slant, slope-following, and a smart mode that preserves handle relationships. Node alignment to other nodes, to font metrics (ascender, caps height, x-height, baseline, descender, measurement line), and to user-defined targets with optional intercept and dimension-preserving modes. Slope copy/paste with flipping. Hobby spline tension copy/paste. Node coordinate banking for complex multi-step operations. Primitive drawing tools: circle from 2 or 3 selected nodes, square from diagonal or midpoints.
Contour — Contour closing, opening, reversing, and boolean operations (union, subtract, intersect, exclude). Contour alignment to other contours, to font metrics, and bounding-box-relative positioning. Contour group alignment (A-to-B). Distribution (horizontal and vertical) of multiple contours. Contour reordering by position.
Corner — Smart corner filter management with multi-master presets. Apply, remove, and find-and-remove smart corners by preset value. Live slider control for captured smart angles. Mitre, round, loop, and ink-trap corner operations with dialog-based parameter entry. Corner rebuild for re-processing existing corners.
Layer — Full layer management: add, duplicate, delete, duplicate-as-mask. Copy and paste whole layer groups. Layer visibility toggle. Layer type assignment (mask, wireframe, service). Element-level operations across layers: swap, pull, push, clean. Element locking/unlocking. Contour-level cross-layer operations: pull/push nodes, copy/paste outlines between layers, paste by layer name. Side-by-side layer comparison view. Zero setup interpolation between selected layers.
Delta — The adaptive scaling (delta machine) panel. Virtual axis setup with stem values per master layer. Target layer generation with configurable horizontal/vertical stems, width, and height. Supports extrapolation, intensity control, italic-angle compensation, and multiple transform origins. Axis configurations can be saved/loaded from Font Lib or external JSON files. Integrates with the core delta-scaling engine based on Tim Ahrens' methodology.
Element — Shape (element) manipulation: naming, unlinking references, deletion, transform reset, transform rounding, auto-reorder by position, ungroup-all. Shape insertion and replacement from font-wide element library. Shape alignment to other shapes, to layer bounds, and to font metrics. An expression-based element composition system with a scripting syntax supporting coordinate placement by node tags, anchor names, bbox positions, per-layer overrides, and element swapping.
Clipboard — Multi-master aware contour clipboard using core-object storage. Copy full contours or partial selections. Paste with configurable transform (translate, scale, rotate, skew), delta machine size fit and transform origin. Supports reversed and partial paste modes as well as drawing and connecting multiple (selected in UI) segments. Save/load clipboard contents to XML files for cross-session and cross-font workflows.
Metrics — Sidebearing and advance width tools. Copy metrics from other glyphs by name with percentage and unit adjustments. Metric expressions: get, set, auto-link from element references, and unlink. Copy bounding-box dimensions (width and height) between glyphs with proportional adjustments.
Anchor — Anchor management with tree-view display per layer. Add, move, and clear anchors with various coordinate input modes: absolute positions, font-metric-relative placement (ascender, caps, x-height, baseline, descender), bounding-box-relative positions, and expression-based coordinates. Per-layer coordinate lists for multi-master workflows. Italic-angle-aware positioning.
Guide — Guideline creation at percentage-based positions relative to advance width, bounding box, or font metrics (x-height, caps height, ascender, descender). Named and tagged guidelines with color assignment. Vertical and horizontal guide placement. Source glyph reference for cross-glyph guide alignment. Glyph tagging and node naming tools.
Glyph — Basic glyph operations: rename, copy/duplicate with configurable options (outlines, guidelines, anchors, tags, flags, references, LSB/RSB). Batch glyph duplication with auto-numbering and transform application.
Outline — Interactive node table with sortable columns showing node index, element index, contour index, coordinates, and node type per layer. Direct coordinate editing in the table with live viewport update. Synchronized selection between table and canvas.
Pairs — Kern string generation. Filler-based pair construction with customizable left/right fillers. Multiple pattern modes for systematic kerning string creation. Import kern data from DTL .krn, .cla, and .afm files.
Stats — Glyph statistics: bounding box dimensions, advance widths, sidebearings across layers. Comparative view with percentage and unit modes. Character-set-based batch queries.
AutoMetrics — Automated metric assignment tools.
CopyKerning — Kern pair copying between glyphs and layers with class-aware support. Source pair lookup with expression adjustment. Group kerning mode with automatic class resolution.
CleanKerning — Kerning table cleanup utilities.
TypeRig Manager (typerig-manager.py)
A separate dialog for font-level operations:
FontMetrics — Multi-master font metrics editor with table-based interface for all vertical metrics across all master layers. Font zone management: add, remove, import/export zones as JSON. Zone creation from metric references.
Toolbars
Dockable toolbars for quick access to common operations:
Node Toolbar — Node insertion, removal, extreme insertion, start-point management, and corner operations (mitre, round, loop, trap, rebuild) as toolbar buttons.
Node Align Toolbar — Node alignment to min/max coordinates, user-set targets, and font metrics (ascender, caps, x-height, baseline, descender, measurement line) with intercept, dimension-preserving, and smart-align options.
Node Slope Toolbar — Slope copy/paste with italic angle support. Paste to min/max pivot with optional horizontal flip.
Contour Toolbar — Contour boolean operations, closing, reversing, and winding correction as toolbar buttons.
MacOS Panel (toolbar-mac.py) — A unified panel-based interface that consolidates node, alignment, slope, corner, contour, and curve tools into a single flow layout. This exists because QToolBar widgets don't function properly in MacOS FontLab, so all toolbar functionality is reimplemented as a panel with TRFlowLayout.
Standalone Tools
Separate dialog tools for specific tasks:
Delta Preview (TR-DeltaPreview.py) — Visual preview of delta machine results without writing to the font. Dual-pane interface with source masters and computed target results rendered as QPainterPath objects built from core geometry. Live zoom and padding controls. Execute-to-font mode for committing approved results as real layers.
Comparator (TR-Comparator.py) — Cross-font and cross-layer glyph comparison. Detect outline differences, missing layers, shifted-but-identical layers, and anchor mismatches between two fonts or between layers within a single font. Visual overlay rendering with color-coded difference display. Time-stamp-aware comparison for change tracking. Batch processing with progress bar and font mark colorization.
Match Contours (TR-MatchContours.py) — Visual contour matching across masters. Contour order tab for drag-and-drop reordering with winding direction display (color-coded CW/CCW). Contour start-point tab for aligning start nodes across masters with corner-based (BL, TL, BR, TR) and sequential (next/prev) start-point adjustment. Visual icon rendering per contour per master.
Encoder (TR-EncodeGlyphs.py) — Unicode encoding management. Load encodings from JSON, FontLab .nam files, or Google protobuf .textproto files. Apply or clear unicode mappings for entire fonts or selected glyphs. Save/load encoding data to Font Lib.
Sort Anchors (TR-SortAnchors.py) — Sort anchor ordering across all masters for consistency. Reference-master mode preserves the anchor order from a chosen master. Alphabetical mode sorts all anchors uniformly. Verbose mode reports missing anchors across masters.
Propagate Anchors (TR-PropagateAnchors.py) — Table-driven batch anchor copying between glyphs. Per-action configuration for source glyph, anchor selection, destination glyphs, layer scope, and copy options (absolu
