Windows、MacOS平台下的字体列表改用原生方式获取

This commit is contained in:
lyswhut
2023-06-05 15:05:03 +08:00
parent 5582e78315
commit fa3fd8d8a4
5 changed files with 56 additions and 5 deletions
+11 -1
View File
@@ -3,8 +3,18 @@
// exports.getAvailableFontFamilies = getAvailableFontFamilies
import { getFonts as getFontsByCommand } from 'font-list'
import { getAvailableFontFamilies } from 'electron-font-manager'
import { getFonts } from 'font-list'
const getFonts = async() => {
switch (process.platform) {
case 'win32':
case 'darwin':
return getAvailableFontFamilies()
default: return getFontsByCommand()
}
}
export {
getFonts,