What is the right way to use @font-face
so that the browser will not download the font if the user already have it?
I am using @font-face to define DejaVu, which is already installed on my system (linux). Firefox is not downloading the font, but Chromium is downloading it every time!
My CSS code, based on font squirrel and that question look like this:
@font-face { font-family: 'DejaVu Serif'; src: url('DejaVuSerif-webfont.eot'); src: local('DejaVu Serif'), url('DejaVuSerif-webfont.woff') format('woff'), url('DejaVuSerif-webfont.ttf') format('truetype'), url('DejaVuSerif-webfont.svg#webfontCFu7RF0I') format('svg'); font-weight: normal; font-style: normal; } /* ... @font-face definitions for italic and bold omitted ... */ @font-face { font-family: 'DejaVu Serif'; src: url('DejaVuSerif-BoldItalic-webfont.eot'); src: local('DejaVu Serif Bold Italic'), url('DejaVuSerif-BoldItalic-webfont.woff') format('woff'), url('DejaVuSerif-BoldItalic-webfont.ttf') format('truetype'), url('DejaVuSerif-BoldItalic-webfont.svg#webfontQAewh7pf') format('svg'); font-weight: bold; font-style: italic; }
You should change src:url("C:/path/to/ttf"); to src:url("file:///path/to/file") . Show activity on this post. Show activity on this post. Just add bellow code before all the styling of your css file and then you can use this font family for any selector inside within your css file.
You can use a <basefont> tag to set all of your text to the same size, face, and color. The font tag is having three attributes called size, color, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the <font> tag.
If you want to check for local files first do:
@font-face { font-family: 'Green Sans Web'; src: local('Green Web'), local('GreenWeb-Regular'), url('GreenWeb.ttf'); }
There is a more elaborate description of what to do here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With