WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
100446
local(Helvetica) in src descriptor prevent fallback
https://bugs.webkit.org/show_bug.cgi?id=100446
Summary
local(Helvetica) in src descriptor prevent fallback
Kenichi Ishibashi
Reported
2012-10-25 19:50:56 PDT
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.
Attachments
test case
(337 bytes, text/html)
2012-10-25 19:50 PDT
,
Kenichi Ishibashi
no flags
Details
Patch
(1.86 KB, patch)
2012-10-25 22:30 PDT
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Patch for landing
(2.47 KB, patch)
2012-10-25 23:23 PDT
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Patch for landing
(6.12 KB, patch)
2012-10-30 16:49 PDT
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Kenichi Ishibashi
Comment 1
2012-10-25 19:52:08 PDT
I'm not sure why these replacements exists. We can fix the issue by just removing these replacements. Mitz, what do you think?
mitz
Comment 2
2012-10-25 21:22:49 PDT
(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().
Kenichi Ishibashi
Comment 3
2012-10-25 22:30:37 PDT
Created
attachment 170815
[details]
Patch
Kenichi Ishibashi
Comment 4
2012-10-25 22:32:06 PDT
(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.
mitz
Comment 5
2012-10-25 22:42:04 PDT
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.
Kenichi Ishibashi
Comment 6
2012-10-25 23:23:03 PDT
Created
attachment 170825
[details]
Patch for landing
Kenichi Ishibashi
Comment 7
2012-10-25 23:23:34 PDT
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.
WebKit Review Bot
Comment 8
2012-10-26 02:09:23 PDT
Comment on
attachment 170825
[details]
Patch for landing Clearing flags on attachment: 170825 Committed
r132589
: <
http://trac.webkit.org/changeset/132589
>
WebKit Review Bot
Comment 9
2012-10-26 02:09:27 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 10
2012-10-26 04:30:16 PDT
Re-opened since this is blocked by
bug 100498
Kenichi Ishibashi
Comment 11
2012-10-30 16:49:03 PDT
Created
attachment 171549
[details]
Patch for landing
WebKit Review Bot
Comment 12
2012-10-30 17:45:37 PDT
Comment on
attachment 171549
[details]
Patch for landing Clearing flags on attachment: 171549 Committed
r132969
: <
http://trac.webkit.org/changeset/132969
>
WebKit Review Bot
Comment 13
2012-10-30 17:45:41 PDT
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.
Top of Page
Format For Printing
XML
Clone This Bug