Forums Get help. Give help.
Problems with @font-face fonts on iPhone
-
The site I'm working on is using two embedded @font-face fonts, both using kits from Font Squirrel. Both fonts display perfectly on all my browsers and iOS simulator, but when I load the site on my physical iPhone, only one font displays properly, with the other falling back to another sans-serif font.
I've tried replacing the SVG font and even uploaded the TTF to Font Squirrel to generate a new SVG file, and still no luck. Both fonts are embedded in exactly the same way and come from the same place.
Any ideas? I can't think of anything else to try. -
Link? Name of font?
-
The type designer of Open Sans studied at a University where I grew up (unimportant fact).
Anyway. By any chance have you renamed anything in the CSS or font file itself? -
Have not renamed anything as far as I'm aware. Here is the @font-face code I'm using:
@font-face {
font-family: 'OpenSansLight';
src: url('../fonts/opensans/OpenSans-Light-webfont.eot');
src: url('../fonts/opensans/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/opensans/OpenSans-Light-webfont.woff') format('woff'),
url('../fonts/opensans/OpenSans-Light-webfont.ttf') format('truetype'),
url('../fonts/opensans/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
font-weight: normal;
font-style: normal;
} -
This could be nothing but could it be that
url('../fonts/opensans/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
should be
url('../fonts/opensans/OpenSans-Light-webfont.svg#OpenSans-Light') format('svg');
and that it's the hyphen in the font name tripping you up? -
Just tried that...no luck.
I'm don't recall where I pulled this font-face syntax from but I don't completely understand all of it. Not sure what function the #OpenSansLight after the .svg serves, but during an earlier test I had a different font name there for the CAC Champagne font I'm using and it still worked on iOS devices. I've since changed it but it didn't seem to create any issues. -
Don't know if this will help: http://blog.echoenduring.com/2011/12/01/quick-tip-svg-fonts-font-face/
-
Renders without a problem when I tested this on my iPhone 4S.
http://christopherburton.net/open-sans/demo.html -
@Paulie_D: Thanks for the article. Ironically, the font that does work doesn't match its fragment identifier, and the font that doesn't work does match its fragment identifier. So somehow that's not what's affecting me.
@ChristopherBurton: Your page works for me too.
Digging a little deeper I've realized that iOS 5 doesn't use the .svg file anymore, that's just for older versions of iOS—it's actually using the .ttf file. So I'm wondering if that's where my problem is. I don't think it's a font file or css issue—as the font loads properly everywhere else.
I found this article at Font Squirrel: Troubleshooting Font-Face Problems
The only thing I can think of is that somehow the .ttf file is getting blocked through apache or MAMP when I try to view it locally on an iOS device. I tried inserting the first bit of code the article recommends into my httpd.conf file, and no luck there. I would try the second piece of code, but I'm lost as to what my "calling domain" is.
This is the only other thing I can think of, but I need some help with understanding what that article means (what's an IIS server?). Thanks again for your help with this guys.
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Categories
- All Discussions15,493
- CSS Combat7,193
- Other Discussions3,820
- JavaScript Jungle2,455
- PHP Problems2,025
Tips
Just some helpful hints to get the most out of the forums.