Font Replacer

Replaces specified fonts with alternatives across all page elements

作者
pfzim
日安装量
1
总安装量
3
评分
0 0 0
版本
0.4
创建于
2025-03-28
更新于
2025-04-04
大小
12.9 KB
许可证
GPL-3.0-or-later
适用于
所有网站

Font Replacer Script Overview

This UserScript automatically replaces specified fonts with alternatives across all webpage elements. Its primary purpose is to improve text readability when font anti-aliasing is disabled, as some fonts (like Helvetica or GitLab Sans) may render poorly without smoothing.


Key Features

  1. Real-Time Font Replacement
    Scans for target fonts (e.g., Helvetica, GitLab Sans) and substitutes them with more legible alternatives (Verdana, Arial, etc.).

  2. Customizable Replacements
    Configure font mappings in the fontReplacements object:

    const fontReplacements = {
       "Helvetica": "Verdana",
       "Segoe UI": "Arial"
       // Add more as needed
    };
    
  3. Comprehensive Coverage

    • Recursively checks all DOM elements (including nested/dynamic content via MutationObserver).
    • Handles inline styles and CSS-computed fonts.
  4. Non-Intrusive Execution

    • No grant permissions required.
    • Only modifies fonts that match replacement rules.

How to Use

  1. Install the script in Tampermonkey/Greasemonkey.
  2. Edit fontReplacements to match your preferences.
  3. Fonts will update automatically upon page load.

Example Replacements

Original Font Replacement Reason
Helvetica Verdana Better readability without AA
GitLab Sans Verdana Fixes jagged edges
Roboto Mono Courier New Crisper monospace rendering

Technical Notes

  • Works on all sites (via @match *://*/*).
  • Optional @font-face override (commented out) for forced enforcement.
  • Processes dynamically added content without page reloads.

Ideal for GitLab, Jira, and other interfaces where fonts degrade without anti-aliasing.

Pro Tip: Uncomment the console.log lines to debug font changes in real time.

// Debug example:
// console.log('Replaced:', originalFont, '→', newFont); 

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址