Firefox: substitute a font with another in any page

4

2

I'm using the stylish addon and it works great. However I would like to substitute a specific font - say Arial - with another of my choice every time it is found instead of setting a global font (which I don't like as I just want to substitute Arial) or using a stylish rule for every page. Is it possible to do this? Maybe with a greasemonkey script?

Matteo Riva

Posted 2010-02-06T15:53:04.670

Reputation: 8 341

Answers

3

You'd need greasemonkey, not just stylish. The script would have to look at computed styles for every element, and account for the fact that Arial can be accessed by several names.

Another angle is to reconfigure Arial to be replaced by another font. This is more foolproof and less resource intensive.

Assuming you're on linux, put this in ~/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="pattern"><!-- Replace Arial -->
  <test qual="any" name="family"><string>Arial</string></test>
  <edit name="family" mode="assign_replace"><string>A better font</string></edit>
 </match>
</fontconfig>

Tobu

Posted 2010-02-06T15:53:04.670

Reputation: 2 584

but then it would remap arial to a better font on every app in your desktop – Capi Etheriel – 2010-02-09T15:32:53.133

I have tried with ~/.fonts.conf but I couldn't get it working -- no matter what fonts I try to substitute, it seems to make no difference. – Matteo Riva – 2010-03-05T18:59:08.313

I put assign_replace instead of assign. What you saw was probably an interaction with /etc/fonts/conf.d/30-metric-aliases.conf – Tobu – 2010-03-27T19:46:12.680

1

I follow this, and then set

@font-face {
        font-family: "Arial";
        src: local("Segoe UI Semibold")
}

in a Stylist addons.

TriPLC

Posted 2010-02-06T15:53:04.670

Reputation: 11

This works for machine fonts, but unfortunately not for web fonts which are already specified by @font-face on the website. Until now I haven't found a way to override these. – letmaik – 2013-05-02T16:14:58.623