Skip to content

Commit f1316df

Browse files
committed
refactor: introduce SYSTEM_FONT_LIST for font management
- Added a new constant, SYSTEM_FONT_LIST, to centralize the list of system fonts used in the application. - Updated the getFontList function to utilize SYSTEM_FONT_LIST instead of FONT_LIST, ensuring consistency in font handling across the system.
1 parent 746b63d commit f1316df

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/constant.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ export type RecommendServerCategory = {
88
subCategories?: RecommendServerCategory[];
99
};
1010

11+
export const SYSTEM_FONT_LIST = [
12+
'-apple-system',
13+
'BlinkMacSystemFont',
14+
'Segoe UI',
15+
'Roboto',
16+
'Helvetica Neue',
17+
'Arial',
18+
'Noto Sans TC',
19+
'Microsoft JhengHei',
20+
'Heiti TC',
21+
'LiHei Pro',
22+
'sans-serif',
23+
];
24+
1125
export const FONT_LIST = [
1226
// Recommended Fonts
1327
{

src/web/handlers/system.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Types from '@/types';
22

33
import { store, eventEmitter, getSettings, getRegion } from '@/web/main';
44

5-
import { FONT_LIST } from '@/constant';
5+
import { SYSTEM_FONT_LIST } from '@/constant';
66

77
export function getSystemSettings() {
88
return getSettings();
@@ -49,7 +49,7 @@ export function getFontSize() {
4949
}
5050

5151
export function getFontList() {
52-
const fonts = FONT_LIST.map((font) => font.value);
52+
const fonts = SYSTEM_FONT_LIST
5353
return fonts;
5454
}
5555

0 commit comments

Comments
 (0)