RESOLVED FIXED 79524
[WinCairo] Compute more accurate font heights
https://bugs.webkit.org/show_bug.cgi?id=79524
Summary [WinCairo] Compute more accurate font heights
Brent Fulgham
Reported 2012-02-24 13:15:58 PST
Lynn Neir reports: Many of the Layout tests (e.g., "css1/text_properties/line_height.html") use ‘ex’ to calculate margin or line-height, etc. This value depends directly on the proper calculation of xHeight. In my tests I never actually see the existing code that calculates xHeight getting executed, seems windows function GetGlyphOutline is failing, that is it never gets to line: xHeight = gm.gmptGlyphOrigin.y * metricsMultiplier; So then it ends up always using xHeight = ascent * 0.56f, which is not exactly correct to match mac results. So the code I used is below: cairo_text_extents_t extents; cairo_scaled_font_text_extents(scaledFont, "x", &extents); xHeight = -extents.y_bearing; This code correctly gets the x-Height and the results match for the ones above. Try it out for yourself and see what you think." I did try it out, and found that the results were better. Moreover, the actual implementation of "cairo_scaled_font_text_extents" makes use of the same ::GetGlyphOutline (and related) calls, with additional fallback handling for non-TrueType fonts, etc.
Attachments
Correct handling of xHeight to produce better layout test results. (4.76 KB, patch)
2012-02-24 13:26 PST, Brent Fulgham
aroben: review+
Brent Fulgham
Comment 1 2012-02-24 13:26:01 PST
Created attachment 128794 [details] Correct handling of xHeight to produce better layout test results. This patch brings several css1/text layout tests into agreement with the Apple port.
WebKit Review Bot
Comment 2 2012-02-24 13:29:27 PST
Attachment 128794 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 3 2012-02-24 13:39:20 PST
All changes landed in r108843.
Note You need to log in before you can comment on or make changes to this bug.