Hi Jonathan,

thanks for the feedback, more inline.

On 8/8/13 5:17 PM, Jonathan Kew wrote:
On 8/8/13 15:17, Axel Hecht wrote:
Hi,

I'm looking for a review of some rather hacky tool I just created to see
if the fonts on b2g actually support a particular language.

https://github.com/Pike/font-tool

Basic outline of what the tool does:

Parses langGroups.properties to see which locale has which group, with
default to x-unicode.

Preprocesses all.js with -DANDROID -DMOZ_WIDGET_GONK, and parses
pref("font.name....")

Uses fc-scan to find all the fonts in moztt and
platform/frameworks/base, pick those with style Regular.

Uses fc-validate to figure out if those fonts actually support the given
locale.

Example, Bulgarian seems to be missing 60 glyphs for monospace:

python buildfonts.py /src/central/mozilla-central/ bg
monospace
moztt/SourceCodePro-1.017/SourceCodePro-Regular.ttf:0 Missing 60
glyph(s) to satisfy the coverage for bg language

That sounds plausible, as SourceCodePro does not yet have Cyrillic
support. (Do we have Droid Sans Mono on the device? If so, we should
probably be falling back to that.)

Nice, filed https://bugzilla.mozilla.org/show_bug.cgi?id=903038.

sans-serif
base/data/fonts/Roboto-Regular.ttf:0 Satisfy the coverage for bg language
serif
moztt/CharisSILCompact-4.114/CharisSILCompact-R.ttf:0 Satisfy the
coverage for bg language

Couter example seems to be Chinese, the unagi shows something, while my
tool reports 13k missing glyphs for zh-TW.

Not surprising, really. Two issues here: first, we rely on font fallback
to find a font that supports a given character, if the default specified
by prefs doesn't have it. In the case of Chinese, I think we tend to
list a Latin font so that it will be used (rather than the often-ugly
Latin glyphs in a Chinese font) for Latin characters, which are commonly
found mixed in to Chinese pages, and then rely on fallback to find the
actual Chinese font when needed.

So you'd need to check the fallback font (probably Droid Sans Fallback,
unless there's something else we're shipping on b2g), not necessarily
the font listed in prefs.

And second, "validating" the character coverage of a Chinese font is a
bit tricky - you'll need to specify more carefully what the exact
requirements are. For Chinese, there are tens of thousands of glyphs
that are part of the writing system, but most everyday text will only
use a relatively small subset - still several thousand, but nowhere near
"everything".

The file fontconfig/tree/fc-lang/zh_tw.orth notes that it is "Made by
trimming the Big5 -> unicode mapping down to just Chinese glyphs", which
results in a list of around 13,000 characters. In contrast, according to
[1] (though estimates will vary, no doubt), "An educated Chinese person
will know about 8,000 characters, but you will only need about 2-3,000
to be able to read a newspaper". So for most practical purposes, that
collection should be (more than) sufficient.

If we're using Droid Sans Fallback, I believe it supports somewhere well
over 20,000 Chinese characters, so that probably includes all those in
fontconfig's list - but that still doesn't mean it has *every* possible
Chinese character.

Yeah, I see DroidSansFallback in fonts.mk in moztt, https://github.com/mozilla-b2g/moztt/blob/master/fonts.mk#L31, but how would we pick that up?

Axel


JK


[1]
http://www.bbc.co.uk/languages/chinese/real_chinese/mini_guides/characters/characters_howmany.shtml



_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to