Commit Graph

126 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
42a711655b Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-13 00:59:23 +00:00
Noemi Erli
fbf29a9961 Backed out changeset 7585591a9bad (bug 1773558) for causing failures in system-fonts.html 2022-06-12 19:02:33 +03:00
Emilio Cobos Álvarez
152643ec11 Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-12 10:48:58 +00:00
Lee Salzman
f22e557983 Bug 1771415 - Properly support subpixel AA in DrawTargetWebgl. r=aosmond,gfx-reviewers
It turns out subpixel AA handling is quite broken in DrawTargetWebgl. First,
we need to distinguish whether or not we are rendering bitmap or outline
fonts, so this adds a query MayUseBitmaps that tries to make a best guess
about whether the font has any bitmap glyphs in it.

If the font has bitmaps, then it might render grayscale bitmaps which use
the supplied color or color emoji which ignore the color. If the font is
just outlines, it may instead render subpixel AA which needs to be interpreted
as a subpixel mask rather than as a normal RGBA result. Thus, MayUseBitmaps
helps us distinguish what a potential rasterized color result is and how to
properly blend it.

Next, we use a similar blending strategy as for WebRender without dual-source
blending to blend the subpixel AA mask using a mode with a constant blend color.

Differential Revision: https://phabricator.services.mozilla.com/D147487
2022-05-27 16:07:15 +00:00
Jonathan Kew
0fa36b6dc0 Bug 1770163 - Make OpenType 'gasp' table ranges apply up to their maxPPEM size, inclusively. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D146813
2022-05-19 15:30:21 +00:00
Jonathan Kew
082554b8ef Bug 1587094 - Create a pref to control whether we use DirectWrite's bold simulation or multi-strike synthetic bold; default to multi-strike for webfonts. r=lsalzman
This is designed to mitigate the problem of third-party fonts that render poorly
under DirectWrite's bold simulation, by using multi-strike synthetic bold (like
we use on macOS) instead.

The behavior is controlled by a pref, so that we can readily switch between
using DWrite's bold simulation for all fonts (pref=2, our current behavior);
using it only for installed fonts and falling back to multi-strike for webfonts
(pref=1, new behavior); or never using the DWrite simulation (pref=0).

Differential Revision: https://phabricator.services.mozilla.com/D137584
2022-02-09 12:07:05 +00:00
Butkovits Atila
5ea4f6305b Backed out changeset c885ece84961 (bug 1587094) for causing graphics crashes (bug 1754385). a=backout 2022-02-09 11:54:44 +02:00
Jonathan Kew
36ba62cbae Bug 1587094 - Create a pref to control whether we use DirectWrite's bold simulation or multi-strike synthetic bold; default to multi-strike for webfonts. r=lsalzman
This is designed to mitigate the problem of third-party fonts that render poorly
under DirectWrite's bold simulation, by using multi-strike synthetic bold (like
we use on macOS) instead.

The behavior is controlled by a pref, so that we can readily switch between
using DWrite's bold simulation for all fonts (pref=2, our current behavior);
using it only for installed fonts and falling back to multi-strike for webfonts
(pref=1, new behavior); or never using the DWrite simulation (pref=0).

Differential Revision: https://phabricator.services.mozilla.com/D137584
2022-02-08 14:40:02 +00:00
Norisz Fay
f5dcb33066 Backed out changeset 49dc772ff0cd (bug 1587094) for causing multiple crashes CLOSED TREE 2022-02-08 05:30:51 +02:00
Jonathan Kew
41e53889c4 Bug 1587094 - Create a pref to control whether we use DirectWrite's bold simulation or multi-strike synthetic bold; default to multi-strike for webfonts. r=lsalzman
This is designed to mitigate the problem of third-party fonts that render poorly
under DirectWrite's bold simulation, by using multi-strike synthetic bold (like
we use on macOS) instead.

The behavior is controlled by a pref, so that we can readily switch between
using DWrite's bold simulation for all fonts (pref=2, our current behavior);
using it only for installed fonts and falling back to multi-strike for webfonts
(pref=1, new behavior); or never using the DWrite simulation (pref=0).

Differential Revision: https://phabricator.services.mozilla.com/D137584
2022-02-07 20:54:52 +00:00
Andrew Osmond
3da948d0c6 Bug 1728113 - Remove DrawTargetCapture and related code. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D123953
2021-08-30 16:35:50 +00:00
Bob Owen
2729b7711f Bug 1698946 p3: Change existing code to use DWriteSettings. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D120598
2021-08-05 09:13:11 +00:00
Mike Hommey
467605d442 Bug 1722454 - Remove USE_SKIA. r=gfx-reviewers,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D120935
2021-07-29 23:29:44 +00:00
Lee Salzman
b4f1e64cb8 Bug 1677301 - try to catch exceptions while reading font file data in ScaledFontDWrite. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D99179
2020-12-09 10:41:34 +00:00
Brad Werth
4643a83cc5 Bug 1625590 Part 2: Make ScaledFontDWrite::GetFontFileName include the null terminator in the returned file name. r=jrmuizel
This ensures that CreateFromFontDescriptor gets the null-terminated WCHAR
that it expects.

Differential Revision: https://phabricator.services.mozilla.com/D96478
2020-11-19 16:59:31 +00:00
Lee Salzman
14c09f6bfc Bug 1611467 - unify UnscaledFont::GetFontDescriptor and GetWRFontDescriptor implementations. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D68284
2020-03-26 16:11:00 +00:00
Andrew Osmond
490ae875e7 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
gfx::Color is currently misused in many places. The DrawTargets expect
the color space to be in device space, e.g. what we are actually going
to draw using. Everything sitting above generally deals with sRGB, as
specified in CSS. Sometimes we missed the conversion from sRGB to device
space when issuing draw calls, and similarly sometimes we converted the
color to device space twice.

This patch splits the type in two. sRGBColor and DeviceColor now
represent sRGB and device color spaces respectively. DrawTarget only
accepts DeviceColor, and one can get a DeviceColor from an sRGBColor via
the ToDeviceColor helper API. The reftests now pass with color
management enabled for everything (e.g. CSS) instead of just tagged
raster images.

There will be a follow up patch to enable color management everywhere by
default on all supported platforms.

Differential Revision: https://phabricator.services.mozilla.com/D64771
2020-03-09 14:16:17 +00:00
Emilio Cobos Álvarez
b92e0ff770 Bug 1602317 - Switch WR bindings to use associated-constants-in-body. r=jrmuizel
Now that we have C++17, and thus inline const, we can do this.

Depends on D56306

Differential Revision: https://phabricator.services.mozilla.com/D56307
2019-12-08 21:09:37 +00:00
Lee Salzman
8f40f35ae0 Bug 1593970 - scale subpixel contribution based on ClearType level setting. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D52441
2019-11-09 13:03:47 +00:00
Lee Salzman
b53c45d845 Bug 1591996 - miscellaneous Gecko fixes for Skia m79 update. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50825
2019-10-28 21:42:48 +00:00
Lee Salzman
2ef795ae61 Bug 1584268 - only instantiate Cairo fonts when drawing to Cairo target. r=jfkthame
This removes a lot of old cruft in thebes to instantiate Cairo scaled fonts.
Instead, we only instantiate the Cairo scaled font inside Moz2D when we actually
need it for DrawTargetCairo. This thus gets rid of the duplicated code we had
inside both Moz2D and thebes to deal with Cairo scaled fonts.

Differential Revision: https://phabricator.services.mozilla.com/D47297
2019-10-01 21:56:30 +00:00
Lee Salzman
b690affa2c Bug 1582231 - remove Moz2D dependency on Cairo glyph extents. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D46332
2019-09-20 16:30:21 +00:00
Lee Salzman
36e29fb39f Bug 1547063 - add SharedFTFace abstraction of FT_Face. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44491
2019-09-16 17:03:04 +00:00
Cosmin Sabou
5de1c512f9 Backed out 8 changesets (bug 1547063) for causing bug 1581466. a=backout
Backed out changeset c969a93b0ca7 (bug 1547063)
Backed out changeset 003f5a79c6a7 (bug 1547063)
Backed out changeset 2c7032b4d022 (bug 1547063)
Backed out changeset 23892ecc6ef8 (bug 1547063)
Backed out changeset af6e6807ece7 (bug 1547063)
Backed out changeset ebc71e607938 (bug 1547063)
Backed out changeset 772c3427c791 (bug 1547063)
Backed out changeset e74a67e2afe3 (bug 1547063)
2019-09-16 10:44:20 +03:00
Lee Salzman
3173dcc8a0 Bug 1547063 - add SharedFTFace abstraction of FT_Face. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44491
2019-09-15 02:59:44 +00:00
Lee Salzman
73ba2faff7 Bug 1576077 - make ScaledFontDWrite remember if it needs synthetic bold. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D45721
2019-09-13 15:47:32 +00:00
Lee Salzman
f59d828b0e Bug 1572913 - check ClearType level in ScaledFontDWrite::GetDefaultAAMode. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D44912
2019-09-06 18:45:56 +00:00
Eric Rahm
47b0011946 Bug 1577910 - Remove using namespace std from gfx/2d r=nical
Differential Revision: https://phabricator.services.mozilla.com/D44281
2019-09-01 18:32:06 +00:00
Lee Salzman
4fd82fd408 Bug 1565158 - allow forcing DWrite symmetric rendering mode. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D38569
2019-07-19 03:56:50 +00:00
Sylvestre Ledru
3bf4f867df Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D38057
2019-07-16 07:33:44 +00:00
Sylvestre Ledru
90f14f282a Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35622
2019-07-06 08:18:28 +00:00
Jeff Muizelaar
91e6e31941 Bug 1561235. Check the type of the PathBuilder instead of the DrawTarget. r=mstange
The draw target might give us a different type.

Differential Revision: https://phabricator.services.mozilla.com/D36830
2019-07-03 20:13:44 +00:00
Lee Salzman
cf6a01ca81 Bug 1556481 - check for DWrite failures in UnscaledFontDWrite::GetFontFileData. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D33585
2019-06-04 09:26:11 +00:00
Lee Salzman
3fcbc11030 Bug 1553910 - pass DWrite subpixel order into Skia and WebRender. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D32545
2019-05-25 16:20:59 +00:00
Lee Salzman
96d8e052bb Bug 1544188 - check cleartype level for WR DWrite fonts. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D27563
2019-04-18 15:58:22 +00:00
Emilio Cobos Álvarez
fdc98f5ff0 Bug 1533142 - followup: Fix Windows MinGW bustage. r=me 2019-03-07 00:34:19 +01:00
Emilio Cobos Álvarez
3ff2d186c6 Bug 1533142 - Use more cbindgen features. r=kats
We can get back the fancy flag syntax as soon as we get C++17 inline variables,
which I sent an email to dev-platform@ about, with no reply.

Differential Revision: https://phabricator.services.mozilla.com/D22382
2019-03-06 23:01:11 +00:00
Lee Salzman
b99c8d2345 Bug 1455848 - use paths for WR font handles on Windows. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D16896
2019-01-17 15:45:07 -05:00
Razvan Maries
c7c5622cd2 Backed out 4 changesets (bug 1455848) for windows wrench failures. CLOSED TREE
Backed out changeset d56504db04ea (bug 1455848)
Backed out changeset f2279ecacb81 (bug 1455848)
Backed out changeset 44a36f0fe512 (bug 1455848)
Backed out changeset b8444f241aca (bug 1455848)
2019-01-24 00:56:40 +02:00
Lee Salzman
8ba040d5da Bug 1455848 - use paths for WR font handles on Windows. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D16896
2019-01-17 15:45:07 -05:00
Ehsan Akhgari
498e2df734 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset
2019-01-18 10:16:18 +01:00
Bas Schouten
02f2ee7056 Bug 1519739: Attempt to create Direct2D paths on the paint thread. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D16433
2019-01-14 01:16:17 +01:00
Sylvestre Ledru
3ece000f7a Bug 1516555 - Reformat everything to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D15426
2018-12-28 15:48:06 +00:00
Lee Salzman
5b77d130ae Bug 1455848 - let UnscaledFontDWrite::GetWRFontDescriptor continue even if retrieving file names fails. r=jrmuizel 2018-12-18 11:19:26 -05:00
Lee Salzman
6b103ffea5 Bug 1455848 - validate access to DWrite font files in WR and output helpful log messages on failure. r=jrmuizel 2018-12-11 15:58:02 -05:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Lee Salzman
ff028c13ef Bug 1455848 - ensure WR DWrite font descriptors can be found in the system font collection. r=jfkthame 2018-11-06 14:43:24 -05:00
Jonathan Kew
03ffb74dac Bug 1441323 - Handle font variation settings in ScaledFontDWrite::GetWRFontInstanceOptions. r=lsalzman 2018-02-26 21:56:07 +00:00
Lee Salzman
eefbdea633 Bug 1477625 - Don't use subpixel positioning for GDI fonts in WebRender. r=jrmuizel 2018-09-12 13:34:08 -04:00
Lee Salzman
4fa6a9b2d2 Bug 1480615 - reuse scaled fonts across blob image recordings. r=jrmuizel 2018-09-05 21:55:53 -04:00