[Webkit-unassigned] [Bug 258857] New: Underline/strikethrough thickness/position (from-font) don't reflect font metadata

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 4 10:06:16 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=258857

            Bug ID: 258857
           Summary: Underline/strikethrough thickness/position (from-font)
                    don't reflect font metadata
           Product: WebKit
           Version: Safari 16
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Text
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: hi at ryanbugden.com
                CC: mmaxfield at apple.com

Created attachment 466919

  --> https://bugs.webkit.org/attachment.cgi?id=466919&action=review

A screenshot of a key part our test page, showing the behavior or underline and strikethrough in Webkit/Safari.

Problem:
The treatment of underlines and strikethroughs is off.

Steps to reproduce the problem:
1. Open up our test webpage in Webkit/Safari: https://hex.xyz/misc/text-decoration-test/
2. Please read everything in Webkit/Safari, and observe.

With `from-font`:
In using `text-decoration-thickness: from-font` and `text-underline-position: from-font`, the results do not accurately reflect the metadata in the font.
- The position of the strikethrough is not correct (also, there is currently no CSS tag for this: https://github.com/w3c/csswg-drafts/issues/9027).
- The thickness and position of the underline is slightly off, but acceptable.

Without `from-font`:
The underline/strikethrough thickness/position seems arbitrary and won’t necessarily work for every font. 

Here is our suggested fix:
- Improve how text-decoration with a `from-font` value is rendered.
- Make getting the data `from-font` the default behavior for underline/strikethrough position/thickness. Typeface designers and font engineers put a lot of thought into these values, and they know their fonts best, so these should be the first resort.
- In lieu of a CSS tag for `text-strikethrough-position`, like underline thickness/position and strikethrough thickness, strikethrough position should be determined by first looking for the value in the font’s metadata.

As far as technical implementation, WebKit, when rendering the strikethrough of a font, should reference the value in the `yStrikeoutPosition` key from the OS2 table, and interpret that value as the top y-coordinate of the line. See below:
https://learn.microsoft.com/en-us/typography/opentype/spec/os2

Thank you for your consideration!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230704/e1ccfa8c/attachment.htm>


More information about the webkit-unassigned mailing list