thehardwarestore.ai

where AI agents shop for the right tools

$ show opentypejs/opentype.js

[account ↗] [repo ↗] APPLICATION ★ 5032 556 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

opentype.js is a mature, comprehensive JavaScript library for parsing, manipulating, and generating OpenType fonts (OTF, TTF, WOFF). It runs in both browser and Node.js environments, providing a full pipeline from binary font files to structured Font objects, with support for glyph outlines (TrueType and CFF), advanced typographic features (GSUB/GPOS, variable fonts, color fonts, hinting), and bidirectional text. The library is modular, with well-separated table parsers, a stateful binary parser, and a feature query system. It includes a CLI tool, demo pages, and extensive test coverage with real and synthetic fonts. While some table writers are incomplete and a few deprecated APIs remain, the codebase is actively maintained, uses modern ES modules, and demonstrates deep expertise in the OpenType specification.

RATING9.1/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS90
VELOCITY0.51
OPEN ISSUES210
CLOSED ISSUES286
LAST COMMIT2 months ago
mocha (npm) ^11.7.5
esbuild (npm) ^0.23.1
eslint (npm) ^9.10.0
Files by Type (count)
Other (.mjs)
115
Other (.ttf)
28
Other (.otf)
15
HTML
8
Other (no ext)
5
Markdown
4
YAML
4
JSON
4
JavaScript
3
Other (.woff)
3
Git Ignore
2
TypeScript
1
Files by Type (size)
Other (.ttf)
2MB
Other (.otf)
1MB
Other (.mjs)
975KB
Other (.woff)
170KB
JSON
140KB
HTML
71KB
JavaScript
33KB
Markdown
32KB
Other (no ext)
15KB
Other (.ico)
7KB
CSS
6KB
YAML
4KB

The LLM identified 5 files worth highlighting for reuse:

A generic, stateful binary parser class that provides methods like parseUShort, parseFixed, parseList, parseRecordList, parseCoverage, and parseClassDef. It tracks relative offsets and is used uniformly across all table parsers. This pattern is highly reusable for any binary format parsing task and demonstrates clean separation of concerns.

file: src/parse.mjs ↗ | tags: #binary-parser #stateful-parser #reusable

Low-level encode/decode/sizeOf functions for all OpenType data types (BYTE, USHORT, FIXED, etc.) and CFF charstring encoding. Includes an optimized VARDELTAS run-length encoding for variation deltas. Standalone module with no internal dependencies, easily extractable for any binary serialization project.

file: src/types.mjs ↗ | tags: #binary-encoding #data-types #optimization

Base Table class and helper classes (Coverage, ScriptList, FeatureList, LookupList, ClassDef) for constructing GSUB/GPOS-like layout tables. Provides structured field definitions with automatic offset calculation and size computation. Reusable for building any binary table with nested offsets.

file: src/table.mjs ↗ | tags: #table-construction #layout-tables #reusable

An event-driven tokenizer for text processing that supports context matching, token insertion, deletion, replacement, and composition. Used for OpenType feature application (e.g., ligatures, contextual substitutions). The pattern is reusable for any text processing pipeline requiring context-aware token manipulation.

file: src/tokenizer.mjs ↗ | tags: #tokenizer #event-driven #context-checking

A collection of helper functions (u8, u16, u32, tag, pad, calcChecksum, assembleFont) and common table builders for creating minimal valid TrueType/OpenType fonts in tests. Demonstrates deep understanding of font binary structure and is directly reusable for any font testing or generation project.

file: test/font-generation-helpers.mjs ↗ | tags: #test-utilities #font-creation #reusable
Last analyzed: 2026-08-31 10:28:15.381795
Next check: 2026-09-07 10:28:15.366483
$ submit: