Jim's TrueType QR Code Font
Jim's TrueType QR Code Font
This project, hosted by jimparis on GitHub, provides an experimental OpenType font capable of transforming specific text strings into functional QR code symbols.
🌐 Live Demo: https://qr.jim.sh/
📦 Available Font Versions
Depending on the required data capacity, there are three distinct font files available for download:
| Font File | Module Dimensions | Maximum Character Capacity |
|---|---|---|
qrfont-1L.ttf | 17 characters | |
qrfont-2L.ttf | 32 characters | |
qrfont-3L.ttf | 53 characters |
🛠️ How It Works
The font is designed to identify text wrapped in brackets and render that specific segment as a QR code, while leaving the surrounding text as standard, readable characters.
Example Input: abc[hello]ghi
Result: The characters abc and ghi appear normally, but [hello] is rendered as a QR code symbol.
Technical Specifications
- Input Type: Printable ASCII.
- Encoding Mode: Byte mode.
- Masking: Uses a fixed mask pattern 0.
- Delimiters:
[and]are used to trigger the QR generation. - Creation Method: These fonts are
hand-authoredprogrammatically generated.
The Generation Pipeline
The build process utilizes a script to create glyph outlines and GSUB (Glyph Substitution) feature logic.
🏗️ Build Instructions
The project leverages uv for managing Python dependencies.
Installation & Compilation
To build the font, you can use the following methods:
- Standard Build: Run
make - Direct Python Execution:
uv run tools/build_font.py
[!NOTE] By default, the generator looks for the base font at:
/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf
If you wish to use a different TrueType source, use the --base-font flag:
uv run tools/build_font.py --base-font /path/to/BaseFont-Regular.ttf
Build Variants
Depending on your needs, you can choose between two build paths:
- Full Parity:
make full-parity- Detail: Generates thousands of contextual lookups.
- Performance: Takes significantly longer to compile.
- Fast Placeholder:
make fast-placeholder- Detail: Uses placeholder zero parity for rapid layout testing.
Debugging
To analyze the shaped glyph stream, execute:
uv run tools/shape_debug.py ' [a] ' ' [b] '
📤 Project Outputs
Upon a successful build, the following files are generated in the dist/ and build/ directories:
dist/qrfont-*.ttf: The actual font files (1-L, 2-L, 3-L).dist/index.html: An interactive web-based demonstration.build/qrfont-*.fea: The OpenType feature files.
⚖️ Licensing & Requirements
The resulting fonts are considered a Modified Version of Liberation Sans Regular. Consequently, they are licensed under the SIL Open Font License, Version 1.1.
Critical Requirements:
- Shaping Engine: Because the font relies heavily on OpenType shaping, it must be used in an environment that supports GSUB features.
- Constraints: Input within the QR blocks is strictly limited to printable ASCII and the character limits defined in the version table above.