È possibile implementare il carattere OTF
utilizzando @ font-face come:
@font-face {
font-family: GraublauWeb;
src: url("path/GraublauWeb.otf") format("opentype");
}
@font-face {
font-family: GraublauWeb;
font-weight: bold;
src: url("path/GraublauWebBold.otf") format("opentype");
}
Tuttavia, se si desidera supportare una vasta gamma di browser moderniti consiglierei di passare a WOFF
e TTF
tipi di font . Il tipo WOFF
è implementato da tutti i principali browser desktop, mentre il tipo TTF
è un fallback per i browser Safari, Android e iOS meno recenti. Se il tuo font è un font gratuito, puoi convertire il tuo font usando ad esempio uno onlinefontconverter.
@font-face {
font-family: GraublauWeb;
src: url("path/GraublauWebBold.woff") format("woff"), url("path/GraublauWebBold.ttf") format("truetype");
}
Se si vuole sostegno quasi tutti i browser che è ancora là fuori (non più necessario IMHO), si dovrebbe aggiungere un po 'più di carattere tipi come:
@font-face {
font-family: GraublauWeb;
src: url("webfont.eot"); /* IE9 Compat Modes */
src: url("webfont.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("webfont.woff") format("woff"), /* Modern Browsers */
url("webfont.ttf") format("truetype"), /* Safari, Android, iOS */
url("webfont.svg#svgFontName") format("svg"); /* Legacy iOS */
}
Si può leggere di più sul perché tutti questi tipi sono implementati e sui loro hack here. Per avere una visione dettagliata di quali tipi di file sono supportati da quali browser, vedi:
@font-face Browser Support
EOT Browser Support
WOFF Browser Support
TTF Browser Support
SVG-Fonts Browser Support
speranza che questo aiuti
Forse javascript deve essere rimosso dall'elenco di tag qui? – kzh