Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep terminal font settings reliable #5397

MergedStiensWout(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/5397/headmerged by juliusmarminge View on GitHub

Problem

The typography controls could leave the terminal in two incorrect font states:

  • Advanced mode still inherited an unset terminal family from the code-font preference, so changing Code changed active terminals.
  • Custom terminal faces were checked before their styles loaded. A proportional face could pass through the monospace fallback, then render against a fixed cell grid after loading, leaving glyphs behind the cursor and link underline.

Fix

  • inherit the code family only in simple typography mode; Advanced uses the terminal preference or terminal default
  • load every style the canvas renderer can request before accepting a custom terminal family
  • validate regular, bold, italic, and bold-italic advances across representative glyphs, including the space glyph
  • repeat fixed-width validation when later font-loading events arrive
  • keep terminal previews and default labels aligned with runtime resolution
  • cover simple/Advanced preference resolution, fixed advances, and post-load rejection with regression tests

Validation

  • full GitHub Actions test suite
  • vp run --filter @t3tools/web typecheck
  • targeted vp lint --report-unused-disable-directives on changed files
  • targeted vp fmt and git diff --check
  • direct Node runtime assertion for strict advance validation

Follow-up to #5103.

Generated with GPT-5.6 Sol in the Codex harness.


Note

Medium Risk Touches terminal rendering metrics and font validation timing; some fonts that passed the old two-glyph check may now be rejected or fall back after load.

Overview Fixes terminal typography so Advanced mode no longer ties an empty terminal font to the code font (code changes no longer move the live terminal), while simple mode still inherits the monospace preference for the terminal.

The Ghostty canvas path now preloads normal/bold/italic variants before accepting a custom face, and tightens monospace checks via areFontAdvancesMonospace across multiple glyphs and styles (not just i vs M). Late fonts.loadingdone events re-run validation and can fall back if a proportional face loads after an earlier pass.

Settings previews and the terminal drawer share resolveTerminalFontPreference and TYPOGRAPHY_ADVANCED_STORAGE_KEY so UI matches runtime behavior.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6d25c324422a9fb6376e7a396ce5cc7b1c9b363b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix terminal font settings to load style variants before measuring and applying fonts

  • Introduces loadTerminalFontFamily in surface.ts to await all relevant font style variants before validating and applying a terminal font, replacing direct document.fonts.load calls.
  • GhosttyTerminalSurface.setFont now uses an epoch counter to let the newest font request win, avoiding race conditions from overlapping async loads.
  • Adds resolveTerminalFontPreference to appearanceFonts.ts: in simple mode the terminal inherits the code font; in advanced mode it uses the terminal font setting independently.
  • Adds areFontAdvancesMonospace as a reusable tolerance-based monospace check that fails open when canvas metrics are unavailable; isMonospaceFamily now checks multiple style variants and rejects a family if any variant measures as proportional.
  • Behavioral Change: initial terminal grid metrics are now measured after font styles finish loading, which may delay first render slightly but improves layout accuracy.
Macroscope summarized 6d25c32.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: bb7faec0-b271-47f5-81fe-6822c8532528

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3838e5334fbef743b71a1ba6e07a73d7b6d5bdc6. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved 6d25c32

      Bug fix for terminal font settings with focused scope: improves font loading validation, fixes advanced/simple typography mode resolution, and enhances monospace detection. Changes are well-tested and the author owns this code area.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this2a04db1

    6. juliusmarminge closed this

Sign in to join this conversation.