Use My Fonts

Use my custom fonts on the pages

As of 2024-09-23. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name                Use My Fonts
// @name:en-US          Use My Fonts
// @name:zh-CN          使用我的字体
// @description         Use my custom fonts on the pages
// @description:en-US   Use my custom fonts on the pages
// @description:zh-CN   在页面上使用我的自定义字体
// @namespace           use-my-fonts
// @version             2024.09.23.3
// @author              Akatsuki Rui
// @license             MIT License
// @grant               GM_addStyle
// @run-at              document-start
// @match               *://*/*
// ==/UserScript==

"use strict";

const css = String.raw;

// FONT_CSS is generated by use-my-fonts.scss
const FONT_CSS = css`
  @charset "UTF-8";
  @font-face {
    font-family: "Arial";
    src: local("Roboto");
  }
  @font-face {
    font-family: "Helvetica";
    src: local("Roboto");
  }
  @font-face {
    font-family: "Open Sans";
    src: local("Roboto");
  }
  @font-face {
    font-family: "Segoe UI";
    src: local("Roboto");
  }
  @font-face {
    font-family: "Tahoma";
    src: local("Roboto");
  }
  @font-face {
    font-family: "Microsoft YaHei UI";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "Microsoft YaHei";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "微软雅黑";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "NSimsun";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "新宋体";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "Simhei";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "宋体";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "Simsun";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "黑体";
    src: local("Noto Sans CJK SC");
  }
  @font-face {
    font-family: "Microsoft Jhenghei";
    src: local("Noto Sans CJK TC");
  }
  @font-face {
    font-family: "微軟正黑體";
    src: local("Noto Sans CJK TC");
  }
  @font-face {
    font-family: "ヒラギノ角ゴ Pro W3";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "Hiragino Kaku Gothic Pro";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: Osaka;
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: メイリオ;
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: Meiryo;
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "MS Pゴシック";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "MS PGothic";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "MS ゴシック";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "MS Gothic";
    src: local("Noto Sans CJK JP");
  }
  @font-face {
    font-family: "Malgun Gothic";
    src: local("Noto Sans CJK KR");
  }
  @font-face {
    font-family: "맑은 고딕";
    src: local("Noto Sans CJK KR");
  }
  @font-face {
    font-family: "Consolas";
    src: local("Cascadia Code");
  }
`;

GM_addStyle(FONT_CSS.trim());