Bug 138762 - Use underlining metrics from the font file
Summary: Use underlining metrics from the font file
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on: 138854
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-14 17:02 PST by Myles C. Maxfield
Modified: 2014-12-01 08:33 PST (History)
15 users (show)

See Also:


Attachments
Patch (17.89 KB, patch)
2014-11-14 17:09 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2 (539.69 KB, application/zip)
2014-11-14 18:18 PST, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion (558.96 KB, application/zip)
2014-11-14 19:10 PST, Build Bot
no flags Details
Patch (22.73 KB, patch)
2014-11-17 10:22 PST, Myles C. Maxfield
hyatt: review+
mmaxfield: commit-queue-
Details | Formatted Diff | Diff
Patch (23.74 KB, patch)
2014-11-17 18:15 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2014-11-14 17:02:22 PST
Use underlining metrics from the font file
Comment 1 Myles C. Maxfield 2014-11-14 17:09:32 PST
Created attachment 241645 [details]
Patch
Comment 2 WebKit Commit Bot 2014-11-14 17:13:16 PST
Attachment 241645 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jon Lee 2014-11-14 17:58:21 PST
Comment on attachment 241645 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241645&action=review

> Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:69
> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));

This calculation reoccurs per port. Can we consolidate this?
Comment 4 Build Bot 2014-11-14 18:18:44 PST
Comment on attachment 241645 [details]
Patch

Attachment 241645 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4829837717929984

New failing tests:
fast/css3-text/css3-text-decoration/text-decoration-thickness.html
Comment 5 Build Bot 2014-11-14 18:18:48 PST
Created attachment 241651 [details]
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-14  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 6 Build Bot 2014-11-14 19:10:41 PST
Comment on attachment 241645 [details]
Patch

Attachment 241645 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6706599913586688

New failing tests:
fast/css3-text/css3-text-decoration/text-decoration-thickness.html
Comment 7 Build Bot 2014-11-14 19:10:46 PST
Created attachment 241655 [details]
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-01  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 8 Myles C. Maxfield 2014-11-17 09:54:42 PST
Comment on attachment 241645 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241645&action=review

>> Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:69
>> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
> 
> This calculation reoccurs per port. Can we consolidate this?

I actually can't because the font size is considered platform-dependent (and the size is an input to these calculations). "Font"s have sizes because of the font-size CSS property, and "PlatformFontData"s have sizes because it's dealing with the platform directly, but SimpleFontData (nor its constituent FontMetrics) knows anything about sizes.
Comment 9 Myles C. Maxfield 2014-11-17 10:22:57 PST
Created attachment 241722 [details]
Patch
Comment 10 Dave Hyatt 2014-11-17 14:26:12 PST
Comment on attachment 241722 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241722&action=review

r=me

> Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:69
> +    float decorationThickness = m_platformData.m_size / 16.0f;
> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));

Comments might be nice here explaining what you're doing.

> Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm:109
> +        decorationThickness = m_platformData.size() / 16.0f;
> +        underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));

Ditto.

> Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp:73
> +    float decorationThickness = m_platformData.size() / 16.0f;
> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));

And again!

> Source/WebCore/svg/SVGFontData.cpp:83
> +    float decorationThickness = fontSize / 16.0f;
> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));

This is coming up enough that maybe you want a helper somewhere that takes two float references and sets their values. That way if we ever decide to change behavior, you'd only have to patch one spot. :)
Comment 11 Myles C. Maxfield 2014-11-17 17:10:05 PST
Comment on attachment 241722 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241722&action=review

>> Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:69
>> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
> 
> Comments might be nice here explaining what you're doing.

Done.

>> Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm:109
>> +        underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
> 
> Ditto.

Done.

>> Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp:73
>> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
> 
> And again!

Done.

>> Source/WebCore/svg/SVGFontData.cpp:83
>> +    float underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
> 
> This is coming up enough that maybe you want a helper somewhere that takes two float references and sets their values. That way if we ever decide to change behavior, you'd only have to patch one spot. :)

Done.
Comment 12 Myles C. Maxfield 2014-11-17 18:15:47 PST
Created attachment 241755 [details]
Patch
Comment 13 Jon Lee 2014-11-18 08:06:54 PST
rdar://problem/18948247
Comment 14 Myles C. Maxfield 2014-11-18 10:05:39 PST
http://trac.webkit.org/changeset/176263
Comment 15 WebKit Commit Bot 2014-11-18 17:15:30 PST
Re-opened since this is blocked by bug 138854
Comment 16 Sam Weinig 2014-11-28 23:07:27 PST
It seems the patch was rolled out due to "underlines looking hideous". What exactly was hideous about them? Do we want to abandon the idea of getting the metrics from fonts altogether (and close this bug), or does the patch just need fixing?
Comment 17 Myles C. Maxfield 2014-12-01 08:33:57 PST
This patch needs investigation. I think we are moving the underline after we place it according to the font file, moving it up too high, so it was intersecting each letter, causing the skipping logic to be triggered, meaning underlines turned into periods between each glyph