Bug 210484

Summary: Ascent/descent of SVG Fonts converted using SVGToOTFFontConversion is wrong, breaking text selection
Product: WebKit Reporter: Nikolas Zimmermann <zimmermann>
Component: SVGAssignee: Nikolas Zimmermann <zimmermann>
Status: NEW ---    
Severity: Normal CC: dino, ews-watchlist, fmalita, gyuyoung.kim, mmaxfield, pdr, sabouhallawa, schenney, sergio, zimmermann
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

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.