Skip to content

Add regional typography controls / 新增分区域字体设置#6634

Merged
SivanCola merged 4 commits into
esengine:main-v2from
SivanCola:feature/regional-typography-settings
Jul 18, 2026
Merged

Add regional typography controls / 新增分区域字体设置#6634
SivanCola merged 4 commits into
esengine:main-v2from
SivanCola:feature/regional-typography-settings

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

  • add a Detailed Typography settings view with independent controls for interface, conversation, composer, code/tools, and supporting text
  • support preset and custom font families, per-region font sizes, live preview, reset, undo, and English/Simplified Chinese/Traditional Chinese copy
  • persist preferences locally while preserving the existing global appearance settings as the default
  • make themed assistant replies and Markdown inherit the conversation font family and size instead of hardcoded values

Why

The existing global font and text-size controls cannot accommodate users who need larger conversation text without enlarging navigation, code, or metadata. Theme-specific assistant response rules also override the selected conversation typography, causing user messages and replies to render at different sizes.

User impact

Users can tune readability by semantic area, preview changes immediately, and return any region or the entire page to the global defaults. Existing installations retain their current appearance until a region is explicitly customized.

Backward compatibility

Field or surface Old-data behavior Conclusion
reasonix-region-typography-v1 local preference Missing storage creates defaults where every region follows the existing global settings Safe
Partial or invalid regional values Missing regions fall back to defaults; sizes are clamped and unsafe custom font delimiters are rejected Safe
Regional CSS custom properties Absent properties fall back to the existing global scale and font tokens Safe
Existing appearance preferences No existing key or persisted format is changed Safe

Verification

  • pnpm --dir desktop/frontend test
  • pnpm --dir desktop/frontend typecheck
  • pnpm --dir desktop/frontend check:css
  • pnpm --dir desktop/frontend build
  • browser interaction checks for navigation, region selection, follow-global, font/size changes, preview tabs, reset, undo, persistence, and scroll reset
  • computed-style check confirming user and assistant messages use the same configured conversation size and font family

Problem:
Users can only change one global font family and text scale, so conversation, composer, code, metadata, and navigation cannot be tuned independently. Assistant response styles can also override the selected conversation typography.

Root cause:
The frontend exposes a single global typography layer, while higher-specificity theme rules hardcode assistant response font properties.

Fix:
Add persisted, backward-compatible typography preferences and a detailed settings view for five semantic regions. Route each region through CSS custom properties, localize the UI, and make assistant responses inherit the conversation font and size.

Verification:
- pnpm --dir desktop/frontend exec tsx src/__tests__/typography-preferences.test.ts
- pnpm --dir desktop/frontend exec tsx src/__tests__/typography-overflow-contract.test.ts
- pnpm --dir desktop/frontend typecheck
- pnpm --dir desktop/frontend check:css
- pnpm --dir desktop/frontend build
- Browser computed styles confirm matching user and assistant typography
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jul 18, 2026
Problem:
Regional typography settings could be ignored by assistant replies, code/tool content, and metadata. The theme restore copy also implied a broader reset than it performs.

Root cause:
Root-scoped typography tokens were computed before descendant region scales, and later theme selectors overrode regional font values. Custom font input could also diverge from its normalized persisted value, while restore labels did not name the Graphite-only scope.

Fix:
Expose exact per-region size properties, recompute semantic typography tokens at each region, route late selectors through regional variables, normalize custom font input before state updates, and clarify/localize the Graphite restore copy while preserving detailed typography.

Verification:
- pnpm --dir desktop/frontend test
- pnpm --dir desktop/frontend test:typecheck
- pnpm --dir desktop/frontend build
- Browser checks confirmed user and assistant replies render at 24px and remain 24px after restoring the Graphite appearance.
Problem:
Supporting-text customization changed the effective default from 12px to 11px, and code/metadata previews did not match their applied sizes.

Root cause:
The metadata region used an 11px scaling base while the existing status token uses 12px. The preview also multiplied every region by a hardcoded 14px base.

Fix:
Align metadata with the 12px supporting-text base and give each preview region an exact size variable with the correct global fallback.

Verification:
- pnpm --dir desktop/frontend test
- pnpm --dir desktop/frontend check:css
- pnpm --dir desktop/frontend test:typecheck
- pnpm --dir desktop/frontend build
- Browser computed-style checks confirmed code and metadata previews match their configured sizes and metadata stays 12px when leaving follow-global.
Problem:
Diff text stayed at 12.5px while the code and tools region followed a non-default global text size.

Root cause:
The diff fallback bypassed the global font scale and only read the exact regional override.

Fix:
Scale the legacy 12.5px diff base by the global text-size token until the code region is customized, and lock the behavior with a CSS contract test.

Verification:
- pnpm --dir desktop/frontend exec tsx src/__tests__/typography-overflow-contract.test.ts
- pnpm --dir desktop/frontend check:css
- pnpm --dir desktop/frontend test:typecheck
- pnpm --dir desktop/frontend build
@SivanCola
SivanCola marked this pull request as ready for review July 18, 2026 14:18
@SivanCola
SivanCola requested a review from esengine as a code owner July 18, 2026 14:18
@SivanCola
SivanCola merged commit 5eac2d7 into esengine:main-v2 Jul 18, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant