Skip to content

Instantly share code, notes, and snippets.

@Bryan2333
Last active January 1, 2026 02:44
Show Gist options
  • Select an option

  • Save Bryan2333/a00d7403839718d8608a86bd4cc23c0e to your computer and use it in GitHub Desktop.

Select an option

Save Bryan2333/a00d7403839718d8608a86bd4cc23c0e to your computer and use it in GitHub Desktop.
自定义字体
// ==UserScript==
// @name 自定义字体
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 设置自定义字体,修复图标显示并优化中英文
// @match *://*/*
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
GM_addStyle(`
body {
/*
字体栈顺序策略:
1. Segoe UI / Roboto / Helvetica: 针对 Windows/Android/macOS 的优质西文
2. PingFang SC / Microsoft YaHei: 针对 Mac 和 Windows 的中文
3. sans-serif: 通用无衬线兜底
4. Symbols Nerd Font: 最后加载图标字体以修复方块
*/
font-family:
"Segoe UI", Roboto, "Helvetica Neue", Arial,
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
sans-serif,
"Symbols Nerd Font Mono", "Symbols Nerd Font" !important;
}
/* 以下部分保持原样,未做修改 */
pre, code, kbd, samp {
font-family: 'Ubuntu Sans Mono', 'Symbols Nerd Font Mono', monospace !important;
font-size: inherit;
}
[style*="monospace"] {
font-family: 'Ubuntu Sans Mono', 'Symbols Nerd Font Mono', monospace !important;
font-size: inherit;
}
`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment