Repository navigation
Add experimental grayscale terminal font smoothing on macOS - #335625
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The platform-gated configuration contract is inaccurate, and detached forwarding is not actually covered by the new test.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/vs/workbench/contrib/terminal/common/terminal.ts — Model the excluded setting as optional |
|
src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts — Exercise detached configuration forwarding |
What changed in this PR
Adds an opt-in crisp font-rendering mode for macOS terminals while preserving existing defaults.
Changes:
- Registers
terminal.integrated.fontRendering. - Applies smoothing consistently to standard, detached, and sticky-scroll terminals.
- Refreshes glyph caches and adds targeted tests.
| File | Description |
|---|---|
terminalStickyScrollOverlay.ts |
Applies rendering policy to sticky scroll. |
xtermTerminal.test.ts |
Tests rendering configuration behavior. |
terminalConfiguration.ts |
Registers the setting. |
terminal.ts (workbench) |
Adds the configuration property. |
xtermTerminal.ts |
Applies rendering during attachment and updates. |
terminalFontRendering.ts |
Implements class updates and atlas refresh. |
terminalFontRendering.css |
Defines HiDPI smoothing behavior. |
terminal.ts (platform) |
Adds the setting identifier. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]> Copilot-Session: 10172ed2-6839-4f48-a62c-ffd95f85c86e
|
Update (39b262f): The PR now follows the recommendation below. It is scoped to macOS and uses The implementation is cross-platform, but the sharpness benefit is not established across platforms. I compared the pre-PR build with PR head on Windows: Cascadia Mono 16px, 150% display scaling, WebGL enabled, images disabled, and matching content/theme. The setting works mechanically: Additional pixel-alignment and Canvas text-rendering experiments did not improve the sampled output. This is not evidence that Windows cannot improve; it means this PR has not demonstrated that improvement. Recommendation: preserve the observed macOS benefit, keep If the intended feature is specifically "sharper terminal text," I would not extend that claim to Windows based on the current evidence. (generated by copilot) |
Only offer terminal.integrated.fontRendering on macOS and rename the opt-in value from crisp to grayscale, since it changes antialiasing rather than making text universally sharper. Stop coupling the setting to terminal transparency, so images remain the only thing that enables it, and document that the WebGL renderer currently only picks the policy up after a window reload with open terminals.
|
Comparison of terminals restored by Developer: Reload Window, with The same full effect appears in a terminal opened while another one is open. With the WebGL renderer, terminals that were already open when the setting changed don't change, and the first terminal in a window only partly picks it up. See the description for the measured cases. |



Part of: #337208
terminal.integrated.fontRenderingsetting on macOS, withinherit(default, unchanged) andgrayscale.grayscaleas terminal-scoped-webkit-font-smoothing: antialiasedon high-DPI displays only, leaving the editor, workbench, terminal font, and theme colors unchanged.terminal.integrated.enableImages; hide the setting and model it as optional outside macOS.Context
crispwas renamedgrayscaleto describe the antialiasing mode it applies.Known limitation
With GPU acceleration,
grayscaleis not yet applied consistently. Measured in Code OSS on macOS at DPR 2, with WebGL confirmed and identical Menlo 13 content; each case was run twice:The setting description points to Developer: Reload Window for this reason. Here is the reload comparison:
Next steps
clearTextureAtlasreplaces glyph bitmaps but not the cached Canvas2D font state. Atlases are also shared by a configuration that excludes font smoothing. A fix could establish the raster policy before warm-up, invalidate font state when it changes, and keep atlases with different policies separate. xtermjs/xterm.js#2464 closed general antialiasing configuration as out of scope, so the scope is worth discussing with maintainers first.Validation
Run against the same change applied to
e550b8b959b1, whose dependencies match the local install:npm run test-browser-no-install -- --run src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts --browser chromium: 25 passing.npm run typecheck-client, ESLint for the changed TypeScript files,npm run stylelint -- src/vs/workbench/contrib/terminal/browser/xterm/terminalFontRendering.css, andgit diff --check.Manual review cases
grayscale, then open another terminal while one is open, or run Developer: Reload Window. Text should look sharper; font, size, spacing, and colors should not change.inherit.terminal.integrated.enableImagesand confirm images and transparency work in both modes.Inspirations from:
workbench.fontAliasingCSS.workbench.fontAliasing'sincluded: isMacintosh.terminal.integrated.enableWin32InputMode, without opting into automatic experiment overrides.clearTextureAtlasmatchesXtermTerminal.forceRedraw.TerminalService._ensureDetachedTerminalListeners.