Created attachment 170791 [details] test case Test case attached. WebKit doesn't fallback src descriptor of @font-face when the src descriptor contain "local(Helvetica)" even if a machine doesn't have Helvetica font. Instead, WebKit uses Arial font to render text. The following code causes the issue (in FontCache.cpp): static const AtomicString& alternateFamilyName(const AtomicString& familyName) { ... // Alias Arial and Helvetica DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial")); DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica")); if (equalIgnoringCase(familyName, arial)) return helvetica; if (equalIgnoringCase(familyName, helvetica)) return arial; ... } Helvetica is replaced with Arial when Helvetica isn't on the machine. Since most machines have Arial, the text will be rendered with Arial. This behavior prevents page authors to use their Helvetica fonts as webfonts.
I'm not sure why these replacements exists. We can fix the issue by just removing these replacements. Mitz, what do you think?
(In reply to comment #1) > I'm not sure why these replacements exists. We can fix the issue by just removing these replacements. > > Mitz, what do you think? I think the aliases exist for better compatibility with some websites, and that this bug can be fixed by changing CSSFontFaceSource::getFontData() to pass true as the checkingAlternateName parameter of getCachedFontData().
Created attachment 170815 [details] Patch
(In reply to comment #2) > I think the aliases exist for better compatibility with some websites, and that this bug can be fixed by changing CSSFontFaceSource::getFontData() to pass true as the checkingAlternateName parameter of getCachedFontData(). Thanks for the suggestion. It works. Posted a patch.
Comment on attachment 170815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=170815&action=review > Source/WebCore/ChangeLog:19 > + Somewhere in this change log there should be a description of the problem and how it was solved. Something along these lines, perhaps: FontCache::getCachedFontData() has a mechanism that aliases a few pairs of font family names, so that if the family name specified in the font-family property is not available on the system, but the its alias is available, it will be used instead. This is appropriate for the font-family property, but not for font family names specified in the local() function of the src descriptor in a @font-face rule. > Source/WebCore/css/CSSFontFaceSource.cpp:109 > + return fontCache()->getCachedFontData(fontDescription, m_string, true); You can even add a comment before this line explaining why we’re passing true.
Created attachment 170825 [details] Patch for landing
Comment on attachment 170815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=170815&action=review Thank you for review. >> Source/WebCore/ChangeLog:19 >> + > > Somewhere in this change log there should be a description of the problem and how it was solved. Something along these lines, perhaps: > FontCache::getCachedFontData() has a mechanism that aliases a few pairs of font family names, so that if the family name specified in the font-family property is not available on the system, but the its alias is available, it will be used instead. This is appropriate for the font-family property, but not for font family names specified in the local() function of the src descriptor in a @font-face rule. Done. >> Source/WebCore/css/CSSFontFaceSource.cpp:109 >> + return fontCache()->getCachedFontData(fontDescription, m_string, true); > > You can even add a comment before this line explaining why we’re passing true. Done.
Comment on attachment 170825 [details] Patch for landing Clearing flags on attachment: 170825 Committed r132589: <http://trac.webkit.org/changeset/132589>
All reviewed patches have been landed. Closing bug.
Re-opened since this is blocked by bug 100498
Created attachment 171549 [details] Patch for landing
Comment on attachment 171549 [details] Patch for landing Clearing flags on attachment: 171549 Committed r132969: <http://trac.webkit.org/changeset/132969>