I dont understand whats going on here because when I had this code on its own it was working (in FireFox):
@font-face {
font-family: 'mmfont';
src: url('/scripts/mmfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Then I added a second font in exactly the same manner, but only the first one was working:
@font-face {
font-family: 'mmfont2';
src: url('/scripts/mmfont2.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Then I used a font-generator to get an EOT file for IE9 and generate the @font-face code for me, but now neither font is working in any browser (I tried IE9, FF12, Chrome & Safari5).
I then put the @font-face CSS in its own '/scripts/fonts.css' file so that the fonts and CSS were in the same folder, and I tried to use the URLs both directly ('mmfont.ttf') and by the webroot folder ('/scripts/mmfont.ttf') but still neither way is working at all.
What am I doing wrong?
Correction:
I had a typo when calling the first font 'mmfont' I did this: font-family: mm_font
but now that I fixed the typo, once again only the 1st font is working with the code below, and the second font mmfont2
is not working. I tried to re-arrange the order (define the 2nd font first) but it still wont work. So now I believe there is a problem with my font file, so I will try to get another copy and see how that goes.
Update:
There seems to be nothing wrong with the code. I used FireBug to do a Source Edit of the fonts.css file, and when I renamed the url for 'mmfont2' to 'mmfont.ttf' (the URL for the 1st font) it updated the page and the font loaded, however when I renamed it back to 'mmfont2.ttf' it went back to the default font of the browser. So I am now sure it is a problem with the font file rather than the code.
It looks like this 2nd font I'm using isn't a web-compatible font. Funnily, it turns out that all along the same font has another alias "Century Gothic" which is a web-safe font and works in all the browsers without even having to link any files!!
(I don't know if I should have this question closed or deleted)
/scripts/fonts.css
@CHARSET "ISO-8859-1";
@font-face {
font-family: 'mmfont';
src: url('/scripts/mmfont.eot');
src: url('/scripts/mmfont.eot?#iefix') format('embedded-opentype'),
url('/scripts/mmfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'mmfont2';
src: url('/scripts/mmfont2.eot');
src: url('/scripts/mmfont2.eot?#iefix') format('embedded-opentype'),
url('/scripts/mmfont2.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/index.html
<link rel="StyleSheet" href="/scripts/fonts.css" type="text/css">
directory
/
/index.html
/scripts/
/scripts/mmfont.ttf
/scripts/mmfont.eot
/scripts/mmfont2.ttf
/scripts/mmfont2.eot
/scripts/fonts.css