Bug 215214 - REGRESSION(r254506): [Freetype] Spektra variable font does not work properly
Summary: REGRESSION(r254506): [Freetype] Spektra variable font does not work properly
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: https://v-fonts.com/fonts/spektra
Keywords: InRadar
Depends on:
Reported: 2020-08-06 06:07 PDT by Adrian Perez
Modified: 2020-08-13 22:59 PDT (History)
4 users (show)

See Also:

Side by side comparison of Epiphany (WebKitGTK) and Firefox (582.92 KB, image/png)
2020-08-06 06:13 PDT, Adrian Perez
no flags Details
Patch (2.30 KB, patch)
2020-08-13 08:25 PDT, Carlos Garcia Campos
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2020-08-06 06:07:20 PDT
The following font changes it slant (backwards to forwards) depending
on a variable parameter: https://v-fonts.com/fonts/spektra

With a current WebKitGTK build from “trunk” the slant is always backwards.
Comment 1 Adrian Perez 2020-08-06 06:13:45 PDT
Created attachment 406082 [details]
Side by side comparison of Epiphany (WebKitGTK) and Firefox

Screenshot showing Epiphany (left, with a WebKitGTK build from trunk)
and Firefox (right) with the test URL loaded and the “Italic” parameter
set to +20 in both cases.
Comment 2 Adrian Perez 2020-08-06 06:16:39 PDT
WebKitGTK 2.28.4 (the most recent stable release at the moment) also
shows this issue, so it does not seem to be a recent regression.
Comment 3 Radar WebKit Bug Importer 2020-08-13 06:08:21 PDT
Comment 4 Carlos Garcia Campos 2020-08-13 06:56:00 PDT
It turns out the problem is not the spektra font, not even the font variation implementation, it's the webkit-font-smoothing cairo implementation that breaks font variations. So, what's different in https://v-fonts.com/fonts/spektra is that webkit-font-smoothing is used. This regressed in r254506, when a font smoothing mode is passed to drawGlyphsToContext() a new cairo font options is set, using the default font options and changing the antialiasing. This means the font options from the font (the ones containing the variation settings), set in the context by cairo_set_scaled_font() are lost. We should copy the scaled font options instead, then set the antialiasing and apply them. I'll prepare a patch and try to add a test.
Comment 5 Carlos Garcia Campos 2020-08-13 08:25:00 PDT
Created attachment 406518 [details]
Comment 6 Adrian Perez 2020-08-13 15:32:05 PDT
Tested patch locally as well, worked like a charm!
Comment 7 Carlos Garcia Campos 2020-08-13 22:59:28 PDT
Committed r265648: <https://trac.webkit.org/changeset/265648>