Reputation: 18427
I've run into an extremely weird bug. I have set up a custom font-face:
@font-face {
font-family: 'MyAwesomeFont';
src: '...';
font-weight: 'normal;
}
@font-face {
font-family: 'MyAwesomeFont';
src: '...';
font-weight: 'bold;
}
There's like 3 more, all with the same name but different font-weight
(a bolder
, 100
and 200
). When using the normal
one, Firefox uses the bold
one instead - I mean, it doesn't tell me it uses the other one, but other browsers don't behave like that at all...
I tried using an arbitrary value instead of normal
but that just screwed up things for other browsers. Any ideas what I should try to do?
update
I just used exact numbers for all the font-faces. I used 400 for the normal one, so technically it's the same. But now Firefox renders it correctly. I'm very unsure as to what exactly happened...
Upvotes: 0
Views: 142
Reputation: 1
The problem is the "bolder" and "lighter" statement. Somehow @font-face doesn't play nice with those font-weight declaration.
I was playing around, trying to figure out why my regular font was bold all the time. The order of the font-face declaration also made a difference, but still it acted weird.
Then I replaced the "bolder" statement with a number "900", and suddenly everything worked as it should.
I didn't find any other blogs talking about this problem yet. This issue happens in Firefox, Chrome and at least IE11.
Although IE11 doesn't seem to play nice with the "lighter" statement.
So to be sure, just use numbers (100 to 900) or bold. not bolder or lighter
Upvotes: 0
Reputation: 5542
When using your "own" fonts, respectively make sure that a certain font is available you should follow certain things.
Firstly how to use @font-face
:
Always use a number (100 - 900) for the font-weight and also define the font-style (most fonts have separate files for normal and italic (for different thickness = font-weight)
@font-face {
font-family: 'MyAwesomeFont';
src: '...';
font-weight: 400; /* 'normal' equals to '400' */
font-style: normal;
}
@font-face {
font-family: 'MyAwesomeFont';
src: '...';
font-weight: 700; /* 'bold' depends on your available font files, normally it is equal to '700' */
font-style: normal;
}
You'll find some further information about font-weight
on this site: https://developer.mozilla.org/en/docs/Web/CSS/font-weight
If the desired font is not loaded, you can check the following points:
Also ensure that all used characters are in the subset of your font file(s).
If you still encounter any problems come here again and let us know. ;-)
Good luck and success!
Upvotes: 1