2011-01-31 27 views
14

Mam problem z uzyskaniem @font-face zachowania się w dowolnej testowanej przeglądarce mobilnej Webkit - Safari na iPhonie 3GS, domyślnej przeglądarce Androida 2.2 i przeglądarce Dolphin na Androidzie.@ Czcionka-twarz nie działa w mobilnym pakiecie Webkit

Działa we wszystkich przeglądarkach komputerowych, od IE7 do IE9, FF3.5, Safari 4 i Opera.

Czcionki i CSS są od 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; 
} 

Sprawdziłem SVG identyfikator w źródle czcionek SVG, i wszyscy zgadzają.

Czy to możliwe, ponieważ w CSS mam jakieś zasady dotyczące odstępów między literami?

Dzięki!

Odpowiedz

17

Jak się okazało, składnia była błędna. Natknąłem tego rozwiązania poprzez twitter:

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

To działało idealnie. Po prostu zaznaczyłem wszystkie główne przeglądarki i pojawiły się moje czcionki, w tym na Androida i iOS.

Teraz mój CSS brzmi tak:

@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; 
} 

Dobrze jest wiedzieć, że jest to lepsze rozwiązanie kuloodporny tam niż hack Dang smileyface.

Mam nadzieję, że to pomoże komuś!

+1

Brakuje ci apostrofu na twoim drugim "eot". Co to jest uśmiechniętą buźkę ... Nigdy o tym nie słyszałem? :) ☺ –

+1

Dzięki za heads up! Edytowane. Możesz przeczytać o składni uśmiechniętej twarzy [na blogu Paula Irish'a] (http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/). – bigsweater

+3

Powinieneś opisać, co zmieniłeś i dlaczego. Wygląda na to, że pozbyłeś się swojej buźki i dodałeś "#") format ('eot'), 'do twoich eot fontów. Wygląda na to, że specyfikacja powinna mieć format ("embedded-opentype"). – xr280xr

Powiązane problemy