Repository navigation
fix(fonts): list Windows fonts through Chromium instead of PowerShell and surface failures - #37369
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
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. |
nwparker
force-pushed
the
nwparker/fix-windows-font-enumeration
branch
from
November 2, 2026 06:38
b813d1d to
ccdcf41
Compare
…Shell Read the registered font files' name/fvar/STAT tables so a Group Policy block on PowerShell no longer collapses the picker to five fonts, and say so in the picker when the OS list is unreadable.
…nstead of a custom sfnt parser
…he web client quiet
nwparker
force-pushed
the
nwparker/fix-windows-font-enumeration
branch
from
November 2, 2026 06:53
8eacf61 to
76e2c82
Compare
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Windows the font picker got its list from a PowerShell
System.Drawing.InstalledFontCollectionscript run by main. When Group Policy blocks Windows PowerShell, which is common on managed machines, the spawn fails. Main then substituted five hard-coded fonts, two of which usually aren't installed, and the picker showed no sign that anything had gone wrong.Root cause: the Windows font list depended on a child process succeeding, and every failure was replaced with a fallback list that looked real. #15746 made the spawn use an absolute path, which fixed the PATH half of the problem but not the policy block.
Fix
window.queryLocalFonts()(installed-font-list.ts). There's no subprocess, no registry read and no font parsing in Orca. Main grantslocal-fontsin the main-window session's permission check handler, for the main window's main frame only, so there's no prompt and no user gesture.SecurityError.local-fonts, so nothing can prompt.queryLocalFontsthrows or returns nothing, the renderer falls back to the existing IPC. That is PowerShell on Windows, and the unchangedsystem_profiler/fc-listpath on macOS/Linux.listSystemFontFamilies()logs the error and returns[]instead of a fake list. That fallback list was a copy of the renderer'sgetFallbackTerminalFonts(), which already seeds the suggestions, so it was deleted. When no list arrives, everyFontAutocompleteshows a footer under the curated suggestions: "Couldn't list installed fonts. Type any installed font name to use it." Free-text entry was already accepted; the footer just says so. The flag clears again after a later success, and it is never shown on the web client, where browsers can't list fonts at all.Closes #11771
Builds on earlier community attempts: #11785 by @umi008 (prefer
pwsh, log failures) and #12595 by @dpfwpfahs1-coder (UTF-8 decoding of localized names). With Chromium as the primary source, neither the PowerShell resolution path nor its console encoding is on the common path any more.Why
queryLocalFontsinstead of a native font parserThe first version of this PR read the registered font files'
name/fvar/STATtables in main. It worked: 181 families in 24 ms. But that is a hand-written binary parser that has to stay correct against arbitrary font files. Measured on the same Windows machine:queryLocalFonts()(this PR)* Resolvable means a canvas in Electron 43 renders the name with a different font than the generic fallback. GDI's list includes about 23 weight-named or truncated families, such as "Segoe UI Semilight" and "Bahnschrift SemiLight SemiConde", that Chromium cannot resolve.
** The remaining one is HYZhongHei, a CJK-only font; this check can't detect it because it measures Latin text.
queryLocalFontsreturns typographic families ("Segoe UI", "Cascadia Code", "Noto Sans JP"). That matches CSS's family-plus-weight model, Orca's separate terminal font-weight settings, and what macOS already shows. Chromium maintains it, so this PR adds no parser code.Visual proof
Real Windows 11 (awin-lan),
electron-vitebuild. To simulate a Group Policy block, the PowerShell path in the@orca/process-hostdist was pointed at a missing executable, so the spawn fails just as a policy block makes it fail.Before (origin/main, PowerShell blocked): 5 hard-coded fonts, no sign of failure.

After (PowerShell blocked): full installed list from

queryLocalFonts.After, every source failing (dark):

local-fontsgrant disabled and PowerShell blocked. Curated list plus the footer.Validation
Windows (Windows 11 10.0.26200, awin-lan; isolated HOME/APPDATA/LOCALAPPDATA/user-data; CDP over a tunnel):
queryLocalFontslocal-fontsdenied and PowerShell blockedSecurityError: ... "local-fonts" is disallowed by Permissions Policy.ORCA_BACKGROUND_LAUNCH=1, CDP 9363): the picker still usessystem_profilerIPC, 257 families as on main. The picker renders normally in light and dark.pnpm test src/main/system-fonts.test.ts src/main/window src/renderer/src/components/settings(1885 passed),pnpm tc:node,pnpm tc:web,oxlint,pnpm format,pnpm sync:localization-catalog.queryLocalFontsversion. Fixed from that review: the grant is limited to the main window's webContents, and the web client doesn't show the footer.Perf
Scanned with the perf-scan skill:
queryLocalFontsenumeration runs in Chromium's browser process and is async to the renderer; the renderer only dedupes and sorts about 300 strings.No findings.
Merge risk: Low
100/−60 lines. It adds no parser and no new native or IPC surface.string[]), and main and renderer ship together.Negative user-facing tradeoffs
queryLocalFontsreturns English family names whereInstalledFontCollectionreturned localized ones ("Malgun Gothic" vs "맑은 고딕"). Both resolve, and saved localized names keep working.system_profiler/fc-listfails, the picker shows the footer where it used to show the same curated list silently.queryLocalFontsreturned the same 257 families in about 3 s versus about 9.6 s forsystem_profiler. Switching macOS/Linux is out of scope because this PR keeps their behaviour unchanged.