Exo Font Engine

Force Product Sans fonts on specific sites

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Exo Font Engine
// @namespace    exo.font.engine
// @version      1.0
// @description  Force Product Sans fonts on specific sites
// @match        *://open.spotify.com/*
// @match        *://discord.com/*
// @match        *://twitter.com/*
// @match        *://x.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const fontCSS = `
    /* === PRODUCT SANS FONT SET === */
    @font-face {
        font-family: 'Product Sans';
        src: url('https://fonts.gstatic.com/s/productsans/v5/pxiByp8kv8JHgFVrLBT5Z1xlEA.ttf') format('truetype');
        font-weight: 400;
    }

    @font-face {
        font-family: 'Product Sans Medium';
        src: url('https://fonts.gstatic.com/s/productsans/v5/pxiEyp8kv8JHgFVrJJfecg.ttf') format('truetype');
        font-weight: 500;
    }

    @font-face {
        font-family: 'Product Sans Bold';
        src: url('https://fonts.gstatic.com/s/productsans/v5/pxiByp8kv8JHgFVrLCz7Z1xlEA.ttf') format('truetype');
        font-weight: 700;
    }

    /* === GLOBAL FONT OVERRIDE === */
    * {
        font-family: 'Product Sans', 'Product Sans Medium', 'Product Sans Bold', sans-serif !important;
        -webkit-font-smoothing: antialiased !important;
        text-rendering: optimizeLegibility !important;
    }

    /* === WEIGHT CONTROL === */
    b, strong {
        font-family: 'Product Sans Bold' !important;
        font-weight: 700 !important;
    }

    h1, h2, h3, h4, h5, h6 {
        font-family: 'Product Sans Bold' !important;
    }

    button, nav, .medium {
        font-family: 'Product Sans Medium' !important;
        font-weight: 500 !important;
    }
    `;

    const style = document.createElement("style");
    style.textContent = fontCSS;
    document.head.appendChild(style);

})();