Windows、MacOS平台下的字体列表取消使用原生方式获取(#1596)
This commit is contained in:
@@ -3,18 +3,18 @@
|
||||
|
||||
// exports.getAvailableFontFamilies = getAvailableFontFamilies
|
||||
|
||||
import { getFonts as getFontsByCommand } from 'font-list'
|
||||
import { getAvailableFontFamilies } from 'electron-font-manager'
|
||||
import { getFonts } from 'font-list'
|
||||
// import { getAvailableFontFamilies } from 'electron-font-manager'
|
||||
|
||||
|
||||
const getFonts = async() => {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
case 'darwin':
|
||||
return getAvailableFontFamilies()
|
||||
default: return getFontsByCommand()
|
||||
}
|
||||
}
|
||||
// const getFonts = async() => {
|
||||
// switch (process.platform) {
|
||||
// case 'win32':
|
||||
// case 'darwin':
|
||||
// return getAvailableFontFamilies()
|
||||
// default: return getFontsByCommand()
|
||||
// }
|
||||
// }
|
||||
|
||||
export {
|
||||
getFonts,
|
||||
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
return name
|
||||
})
|
||||
const lrcStyles = computed(() => ({
|
||||
fontFamily: /\s/.test(setting['desktopLyric.style.font']) ? `"${setting['desktopLyric.style.font']}"` : setting['desktopLyric.style.font'],
|
||||
fontFamily: setting['desktopLyric.style.font'],
|
||||
fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px',
|
||||
opacity: setting['desktopLyric.style.opacity'] / 100,
|
||||
textAlign: setting['desktopLyric.style.align'],
|
||||
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
return name
|
||||
})
|
||||
const lrcStyles = computed(() => ({
|
||||
fontFamily: /\s/.test(setting['desktopLyric.style.font']) ? `"${setting['desktopLyric.style.font']}"` : setting['desktopLyric.style.font'],
|
||||
fontFamily: setting['desktopLyric.style.font'],
|
||||
fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px',
|
||||
opacity: setting['desktopLyric.style.opacity'] / 100,
|
||||
textAlign: setting['desktopLyric.style.align'],
|
||||
|
||||
@@ -27,7 +27,7 @@ export default () => {
|
||||
})
|
||||
|
||||
watch(() => appSetting['common.font'], (val) => {
|
||||
document.documentElement.style.fontFamily = /\s/.test(val) ? `"${val}"` : val
|
||||
document.documentElement.style.fontFamily = val
|
||||
}, {
|
||||
immediate: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user