About CJK bold Droid Sans font rendering issue on MeeGo

57 views
Skip to first unread message

ningxin.hu

unread,
Apr 13, 2010, 11:56:02 PM4/13/10
to Chromium-dev
Hi,
I use chromium on MeeGo netbook OS. Doird font is designed for
compact
screen such as netbook. MeeGo netbook OS sets it as preferred font.
But the CJK bold font are rendered to box in chromium. It's really a
bad user experience.
I found there is a issue (http://code.google.com/p/chromium/issues/
detail?id=31232) which has same problem on Fedora Core.
I investigated this issue on Moblin/Meego which have droid font
installed (the fontconfig is very similar to Fedora Core).
From my trace of 5.0.355:
1. When Webkit wants to select a font for rendering a bold Chinese
(or
JK) character,
it calls into WebCore::FontCache::getFontDataForCharacters
(FontCacheLinux.cpp).
2. the ChromiumBridge::getFontFamilyForCharacters returns "Droid
Sans" family
3. then Webkit uses this family name to invoke
SkFontHost::CreateTypeface
(skia/ext/SkFontHost_fontconfig.cpp) which will try to match a font.
4. FontConfigDirect::Match (skia/ext/
SkFontHost_fontconfig_direct.cpp)
uses family
name (here is "Droid Sans") + weight (here is bold) to call
fontconfig
to match a font.
5. fontconfig returns "/usr/share/fonts/droid/DroidSans-Bold.ttf",
but
this font has
no Chinese glyph data. So when skia wants to draw it, it fails.
In my test, if we specify the lang info (here zh-cn) to call
fontconfig (the match pattern is 'Droid Sans' + 'bold' + 'zh-cn',
fontconfig will return /usr/share/fonts/droid/DroidSansFallback.ttf,
then skia will use fake bold to draw the bold Chinese character
successfully.
We can exam the current chromium (webkit) behavior by fc-match
command.
In this case, webkit choose font only family + weight (of cause, also
by italic and
scalable, for simplicity, we ignore them in this case).
fc-match -s "Droid Sans":weigth=bold
DroidSans.ttf: "Droid Sans" "Regular"
DroidSansFallback.ttf: "Droid Sans" "Regular"
...
however, DroidSans.ttf has no glyph data for CJK language
fc-match -s "Droid Sans":weigth=bold:lang=zh-cn
DroidSansFallback.ttf: "Droid Sans" "Regular"
DroidSans.ttf: "Droid Sans" "Regular"
...
DroidSansFallback.ttf has the glyph data for CJK, skia can use them
to
do fake bold rendering.
So suggest to to introduce language info when webkit invokes
fontconfig to select font.
Comments are welcome.
regards,
ningxin

Nico Weber

unread,
Apr 13, 2010, 11:59:34 PM4/13/10
to ningx...@gmail.com, Chromium-dev
This list is not for reporting bugs. Instead, please add a comment to
the existing bug you found, or open a new issue at
http://new.crbug.com .

Nico

> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
>    http://groups.google.com/a/chromium.org/group/chromium-dev
>

Evan Martin

unread,
Apr 14, 2010, 12:42:38 AM4/14/10
to tha...@chromium.org, ningx...@gmail.com, Chromium-dev
Thank you for your nice analysis! If only people could track down all
of our bugs to this extent.

But Nico is correct. I believe the bug you are looking for in this case is
http://code.google.com/p/chromium/issues/detail?id=32109
I tried a few incorrect fixes for this before I had enough of the font
code in my head to see the correct place to implement it. See comment
3. If you get the chance to write a patch I would be happy to review
it.

Reply all
Reply to author
Forward
0 new messages