Bug 96348 - Texts with monospace font are incorrectly chosen when lang=zh
Summary: Texts with monospace font are incorrectly chosen when lang=zh
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.8
: P3 Normal
Assignee: Nobody
URL: http://jsfiddle.net/HjJcD/1/
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-10 20:01 PDT by Yu-Cheng Chuang
Modified: 2015-04-22 06:59 PDT (History)
4 users (show)

See Also:


Attachments
Screenshot of Facebook FQL sample code, when logged in as a Chinese user (66.02 KB, image/png)
2012-09-10 20:01 PDT, Yu-Cheng Chuang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yu-Cheng Chuang 2012-09-10 20:01:07 PDT
Created attachment 163268 [details]
Screenshot of Facebook FQL sample code, when logged in as a Chinese user

Safari version: 6.0
OS X Version: 10.8.1

Summary:

When a <pre> or <code> has lang attribute set to zh, zh-tw or zh-cn, or is inside an element with such lang attribute, then the texts are not in monospace font.

Code to reproduce:

    <pre lang='zh-tw'>hello world</pre>

Expected result:

"hello world" should be in monospaced font.

Actual result:

"hello world" are in sans-serif font.

Test code:

http://jsfiddle.net/HjJcD/1/

Real-world example:

https://developers.facebook.com/docs/reference/fql/

When logged in a Facebook account with user language set to Chinese (Traditional), the code examples are not in monospace font, but in Heiti TC.

I think this is because Safari now chooses font by the lang attribute, and in Mac OS X, monospace font of zh, zh-tw and zh-cn are the same as sans-serif font, described in DefaultFontFallback.plist (under /System/Library/Frameworks/CoreText.framework/Versions/A/Resources)
Comment 1 Alexey Proskuryakov 2012-09-11 11:30:45 PDT
Firefox also has this issue. Not sure if Chinese (and other CJK) OS X fonts even have monospace Roman characters.
Comment 2 Chen Zhixiang 2013-08-01 21:38:11 PDT
Hi, this bug seems also affecting <samp> element's render behavor in WinCE port.

since <samp>'s default html.css setting is "font-family: monospace", its font-size should be displayed smaller, but not.
Comment 3 Chen Zhixiang 2013-08-01 23:05:53 PDT
settings->setDefaultFixedFontSize(10); 

My problem resolved.