Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 实现“自定义字体”能力:新增字体配置入口,支持为应用全局、播放器歌词以及三个外部歌词窗口分别指定字体,并通过主进程枚举系统字体列表供选择。
Changes:
- 新增字体配置自定义设置项(FontConfig),并新增 IPC
system:listFonts+ 渲染端 composable 拉取系统字体。 - 将字体栈抽象为
--app-font/--user-font,让主窗口与外部歌词窗口统一使用同一套字体变量与覆盖逻辑。 - 在各歌词渲染入口(全屏歌词、桌面/灵动岛/任务栏歌词窗口)增加
fontFamily配置字段并应用到根样式。
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| windows/taskbar-lyric/index.html | 引入 /fonts/font.css 并将默认字体设为 var(--app-font) |
| windows/taskbar-lyric/App.vue | Taskbar Lyric 增加 fontFamily 配置并绑定到根样式 |
| windows/dynamic-island/index.html | 引入 /fonts/font.css 并将默认字体设为 var(--app-font) |
| windows/dynamic-island/App.vue | Dynamic Island 增加 fontFamily 配置、测量逻辑与根样式绑定 |
| windows/desktop-lyric/index.html | 引入 /fonts/font.css 并将默认字体设为 var(--app-font) |
| windows/desktop-lyric/App.vue | Desktop Lyric 增加 fontFamily 配置并绑定到根样式 |
| uno.config.ts | 将 fontFamily.sans 指向 var(--user-font, var(--app-font)) |
| src/types/settings.ts | 为全局外观与主窗口歌词设置新增 fontFamily 字段 |
| src/styles/global.css | 主窗口 body 使用 var(--user-font, var(--app-font)) |
| src/stores/settings.ts | 为 appearance / lyric 默认值新增 fontFamily |
| src/settings/schema.ts | 新增“字体”设置分区并挂载 FontConfig 自定义组件 |
| src/main.ts | 移除显式 import(依赖 AutoImport) |
| src/i18n/locales/zh-CN.json | 新增字体配置相关中文文案与通用“应用”按钮文案 |
| src/i18n/locales/en-US.json | 新增字体配置相关英文文案与通用“Apply”按钮文案 |
| src/composables/useSystemFonts.ts | 新增 composable:通过 preload API 拉取系统字体列表 |
| src/components/ui/SSelect.vue | 支持为单条 option 传入内联样式(用于字体预览) |
| src/components/ui/SDialog.vue | 调整 Dialog 内容区/标题区/底部操作区布局与滚动策略 |
| src/components/settings/custom/FontConfig.vue | 新增字体配置弹窗与草稿提交逻辑 |
| src/components/player/FullPlayer/index.vue | 全屏歌词样式应用 settings.lyric.fontFamily |
| src/App.vue | 根据 appearance.fontFamily 动态写入/移除 --user-font |
| shared/types/settings.ts | 为三个外部歌词窗口设置新增 fontFamily 字段 |
| shared/defaults/settings.ts | 为外部歌词窗口默认配置补齐 fontFamily 默认值 |
| public/fonts/font.css | 定义 --app-font 默认字体栈 |
| pnpm-lock.yaml | 锁文件更新:新增 font-list,升级 reka-ui |
| package.json | 新增依赖 font-list,升级 reka-ui 版本 |
| electron/preload/index.ts | 暴露 window.api.system.listFonts() |
| electron/preload/index.d.ts | 为 listFonts 补充类型声明 |
| electron/main/ipc/system.ts | 新增 IPC system:listFonts,使用 font-list 获取系统字体 |
| components.d.ts | 注册 FontConfig 组件类型(自动生成文件更新) |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| // 获取系统已安装字体 | ||
| ipcMain.handle("system:listFonts", async (): Promise<string[]> => { | ||
| try { | ||
| return await getFonts({ disableQuoting: true }); |
Comment on lines
+86
to
+94
| /** 获取字体选项 */ | ||
| const getOptions = (target: FontTarget): FontOption[] => { | ||
| const list: FontOption[] = [ | ||
| { value: DEFAULT_OPTION_VALUE, label: target.defaultLabel }, | ||
| { value: CUSTOM_OPTION_VALUE, label: t("settings.fontConfig.customLabel") }, | ||
| ]; | ||
| for (const font of fonts.value) { | ||
| list.push({ value: font, label: font, style: { fontFamily: font } }); | ||
| } |
Comment on lines
+4
to
+7
| watchEffect(() => { | ||
| const v = useSettingsStore().appearance.fontFamily; | ||
| const root = document.documentElement.style; | ||
| if (v) root.setProperty("--user-font", `${v}, var(--app-font)`); |
Comment on lines
+53
to
58
| /* 文本测量:优先使用 config.fontFamily,确保与渲染一致 */ | ||
| const measureCtx = document.createElement("canvas").getContext("2d")!; | ||
| const measureTextWidth = (text: string, sizePx: number = fontSize.value): number => { | ||
| const family = getComputedStyle(document.documentElement).fontFamily; | ||
| const family = | ||
| config.fontFamily || getComputedStyle(document.documentElement).fontFamily; | ||
| measureCtx.font = `${config.fontWeight} ${sizePx}px ${family}`; |
roarrabbit
pushed a commit
to roarrabbit/SPlayer-Next
that referenced
this pull request
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.