是否可以使用自定义字体 - 使用 font-face?
我能够在网页中嵌入字体并设计其样式,以便在 Android 和 iPhone 上查看,而且效果很好。但是,它不会在 Windows Phone 7.5 上呈现。
我尝试将字体嵌入到 CSS 中:
@font-face {
font-family:'MyFont';
src: url(data:font/woff;charset=utf-8;base64,d09GR...
}
...并且还提供了 eot / ttf 文件,使用适用于所有其他浏览器的声明 -
@font-face {font-family:'MyFont';src:url('../fonts/MyFont-webfont.eot');src:url('../fonts/MyFont-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/MyFont-webfont.svg#MyFontRegular') format('svg'), url('../fonts/MyFont-webfont.woff')format('woff'), url('../fonts/MyFont-webfont.ttf') format('truetype');font-weight:normal;font-style:normal;}
...但仍然没有运气。我不敢相信新的 Windows 手机不允许嵌入字体,并且只支持有限的字体列表,如以下所述:
http://msdn.microsoft.com/en-us/library/hh202920%28v=vs.92%29.aspx
即使它是一个 Javascript 渲染解决方案,任何见解/提示或提示会很棒...一定有某种解决方法!
I'm able to embed and style a font-face in a webpage to view on Android and iPhone, and it works fine. However, it will not render on Windows Phone 7.5.
I've tried embedding the font into the CSS:
@font-face {
font-family:'MyFont';
src: url(data:font/woff;charset=utf-8;base64,d09GR...
}
...and also provided eot / ttf files, using a declaration that works across all other browsers -
@font-face {font-family:'MyFont';src:url('../fonts/MyFont-webfont.eot');src:url('../fonts/MyFont-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/MyFont-webfont.svg#MyFontRegular') format('svg'), url('../fonts/MyFont-webfont.woff')format('woff'), url('../fonts/MyFont-webfont.ttf') format('truetype');font-weight:normal;font-style:normal;}
...but still no luck. I can't believe that the new Windows phones do not allow for font embedding, and only support a limited list of fonts, as mentioned in:
http://msdn.microsoft.com/en-us/library/hh202920%28v=vs.92%29.aspx
Even if it's a Javascript rendering solution, any insight / hints or tips would be great...there must be some kind of workaround!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据 这篇博文是IE9和WP7上的IE9之间的“17个区别”之一。
这是 MSDN 文章证实了这一点。
According to this blog post it's one of the "17 differences" between IE9 and IE9 on WP7.
And here's the MSDN article which officially confirms it.
我成功地使用 Cufón 在 WP 7.5 的 IE 上显示自定义字体。 Typeface.js 不起作用。
I was successful in using Cufón to display custom fonts on IE in WP 7.5. Typeface.js did NOT work.
typeface.js 可以使用它。几分钟前刚刚测试过,因为我需要做同样的事情。它使用画布和矢量图。 http://typeface.neocracy.org/
typeface.js works with it. Just tested it a few moments ago because I need to do the same thing. It uses canvas and vector drawings. http://typeface.neocracy.org/
每当我需要自定义字体时,我都会访问 http://www.fontsquirrel.com/
这是一个很棒的网站,可以让您从 .ttf 文件生成字体套件,包括完整的 CSS 声明以及浏览器兼容性所需的技巧。
我不知道它是否适用于 Win 7 Mobile,但我认为值得一试
Whenever I need custom fonts I visit http://www.fontsquirrel.com/
It's an awesome site that lets you generate font-kits out of a .ttf file including a full CSS declaration with needed hacks for browser compatibility.
I don't know if it works on Win 7 Mobile, but I think it's worth a try