F9y4ng / GreasyFork-Scripts

The open source code of this project is used for userscripts (油猴脚本) for desktop browsers, including Font Rendering (Customized) (字体渲染(自用脚本)- Font Rendering.user.js), and Search Engine Assistant (优雅的搜索引擎助手 - Google & Baidu Switcher.user.js), etc.
https://f9y4ng.github.io/GreasyFork-Scripts/
GNU General Public License v3.0
950 stars 46 forks source link

Can I choose the fonts that have been installed on my computer? #203

Closed wuhuauguo911 closed 1 year ago

wuhuauguo911 commented 1 year ago

Can I choose the fonts that have been installed on my computer?

F9y4ng commented 1 year ago

Due to javascirpt's sandbox permission restrictions, it does not have direct access to the list of fonts installed on your system, so the script calls the system fonts by means of fixed-format parameters that configure the fonts that are already installed on your operating system and that you want to choose to use.

For example, use {"ch": "鸿蒙黑体", "en": "HarmonyOS Sans SC", "ps": "HarmonyOS_Sans_SC"} to add a new custom font, "ch" points to the Chinese name of the font, "en" points to the English name of the font, and "ps" points to the PostScript name of the font.