我正在为@font face 使用以下 CSS。它适用于我的桌面和我测试过的 IOS 设备。但它在 Android 上失败了:
@font-face {
font-family: 'ReformaGroteskMedium';
src: url('/css/fonts/reforma_grotesk/26890C_0_0.eot');
src: url('/css/fonts/reforma_grotesk/26890C_0_0.eot?#iefix') format('embedded-opentype'),
url('/css/fonts/reforma_grotesk/26890C_0_0.woff') format('woff'),
url('/css/fonts/reforma_grotesk/26890C_0_0.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
我注意到从 http://www.fontsquirrel.com/ 生成的字体(哪些工作)以完全相同的方式嵌入,除了它们还有以下行:
url('SourceSansPro-ExtraLightIt-webfont.svg#SourceSansProExtraLightItalic') format('svg');
这就是我的版本不工作的原因吗,Android 只支持 SVG 吗?
我在 Asus 平板电脑上使用的 Android 版本是 4.0.1。它在较新的 Android 手机上运行良好。
最佳答案
引用来自 THIS ARTICLE 的 Moz 开发网络:
When SVG was specified support for web fonts was far from being expected. Since the correct font is however crucial for the rendering of a graphic, it was decided to add a font description technology to SVG. It was not meant to concur with other formats like PostScript or OTF, but as a simple means of embedding glyph information for rendering engines.
所以我想应该始终将 SVG(可缩放矢量图形)格式用作允许任何浏览器/设备引擎正确呈现字体的“降落伞”。
无论如何,我没有找到任何关于 Android 4.0.1 和字体导入的官方信息,但我强烈建议在导入字体时始终使用 SVG 格式。
关于android - @font face 不适用于 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16223771/