默认的字体在Android设置 [英] Default font set on Android

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

问题描述

谁能告诉我什么是大​​多数Android设备捆绑的字体,专门针对网页?

Can anyone tell me what are the bundled fonts on most Android devices, specifically for web pages?

就像 Windows已经自己捆绑字体或的Mac字体列表的,什么是来与大多数Android手机和平板电脑的字体?任何人都可以指向一个清单在网络上?

Just like Windows has their bundled fonts or Mac font lists, what are the fonts that come with most Android phones and tablets? Can anyone point to a list on the web?

我制作网页,并要建立我的CSS来降低正常使用新的字体,只是简单的醇'无衬线和衬线字体系列。 THX。

I'm making web pages and want to set up my CSS to degrade gracefully from using newer fonts to just plain ol' "sans-serif" and "serif" font families. Thx.

推荐答案

Grstmo的回答扩大:

system_fonts.xml 从字体 - 定义映射家庭实际的字体文件。因此,让我们试试这些:

system_fonts.xml defines mapping from font-family to actual font files. So let's try these:

<div style="font-family: sans-serif; font-style: normal">Regular</div>
<div style="font-family: sans-serif; font-style: italic">Italic</div>
<div style="font-family: sans-serif; font-weight: bold">Bold</div>
<div style="font-family: sans-serif; font-weight: bold; font-style: italic">Bold-italic</div>

<div style="font-family: sans-serif-light; font-style: normal">Light</div>
<div style="font-family: sans-serif-light; font-style: italic">Light-italic</div>

<div style="font-family: sans-serif-thin; font-style: normal">Thin</div>
<div style="font-family: sans-serif-thin; font-style: italic">Thin-italic</div>

<div style="font-family: sans-serif-condensed; font-style: normal">Condensed regular</div>
<div style="font-family: sans-serif-condensed; font-style: italic">Condensed italic</div>
<div style="font-family: sans-serif-condensed; font-weight: bold">Condensed bold</div>
<div style="font-family: sans-serif-condensed; font-weight: bold; font-style: italic">Condensed bold-italic</div>

<div style="font-family: serif; font-style: normal">Serif Regular</div>
<div style="font-family: serif; font-style: italic">Serif Italic</div>
<div style="font-family: serif; font-weight: bold">Serif Bold</div>
<div style="font-family: serif; font-weight: bold; font-style: italic">Serif Bold-italic</div>

<!-- "Droid Sans" actually gives you Roboto. -->
<div style="font-family: &quot;Droid Sans&quot;; font-style: normal">Droid Sans Regular</div>
<div style="font-family: &quot;Droid Sans&quot;; font-weight: bold">Droid Sans Bold</div>

<div style="font-family: monospace; font-style: normal">Monospace Regular</div>

http://jsfiddle.net/9z3tD/4/ => (在Android 4.2测试)

http://jsfiddle.net/9z3tD/4/ => (tested on android 4.2)

编辑:德罗伊德桑中的截图显然是Roboto。 该配置支持,但事实证明<一个href="https://github.com/android/platform_frameworks_base/blob/0d9c922c9614147d1277cb36cfb7296774415d15/data/fonts/Android.mk#L38-39"相对=nofollow>底层文件是simlink : DroidSans.ttf - &GT; Roboto-Regular.ttf DroidSans-Bold.ttf - &GT; Roboto-Bold.ttf

"Droid Sans" in the screenshot is clearly Roboto. The config supports it but turns out the underlying file is a simlink: DroidSans.ttf -> Roboto-Regular.ttf, DroidSans-Bold.ttf -> Roboto-Bold.ttf

编辑:这似乎并不重要我是否引用的姓氏( http://jsfiddle.net / 9z3tD / 9 / 的呈现是相同的)。如通用关键字之间CSS区分衬线并引用这指的是字体的名字恰巧是衬线;但XML配置没什么区别,所以我的的猜测的android系统中任一语法是指字体名称为衬线。但是,的可以的有差别,如果你创建一个自定义的WebView并将其配置为通用映射关键字到其他字体(<一href="https://developer.android.com/reference/android/webkit/WebSettings.html#setSerifFontFamily(java.lang.String)"相对=nofollow> setSerifFontFamily() 和朋友)。

It doesn't seem to matter whether I quote the family names (http://jsfiddle.net/9z3tD/9/ renders the same). CSS distinguishes between generic keywords like serif and quoted "serif" which refers to a font whose name happens to be "serif"; but the xml config makes no distinction so I guess in android either syntax refers to a font whose name is "serif". But there may be a difference if you create a custom WebView and configure it to map generic keywords to other fonts (setSerifFontFamily() and friends).

再就是 fallback_fonts.xml 。这些没有名字;例如你不能说字体家庭:德罗伊德桑回退
。 但是,所有的人都suppossed去受审;每缺少的字形在其他字体。 presumably可以使用,甚至选择一个子集字体变优雅紧凑型,并通过设置文本 LANG =JA
但是我没有看到德罗伊德桑后备使用在所有所以可能回退不能在WebKit的工作: - (

Then there are fallback_fonts.xml. These have no names; e.g. you CAN'T say font-family: "Droid Sans Fallback".
But all of them are suppossed to be tried for every missing glyph in other fonts. Presumably one can even choose a subset using font-variant of "elegant" or "compact" and by setting text lang="ja"?
However I don't see Droid Sans Fallback being used at all so perhaps fallbacks don't work in WebKit :-(

免责声明:以上适用于普通的Andr​​oid,使用的股票浏览器和/或Chrome。我的认为的它也适用于web视图(使用默认配置),但还没有测试过。

Disclaimer: The above applies to stock Android, using stock browser and/or Chrome. I believe it also applies to WebView (with default config) but haven't tested.

在理论上厂家可以使用其他字体,如我听到传言三星做的。在上BrowserStack有的所有所有的Andr​​oid设备的做法截图 - 包括三星 - 看我的未经训练的眼睛是Roboto或Droid的,是刚刚发布的Andr​​oid的差异... 不过这里是银河S3抓到不走样格鲁吉亚衬线 这样的的东西的不同。

In theory manufacturers may use other fonts, e.g. I heard rumors Samsung does it. In practice screenshots on all android devices BrowserStack had all — including Samsungs — look to my untrained eyes to be Roboto or Droid, the differences being just android releases... However here is Galaxy S3 caught not aliasing Georgia to serif so something differs.

火狐是一个浏览器的一个很好的例子,做不同 - 他们切换到的打开SAN和的Charis SIL紧凑,随后的替换打开三世与Clear三世
完整的配置是 LIB preF /初始化/ all.js的并依赖于语言。
据我所知,火狐无视system_fonts.xml的别名,如: 格鲁吉亚导致Sans字体。
OTOH,旧版本(测试30,34)<一href="http://app.crossbrowsertesting.com/public/i866dfd0fa0b9da1/livetests/2829137/snapshots/z52e17c6de3d96d99b2f"相对=nofollow>允许您参考系统字体的名字,甚至德罗伊德桑后备但这<一个href="http://app.crossbrowsertesting.com/public/i866dfd0fa0b9da1/livetests/2829146/snapshots/zfd0f4c5ca06a7138a26"相对=nofollow>不上FF 36上班,37 (这两个结果对的 HTTP://$c$cpen.io/cben/pen/VYgPEE ,使用AdobeBlank意味着,当你看到字符,该字体使用)

Firefox is a good example of a browser doing it differently — they switched to Open Sans and Charis SIL Compact, then replaced Open Sans with Clear Sans.
The full config is in libpref/init/all.js and is language-dependent.
As far as I can tell, Firefox disregards the system_fonts.xml's aliases, e.g. Georgia results in a sans font.
OTOH, older versions (tested 30, 34) allowed you to refer to system fonts by name, even to Droid Sans Fallback but this doesn't work on FF 36, 37 (these 2 results are for http://codepen.io/cben/pen/VYgPEE, use of AdobeBlank means that when you see chars, that font was used).

参见相关答案。

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

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