feat(frontend): unify font rendering and add font picker in settings

The UI used hardcoded "PingFang SC" in 50+ components, while the global
font stack in App.vue used a different fallback chain. Outside of mainland
China this caused visibly different fonts in the sidebar, breadcrumbs,
search and agent views compared to settings and document panes.

- Introduce --app-font-family / --app-font-family-mono CSS variables in
  theme.css and route TDesign's --td-font-family through them
- Add a useFont composable that persists the user's choice in localStorage
  and applies it via document.documentElement.style before mount
- Replace hardcoded font-family declarations across the app with the new
  variables (TencentSans logo and the SVG attribute list are preserved)
- Add UI font and monospace font selectors in General Settings with
  i18n strings for en-US, zh-CN, ko-KR and ru-RU

https://claude.ai/code/session_01S1FVPf4jRfWXkTSnpMmMp7
This commit is contained in:
Claude
2026-05-02 08:06:56 +00:00
committed by lyingbug
parent 6c1442aaf9
commit f140c12518
59 changed files with 542 additions and 251 deletions
@@ -3629,7 +3629,7 @@ const handleSave = async () => {
.sidebar-title {
margin: 0;
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 18px;
font-weight: 600;
color: var(--td-text-color-primary);
@@ -3649,7 +3649,7 @@ const handleSave = async () => {
border-radius: 6px;
cursor: pointer;
transition: all 0.2s ease;
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
color: var(--td-text-color-secondary);
@@ -3934,7 +3934,7 @@ const handleSave = async () => {
.slider-value {
width: 40px;
text-align: right;
font-family: monospace;
font-family: var(--app-font-family-mono);
font-size: 14px;
color: var(--td-text-color-primary);
}
@@ -4480,7 +4480,7 @@ const handleSave = async () => {
// 系统提示词输入框样式
.system-prompt-textarea {
width: 100%;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-family: var(--app-font-family-mono);
font-size: 13px;
:deep(textarea) {
@@ -4528,7 +4528,7 @@ const handleSave = async () => {
align-items: center;
padding: 1px 5px;
border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
color: var(--td-text-color-primary, #333);
background-color: var(--td-bg-color-secondarycontainer, #f3f3f3);
@@ -4585,7 +4585,7 @@ const handleSave = async () => {
background: var(--td-bg-color-container-hover, #f5f7fa);
padding: 2px 5px;
border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
color: var(--td-brand-color, #0052d9);
}