Font Replacer

Replaces specified fonts with alternatives across all page elements

Maker
pfzim
Dagelijks aantal installaties
0
Totaal aantal installaties
2
Beoordelingen
0 0 0
Versie
0.4
Gemaakt op
28-03-2025
Bijgewerkt op
04-04-2025
Grootte
12,9 KB
Licentie
GPL-3.0-or-later
Wordt toegepast op
Alle websites

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);