10

For example I have Open Sans font installed in Windows, and also embeded from google fonts in my website. If I forgot implement google fonts, then I can anyway see font on my website because I have it installed in system, but my visitors not. How to test fonts, and ignore system fonts?

I tried to find some options in config in chrome/firefox or plugins to pernamently disable system fonts in browser, but I can't find anything. I want to use installed fonts in Photoshop, but not in browser.

Sorry for bad english. Regards

norr
  • 1,725
  • 1
  • 20
  • 33

2 Answers2

3

Try renaming your font to something that does not match the name in your system.

@font-face {
   font-family: 'Open-Sans-Private';
}

This way your system will not recognize it and you'll be able to see if your embedding strategy actually worked.

Hope that helps!

SimonHawesome
  • 1,292
  • 2
  • 14
  • 19
0

Partial solutions that might be helpful for your use case...

My related use case

First, though, my related use case: I have an SVG file that renders text in a font named, say, "HAL Flex Sans". This isn't a base system font that came with my operating system, it's a user-installed font: I had to install it myself.

When I view the SVG in a web browser on my computer, the text in the SVG is correctly rendered in HAL Flex Sans.

Perhaps I've embedded a font definition in the SVG <style> element:

@font-face {
  font-family: 'HAL Flex Sans';
  font-style: normal;
  font-weight: 400;
  src: url(data:font/woff2;base64, ... ) format('woff2');
}

but how do I know whether the browser is using that embedded font or the font installed on my computer?

Or, perhaps I can see that someone else has published an SVG image on the web that requires HAL Flex Sans, without providing or referring to a font definition, but they're unaware that there's anything wrong; it looks okay to them, because they have HAL Flex Sans installed on their computer. And so do their close colleagues.

How can one test what the SVG looks like on a computer that doesn't have HAL Flex Sans installed, without actually having a separate physical computer to perform that test?

One solution is to create a virtual machine (VM) that has a web browser, but deliberately doesn't have HAL Flex Sans installed. In fact, I've used that solution. But there are other solutions that require less effort.

Solution 1: Disable user-installed fonts in Firefox

In Firefox (where the default font is, for example, Times New Roman):

  1. In the address bar, enter about:config
  2. Accept the risk
  3. Change the value of the preference layout.css.font-visibility.standard from 3 (also user-installed fonts) to 1 (only base system fonts)
  4. Reload the tab that contains the content to be tested

If text in the content to be tested is rendered in the default browser font (for example, Times New Roman), that's bad: it means the content is falling back on a font installed on your computer.

For details, see the chosen solution to the question "How to Block System Font Detection in Firefox?" on the Mozilla Firefox support forum.

Solution 2: Allow only whitelisted installed fonts in Firefox

I prefer solution 1. This solution can affect some browser UI text, such as address bar content and tab labels.

In Firefox:

  1. In the address bar, enter about:config
  2. Accept the risk
  3. Add the string-valued preference font.system.whitelist
  4. Set the value of font.system.whitelist to the name of a locally installed font that looks very different to the font in question
  5. Reload the tab that contains the content to be tested (for example, the SVG image)

If text in the content to be tested is rendered in the whitelisted font, that's bad: it means the content is falling back on a font installed on your computer.

Graham Hannington
  • 1,749
  • 16
  • 18
  • In case it occurs to anyone: the Chrome "[Disable local fonts](https://developer.chrome.com/blog/new-in-devtools-86/#emulate-local-fonts)" feature might sound promising based on the feature name, but it's not useful here. That feature emulates missing `local()` sources in `@font-face` rules. It *doesn't* disable Chrome from using a locally installed font that is referred to by name via `font-family`. – Graham Hannington Aug 15 '23 at 07:45