Bug 79524 - [WinCairo] Compute more accurate font heights
Summary: [WinCairo] Compute more accurate font heights
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
Depends on:
Reported: 2012-02-24 13:15 PST by Brent Fulgham
Modified: 2012-02-24 13:39 PST (History)
4 users (show)

See Also:

Correct handling of xHeight to produce better layout test results. (4.76 KB, patch)
2012-02-24 13:26 PST, Brent Fulgham
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 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.
Comment 1 Brent Fulgham 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.
Comment 2 WebKit Review Bot 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.
Comment 3 Brent Fulgham 2012-02-24 13:39:20 PST
All changes landed in r108843.