Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

html - Can I force the browser to use CSS @font-face instead of font installed on system?

Do browsers ignore @font-face if they determine that a CSS-imported font is already installed on the client OS?

I have a number of uncommon fonts installed on my system for design, etc. It would appear that browsers render these fonts with slight differences, depending on whether or not they are installed on the client OS. My guess is that the browser ignores the CSS font import if it determines that the font is already installed on the client OS.

The problem with this is that these rendering distinctions, however slight, can affect spacing, positioning and alignments, causing me to see a different version of a page than visitors. I have to uninstall the font (a pain to do every time) or preview it in a virtual machine (less of a pain, but still a pain).

Is there any way I can tell CSS, "only use this specific font from the CSS import and ignore the font installed on the client OS?"

EDIT : This seems to resolve the issue:

  1. Ensure the CSS @font-face specification uses a different string for font-family than what is installed on the system.

  2. When referencing the font elsewhere in CSS, use:

    font-family: System Installed Font Name, 'Imported Font Name', Fallback Font;

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From the edit in my question:

This seems to resolve the issue:

  1. Ensure the CSS @font-face specification uses a different string for font-family than what is installed on the system.

  2. When referencing the font elsewhere in CSS, use:

    font-family: System Installed Font Name, 'Imported Font Name', Fallback Font;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...