問題描述

任何人都可以告訴我大多數 Android 裝置上的捆綁字型是什麼,特別是網頁?

就像 Windows has their bundled fontsMac font lists 一樣,大多數 Android 手機和平板電腦的字型是什麼?任何人都可以指向網路上的列表?

我正在製作網頁,並希望設定我的 CSS 從正常使用較新的字型降級到純粹的”sans-serif” 和”serif” 字型系列。謝謝。

最佳解決思路

擴充套件 Grstmo’s answer

system_fonts.xml 定義了從 font-family 到實際字型檔案的對映。所以讓我們試試這些:

<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 中測試)

編輯:”Droid Sans” 在截圖中顯然是 Roboto 。該配置支援它,但結果是 the underlying file is a simlinkDroidSans.ttf -> Roboto-Regular.ttfDroidSans-Bold.ttf -> Roboto-Bold.ttf

編輯:我是否引用姓氏似乎並不重要 (http://jsfiddle.net/9z3tD/9/呈現相同的) 。 CSS 區分了 serif 和引用"serif"的通用關鍵字,它指的是一個名稱恰好是”serif” 的字型; 但是 xml 配置沒有區別,所以我猜 android 中的語法是指一個名稱為”serif” 的字型。但是如果您建立自定義 WebView 並將其配置為將通用關鍵字對映到其他字型 (setSerifFontFamily()和朋友) 可能會有所不同。

那麼還有 fallback_fonts.xml 。這些沒有名字例如你不能說 font-family: "Droid Sans Fallback"。但是,所有這些都被禁止在其他字型中的每個丟失的字形中被嘗試。大概可以使用"elegant""compact"font-variant 選擇一個子集,並透過設定文字 lang="ja"?然而,我看不到 Droid Sans Fallback 在所有使用,所以也許 fallbacks 不工作在 WebKit 🙁


免責宣告:以上適用於股票 Android,使用股票瀏覽器和/或 Chrome 。我相信它也適用於 WebView(預設配置) 但尚未測試。

在理論上,製造商可以使用其他字型,例如我聽說三星做謠言。實際上,所有 Android 裝置上的所有 Android 裝置螢幕截圖都包含三星,包括三星在內的我未經訓練的眼睛是 Roboto 或 Droid,差異僅在於 Android 發行版。但是,這裡是 Galaxy S3 沒有將 Georgia 別名為 serif,所以有些不同。

Firefox 是瀏覽器不同的一個很好的例子,它們切換到 Open Sans and Charis SIL Compact,然後切換到 replaced Open Sans with Clear Sans 。完整配置在 libpref/init/all.js 中,是 language-dependent 。據我所知,Firefox 忽略了 system_fonts.xml 的別名,例如 Georgia 導致無效字型。 OTOH,舊版本 (測試 30,34)allowed you to refer to system fonts by name, even to Droid Sans Fallback,但這個 doesn’t work on FF 36, 37(這兩個結果是針對 http://codepen.io/cben/pen/VYgPEE,使用 AdobeBlank 意味著當您看到字元時,使用該字型) 。


另請參閱 relevant answer 關於應用程式可用的字型。

次佳解決思路

這已經在這裡回答:How to retrieve a list of available/installed fonts in android? 只有 3 種字型可用作 Android 的一部分; 正常 (Droid Sans),襯線 (Droid Serif) 和等離子體 (Droid Sans Mono) 。

第三種解決思路

從 Android 4.1 可以使用這個例子:

font-family: sans-serif-light;

參考文獻

注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。