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
@@ -2413,7 +2413,7 @@ const handleAddToKnowledge = (answerEvent: any) => {
background: var(--td-bg-color-secondarycontainer);
padding: 2px 5px;
border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
}
@@ -2962,7 +2962,7 @@ const handleAddToKnowledge = (answerEvent: any) => {
padding: 0;
.detail-output {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
color: var(--td-text-color-primary);
padding: 12px;
@@ -3199,7 +3199,7 @@ const handleAddToKnowledge = (answerEvent: any) => {
background: var(--td-bg-color-container);
padding: 10px;
border-radius: 6px;
font-family: 'Monaco', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
color: var(--td-text-color-primary);
margin: 0;
overflow-x: auto;
@@ -3372,7 +3372,7 @@ const handleAddToKnowledge = (answerEvent: any) => {
}
code {
font-family: monospace;
font-family: var(--app-font-family-mono);
font-size: 13px;
padding: 2px 4px;
background: var(--td-bg-color-secondarycontainer);
@@ -172,7 +172,7 @@ const toolArguments = computed(() => props.arguments || {});
padding: 0;
.detail-output {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 12px;
color: var(--td-text-color-primary);
padding: 16px;
@@ -386,7 +386,7 @@ onBeforeUnmount(() => {
background: var(--td-bg-color-secondarycontainer);
padding: 2px 5px;
border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
}
@@ -79,7 +79,7 @@ function fallbackCopy(text: string) {
}
code {
font-family: 'Monaco', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
background: var(--td-bg-color-secondarycontainer);
padding: 2px 4px;
@@ -111,7 +111,7 @@ const processedContent = computed(() => {
flex: 1;
code {
font-family: 'Monaco', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 10px;
background: var(--td-bg-color-secondarycontainer);
padding: 1px 4px;
@@ -251,7 +251,7 @@ const formatMetadataValue = (value: unknown) => {
}
.metadata-value {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
color: var(--td-text-color-primary);
}
}
@@ -267,7 +267,7 @@ const formatMetadataValue = (value: unknown) => {
}
code {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 10px;
background: var(--td-bg-color-secondarycontainer);
padding: 2px 4px;
@@ -98,7 +98,7 @@ const props = defineProps<{
}
code {
font-family: 'Monaco', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
background: var(--td-bg-color-secondarycontainer);
padding: 2px 4px;
@@ -144,7 +144,7 @@ const props = defineProps<{
}
code {
font-family: 'Monaco', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
background: var(--td-bg-color-secondarycontainer);
padding: 2px 4px;
@@ -237,7 +237,7 @@ const getRelevanceLabel = (level: RelevanceLevel): string => {
}
code {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 10px;
background: var(--td-bg-color-secondarycontainer);
padding: 1px 4px;
@@ -237,7 +237,7 @@ const headerTitle = computed(() => {
border: 1px solid @card-border;
border-radius: 4px;
overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 12px;
}
@@ -308,7 +308,7 @@ const headerTitle = computed(() => {
}
code {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
background: var(--td-bg-color-secondarycontainer);
padding: 2px 5px;
@@ -301,7 +301,7 @@
// Code block
.code-block {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-family: var(--app-font-family-mono);
font-size: 11px;
background: var(--td-bg-color-secondarycontainer);
padding: 8px;