The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): preserve mono fallback for Latin Extended code
izumi0uuf955c8534fb7
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.cssindex 2cef8bd884d..b5fb2af9655 100644--- a/apps/desktop/src/styles.css+++ b/apps/desktop/src/styles.css@@ -446,12 +446,16 @@'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', emoji;/* Key caps always use the native UI face — never theme typography overrides. */--dt-font-kbd: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;- /* Menlo/Monaco first — Apple's native monospace faces — so code/diff read- in the system mono on macOS, with SF Mono and bundled Courier Prime as- fallbacks. */+ /* JetBrains Mono first — the face we bundle (@font-face above) and the+ terminal's primary — so code/diff match the terminal on every platform+ instead of drifting to a system Cascadia Code where it's installed. The+ extra Linux mono fallbacks preserve Latin Extended glyphs (#61392:+ Vietnamese and other non-Latin diacritics) as monospace when a theme+ display font does not cover them. */--dt-font-mono:- Menlo, Monaco, 'SF Mono', 'Courier Prime', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',- 'Noto Color Emoji', emoji;+ 'JetBrains Mono', 'Cascadia Code', 'Cascadia Mono', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono',+ 'Noto Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace, 'Apple Color Emoji', 'Segoe UI Emoji',+ 'Segoe UI Symbol', 'Noto Color Emoji', emoji;--dt-base-size: 1rem;--dt-line-height: 1.5;--dt-letter-spacing: 0;diff --git a/apps/desktop/src/themes/presets.test.ts b/apps/desktop/src/themes/presets.test.tsindex a4d4eb54037..bb49db6e343 100644--- a/apps/desktop/src/themes/presets.test.ts+++ b/apps/desktop/src/themes/presets.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'-import { BUILTIN_THEME_LIST, DEFAULT_TYPOGRAPHY } from './presets'+import { BUILTIN_THEME_LIST, DEFAULT_TYPOGRAPHY, nousTheme } from './presets'// #40364: none of the UI text/mono fonts carry emoji glyphs, so every font// stack must end with a color-emoji fallback or emoji render as tofu on@@ -25,3 +25,36 @@ describe('theme typography emoji fallback (#40364)', () => {expect(stack).toMatch(/Apple Color Emoji|Segoe UI Emoji|Noto Color Emoji|(^|,\s*)emoji\b/)})})++describe('theme typography Latin Extended fallback (#61392)', () => {+ const monoStacks: Array<[string, string]> = [+ ['DEFAULT_TYPOGRAPHY.fontMono', DEFAULT_TYPOGRAPHY.fontMono],+ ...BUILTIN_THEME_LIST.map(theme => [+ `${theme.name}.effectiveFontMono`,+ theme.typography?.fontMono ?? nousTheme.typography?.fontMono ?? DEFAULT_TYPOGRAPHY.fontMono+ ] as [string, string])+ ]++ it.each(monoStacks)('%s falls back to bundled JetBrains Mono before generic fonts', (_label, stack) => {+ const jetbrains = stack.indexOf('JetBrains Mono')++ expect(jetbrains).toBeGreaterThanOrEqual(0)++ const genericIndexes = [+ stack.indexOf('ui-monospace'),+ stack.indexOf('monospace'),+ stack.indexOf('Apple Color Emoji'),+ stack.indexOf('Segoe UI Emoji'),+ stack.indexOf('Noto Color Emoji')+ ].filter(index => index >= 0)++ expect(genericIndexes.length).toBeGreaterThan(0)+ expect(jetbrains).toBeLessThan(Math.min(...genericIndexes))+ })++ it('default stack includes common Linux monospace glyph fallbacks', () => {+ expect(DEFAULT_TYPOGRAPHY.fontMono).toContain('DejaVu Sans Mono')+ expect(DEFAULT_TYPOGRAPHY.fontMono).toContain('Liberation Mono')+ expect(DEFAULT_TYPOGRAPHY.fontMono).toContain('Noto Sans Mono')+ })+})diff --git a/apps/desktop/src/themes/presets.ts b/apps/desktop/src/themes/presets.tsindex 3c5b963f588..f4f24f9426a 100644--- a/apps/desktop/src/themes/presets.ts+++ b/apps/desktop/src/themes/presets.ts@@ -32,7 +32,15 @@ const SYSTEM_SANS ='"Segoe WPC", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif, ' +EMOJI_FALLBACK-const SYSTEM_MONO = 'Menlo, Monaco, "SF Mono", "Courier Prime", monospace, ' + EMOJI_FALLBACK+// Keep the bundled JetBrains Mono first in every mono fallback chain. Several+// theme display fonts (Courier Prime, IBM Plex Mono) do not cover Vietnamese /+// Latin Extended glyphs; falling directly to platform UI fonts makes code+// blocks visibly non-monospace. JetBrains Mono is bundled with the app and+// covers those glyphs, while the Linux fallbacks catch distros without it.+const SYSTEM_MONO =+ '"JetBrains Mono", "Cascadia Code", "Cascadia Mono", "DejaVu Sans Mono", "Liberation Mono", "Noto Sans Mono", ' ++ '"Noto Mono", "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace, ' ++ EMOJI_FALLBACKexport const DEFAULT_TYPOGRAPHY: DesktopThemeTypography = { fontSans: SYSTEM_SANS, fontMono: SYSTEM_MONO }@@ -371,8 +379,8 @@ export const cyberpunkTheme: DesktopTheme = {description: 'Neon green on black — matrix terminal',...THEME_PRESET_PALETTES.cyberpunk,typography: {- fontMono: `"Courier New", Courier, monospace, ${EMOJI_FALLBACK}`,- fontSans: `"Courier New", Courier, monospace, ${EMOJI_FALLBACK}`+ fontMono: `"Courier New", Courier, ${SYSTEM_MONO}`,+ fontSans: `"Courier New", Courier, ${SYSTEM_MONO}`}}