
ChordFont(archived)
Jazz chord symbols, engraved properly — as a font.
npm install @chordlang/font
Jazz chord symbols, engraved properly — as a font.
npm install @chordlang/fontAn OpenType font that sets chord symbols the way jazz lead sheets print them.
You type plain ASCII, Ebmaj7 or F#m7b5, and the font draws the flats,
sharps, triangle and superscripts. No rendering library, canvas or script runs
at display time: the engraving rules live in the font’s substitution tables, so
anything that can set a typeface can set chords.
The hard part of chord engraving is that one keystroke means different things
in different places. In Bb7b5, the first b is part of the root, B flat, and
the second is an alteration, a flattened fifth. Engravers draw them differently.
OpenType’s contextual substitution (GSUB calt) can choose a glyph by what sits
to its left, and that is enough to tell them apart.
The rules run in order. A flat or sharp right after A–G becomes the root form;
any flat or sharp left over becomes the alteration form. A digit after an
alteration becomes superscript, and each following digit chains on, so #11
and b13 set as one raised group. Ligatures turn maj into a triangle and
dim into a small circle; a 7 after either stays full size.
The font never parses a chord. It maps ASCII to glyphs and nothing more, and
its shape tests, run through HarfBuzz, are the engraving spec: Dm7b5 must
shape to D m d7 flat.alt d5.sup. A separate chord package, built on
tonal, turns messy input into canonical
ASCII and the notes it means, and serves as the harmony spec. A stress-test chart
renders the whole vocabulary as a regression fixture.
The chordlang monorepo also ships a
playground, a lead-sheet format (.cfmd) parsed with Peggy, and harmonic graphs
(.cfgv, rendered with Graphviz).
Glyphs derive from Petaluma (Steinberg’s SMuFL font), under the SIL Open Font License.