Skip to content

sgmonda/sergamon

Repository files navigation


Sergamon

Pixel-perfect monospaced font for code. No ligatures. No surprises.

License: OFL-1.1 Build Glyphs Node

WebsiteDownloadContributing


Sergamon preview — JavaScript code sample

Why Sergamon?

Most programming fonts chase the same goals: ligatures, multiple weights, smooth curves. Sergamon goes the opposite direction.

Every glyph is hand-crafted on an 8x16 pixel grid — the same constraints as a classic hardware terminal. The result is a font that is sharp, predictable, and honest:

  • == is two equal signs. -> is a hyphen and a greater-than. No ligatures, no magic substitutions — your source code looks exactly as you typed it.
  • One weight. No bold, no light, no italic. Like a real terminal, every character has the same stroke.
  • Confusables are distinct. 0/O/o, 1/l/I, `/'/" — each pair is carefully designed to be unambiguous at a glance.
  • Massive coverage. 4,000+ glyphs spanning Latin, Cyrillic, Greek, Hebrew, Arabic, Thai, Devanagari, Georgian, Armenian, box-drawing, braille, math operators, and more.
  • Invisible character indicators. 420+ normally-invisible Unicode characters used in cyberattacks (Trojan Source, prompt injection, phishing evasion) are rendered as small, distinctive indicator glyphs instead of blank space. Learn more.

Quick Install

Download the latest Sergamon.ttf (desktop) or Sergamon.woff2 (web) from the Releases page.

macOS
  1. Double-click Sergamon.ttf and click Install Font in Font Book.

Updating? macOS caches font metadata aggressively. Remove the old font first, then:

sudo atsutil databases -remove
sudo killall fontd
Windows

Right-click Sergamon.ttf and select Install (or Install for all users).

Linux
cp Sergamon.ttf ~/.local/share/fonts/
fc-cache -fv

Editor & Terminal Setup

VS Code
{
  "editor.fontFamily": "'Sergamon', monospace",
  "editor.fontSize": 16,
  "editor.letterSpacing": 0
}
JetBrains IDEs (IntelliJ, WebStorm, PyCharm, etc.)

Settings > Editor > Font — set Font to Sergamon, Size to 16.

Sublime Text
{
  "font_face": "Sergamon",
  "font_size": 16
}
Vim / Neovim (GUI)
set guifont=Sergamon:h16
iTerm2

Preferences > Profiles > Text — set Font to Sergamon, Size to 16. Disable Use bold fonts and Draw bold text in bright colors for best results.

Windows Terminal
{
  "profiles": {
    "defaults": {
      "font": {
        "face": "Sergamon",
        "size": 16
      }
    }
  }
}
Alacritty
[font]
size = 16.0

[font.normal]
family = "Sergamon"

Web Usage

@font-face {
  font-family: 'Sergamon';
  src: url('/fonts/Sergamon.woff2') format('woff2'),
       url('/fonts/Sergamon.ttf') format('truetype');
  font-display: swap;
}

code, pre {
  font-family: 'Sergamon', monospace;
}

Or load directly from the project site:

@font-face {
  font-family: 'Sergamon';
  src: url('https://sgmonda.com/sergamon/fonts/Sergamon.woff2') format('woff2');
  font-display: swap;
}

How It Works

Sergamon treats glyph definitions as source code. Each character lives in a plain-text .glyph file — an 8x16 pixel grid that a TypeScript pipeline compiles into vector font files.

# zero (U+0030)

........   . = empty pixel
........   X = filled pixel
........   8 columns wide
.XXXXX..  16 rows tall
XX...XX.
XX...XX.
XX..XXX.
XX.XXXX.
XXXX.XX.
XXX..XX.
XX...XX.
XX...XX.
.XXXXX..
........
........
........
.glyph files ──> parse ──> validate ──> optimize ──> vectorize ──> TTF ──> WOFF2

The optimizer merges adjacent filled pixels into larger rectangles before converting to vector paths, keeping the output compact and efficient.

Invisible Character Indicators

Unicode contains hundreds of characters that produce no visible output — zero-width spaces, bidirectional overrides, variation selectors, tag characters. Attackers exploit them because humans can't see what the compiler processes.

Sergamon makes these characters visible with small, category-specific indicator glyphs:

Category Codepoints Indicator Threat
BiDi overrides U+202A–U+202E, U+2066–U+2069 Directional arrow + letter Trojan Source (CVE-2021-42574)
Zero-width U+200B, U+200C, U+200D, U+FEFF, U+2060 Category symbol in dotted frame Zero-width payload encoding
Tags Block U+E0000–U+E007F Tag brackets + miniature ASCII LLM prompt injection
Variation Selectors U+FE00–U+FE0F, U+E0100–U+E01EF "V" + hex index Glassworm (2025)
Hangul fillers U+3164, U+FFA0 "HF" indicator Tycoon 2FA phishing
Invisible math U+2061–U+2064 Math symbol in thin frame Formula obfuscation
Soft hyphen U+00AD Dotted line Email filter evasion

For the full security rationale, linked CVEs, and attack descriptions, see the wiki page.

Contributing

Contributions are welcome — whether refining an existing glyph, adding a new character, or improving the build pipeline. See CONTRIBUTING.md for everything you need: file format, style guidelines, testing workflow, and PR process.

License

Font files and glyph sourcesSIL Open Font License 1.1 Build scripts and site code — MIT License