Ticket #219 (assigned defect)

Opened 2 months ago

Last modified 2 months ago

Non-english fonts are not available

Reported by: hiyuh Assigned to: odole (accepted)
Priority: major Milestone: Galekid
Component: Bug Fix Version: 1.0
Keywords: fontconfig lang Cc: hyoksung
Number of hours worked: 12 % Complete: 00
Number of hours remaining:

Description

Both trunk r255 w/

cmake \
	-D WEBKIT_DEBUG="RELEASE"            \
	-D WEBKIT_USE_I18N="ICU"             \
	-D WEBKIT_USE_JS="ON"                \
	-D BUILD_SHARED_LIBS="ON"            \
	-D WEBKIT_USE_FONTS="FREETYPE"       \
	-D WEBKIT_USE_WEB_UI="ON"            \
	-D WEBKIT_USE_EVENTS="SDL"           \
	-D WEBKIT_USE_GRAPHICS="SDL"         \
	-D WEBKIT_USE_IMAGEDECODER="GENERIC"

and Doduo r262 w/

cmake \
	-D BUILD_SHARED_LIBS="ON"                   \
	-D CMAKE_COLOR_MAKEFILE="ON"                \
	-D CMAKE_VERBOSE_MAKEFILE="OFF"             \
	-D COMPILE_TESTS="ON"                       \
	-D OWBAL_BENCH_LOAD_TIME="OFF"              \
	-D OWBAL_PLATFORM_MACPORT="OFF"             \
	-D OWBAL_PLATFORM_GRAPHICS="SDL"            \
	-D WEBKIT_DEBUG="RELEASE"                   \
	-D WEBKIT_USE_CC_EXCEPTIONS="OFF"           \
	-D WEBKIT_USE_CC_PIC="ON"                   \
	-D WEBKIT_USE_CC_RTTI="OFF"                 \
	-D WEBKIT_OFFLINE_WEB_APPLICATIONS="ON"     \
	-D WEBKIT_USE_CROSS_DOCUMENT_MESSAGING="ON" \
	-D WEBKIT_USE_DASHBOARD="ON"                \
	-D WEBKIT_USE_DATABASE="ON"                 \
	-D WEBKIT_USE_DOM_STORAGE="ON"              \
	-D WEBKIT_USE_FILESYSTEM="POSIX"            \
	-D WEBKIT_USE_FONTS="FREETYPE"              \
	-D WEBKIT_USE_HTML5_VIDEO="OFF"             \
	-D WEBKIT_USE_I18N="ICU"                    \
	-D WEBKIT_USE_NPAPI="OFF"                   \
	-D WEBKIT_USE_SVG="ON"                      \
	-D WEBKIT_USE_SYSTEMTIME="LINUX"            \
	-D WEBKIT_USE_THREADING="PTHREADS"

won't show non-english font properly. It looks like "ALL THE FONTS ARE BELONG TO TOFU". NOTE: Tofu is a japanese word. It is "bean curd", "fermented bean curd", "pate de soja". :)

Attachments

Doduo-r262-Google-is-belong-to-TOFU.jpg (116.9 kB) - added by hiyuh on 06/12/08 17:18:46.
google.cn.jpg (140.3 kB) - added by hyoksung on 06/20/08 01:17:42.
Safari 3.1.1 www.google.cn
google.co.jp.jpg (124.5 kB) - added by hyoksung on 06/20/08 01:18:51.
Safari 3.1.1 www.google.co.jp
google.co.jp.2.jpg (124.5 kB) - added by hyoksung on 06/20/08 01:19:06.
Safari 3.1.1 www.google.co.jp
google.co.kr.jpg (126.9 kB) - added by hyoksung on 06/20/08 01:20:34.
Safari 3.1.1 www.google.co.kr

Change History

06/12/08 17:18:46 changed by hiyuh

  • attachment Doduo-r262-Google-is-belong-to-TOFU.jpg added.

06/12/08 17:19:44 changed by hiyuh

  • type changed from task to defect.

06/12/08 17:43:47 changed by jcverdie

  • milestone set to Doduo.

06/15/08 19:33:11 changed by odole

  • hours_worked set to 2.
  • keywords set to fontconfig lang.
  • status changed from new to assigned.
  • owner changed from sroret to odole.

After a first search, the method responsible of this mess seems to be:

FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName)

in BAL/WKAL/Concretizations/Fonts/Freetype/BCFontPlatformDataFreetype.cpp file. As a matter of fact if we add the following in the method:

    if (!FcPatternAddString(pattern, FC_LANG, (const FcChar8*) "ja"))
        goto freePattern;

google.co.jp is correctly displayed. In the same way, replace "ja" string by "zh-cn" to correctly display google.cn.
So there are missing info about langage in order to allow fontconfig to select the correct font.

06/18/08 01:01:24 changed by hyoksung

  • cc set to hyoksung.

06/19/08 15:29:33 changed by odole

  • hours_worked changed from 2 to 12.

after further investigation, this is also a WebKit which never store lang parameters.
See this link: https://bugs.webkit.org/show_bug.cgi?id=10874 for a better explanation.

06/20/08 01:17:42 changed by hyoksung

  • attachment google.cn.jpg added.

Safari 3.1.1 www.google.cn

06/20/08 01:18:51 changed by hyoksung

  • attachment google.co.jp.jpg added.

Safari 3.1.1 www.google.co.jp

06/20/08 01:19:06 changed by hyoksung

  • attachment google.co.jp.2.jpg added.

Safari 3.1.1 www.google.co.jp

06/20/08 01:20:34 changed by hyoksung

  • attachment google.co.kr.jpg added.

Safari 3.1.1 www.google.co.kr

06/20/08 01:28:09 changed by hyoksung

Curiously, my safari 3.1.1 on win xp works good on CJK pages. (see the attachments : http://www.sand-labs.org/owb/attachment/ticket/219/google.cn.jpg, http://www.sand-labs.org/owb/attachment/ticket/219/google.co.kr.jpg) And Konqueror also does well. Is the bug fixed or the problem may not come from the lang parameter?

06/20/08 10:07:16 changed by jcverdie

Hyoksung: Mac and QT Fonts are handling correctly the issue while freetype or pango do not :(

06/20/08 10:19:01 changed by odole

To be more precise: Mac, Qt and probably windows font renderer are clever enough to retrieve the correct glyph to render if it is not found in current font face.
Nonetheless the correct way to handle this should be "lang" attribute which does not seem to be parsed inside WebCore so that information could not be delivered to FontPlatform.

(follow-up: ↓ 10 ) 06/20/08 16:32:24 changed by hyoksung

Actually, the result of the FcFontMatch;

m_pattern = FcFontMatch(config, pattern, &fcresult);

is not "FcResultMatch". In my Linux PC, it always returns "Arial" font even if I put the FC_LANG to be "ja" or "ko" expecting some Japanese or Korean font selected.Only when I manually set the FC_FAMILY to be the right LANG font(e.g.fcfamily = "Baekmuk Gulim"; for 'ko' case), the rendering works okay.

BTW, cairo does not accept the FcFontMatch result when the result value is not "FcResultMatch";

in "cairo_ft_font.c": cairo_font_t * cairo_ft_font_create (FT_Library ft_library, FcPattern *pattern) {

... resolved = FcFontMatch (0, pattern, &result); if (result != FcResultMatch) {

if (resolved)

FcPatternDestroy (resolved);

return NULL;

} ...

(in reply to: ↑ 9 ) 07/02/08 15:30:05 changed by hiyuh

Replying to hyoksung:

In my Linux PC, it always returns "Arial" font...

Yup, METOO(tm).

I did running OWB w/ "strace -e open" and piping "grep -t ttf", then I realized OWB will only open arial.ttf and arialbd.ttf. IIRC, odole said to me in a private mail about it might depends my installed fonts and fontconfig setting, and he showed me his installed fonts and fontconfig setting as well. So I tried to set it same to his ones. But ITDOESN'TWORK(tm).