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
+15 -15
View File
@@ -1027,7 +1027,7 @@ defineExpose({
h2 {
margin: 0;
color: var(--td-text-color-primary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 24px;
font-weight: 600;
line-height: 32px;
@@ -1098,7 +1098,7 @@ defineExpose({
.header-subtitle {
margin: 0;
color: var(--td-text-color-placeholder);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
font-weight: 400;
line-height: 20px;
@@ -1153,7 +1153,7 @@ defineExpose({
padding: 12px 0;
cursor: pointer;
color: var(--td-text-color-secondary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
font-weight: 400;
transition: color 0.2s;
@@ -1193,7 +1193,7 @@ defineExpose({
.org-source-text {
color: var(--td-text-color-secondary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 11px;
font-weight: 500;
flex-shrink: 0;
@@ -1207,7 +1207,7 @@ defineExpose({
border-radius: 10px;
background: var(--td-bg-color-container-hover);
color: var(--td-text-color-secondary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 11px;
font-weight: 500;
flex-shrink: 0;
@@ -1383,7 +1383,7 @@ defineExpose({
.card-title {
color: var(--td-text-color-primary);
font-family: "PingFang SC", -apple-system, sans-serif;
font-family: var(--app-font-family);
font-size: 15px;
font-weight: 600;
line-height: 22px;
@@ -1403,7 +1403,7 @@ defineExpose({
border-radius: 10px;
background: var(--td-bg-color-container-hover);
color: var(--td-text-color-secondary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 11px;
font-weight: 500;
flex-shrink: 0;
@@ -1504,7 +1504,7 @@ defineExpose({
line-clamp: 2;
overflow: hidden;
color: var(--td-text-color-secondary);
font-family: "PingFang SC", -apple-system, sans-serif;
font-family: var(--app-font-family);
font-size: 12px;
font-weight: 400;
line-height: 18px;
@@ -1598,7 +1598,7 @@ defineExpose({
.card-time {
color: var(--td-text-color-placeholder);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 12px;
font-weight: 400;
}
@@ -1619,7 +1619,7 @@ defineExpose({
.empty-txt {
color: var(--td-text-color-placeholder);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 16px;
font-weight: 600;
line-height: 26px;
@@ -1628,7 +1628,7 @@ defineExpose({
.empty-desc {
color: var(--td-text-color-disabled);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
font-weight: 400;
line-height: 22px;
@@ -1696,7 +1696,7 @@ defineExpose({
.circle-title {
color: var(--td-text-color-primary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 16px;
font-weight: 600;
line-height: 24px;
@@ -1704,7 +1704,7 @@ defineExpose({
.del-circle-txt {
color: var(--td-text-color-placeholder);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
font-weight: 400;
line-height: 22px;
@@ -1722,7 +1722,7 @@ defineExpose({
.circle-btn-txt {
color: var(--td-text-color-primary);
font-family: "PingFang SC";
font-family: var(--app-font-family);
font-size: 14px;
font-weight: 400;
line-height: 22px;
@@ -1768,7 +1768,7 @@ defineExpose({
box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
display: flex;
flex-direction: column;
font-family: "PingFang SC", sans-serif;
font-family: var(--app-font-family);
}
.shared-detail-drawer-header {