WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
92724
CSSFontSelector::getFontData() doesn't check font-weight
https://bugs.webkit.org/show_bug.cgi?id=92724
Summary
CSSFontSelector::getFontData() doesn't check font-weight
Kenichi Ishibashi
Reported
2012-07-31 00:38:41 PDT
CSSFontSelector::getFontData() checks font-variants and font-style, but doesn't check font-weight. This results WebKit download unnecessary webfonts. You can try the behavior at
http://jsbin.com/ehiwam/9/quiet
Results of major browsers are: - Chrome/Safari: downloads two fonts (both bold faces) - Firefox: downloads single font - Opera: downloads all four - IE: downloads all four The current draft spec(
http://dev.w3.org/csswg/css3-fonts/#font-prop-desc
) says: "For a font family defined with several @font-face rules, user agents can either download all faces in the family or use these descriptors to selectively download font faces that match actual styles used in document." The current behavior doesn't violate the spec, but I think it would be better to follow FireFox.
Attachments
Patch
(6.55 KB, patch)
2012-07-31 01:29 PDT
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from gce-cr-linux-07
(688.95 KB, application/zip)
2012-07-31 02:21 PDT
,
WebKit Review Bot
no flags
Details
Patch
(6.67 KB, patch)
2012-07-31 18:35 PDT
,
Kenichi Ishibashi
mitz: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Kenichi Ishibashi
Comment 1
2012-07-31 01:29:51 PDT
Created
attachment 155464
[details]
Patch
WebKit Review Bot
Comment 2
2012-07-31 02:21:26 PDT
Comment on
attachment 155464
[details]
Patch
Attachment 155464
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/13391619
New failing tests: fast/css/font-face-multiple-faces.html
WebKit Review Bot
Comment 3
2012-07-31 02:21:31 PDT
Created
attachment 155471
[details]
Archive of layout-test-results from gce-cr-linux-07 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-07 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Kenichi Ishibashi
Comment 4
2012-07-31 02:39:40 PDT
(In reply to
comment #2
)
> (From update of
attachment 155464
[details]
) >
Attachment 155464
[details]
did not pass chromium-ews (chromium-xvfb): > Output:
http://queues.webkit.org/results/13391619
> > New failing tests: > fast/css/font-face-multiple-faces.html
Expected failure. I checked the test on my machine and it should be rebaselined.
mitz
Comment 5
2012-07-31 08:15:33 PDT
Comment on
attachment 155464
[details]
Patch I think this can omit some Unicode ranges of a normal-weight font when asking for a bold font and there are no bold faces covering those ranges.
Kenichi Ishibashi
Comment 6
2012-07-31 18:35:04 PDT
Created
attachment 155700
[details]
Patch
Kenichi Ishibashi
Comment 7
2012-07-31 18:38:06 PDT
(In reply to
comment #5
)
> (From update of
attachment 155464
[details]
) > I think this can omit some Unicode ranges of a normal-weight font when asking for a bold font and there are no bold faces covering those ranges.
You are right. I updated the patch so that the change only applies when asking a normal weight font. I think this matches checks of font-style and font-variant.
mitz
Comment 8
2012-08-06 11:47:15 PDT
Comment on
attachment 155700
[details]
Patch This is still wrong. For example, it breaks this test case: <style> @font-face { font-family: custom; src: url(file:///Library/Fonts/Herculanum.ttf); font-weight: 500; unicode-range: U+0060-0061; } @font-face { font-family: custom; src: url(file:///Library/Fonts/Zapfino.ttf); font-weight: 300; } </style> <div style="font-family: custom;">ab</div>
Kenichi Ishibashi
Comment 9
2012-08-06 17:44:02 PDT
(In reply to
comment #8
)
> (From update of
attachment 155700
[details]
) > This is still wrong. For example, it breaks this test case: > > <style> > @font-face { > font-family: custom; > src: url(file:///Library/Fonts/Herculanum.ttf); > font-weight: 500; > unicode-range: U+0060-0061; > } > @font-face { > font-family: custom; > src: url(file:///Library/Fonts/Zapfino.ttf); > font-weight: 300; > } > </style> > <div style="font-family: custom;">ab</div>
s/ab/c/ ? Anyway it looks like I need to modify a lot of portions of CSSSegmentedFontFace and others and I don't think it's worth to do. Thank you for review.
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