Skip to content

Use OpenMono for monospace text - #184

Merged
Tarquinen merged 4 commits into
devfrom
openmono-font
Nov 21, 2026
Merged

Tarquinen merged 4 commits into
devfrom
openmono-font

Conversation

@iamdavidhill

@iamdavidhill iamdavidhill commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The app now ships one open mono family, OpenMono (SIL OFL 1.1), in place of two.

Before

  • core/src/main/res/font held IBM Plex Mono (Regular, Medium, SemiBold) for code, tool output, shell output, commands and paths, and Berkeley Mono (variable) for the Onboarding Playground's "opencode" mark, onboarding's website mock and two design gallery specimens.
  • devtools used the system FontFamily.Monospace.
  • All of it goes through OpenCodeFonts in OpenCodeTypography.kt.
  • The font licence texts were in docs/licenses/, which no build packages, so the APK had fonts without their licences. There is no in-app licences screen.

What changed

  • OpenCodeFonts.monospace is OpenMono. OpenCodeFonts.berkeleyMono is gone; its uses and the devtools uses point at monospace.
  • Fonts: two static files, Regular and Bold, from the final OpenMono 1.000 build (build 2026-11-19). They are a text subset (Latin including Vietnamese, Greek, Cyrillic, Armenian, punctuation, arrows, math operators, box drawing, block elements, geometric shapes and status symbols such as ✓ ✗ ⚠, plus a few private-use Powerline separators), without the Nerd Fonts icon set. They have no programming ligatures (no calt or ligature features; composition substitutions remain), so code shows as typed.
  • Regular and Bold only: each file is about 1.1 MB as TTF, so the two italics would have added about 700 KB more to the APK.
  • Italic: italic code is rare (only Markdown emphasis on inline code; syntax highlighting is colour only), so the system slants Regular and Bold, as it did with the old code font, which had no italic file either.
  • Weights: the family declares Regular for Normal and Medium, and Bold for SemiBold and Bold, so no weight is synthesized. Medium mono text (server host, skill names) draws as Regular; SemiBold (shell sheet title, inline code in headings) draws as Bold.
  • Sizes, weights and line heights in the code are unchanged. The cell is 0.6 em, as in both removed fonts, so characters that the old and the new font both have keep their width.
  • Licences: core/src/main/assets/licenses/OpenMono-OFL.txt and Inter-OFL.txt (moved from docs/licenses/, one copy each) are packaged in every APK as assets/licenses/, the way the Mermaid renderer's licence already ships. The Plex licence text is removed with its fonts.
  • AGENTS.md and docs/parity (core-ui, app) describe the new font.

Size

Uncompressed In the APK
Before: berkeley_mono.ttf 470,964, plex_mono_regular.ttf 135,580, plex_mono_medium.ttf 136,704, plex_mono_semibold.ttf 140,216 883,464 383,753
After: openmono_regular.ttf 1,126,148, openmono_bold.ttf 1,109,980 2,236,128 614,817

The CI debug APK is 143,652,303 bytes with this change and 143,417,287 bytes on dev at the same base: 235,016 bytes more (231,064 for the fonts, about 4 KB for the two licence texts).

Known limits

  • Italic is a slant. There is no italic file, so italic and bold italic inline code are the upright faces slanted by Android, as before this change.
  • Two weights. Medium now looks like Regular and SemiBold like Bold.
  • Missing characters fall back. Every text character of the old code font is in the new one, and 2,626 more. Braille (spinner frames), CJK and emoji are still not in the mono font; Android draws those from a system font, per glyph or cluster. Their width can differ from the 0.6 em cell and they can change a row's height, so columns in shell output and tool rows are not guaranteed to line up on such lines. This is unchanged.
  • Natural line height differs where the code sets no line height: OpenMono is 1.25 em (hhea 965/−220/65, typo 965/−285/0); the old code font was 1.30 em (1025/−275/0) and the old brand font 1.20 em (956/−244/0). No app code sets includeFontPadding.

Refreshing the fonts

uvx --from 'fonttools[woff]==4.68.0' python scripts/update-openmono.py <OpenMono app build folder>

It converts the build's Regular and Bold text-subset WOFF2 files to TTF and copies the licence. Everything is converted, checked and read before any file in the checkout is replaced, so a failed run changes nothing. Each font must be static and upright with the declared weight, have a 0.6 em cell (zero width only for marks, format, separator and private-use characters, and the Armenian abbreviation mark), have ASCII, box drawing, block elements and ✓ ✗ ⚠, have no ligature features, and have only a few private-use characters. The same input gives the same bytes.

Testing

Not built or run locally, and not yet seen on a device. No images or video yet for that reason; AGENTS.md asks for them on visual changes, so they need to come from a device before this leaves draft.

What was checked:

  • CI's check job (scripts/check.sh: translations, assemble, lint, unit tests) passes on every commit.
  • The CI debug APK contains assets/licenses/OpenMono-OFL.txt and assets/licenses/Inter-OFL.txt and the two fonts, all identical to the checkout, and no other mono font.
  • Read from the Compose source the app uses (ui-text 1.12.1): the four declared weights match exactly, so no weight is synthesized, and no mono text asks for weight 800 or 900. An italic request finds no italic entry, takes the upright font of that weight from the same family, and with the default FontSynthesis.All asks Android for an italic of that typeface, which slants it. No call site sets fontSynthesis.
  • Every former call site is migrated, and no reference to a removed resource remains.
  • The refresh script, run on the final build, writes the same bytes twice; run on copies of a build with a font missing, the licence missing, a truncated font, a font of the wrong weight, an italic file, or a font with the icon set, it stops and leaves the checkout unchanged.

Installable build for the tester: each CI run on this PR uploads a debug APK. Open the PR's Checks tab, then CI, then Artifacts, and download opencode-android-<commit> (kept 30 days; you must be signed in to GitHub), or run gh run download <run id> -R anomalyco/opencode-android. Install it with adb install -r. It is the .debug app, so it installs beside the Play build.

What a tester should look at

In light and dark, at the default and an accessibility font size:

  • Code text (was the old code font): code blocks, inline code (bold, in a heading), tool output, shell output, permission requests.

  • Italic inline code is slanted: emphasised inline code in a message (*`code`* and ***`code`***) shows slanted, in the mono font: not upright and not in another font.

  • Brand-like places: the "opencode" word on the Onboarding playground (Settings › Developer › Playgrounds › Onboarding), the small picture of the website in onboarding, the design gallery samples.

  • A mixed line in shell output and in a tool row, for column alignment and row height:

    └── π ẞ ✓ ⠋ 漢 😀
    

Layout checklist

Natural line height (no line height set in code):

  • The 44 sp "opencode" marks: OnboardingPlaygroundView.kt:362, DesignSystemGallery.kt:185.
  • The website miniature's nav, subhead, tabs, command, button labels and address pill: WelcomeBrowser.kt:45-46, 80-171, 285-293. Check this fixed-height miniature with a non-English language and a larger font scale too.
  • The desktop miniature's command in its 24 dp row: WelcomeDesktop.kt:204, 229.

Explicit line height, but constrained or baseline-sensitive:

  • Transcript headings, code blocks and tool rows: MarkdownStyle.kt:79-84, 116-118; ToolRows.kt:357-375, 497.
  • The numbered file preview and its gutter: AgentCodeView.kt:70, 119-129.
  • The connection host beside its route: ConnectionCard.kt:357-375.
  • Server Details skill names in their 35 dp tile: ServerDetailsView.kt:321-330.
  • Shell Output (ShellOutputView.kt:405), permission requests, and the Developer screens.

The app now ships one open mono family, OpenMono, in place of two.
OpenCodeFonts.monospace is OpenMono (SIL OFL 1.1), from the OpenMono
1.000 app build without ligatures: text-only files, so every text
character, box drawing and the status symbols, and none of the Nerd
Fonts icons.

OpenMono has Regular, Bold and their italics. The family declares
Regular for Normal and Medium and Bold for SemiBold and Bold, each with
its italic, so no weight or slant is synthesized. Medium mono text
(server host, skill names) now draws as Regular, SemiBold (shell sheet
title, inline code in headings) as Bold, and emphasised inline code
gets a real italic.

Replaced: IBM Plex Mono everywhere OpenCodeFonts.monospace is used;
OpenCodeFonts.berkeleyMono (removed) in the Onboarding Playground's
"opencode" mark, onboarding's website mock and the design gallery's
two specimens; and the system FontFamily.Monospace in devtools.
Removed berkeley_mono.ttf, the three plex_mono_*.ttf files and the
Plex licence text; added four openmono_*.ttf files (2,072,716 bytes
in, 883,464 out) and docs/licenses/OpenMono-OFL.txt. Sizes, weights
and line heights are unchanged; all three families have the same
character width.

scripts/update-openmono.py refreshes the fonts and the licence from an
OpenMono app build and checks each file's weight, italic flags, cell
width and lack of ligatures. AGENTS.md and docs/parity (core-ui, app)
describe the new font.

Verified: no reference to the removed resources, berkeleyMono or
FontFamily.Monospace remains; resource names are valid; the script
gives the same bytes on a second run. Not built or run: no Android
toolchain on this machine.
…r-nothing

The OFL asks that each copy of a font carries its copyright notice and
licence. The texts were in docs/licenses/, which no build packages, so
the APK had the fonts without them. They now live in
core/src/main/assets/licenses/ (OpenMono-OFL.txt, Inter-OFL.txt) and
every APK carries them as assets/licenses/, the way the Mermaid
renderer's licence already ships beside it. One copy each; docs/licenses
is gone. Inter's text was missing from the APK in the same way before
this branch, so it moves too.

scripts/update-openmono.py now converts and checks all four fonts and
reads the licence before it replaces anything, then moves the staged
files into place, so a failed refresh leaves the checkout as it was. It
checks the bytes it will write as well as the input, needs fontTools
4.68.0 so the output is reproducible, and checks more: static fonts, a
0.6 em cell, zero width only for marks, format, separator and
private-use characters, a required character set (ASCII, box drawing,
block elements, ✓ ✗ ⚠), no ligature features, and few private-use
characters in place of the glyph-count limit. Its text now says "text
subset" and "no programming ligatures".

Verified: the script on the released build rewrites byte-identical
files; on copies of the build with a font missing, the licence missing,
a truncated font, a font of the wrong weight and a font with the icon
set, it exits 1 and the checkout is unchanged. Not built locally; CI
builds it and the APK artifact is checked for the two licence files.
The fonts now come from the final OpenMono 1.000 build (build
2026-11-19), which adds Greek, Vietnamese, Armenian and more. Each
text-subset file is about 1.1 MB as TTF, so four styles would cost the
APK far more than the fonts they replace. The app ships Regular and Bold
only: openmono_italic.ttf and openmono_bold_italic.ttf are removed and
OpenCodeFonts.monospace declares the upright faces alone (Regular for
Normal and Medium, Bold for SemiBold and Bold).

Italic mono text (emphasised inline code in Markdown) is slanted by the
system from the upright face, as it was with the old code font, which
had no italic either. Compose 1.12.1 finds no italic entry, matches the
upright font of the requested weight in the same family, and with the
default FontSynthesis.All asks Android for an italic of that typeface;
no call site sets fontSynthesis.

scripts/update-openmono.py converts Regular and Bold only and rejects an
italic file. It allows U+055F (Armenian abbreviation mark) to be
zero-width: the final build draws it above the letter before it. The
licence text is refreshed from the build (its first copyright line
changed).

Fonts now: openmono_regular.ttf 1,126,148 bytes and openmono_bold.ttf
1,109,980 bytes (2,236,128; was 883,464 for the four removed files).

Verified: the script on the final build writes the same bytes twice; on
copies of the build with Bold missing and with an italic file in Bold's
place it exits 1 and changes nothing; no reference to a removed
resource remains. Not built locally; CI builds it.
@Tarquinen

Copy link
Copy Markdown
Member

Tested 05a1569 on the Android VM emulator (Pixel 8, API 36), against dev at its base (d31496a). All transcript content is from the session-lab fixture.

Check: scripts/check.sh (all modules) passed: BUILD SUCCESSFUL, exit 0.

APK: assets/licenses/OpenMono-OFL.txt and Inter-OFL.txt are in the built debug APK. res/font holds only inter.ttf, openmono_regular.ttf and openmono_bold.ttf, with no Berkeley Mono or Plex.

What I checked, light and dark: code blocks with highlighting, inline code (plain, bold, italic, in a heading), tool output, the permission command, the onboarding playground's "opencode" mark, the website miniature in the Welcome animation, Server Details' address, Developer › Troubleshooting (devtools mono), and font scale 1.3. I also checked a glyph line: Greek, letterlike, arrows, ✓ ✗ ⚠, box drawing, => != -> <= >= === |>, iIl1| oO0, a table, plus braille, CJK and emoji.

Result: it works. Line heights, row heights and wrapping match dev everywhere I looked. Code lines wrap and clip at the same characters, and box-drawing and 12 KB/3 KB columns line up. Bold is the real bold face, and italic inline code is slanted. No tofu: Greek, letterlike symbols and arrows come from OpenMono, and braille, CJK and emoji fall back cleanly without changing line spacing in a code block. There are no ligatures. The "opencode" mark and the website miniature are nearly indistinguishable from Berkeley Mono.

Small things:

  • OpenMono's ✗ (U+2717) looks almost exactly like a capital X at code size (first image, listOf("✓", "✗", "⚠")). With Plex it fell back to a distinct cross. Its ⚠ is also much smaller than the fallback was.
  • The PR adds about 235 KB to the debug APK (fonts 883 KB → 2.24 MB uncompressed), as the description says.

Not tested: the design system gallery (Compose preview only, not reachable in the app), diffs, the mixed glyph line inside shell output or a tool row (the lab has no way to inject it there), bold italic, Server Details skill tiles, the connection card, the numbered file preview, and a non-English language.

Code, inline code and glyphs, light
Code, inline code and glyphs, dark
Tool output, dark
Onboarding playground mark and the Welcome website miniature
Font scale 1.3
Developer › Troubleshooting

@iamdavidhill
iamdavidhill marked this pull request as ready for review November 21, 2026 04:01
@Tarquinen

Copy link
Copy Markdown
Member

Repeated the earlier emulator check on c8b8117 (after the merge with dev), same fixture content and same six views; the first two are now against today's dev (c001a08). scripts/check.sh passed (all modules). Nothing changed from the earlier comment: same line heights, wrapping and clipping, no tofu, no ligatures, and the same ✗ (looks like X) and small ⚠. Not covered: the same items as last time.

Code, inline code and glyphs, light
Code, inline code and glyphs, dark
Tool output, dark
Onboarding playground mark and the Welcome website miniature
Font scale 1.3
Developer › Troubleshooting

@Tarquinen
Tarquinen merged commit 71c09d3 into dev Nov 21, 2026
2 checks passed
@Tarquinen
Tarquinen deleted the openmono-font branch November 21, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants