fix(frontend): make general-settings font picker actually work

The font picker in 常规设置 silently failed in three distinct ways:

1. Font family changes were invisible on macOS because 6 of the 7 options
   (Inter / Roboto / Segoe UI / Cascadia Code / JetBrains Mono / Fira
   Code) aren't installed by default and fell back to system SF. Swap
   the picker to a platform-aware list — Mac / Windows / Linux each see
   only the fonts their OS actually ships. The "third sans slot" now
   always serves a serif face (Georgia / Times New Roman / DejaVu
   Serif) so the difference is unambiguously visible instead of being
   three near-identical sans families.

2. Font size flipped --app-font-scale on <html>, but that variable was
   only consumed by a handful of TDesign tokens and the body reset, so
   the ~1000+ hard-coded font-size: NNpx rules across the frontend
   stayed put. Apply the multiplier via `zoom` on <html> so the whole
   document scales, then fix the 15 `100vh` rules that would overflow
   under zoom (html / body / #app are already height: 100%, so the
   descendants can use 100% too).

3. The monospace picker had no visible effect even on a working stack
   because `<t-input style="font-family: ...">` is forwarded to the
   inner <input>, but TDesign applies `font: var(--td-font-body-medium)`
   — a shorthand that resets font-family. Reach the real <input> /
   <textarea> via `:deep()` instead of inline style.

Additional polish:
- Add a live preview row under each picker so users can see the effect
  without hunting for a code block or API Info screen
- Rename "等宽字体 / Monospace Font" → "代码字体 / Code Font" to match
  VSCode / GitHub / Notion convention; the old label was jargon
- Rewrite descriptions to explain the actual purpose and scope
This commit is contained in:
wizardchen
2026-05-07 15:02:47 +08:00
committed by lyingbug
parent fb9ae11aa8
commit 4a5caf54af
17 changed files with 362 additions and 119 deletions
+25 -13
View File
@@ -2446,30 +2446,42 @@ export default {
},
font: {
uiFont: 'Шрифт интерфейса',
uiFontDescription: 'Шрифт, используемый во всём интерфейсе (боковая панель, навигация, настройки и т. д.)',
monoFont: 'Моноширинный шрифт',
monoFontDescription: 'Шрифт для блоков кода, API-ключей и технических идентификаторов',
uiFontDescription: 'Шрифт для меню, основного текста, кнопок и большинства элементов интерфейса',
monoFont: 'Шрифт для кода',
monoFontDescription: 'Используется для блоков кода, команд терминала, API-ключей, путей к файлам и других технических текстов. Все символы одной ширины, чтобы 0 не путался с O, а 1 — с l.',
selectFont: 'Выбрать шрифт',
sansPreview: 'Образец Sample Шрифт — Aa Gg Oo 0123',
monoPreview: "const msg = 'Hello'; // 0O1l",
sans: {
system: 'Системный по умолчанию',
// macOS
pingfang: 'PingFang SC',
inter: 'Inter',
helvetica: 'Helvetica / Arial',
segoe: 'Segoe UI',
roboto: 'Roboto',
sansSerif: 'Стандартный без засечек',
georgia: 'Georgia (с засечками)',
// Windows
yahei: 'Microsoft YaHei',
times: 'Times New Roman (с засечками)',
// Linux
'noto-cjk': 'Noto Sans CJK',
'dejavu-serif': 'DejaVu Serif (с засечками)',
// cross-platform
'sans-serif': 'Стандартный без засечек',
},
mono: {
system: 'Системный по умолчанию',
cascadia: 'Cascadia Code',
jetbrains: 'JetBrains Mono',
fira: 'Fira Code',
monaco: 'Monaco / Menlo',
// macOS
menlo: 'Menlo',
monaco: 'Monaco',
// Windows
consolas: 'Consolas',
cascadia: 'Cascadia Code',
// Linux
'dejavu-mono': 'DejaVu Sans Mono',
'liberation-mono': 'Liberation Mono',
// cross-platform
monospace: 'Стандартный моноширинный',
},
fontSize: 'Размер шрифта',
fontSizeDescription: 'Регулирует общий размер текста в интерфейсе',
fontSizeDescription: 'Масштабирует весь интерфейс (текст, иконки, отступы) и применяется немедленно',
size: {
small: 'Маленький',
normal: 'Обычный',