Bug 31804

Summary: Safari/Chromium for Windows fails to load many CJK WebFonts and some Latin WebFonts
Product: WebKit Reporter: Yusuke Sato <yusukes>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, agl, aroben, commit-queue, eric, hyatt, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
allow_multiple_faces_v1 none

Yusuke Sato
Reported 2009-11-23 06:33:27 PST
Safari for Windows fails to load OpenType web fonts (@font-face) that have 2 or more faces. Chromium for Windows also fails to load TrueType and OpenType web fonts that have 2 or more faces. This is because the renameAndActivateFont() function in WebCore/platform/graphics/opentype/OpenTypeUtilities.cpp, which is used by Safari for Windows and Chromium for Windows, explicitly refuses such fonts. However, since most of CJK ttf/otf fonts and some of Latin ttf/otf fonts have more than 2 faces (e.g., one is for horizontal writing and the other is for vertical writing), the restriction seems to be too strict. For example, HIRAGINO (ヒラギノ) font, which is the default Japanese OpenType font for Mac OS X, has 2 faces. I'll attach a one-line patch that allows WebKit to load such fonts. Just for reference, Safari for Mac seems not to have the restriction. I tried to load the HIRAGINO font to Safari for Mac via @font-face (on my local machine, of course), and it succeeded. A comment in WebCore/platform/graphics/mac/FontCustomPlatformData.cpp says that when a font has more than 2 faces, the first one is used for rendering, and I believe this behavior is good enough for most cases.
Attachments
allow_multiple_faces_v1 (1.29 KB, patch)
2009-11-23 06:41 PST, Yusuke Sato
no flags
Yusuke Sato
Comment 1 2009-11-23 06:41:43 PST
Created attachment 43711 [details] allow_multiple_faces_v1
Eric Seidel (no email)
Comment 2 2009-11-25 21:18:49 PST
mitz wrote the code, hyatt reviewed it. The change looks fine to me, but perhaps mitz had a reason for making this != 1 instead of < 1. I would suggest we let mitz comment before this is landed.
Yusuke Sato
Comment 3 2009-11-30 07:15:50 PST
Slightly modified the summary so that it states the actual circumstance of the issue. An example of load failure of a Latin webfont is: http://code.google.com/p/chromium/issues/detail?id=28567 mitz, can you please take a look at the patch?
Adam Barth
Comment 4 2009-11-30 12:35:25 PST
style-queue successfully ran check-webkit-style on attachment 43711 [details] without any errors
mitz
Comment 5 2009-12-01 10:00:20 PST
I am trying to understand how this is supposed to work. On my Mac OS X v10.6 system, there are multiple font files whose name begins with ヒラギノ. Does one of them contain multiple faces? Which one?
Yusuke Sato
Comment 6 2009-12-01 17:39:18 PST
(In reply to comment #5) > I am trying to understand how this is supposed to work. On my Mac OS X v10.6 > system, there are multiple font files whose name begins with ヒラギノ. Does one of > them contain multiple faces? Which one? Please try "ヒラギノ角ゴ ProN W6", for example. $ ls -l /System/Library/Fonts/ヒラギノ角ゴ\ ProN\ W6.otf -rw-r--r-- 1 root wheel 7515064 May 31 2008 /System/Library/Fonts/ヒラギノ角ゴ ProN W6.otf
mitz
Comment 7 2009-12-02 08:54:38 PST
(In reply to comment #3) > An example of load failure of a Latin webfont is: > http://code.google.com/p/chromium/issues/detail?id=28567 The URL in that bug, <http://www.alistapart.com/d/cssatten/stef.html>, is rendered correctly in Safari on Windows with TOT WebKit. I confirmed that even if I skip the TTLoadEmbeddedFont() call in createFontCustomPlatformData() and take the renameAndActivateFont() branch, all fonts on that page load correctly.
mitz
Comment 8 2009-12-02 09:20:26 PST
(In reply to comment #6) > Please try "ヒラギノ角ゴ ProN W6", for example. I could reproduce the problem with that font, i.e. numFonts was 2.
Eric Seidel (no email)
Comment 9 2009-12-02 09:28:45 PST
Comment on attachment 43711 [details] allow_multiple_faces_v1 Marking cq+ since Yusuke isn't a committer yet.
WebKit Commit Bot
Comment 10 2009-12-02 11:17:54 PST
Comment on attachment 43711 [details] allow_multiple_faces_v1 Clearing flags on attachment: 43711 Committed r51605: <http://trac.webkit.org/changeset/51605>
WebKit Commit Bot
Comment 11 2009-12-02 11:18:02 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.