2

I'm having an issue with websites using the Helvetica font and Helvetica Neue.
I tried getting some help to fix it but its apparently an issue with my Linux installation.

Since I can't fix it myself, I thought to write either a userstyle (Stylish) or a userscript for my Chrome browser to detect websites that use Helvetica or Helvetica Neue.
If those font are used, then replace them with something else.

How could this be implemented?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Adonis K. Kakoulidis
  • 4,951
  • 6
  • 34
  • 43

1 Answers1

4

If this is for just a few websites, use Stylish, and tune for just those offending parts of the page. For example:

@-moz-document domain("stackoverflow.com"), domain("askubuntu.com") {
    body, p, div, textarea {
        font-family: comic sans !important;
    }
}


If it's for all sites, Stylish or a userscript is not your best bet.
This is because:

  1. For Stylish, it would be a full time job finding and adding the appropriate CSS selectors.
  2. Or, a blanket approach for Stylish, like:

    * {
        font-family: comic sans !important;
    }
    

    would no-doubt bust the layout of some sites.

  3. A userscript could theoretically replace CSS only if it was set to Helvetica, but one of two problems would occur:

    1. Checking style sheets would seem more efficient but your script would be blocked, from reading/writing some sheets, by security restrictions. Although the style sheets you were most interested in would probably be readable (same domain, not in JS created iframe).
    2. Conversely, you could check the computed style of every element, but you'd have to monitor for AJAX changes, and this could get CPU intensive.


For a blanket approach, the smartest thing to do is to fix or reinstall your Linux OS.

At the very least, you should be able to map your system's Helvetica font to something else (I know you can do this on Windows, so Linux probably has a mechanism too).

Might be best to ask a question on Unix and Linux or on Super User for help fixing the system font problem.

Community
  • 1
  • 1
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • 1
    I have already tried using the multiple domain targeting in the stylish script but that was kinda annoying cause I'd have to do this for every new website I'd visit which used the font. After spending quite some time into researching the issue I found out that Ubuntu was indeed mapping Helvetica to another font named Nimbus Sans (because Helvetica's license didn't allow them to use it). In the end I found the Nimbus Sans files and deleted them. Now the problem is gone. – Adonis K. Kakoulidis Jan 21 '13 at 18:04
  • Can I use a locally installed font similarly? How would the code need to be changed? Is there a related Q&A for it? I can't find it. – NVZ Jan 26 '18 at 18:30
  • 1
    @NVZ, if the font is properly installed on your system, you just need to specify its name. Quotes may be required. For example, `font-family: "Liberation Serif" !important;` works on my machine. There may be more on [su]. – Brock Adams Jan 26 '18 at 22:55