Commit Graph

237 Commits

Author SHA1 Message Date
Lee Salzman
44eb8379af Bug 1547063 - Use FreeType metrics directly instead of querying Cairo. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44497

--HG--
extra : moz-landing-system : lando
2019-09-16 17:15:10 +00:00
Lee Salzman
286a7bbfff Bug 1547063 - Use SharedFTFace in thebes. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44494

--HG--
extra : moz-landing-system : lando
2019-09-16 17:07:59 +00:00
Cosmin Sabou
8113720646 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
0d6ebe2503 Bug 1547063 - Use FreeType metrics directly instead of querying Cairo. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44497

--HG--
extra : moz-landing-system : lando
2019-09-15 03:01:19 +00:00
Lee Salzman
a9377fd974 Bug 1547063 - Use SharedFTFace in thebes. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44494

--HG--
extra : moz-landing-system : lando
2019-09-15 03:00:32 +00:00
Jonathan Kew
54cbb9d57b Bug 1554208 - patch 6 - Add PSName and FullName support to gfxFT2FontList shared font-list initialization, so that src:local() lookups will work. r=jwatt
Also ensure we consistently use the original-case family name in FontNameCache entries,
and only lowercase it to a "key" for lookup/insertion into the font list. This avoids
failures in test_font_whitelist.html due to inconsistency in whether family names have
been lowercased.

Differential Revision: https://phabricator.services.mozilla.com/D36112

--HG--
extra : moz-landing-system : lando
2019-07-12 15:34:30 +00:00
Jonathan Kew
f91a1d3b2a Bug 1554208 - patch 5 - Implement shared-fontlist support in the gfxFT2FontList backend. r=jwatt
This is the main part of the implementation, except that it doesn't handle populating the
local names table (for @font-face src:local() lookups) with Full and PostScript names;
that follows in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D36110

--HG--
extra : moz-landing-system : lando
2019-07-12 15:34:04 +00:00
Jonathan Kew
9f9125a4d0 Bug 1554208 - patch 4 - Make the FontNameCache that we use to store the font list in the startupCache use a more robust and extensible serialization. r=jwatt
I'll need to add a couple of extra fields to the cache records, and realized that the current format
looks really fragile; in theory, it'd break if a font name ever contained a comma or semicolon
(unlikely though that may be). So let's fix it to be a bit more robust before we add to it further.
Using control characters from the C0 range to delimit fields/records, instead of ASCII punctuation,
removes the (tiny) risk of conflict with characters that actually occur in a name, and using
distinct field and record separators means that we can better check that the records we're loading
from the cache actually match the expected format.

(Given that the startup cache gets re-created when the build ID is updated, a change in the format
between versions wasn't going to cause problems for users; their old cache just gets blown away
when upgrading. Still, a little more robustness seems like a good thing.)

Differential Revision: https://phabricator.services.mozilla.com/D36109

--HG--
extra : moz-landing-system : lando
2019-07-12 15:33:35 +00:00
Jonathan Kew
01e8403527 Bug 1554208 - patch 3 - Rearrange gfxFT2Fonts code so that FindFonts() does just what it says, and other work is handled by the caller. r=jwatt
This makes the functional structure a bit cleaner, so that it'll be easier to slip in the alternative
codepath for the shared font-list.

Differential Revision: https://phabricator.services.mozilla.com/D36108

--HG--
extra : moz-landing-system : lando
2019-07-12 15:33:03 +00:00
Jonathan Kew
2469dbfb9d Bug 1554208 - patch 2 - Remove redundant member-reset code from gfxFT2FontList::FindFonts (already handled by gfxPlatformFontList before this is called). r=jwatt
A bit of cleanup of the existing code, before we start actually implementing new stuff.

Differential Revision: https://phabricator.services.mozilla.com/D36107

--HG--
extra : moz-landing-system : lando
2019-07-12 15:32:35 +00:00
Jonathan Kew
83fc5b8ada Bug 1565234 - Remove redundant override that exactly matches the base class implementation, and make GetFontFamilyList non-virtual. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D37731

--HG--
extra : moz-landing-system : lando
2019-07-11 15:28:22 +00:00
Barret Rennie
06f829cc25 Bug 1289211 - Rename InfallibleTArray to nsTArray in gfx/thebes/ r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D36955

--HG--
extra : moz-landing-system : lando
2019-07-10 03:29:40 +00:00
Brindusan Cristian
094a24980d Backed out 6 changesets (bug 1554208) for reftest failures at font-sans-serif.html and geckoview failures at AccessibilityTest.testMoveByLine. CLOSED TREE
Backed out changeset 14b2c3daeaf0 (bug 1554208)
Backed out changeset 7bd8be02631a (bug 1554208)
Backed out changeset 3e6c11ef906c (bug 1554208)
Backed out changeset f72e750ec20d (bug 1554208)
Backed out changeset 3e824f3e3c9c (bug 1554208)
Backed out changeset b610a6988076 (bug 1554208)
2019-07-09 01:07:08 +03:00
Jonathan Kew
da0f34be06 Bug 1554208 - patch 6 - Add PSName and FullName support to gfxFT2FontList shared font-list initialization, so that src:local() lookups will work. r=jwatt
And with this, all tests pass on tryserver when the shared list is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D36112

--HG--
extra : moz-landing-system : lando
2019-07-08 19:47:17 +00:00
Jonathan Kew
d45e85e785 Bug 1554208 - patch 5 - Implement shared-fontlist support in the gfxFT2FontList backend. r=jwatt
This is the main part of the implementation, except that it doesn't handle populating the
local names table (for @font-face src:local() lookups) with Full and PostScript names;
that follows in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D36110

--HG--
extra : moz-landing-system : lando
2019-07-08 19:47:03 +00:00
Jonathan Kew
7a6bb0577c Bug 1554208 - patch 4 - Make the FontNameCache that we use to store the font list in the startupCache use a more robust and extensible serialization. r=jwatt
I'll need to add a couple of extra fields to the cache records, and realized that the current format
looks really fragile; in theory, it'd break if a font name ever contained a comma or semicolon
(unlikely though that may be). So let's fix it to be a bit more robust before we add to it further.
Using control characters from the C0 range to delimit fields/records, instead of ASCII punctuation,
removes the (tiny) risk of conflict with characters that actually occur in a name, and using
distinct field and record separators means that we can better check that the records we're loading
from the cache actually match the expected format.

(Given that the startup cache gets re-created when the build ID is updated, a change in the format
between versions wasn't going to cause problems for users; their old cache just gets blown away
when upgrading. Still, a little more robustness seems like a good thing.)

Differential Revision: https://phabricator.services.mozilla.com/D36109

--HG--
extra : moz-landing-system : lando
2019-07-08 19:46:44 +00:00
Jonathan Kew
920998b64e Bug 1554208 - patch 3 - Rearrange gfxFT2Fonts code so that FindFonts() does just what it says, and other work is handled by the caller. r=jwatt
This makes the functional structure a bit cleaner, so that it'll be easier to slip in the alternative
codepath for the shared font-list.

Differential Revision: https://phabricator.services.mozilla.com/D36108

--HG--
extra : moz-landing-system : lando
2019-07-08 19:46:30 +00:00
Jonathan Kew
8b058ab5a1 Bug 1554208 - patch 2 - Remove redundant member-reset code from gfxFT2FontList::FindFonts (already handled by gfxPlatformFontList before this is called). r=jwatt
A bit of cleanup of the existing code, before we start actually implementing new stuff.

Differential Revision: https://phabricator.services.mozilla.com/D36107

--HG--
extra : moz-landing-system : lando
2019-07-08 19:46:16 +00:00
Jonathan Kew
d88f8facc2 Bug 1558375 - Don't set the FT_LOAD_NO_AUTOHINT flag for fonts that have FT_FACE_FLAG_TRICKY, to avoid broken rendering. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D35023

--HG--
extra : moz-landing-system : lando
2019-06-15 12:40:02 +00:00
Ciure Andrei
86d096eeef Backed out changeset 6153e6bb58e1 (bug 1558375) for causing 1229972.html to perma crash CLOSED TREE 2019-06-15 13:42:53 +03:00
Jonathan Kew
9dbb54dd9e Bug 1558375 - Don't set the FT_LOAD_NO_AUTOHINT flag for fonts that have FT_FACE_FLAG_TRICKY, to avoid broken rendering. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D35023

--HG--
extra : moz-landing-system : lando
2019-06-15 05:27:40 +00:00
Randell Jesup
1c5db230d6 Bug 1554183: Save font data to startup cache immediately r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D33245

--HG--
extra : rebase_source : 53851b4761013c0c65e5e173e8367852729fd0c3
2019-05-24 21:38:47 -04:00
Razvan Maries
d1e73ed3bc Backed out changeset 023c03347e6a (bug 1554183) for build bustages. CLOSED TREE 2019-05-31 18:29:47 +03:00
Randell Jesup
57fd4e550d Bug 1554183: Save font data to startup cache immediately r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D33245

--HG--
extra : rebase_source : e3d4445f3d9a24262127caca7a273846478e3c85
2019-05-24 21:38:47 -04:00
Jonathan Kew
262778abc6 Bug 1533797 - Let freetype backend fall back to MS_SYMBOL if no UNICODE charmap is available. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D30625

--HG--
extra : moz-landing-system : lando
2019-05-10 16:27:49 +00:00
Jonathan Kew
300d6b5a42 Bug 1514869 - patch 2 - Adapt platform-font-list code to work with either the existing in-process font list or cross-process shared font list. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D22938

--HG--
extra : moz-landing-system : lando
2019-04-27 15:37:58 +00:00
Jean-Yves Avenard
11ac9e9cf8 Bug 1540581 - P6. Tidy some C++ declarations in gfx/. r=gerald,jrmuizel
* Remove redundant virtual keywords
* Mark all destructors of inheriting classes as virtual for clarity
* Mark all classes without virtual destructor as final (exposed errors)
* Make destructor virtual where it needed to be (some were missing)
* Replace empty ({}) code declaration in header with = default
* Remove virtual unused methods

I probably missed some, it quickly became a rabbit hole.

Differential Revision: https://phabricator.services.mozilla.com/D26060

--HG--
extra : moz-landing-system : lando
2019-04-11 12:36:51 +00:00
Jonathan Kew
d2a3361fa4 Bug 1533428 - patch 7 - Create a FontFamily type that wraps either a gfxFontFamily pointer or a mozilla::fontlist::Family pointer (to be used by the shared font list), and use this in various places where we need to pass families around. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D22934

--HG--
extra : moz-landing-system : lando
2019-04-01 14:33:34 +00:00
Jonathan Kew
23806e75ca Bug 1500356 - Update gfxFont/gfxFontEntry to use new harfbuzz API in place of deprecated functions. r=jrmuizel
--HG--
extra : rebase_source : d5737b581503e45e1d9fb235cbfc21d8fb568ee7
2018-12-08 08:44:55 -05:00
Tooru Fujisawa
7983faeb5d Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00
Sylvestre Ledru
265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Andrew McCreight
55cef5b2ab Bug 1504365 - Clear weak pointers in shutdown observers. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D12348

--HG--
extra : moz-landing-system : lando
2018-11-19 23:16:24 +00:00
Jonathan Kew
fb4f42f9a7 Bug 1507506 - Use a sorted array rather than a hashtable for the short list of bad-underline font families. r=jwatt 2018-11-15 16:11:45 +00:00
Jonathan Kew
ec73ee3318 Bug 1491860 - Use utf-8 rather than utf-16 strings to read/store font family names from preferences, as they're almost entirely ASCII. r=lsalzman 2018-09-18 09:34:24 +01:00
Jonathan Kew
6f42f167fb Bug 1490402 - Use UTF-8 strings (in place of UTF-16) for font family/face names in the system font list, to reduce memory footprint. r=lsalzman 2018-09-12 20:34:57 +01:00
Henri Sivonen
3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Jonathan Kew
0165cf1194 Bug 1478716 - Ensure we only call FT_Get_MM_Var once per face (and cache the result in the font entry), to avoid being bitten by freetype bug 52955 on Ubuntu. r=lsalzman 2018-08-01 22:39:05 +01:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Lee Salzman
9e14da3f5a Bug 1470515 - refactor ScaledFontFreeType for Android WR. r=rhunt
--HG--
rename : gfx/2d/NativeFontResourceFontconfig.cpp => gfx/2d/NativeFontResourceFreeType.cpp
rename : gfx/2d/NativeFontResourceFontconfig.h => gfx/2d/NativeFontResourceFreeType.h
rename : gfx/2d/ScaledFontCairo.cpp => gfx/2d/ScaledFontFreeType.cpp
rename : gfx/2d/ScaledFontCairo.h => gfx/2d/ScaledFontFreeType.h
2018-06-14 16:42:56 -07:00
Emilio Cobos Álvarez
fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Jonathan Kew
a4df82c15c Bug 1460858 - Fix serialization/deserialization of SlantStyle for the Android startupCache, to ensure proper styled face selection. r=jwatt 2018-05-17 14:44:37 +01:00
Narcis Beleuzu
2a7f77fea4 Backed out changeset 4d6aa78bf59d (bug 1460858) for Android mochitest failures on test_font_whitelist.html. CLOSED TREE 2018-05-17 18:53:28 +03:00
Jonathan Kew
39f95c038d Bug 1460858 - Fix serialization/deserialization of SlantStyle for the Android startupCache, to ensure proper styled face selection. r=jwatt 2018-05-17 14:44:37 +01:00
Jonathan Kew
e92b9e44cf Bug 1449605 - part 1 - Rearrange thebes font code so that the decision whether to apply synthetic-bold is deferred until actually instantiating a font, not made during the font-matching process. r=jwatt
This rearranges how synthetic-bold use is determined in the font selection
& rendering code. Previously, we would decide during the font-selection
algorithm whether we need to apply synthetic-bold to the chosen face, and
then pass that decision through the fontgroup (storing it in the FamilyFace
entries of the mFonts array there) down to the actual rendering code that
instantiates fonts from the faces (font entries) we've selected.

That became a problem for variation fonts because in the case of a user
font, we may not have downloaded the resource yet, so we just have a "user
font container" entry, which carries the descriptors from the @font-face
rule and will fetch the actual resource when needed. But in the case of a
@font-face rule without a weight descriptor, we don't actually know at
font-selection time whether the face will support "true" bold (via a
variation axis) or not, so we can't reliably make the right decision about
applying synthetic bold.

So we now defer that decision until we actually instantiate a platform font
object to shape/measure/draw text. At that point, we have the requested
style and we also have the real font resource, so we can easily determine
whether fake-bold is required.

(This patch should not result in any visible behavior change; that will
come in a second patch now that the architecture supports it.)
2018-05-01 10:30:50 +01:00
Jonathan Kew
d384879f12 Bug 1457103 - patch 3 - Make gfxFontEntry::GetVariationAxes and GetVariationInstances pure virtual, and provide missing subclass implementations. r=jwatt 2018-04-26 17:08:18 +01:00
Jonathan Kew
6ad9a5ee43 Bug 1457103 - patch 1 - Make gfxFontEntry::HasVariations a pure-virtual method, and fill in missing subclass implementations, particularly in FT2FontEntry. r=jwatt 2018-04-26 17:08:18 +01:00
Jonathan Kew
c57f185cd9 Bug 1454598 - part 3 - Use WeightRange more extensively in place of FontWeight throughout user-font handling and font-entry creation, and handle Stretch and SlantStyle similarly. r=jwatt 2018-04-25 07:18:23 +01:00
Jonathan Kew
9872150acc Bug 1454598 - part 2 - Allow variation fonts to record a weight range in gfxFontEntry, and update font-matching to handle ranges. r=jwatt 2018-04-25 07:18:23 +01:00
Jonathan Kew
7e27ba83c3 Backed out 4 changesets from bug 1454598 (26e036b1c703, bc910e36a7d7, bac001216577, 5af215d265b6) due to macOS 10.12 font issues. 2018-04-25 10:18:07 +01:00
Jonathan Kew
8489323f79 Bug 1454598 - part 3 - Use WeightRange more extensively in place of FontWeight throughout user-font handling and font-entry creation, and handle Stretch and SlantStyle similarly. r=jwatt 2018-04-25 07:18:23 +01:00