My problem is that I am using a locally-hosted webfont (which we’ll call Gothic) and the font-size I apply in the stylesheet has a dramatic effect on the backup fonts declared.
Example, using imaginary numbers for ease:
Gothic is sized at 48, px or em, takes up about a width of 300px. Backup font Arial, if it loads instead for whatever reason, at 48 px or em, loads at a width of about 1200 pixels.
I have never seen a typeface behave like this which makes me wonder if the strangeness is due to the construction of the file format, but I am unsure. Any help would be welcome.
First of all, take a look at browser’s @font-face support and note that:
Do you cover any browser?
Then you need to provide a fallback for browsers not supporting @font-face at all.
I suggest you to include Modernizer on your document’s head section.
Select @font-face and Add CSS classes on Modernizer’s download page, or follow this download link.
Modernizer adds classes to your page’s
<html>element, so you can use this classes to override settings for browsers not supporting a specific feature.This rule will apply to the whole document:
It must be placed below any other
font-sizerule.Alternatively, you can declare
font-size:16px !important;and put the rule anywhere in your stylesheet. It will not be overwritten (except by other rules usingimportant!of course).If you want to target a specific element, you’ve to put
.no-fontfaceat the beginning of the selector. For example: