字体等宽的Android 2.3 [英] Font monospace Android 2.3

查看:136
本文介绍了字体等宽的Android 2.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此之前,我在Android Gingerbread上的移动网站和版本存在问题.字体等宽字体并不完全符合等宽字体:不同的字符具有不同的宽度.

I have a problem with a mobile website on Android Gingerbread and versions prior to this. Fonts monospace do not exactly behave as monospaces should: different characters have different widths.

这是在Gingerbread默认Web浏览器上的外观(我也在Dolphin和Opera mini上进行了测试):

This is how it looks on a Gingerbread default web browser (I also tested on Dolphin and Opera mini):

这是在ICS默认网络浏览器上的外观:

This is how it looks on a ICS default web browser:

我使用了从网上下载的Cultive Mono.

I used the Cultive Mono downloaded from the web.

<link href='http://fonts.googleapis.com/css?family=Cutive+Mono' rel='stylesheet' type='text/css'>

CSS:

#my_id span{font:12px  'Cutive Mono', serif; line-height:1.6}

我还尝试了操作系统中的默认等宽字体:

I also tried the default monospace font from the OS:

#my_id span{font:12px  monospace; line-height:1.6}

有人知道如何解决此问题吗?我确实需要在我的移动网站上使用等宽字体.

Does anybody know how can this issue be solved? I really need a monospace working on my mobile website.

谢谢.

这将是jsfiddle中的一个示例: http://jsfiddle.net/HerrSerker/dE94s/9/

This would be an example in jsfiddle: http://jsfiddle.net/HerrSerker/dE94s/9/

推荐答案

找到了针对我的案例的修复程序,如果缺少一个字体,Andorid似乎不渲染字体.

Found a fix for my case, it's seems that Andorid don't render fonts if one is missing.

这不起作用:

font-family: FreeMono, Courier, monospace;

但如果我使用,则可以工作:

but work if I use:

font-family: FreeMono, Courier, monospace;
font-family: monospace;

在此代码中,第二条规则可能会覆盖第一条规则.

In this code probably second rule overwrite the first one.

对于浏览器来说又是一件奇怪的事情,如果有人对此进行解释或提供更多详细信息,我将给予他赏金.

Just another weird thing with browsers, if anybody explain this or give more details, I'll give him a bounty.

这篇关于字体等宽的Android 2.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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