36

Prior art:

Is there a way to disable system fonts temporarily in any browser?

The only solution I can find is to name the font something that doesn't collide with local fonts. I don't like that solution cause:

  1. I'd rather refer to fonts by correct name.

  2. It doesn't work with inline fonts via stylesheet like how Google serves fonts.

So, anyone know how?

Community
  • 1
  • 1
AJcodez
  • 31,780
  • 20
  • 84
  • 118
  • 1) why? `@font-face { font-family: main; src: local(...); }` is perfectly fine, and means you don't have to change a million `font-family` instances just because because you decide to switch font. It is, in fact, good practice. 2) google serves fonts in several ways, including as normal CSS ``, which is by far the easiest to work with. – Mike 'Pomax' Kamermans Oct 19 '15 at 22:08
  • 3
    1) To test performance, for example. – DanielBlazquez Jun 19 '20 at 20:09

4 Answers4

29

If you are on a Mac just open up the 'Font Book' app and disable the font.

jon_wu
  • 1,113
  • 11
  • 26
Michael
  • 338
  • 4
  • 3
10

From Chrome 86, you can now disable local fonts in DevTools.

  1. Open DevTools
  2. Click the three dots in the top right
  3. Select More tools > Rendering
  4. Check Disable local fonts
  5. Refresh the page

This will ignore all local(...) sources in CSS @font-face rules.

David Wheatley
  • 426
  • 6
  • 16
  • 19
    Unfortunately, this **Disable local fonts** option does not do what I expected it to do at first, before I read the detail. For my [use case](https://community.coreldraw.com/talk/coreldraw-graphics-suite-2019/f/coreldraw-graphics-suite-2019-for-windows/63222/export-to-svg-embeds-fonts-in-deprecated-svg-font-format-no-longer-supported-by-most-browsers), I want to stop Chrome (or any modern browser, for that matter) using fonts that are installed on the local computer: **Ignore installed fonts**. This isn't it. – Graham Hannington Nov 19 '20 at 08:16
  • I tried this but didn't work, I had to disable the font from the system – aeron13 May 30 '23 at 13:16
1

Rather than renaming the font-family, I would just omit or comment out the local() function call in your src descriptor. Without it, the browser will always load the font file(s) specified in your url() function(s).

@font-face {
    font-family: "My Font";
    font-weight: 400;
    font-style: normal;
    src:
        /* --> local("My Font") <-- */
        url("/my-font.woff2") format("woff2"),
        url("/my-font.woff") format("woff")
}
Mattias Larsson
  • 175
  • 2
  • 6
0

Is there a way to disable system fonts temporarily in any browser?

Yes.

In Firefox, use one of the following preferences:

  • layout.css.font-visibility.standard
  • font.system.whitelist

For details, see my answer to the question "Disable installed fonts from system in browser".

Graham Hannington
  • 1,749
  • 16
  • 18