2011-01-31 13 views
14

iPhone 3GSのSafari、デフォルトのAndroid 2.2ブラウザ、およびAndroidのDolphinブラウザで、私が試したモバイルWebkitブラウザでは、@font-faceの動作に問題があります。モバイルウェブキットで@ font-faceが動作しない

IE7、IE3、FF3.5、Safari 4、Operaのすべてのデスクトップブラウザで動作します。

フォントおよびCSSがFontSquirrelから、次のとおりです。

@font-face { 
    font-family: 'LeagueGothicRegular'; 
    src: url('../fonts/League_Gothic-webfont.eot'); 
    src: local('☺'), 
     url('../fonts/League_Gothic-webfont.woff') format('woff'), 
     url('../fonts/League_Gothic-webfont.ttf') format('truetype'), 
     url('../fonts/League_Gothic-webfont.svg#webfontFHzvtkso') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'LatinModernRoman10Bold'; 
    src: url('../fonts/lmroman10-bold-webfont.eot'); 
    src: local('☺'), 
     url('../fonts/lmroman10-bold-webfont.woff') format('woff'), 
     url('../fonts/lmroman10-bold-webfont.ttf') format('truetype'), 
     url('../fonts/lmroman10-bold-webfont.svg#webfonthCDr6KZk') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'LatinModernRoman10BoldItalic'; 
    src: url('../fonts/lmroman10-bolditalic-webfont.eot'); 
    src: local('☺'), 
     url('../fonts/lmroman10-bolditalic-webfont.woff') format('woff'), 
     url('../fonts/lmroman10-bolditalic-webfont.ttf') format('truetype'), 
     url('../fonts/lmroman10-bolditalic-webfont.svg#webfontegrLi3sm') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

私はSVGフォントソースでSVG IDをチェックしました、そして、彼らはすべてのマッチアップ。

CSSで後で文字間隔規則があるためでしょうか?

ありがとうございます!

答えて

17

結論としては、構文が間違っていました。私はTwitterでこのソリューションに出くわし:それは完全に働いた

http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax

。すべての主要なブラウザをチェックインするだけで、AndroidやiOSなどのフォントが表示されます。

さて、私のCSSはそうのように読み取ります

@font-face { 
    font-family: 'LeagueGothicRegular'; 
    src: url('../fonts/League_Gothic-webfont.eot#') format('eot'), 
     url('../fonts/League_Gothic-webfont.woff') format('woff'), 
     url('../fonts/League_Gothic-webfont.ttf') format('truetype'), 
     url('../fonts/League_Gothic-webfont.svg#webfontFHzvtkso') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'LatinModernRoman10Bold'; 
    src: url('../fonts/lmroman10-bold-webfont.eot#') format('eot'), 
     url('../fonts/lmroman10-bold-webfont.woff') format('woff'), 
     url('../fonts/lmroman10-bold-webfont.ttf') format('truetype'), 
     url('../fonts/lmroman10-bold-webfont.svg#webfonthCDr6KZk') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'LatinModernRoman10BoldItalic'; 
    src: url('../fonts/lmroman10-bolditalic-webfont.eot#') format('eot'), 
     url('../fonts/lmroman10-bolditalic-webfont.woff') format('woff'), 
     url('../fonts/lmroman10-bolditalic-webfont.ttf') format('truetype'), 
     url('../fonts/lmroman10-bolditalic-webfont.svg#webfontegrLi3sm') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

優れた防弾ソリューションは、そこに一顧smileyfaceハックよりもあります知ってうれしいです。

これが誰かを助けることを願っています!

+1

2番目の「eot」にアポストロフィがありませんまた、スマイリーフェイスハックとは何ですか...私はそれについて聞いたことがありませんか? :)☺ –

+1

ヘッドアップありがとう!編集されました。 smileyfaceの構文[Paul Irishのブログ](http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/)について読むことができます。 – bigsweater

+3

変更した内容とその理由を説明する必要があります。あなたのスマイリーを取り除き、 '# ')書式(' eot ')をあなたのeotフォントに加えたようです。仕様には、フォーマット( 'embedded-opentype')が必要であることが示されているようです。 – xr280xr

0

http://caniuse.com/woffによれば、Android 2.3,4,4.1,4.2、および4.3は、woffフォントをサポートしていません。したがって、ttfも追加する必要があります。私はAndroid 4.1と4.2でテストしていて、うまくいきました。しかし、4.0.3では、tffフォントを追加する必要がありました。

Googleからttfフォントをダウンロードするには、http://sanchez.org.ph/use-host-and-download-google-fonts-on-your-own-website/をご覧ください。