Bug 18307 - REGRESSION (r31620): Incorrect Hiragino Kaku Gothic, font-weight:500
Summary: REGRESSION (r31620): Incorrect Hiragino Kaku Gothic, font-weight:500
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2008-04-03 22:59 PDT by Philippe Wittenbergh
Modified: 2008-04-14 19:58 PDT (History)
2 users (show)

See Also:


Attachments
test case (1.44 KB, text/html)
2008-04-03 23:01 PDT, Philippe Wittenbergh
no flags Details
testcase, hiragino with different weights (4.62 KB, text/html)
2008-04-04 01:58 PDT, John Daggett
no flags Details
Patch (2.76 KB, patch)
2008-04-08 17:12 PDT, mitz
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Wittenbergh 2008-04-03 22:59:56 PDT
Hiragino Kaku Gothic, with font-weight 500 is displayed as bold; I expect it to display is as 'normal', same as font-weight: 400 - that is: use W3 instead of W6.

Testing with r31623 (after bug 6484 landed).

(Gecko 1.9 had the same problem not so long ago, but that has been fixed, at least as of gecko 1.9beta5).
Comment 1 Philippe Wittenbergh 2008-04-03 23:01:20 PDT
Created attachment 20326 [details]
test case

Hiragino Kaku Gothic Pro, various font-weights
Comment 2 mitz 2008-04-03 23:30:03 PDT
<rdar://problem/5842546>
Comment 3 mitz 2008-04-04 00:03:53 PDT
Indeed, CSS2.1 suggests using the '400' weight for '500' if a '500' weight is unmapped.

(Hiragino Kaku Gothic Pro has two weights: W3, which AppKit maps to 4, which is between '300' and '400'; and W6, which AppKit maps to 8, which is between '600' and '700'. Since the desired weight of '500' corrresponds to 6, the two candidates are equidistant from the desired weight, and the current heuristic is to go for the stronger effect, i.e. further away from '400').
Comment 4 mitz 2008-04-04 00:11:45 PDT
As a first approximation, moving the "midpoint" from 5 to 6 here will better match the spec:

    if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude)
        return abs(candidateWeight - 5) > abs(chosenWeight - 5);
Comment 5 John Daggett 2008-04-04 01:58:35 PDT
Created attachment 20329 [details]
testcase, hiragino with different weights

This might be useful.  You can edit the Javascript to add/delete fonts.  The Hiragino fonts have some funky name table entries so you may run into problems when the name is only in Japanese (e.g. ƒqƒ‰ƒMƒmŠÛƒS Pro).
Comment 6 mitz 2008-04-08 17:12:08 PDT
Created attachment 20416 [details]
Patch
Comment 7 Darin Adler 2008-04-12 23:22:11 PDT
Comment on attachment 20416 [details]
Patch

r=me
Comment 8 mitz 2008-04-13 08:59:29 PDT
Fixed in <http://trac.webkit.org/projects/webkit/changeset/31850>.
Comment 9 Philippe Wittenbergh 2008-04-14 19:58:30 PDT
works fine, thanks