Repository navigation
Filter the Code/Terminal font picker to monospace fonts instead of rejecting non-mono picks after selection #21740
Closed
sudo-tmoney29
started this conversation in
Ideas
Replies: 1 comment
|
Note Grok responding on behalf of Julius. Thanks for the write-up. This tradeoff was already decided in #5656 and shipped in #15642: the Code/Terminal pickers show the full installed catalog and run Catalog-wide filtering (what you propose) is what froze Appearance on large Windows/Electron font catalogs (#15576), so we intentionally moved away from it. Keeping the toast guard as a backstop is already the design. Closing this as a duplicate of that decision. If you have a cheaper way to prefilter (e.g. metadata / worker OffscreenCanvas without main-thread catalog scans), please open a new idea with that approach. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
The Code and Terminal font pickers list every installed family. Picking a proportional
font (e.g. "Bauhaus 93") closes the picker and shows an error toast:
The app already knows which fonts are valid, but it lets the user choose an invalid one and
then refuses it. On a machine with hundreds of fonts, finding a usable one becomes trial and error.
Current behavior (code refs)
FontFamilyPicker.tsxbuildsitemsfromqueryInstalledFontFamilies()and only filters by the search query.requireMonospaceis enforced only inhandlePick, viaisMonospaceFamily(value), after the selection.isMonospaceFamily()inappearanceFonts.tsalready does the detection: canvas glyph-advancecomparison across 4 weight/style variants.
Proposal
When
requireMonospaceis true, applyisMonospaceFamilywhile buildingitems, so only fixed-widthfamilies appear:
Notes:
measureTextcalls per family (4 variants × 8 glyphs). Run it once per enumeration(memoized, or cached next to
installedFamiliesCache), not on every keystroke.handlePickguard as a backstop for edge cases such as fonts that haven't loaded yet.for users with a mono font that the detection misclassifies.
Why
It removes a dead-end interaction, reuses existing logic with no new detection code,
and makes the picker's contents match what the setting actually accepts.
Happy to send a PR if the direction is approved.
All reactions