Skip to content

Allow themes to set the terminal font family (#3236) - #3479

Merged
SawyerHood merged 2 commits into
get-bb:mainfrom
0xferrous:fix/terminal-font
Sep 14, 2026
Merged

SawyerHood merged 2 commits into
get-bb:mainfrom
0xferrous:fix/terminal-font

Conversation

@0xferrous

@0xferrous 0xferrous commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

The integrated terminal always used a fixed font stack, so themes could change terminal colors but not the terminal font family. See #3236. Fonts loaded through a delayed CSS import can arrive after the initial document.fonts.ready promise resolves, and shared WebGL glyph caches can retain fallback glyphs when font loading leaves cell dimensions unchanged.

What changed

Added --font-terminal with the existing terminal font stack as its default. The terminal reads it at construction and applies active-theme changes. A listener retained for each mounted terminal handles subsequent font loads, remeasures character cells, clears xterm's glyph atlas, and schedules a refit. Cleanup removes the listener and prevents pending callbacks from refreshing a disposed terminal. Updated theming and configuration documentation.

How you verified

  • Focused terminal and theme tests through Turbo: 61 passed, including delayed loading and listener cleanup regressions.
  • App typecheck and lint through Turbo passed; lint reported 0 errors.
  • Chromium harness using the PR's xterm versions reproduced both font-loading failures before the fix and passed with the updated functions: delayed imports update cell measurements, and two WebGL terminals sharing an atlas redraw loaded-font glyphs.
  • Browser verification covered the focused xterm harness; the full BB UI was not exercised.

Fixes #3236

AGENT GENERATED

## Human comments

## What was wrong

The integrated terminal always used a fixed font stack, so themes could
change terminal colors but not the terminal font family. See
[get-bb#3236](get-bb#3236).

## What changed

Added `--font-terminal` with the existing terminal font stack as its
default. The terminal reads it at construction and applies changes when
the active theme changes, then refits after font updates or async font
loading. The async font path forces xterm to remeasure its character
cells and refresh its rows. Added tests and updated theming and
configuration documentation.

## How you verified

- Focused terminal tests: 28 passed
- Theme tests: 30 passed
- App typecheck passed
- App lint passed with 0 errors
- Production build passed
- Live UI verification was unavailable because `dev-browser` could not
  run in the restricted environment

Fixes get-bb#3236

> AGENT GENERATED
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @0xferrous for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval.

@github-actions github-actions Bot closed this Sep 11, 2026
@0xferrous

0xferrous commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

i've tested it against local build, it worked

AI Disclosure: I don't have much experience with frontend development, but I got gpt sol to review it and the changes from my perspective look fine, only thing I am less experienced to check is the xterm forced font measurement and fitting. I did however built the code and test it to verify that the terminal font customization applies.

@SawyerHood SawyerHood reopened this Sep 14, 2026
@SawyerHood
SawyerHood merged commit cad3bff into get-bb:main Sep 14, 2026
14 checks passed
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.

feat(terminal): allow themes to set the terminal font family

2 participants