Bug 210484 - Ascent/descent of SVG Fonts converted using SVGToOTFFontConversion is wrong, breaking text selection
Summary: Ascent/descent of SVG Fonts converted using SVGToOTFFontConversion is wrong, ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nikolas Zimmermann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-14 02:34 PDT by Nikolas Zimmermann
Modified: 2020-08-13 14:27 PDT (History)
10 users (show)

See Also:


Attachments
Patch (731.35 KB, patch)
2020-04-14 02:34 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (740.11 KB, patch)
2020-04-14 02:40 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (1.54 MB, patch)
2020-04-15 02:42 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (1.78 MB, patch)
2020-04-15 03:57 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (1.91 MB, patch)
2020-04-16 14:48 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (1.99 MB, patch)
2020-04-20 00:22 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (2.21 MB, patch)
2020-04-20 02:36 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (2.21 MB, patch)
2020-04-22 00:20 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch (2.21 MB, patch)
2020-04-22 08:44 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2020-04-14 02:34:52 PDT
Created attachment 396391 [details]
Patch

When comparing SVG Fonts converted to OTF using FontForge and using WebKits                                  
builtin SVGToOTFFontConversion it is evident that the HHEA table is incorrect.

The ascent/descent (HheaAscent/HheaDescent) stored in the HHEA table is 
currently equivalent to the typographic ascent/descent, as specified in  
the SVGFontFaceElement.  

This is not correct, it should be computed as unite of the individual
glyph bounding boxes. Currently this wrong behavior leads to broken
text seleciton when using SVG Fonts. The text selection highlight is
placed incorrectly. This is easiy visible when converting the SVG Font
to OTF using e.g. FontForge and comparing the text selection rects.
Comment 1 Nikolas Zimmermann 2020-04-14 02:40:17 PDT
Created attachment 396392 [details]
Patch
Comment 2 Nikolas Zimmermann 2020-04-14 02:41:32 PDT
TODO:
- Missing one reftest to compare SVG Fonts->OTF on-the-fly conversion vs. FontForge converted SVG Fonts
- Expecations for mac (going through EWS to obtain them)
Comment 3 Nikolas Zimmermann 2020-04-15 02:42:00 PDT
Created attachment 396517 [details]
Patch
Comment 4 Nikolas Zimmermann 2020-04-15 03:57:11 PDT
Created attachment 396519 [details]
Patch
Comment 5 Nikolas Zimmermann 2020-04-16 14:48:21 PDT
Created attachment 396700 [details]
Patch
Comment 6 Nikolas Zimmermann 2020-04-20 00:22:04 PDT
Created attachment 396956 [details]
Patch
Comment 7 Nikolas Zimmermann 2020-04-20 02:36:42 PDT
Created attachment 396961 [details]
Patch
Comment 8 Nikolas Zimmermann 2020-04-22 00:20:22 PDT
Created attachment 397176 [details]
Patch
Comment 9 Nikolas Zimmermann 2020-04-22 08:44:35 PDT
Created attachment 397195 [details]
Patch
Comment 10 Nikolas Zimmermann 2020-04-22 14:09:49 PDT
*sigh* I need access to a local Mac :-)
This patch works flawlessly on Gtk/WPE (FreeType based font rendering) but shows issues on macOS, most noticeable on svg/text/kerning.svg, which is broken with the patch. Will investigate, no need to review until I get this sorted out.