UIWebView字体在纵向上比横向更薄 [英] UIWebView font is thinner in portrait than landscape

查看:94
本文介绍了UIWebView字体在纵向上比横向更薄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用包含一个UIWebView。当应用程序从纵向旋转到横向或向后旋转时,字体粗细似乎略有变化。粗体文本和常规文本在横向上都略微更粗,在纵向上略微更薄。

My app contains a UIWebView. When the app rotates from portrait to landscape or back, the font weight appears to slightly change. Both bold text and regular text get slightly bolder in landscape, and slightly thinner in portrait.

在Safari中似乎不是这种情况,仅在我的应用程序中。这是一个示例图像,在iPad上作为屏幕截图。我已经轮换并裁剪了示例部分。

This does not appear to be the case in Safari, only in my app. Here is an example image, taken as a screenshot on the iPad. I have rotated and cropped an example section.

alt text http://dl.swankdb.com/font-change-example.png

我配置了以下CSS,但它似乎可以防止剧烈字体大小改变,而不是我观察到的微妙的重量变化:

I have the following CSS configured, but it seems to prevent the drastic font size change, not the subtle weight change that I am observing:

html {
    -webkit-text-size-adjust: none; /* Prevent font scaling in landscape */
}

任何人都可以解释这个吗?模拟器没有这样做 - 但我的iPad,iPhone 3GS和iPhone 4都有它。我也收到客户的报告说它发生在他们身上,所以我知道这不在我脑海里!

Can anyone explain this? The simulator does not do it -- but my iPad, iPhone 3GS and iPhone 4 all have it. I've also received reports from customers that it happens to them, so I know it's not in my head!

推荐答案

我'我已经在Safari中看到了这个,我正在整理一个网络应用程序。经过一天左右的头部刮擦,并解构了iPad用户指南使用的CSS,我发现

I've seen this in Safari itself too with a web app I'm putting together. After a day or so of head scratching, and deconstructing the CSS used by the iPad User Guide, I found that

 -webkit-transform: translate3d(0,0,0);

可以解决问题。谷歌搜索它看起来像这样可以实现渲染的硬件加速,从而在纵向和横向方向上产生更加一致的结果。

does the trick. Googling around it looks like this enables hardware acceleration of rendering which leads to far more consistent results in portrait and landscape orientations.

这篇关于UIWebView字体在纵向上比横向更薄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆