280 Commits

Author SHA1 Message Date
Jason Simmons
11ed711eb8
Invalidate the cached SkParagraph font collection when a new font manager is installed (#22157) 2020-10-29 09:31:04 -07:00
Jason Simmons
6fdcdd99cc
Forward font collection APIs to the SkParagraph font collection (#21734) 2020-10-19 16:27:03 -07:00
Jason Simmons
f854cbbfa5
Specify the Noto Naskh Arabic font to get consistent results in tests using Arabic characters (#21974)
See https://github.com/flutter/flutter/issues/68493
2020-10-19 13:51:39 -07:00
gaaclarke
d4ac8e6cb2
Temporarily disabled tests that were using latin and arabic characters (#21971)
while we fix them.
2020-10-19 11:51:34 -07:00
Jason Simmons
069b3cf8f0
Fix the offset passed to minikin::GraphemeBreak::isGraphemeBreak (#21706)
The character offset passed to isGraphemeBreak is relative to the beginning
of the string (not relative to the text_start parameter).  This caused bad
results when searching for grapheme breaks beyond the first line of text
(see https://github.com/flutter/flutter/issues/24802).

This PR fixes the offset value.  It also reverts the workaround applied in
https://github.com/flutter/engine/pull/10063, which caused incorrect
calculation of boundaries between graphemes within ligatures.
2020-10-14 11:44:38 -07:00
Jason Simmons
7e20575b6b
Clear the Minikin layout cache during engine destruction (#21473) 2020-10-08 13:53:04 -07:00
Jason Simmons
641d4e0e42
Add an adjustment to currentLineWidth comparisons when pushing greedy line breaks (#21356)
This is similar to the workaround used for
https://github.com/flutter/flutter/issues/30347

The Minikin line breaker inserts greedy breaks based on a comparison of
postBreak width and currentLineWidth.  currentLineWidth is provided by
the framework based on previous calls to Layout::measureText.
That calculation may not exactly match the calculation of postBreak.

This change ensures that breaks are only added if the difference
between postBreak and currentLineWidth is significant.

Fixes https://github.com/flutter/flutter/issues/65419
2020-10-07 15:34:59 -07:00
Dan Field
612acf349e
Fix windows popup (#21522) 2020-09-30 14:38:44 -07:00
Chris Bracken
08dabe9601
Clean up C++ includes (#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Chris Bracken
16b900b63e
Prefer C++ standard headers to their C counterpart (#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Chris Bracken
36f7f3ca82
Copyright header hygiene improvements (#21089)
Add copyright headers in a few files where they were missing.

Trim trailing blank comment line where present, for consistency with
other engine code.

Use the standard libtxt copyright header in one file where it differed
(extra (C) and comma compared to other files in libtxt).

This also amends tools/const_finder/test/const_finder_test.dart to look
for a const an additional four lines down to account for the copyright
header added to the test fixture.
2020-09-11 08:55:37 -07:00
xster
f8d2d7b42f
Fix font sorting problem due to iOS 14 fonts being broader (#20557) 2020-08-24 13:03:20 -07:00
LongCatIsLooong
d6a0b965b0
Reland "account for inline placeholders in longest line calculation (#20370)" reverted in (#20669) (#20678) 2020-08-21 16:31:02 -07:00
Zachary Anderson
dcd51b8cc1
Revert "account for inline placeholders in longest line calculation (#20370)" (#20669)
This reverts commit 9893a2936658918d742b71ef8cbb07ed63941b18.

Landing on red to fix the build.
2020-08-20 12:35:48 -07:00
LongCatIsLooong
9893a29366
account for inline placeholders in longest line calculation (#20370) 2020-08-11 16:23:26 -07:00
Siva
b955e15ee9
Manual roll of Dart from 24c7666def...40fd1c456e (#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
David Worsham
9353692cdb
fuchsia: Enable most unittests (#19583)
Tweak the primary flutter build rule so that fuchsia is more similar to
other platforms in how tests and the shell are built.

Only embedder_unittests and GLFW tests are disabled on Fuchsia now.

TEST: Ran unittests on host/fuchsia; workstation on fuchsia
BUG: fxb/53847, fxb/54056
2020-07-13 17:36:19 -07:00
Michael Goderbauer
ed5df03dcd
Word substitutions (#19111) 2020-06-18 11:05:24 -07:00
Gary Qian
c9c80011bb
Fix windows SkParagraph compilation (#19073) 2020-06-17 02:14:34 -07:00
bungeman
9ccb2e7f14
Mark conditional SkParagraph include nogncheck. (#18741) 2020-06-02 11:18:03 -07:00
Jason Simmons
46a6d966ad
[SkParagraph] Copy text height behavior to the Skia paragraph style (#18178) 2020-05-07 18:24:08 -07:00
Ali Mahdiyar
b6bb7e796a
Handle paragraph alignment and direction in newline rectangles (#17750) 2020-04-20 14:35:01 -07:00
Jason Simmons
6c431f021c
Remove unused parameter from GetLineXOffset (#17745) 2020-04-17 12:24:58 -07:00
Chris Bracken
e55b4476f1
Use const refs in for loops where reasonable (#17484)
This patch optimizes C++11 range-based for loops where the variable is
copied in each iteration but it would suffice to obtain it by const
reference. This is only applied to loop variables of types that are
expensive to copy which means they are not trivially copyable or have a
non-trivial copy constructor or destructor.

To ensure that it is safe to replace the copy with a const reference
only the following cases are modified:
  * The loop variable is const-qualified.
  * The loop variable is not const, but only const methods or operators
    are invoked on it, or it is used as const reference or value argument
    in constructors or function calls.

This is an application of the internal performance-for-range-copy
clang-tidy analysis.
2020-04-03 11:44:35 -07:00
Dan Field
ff62dec5c9
Roll to clang11, mark 4 (#17483)
* "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 4 (#17467)" (#17482)"

This reverts commit 8166a91bca11b83c16fba8f8fd407e937a2ac89c.

* format code

* Roll buildroot to 3a27de1c5bb0f50be7d3efe3e00de4f6068c9f30
2020-04-02 13:04:49 -07:00
Greg Spencer
8ff6948e23
Make GetDefaultFontFamilies return a vector<string> instead of… (#16928)
On Linux, there is rarely just one default font that can reasonably be expected to be on the platform. This PR changes the GetDefaultFontFamily call to be GetDefaultFontFamilies, and it now returns a vector<string> so that the font collection code can look up all of them, and if any of them exist, add them to the fallback list.

For Linux, I supplied the list "Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", and "Arial", which should cover a large proportion of linux machines. For the other platforms, I supplied a list of length one, containing the one fallback font that used to be defined. On Windows, I added "Segoe UI" as a default, since that is the default system font on newer Windows.

The goal of this function is to provide at least one font family that is installed, since otherwise linux (or any platform) will just have no font at all if the default font isn't found.
2020-03-05 00:45:53 +01:00
Jason Simmons
a7a7afcfd2
[libtxt] Fix the flag used to check validity of the strikeout position in Skia font metrics (#15981) 2020-02-27 11:36:54 -08:00
Jason Simmons
ea56ad22da
libtxt: use a fixture in the benchmarks (#16531) 2020-02-11 10:24:47 -08:00
Jason Simmons
a195a92cc8
[SkParagraph] Text layout benchmarks using SkParagraph (#16373)
Imported from @Rusino's branch
2020-02-07 14:17:57 -08:00
stuartmorgan
473f55940f
Suppress some deprecation warnings on Windows (#16416)
Targeted suppression of some deprecation warnings that are build errors under
clang:
- Ignore the deprecation of codecvt's unicode conversion until we decide on
  a replacement strategy.
- Allow the deprecated posix names of functions in third_party/txt.

Part of https://github.com/flutter/flutter/issues/16256
2020-02-05 21:10:25 -08:00
Chinmay Garde
f7b78e001d
Remove all uses of the redundant flutter_root variable. (#16311)
This was only necessary when the Engine had to build in multiple buildroots
where the sources where checked out at different paths relative to the
buildroot. This is no longer the case and there are already cases GN rules
have been written that mix and match variable usage with the direct
specification of the path to the Flutter sources relative to the sole buildroot.
2020-01-31 21:49:48 -08:00
Gary Qian
ee297aa699
Reland "Engine/LibTxt/dart:ui impl of TextHeightBehavior #15087" (#16155) 2020-01-29 10:52:24 -08:00
Dan Field
53baa7aee5
Revert breaking PRs (#16148)
* Revert "Web PargraphStyle TextHeightBehavior integration (#16075)"

This reverts commit 86682a2d09e7d111a5c4fd2156b9971bd65fb693.

* Revert "Engine/LibTxt/dart:ui impl of TextHeightBehavior (#15087)"

This reverts commit cbf4536d158e25e372469c242e326c48cc730de7.
2020-01-28 10:40:05 -08:00
Gary Qian
cbf4536d15
Engine/LibTxt/dart:ui impl of TextHeightBehavior (#15087) 2020-01-27 13:37:11 -08:00
Dan Field
89f3471fa7
the the fix (#15973) 2020-01-24 12:43:32 -08:00
Jason Simmons
766f53c0c7 [libtxt] Assign a unique ID to each glyph cluster within a line (#15742) 2020-01-22 10:38:03 -08:00
Gary Qian
329154171c
Add FML_DCHECK to ensure layout before calling getters (#15635) 2020-01-14 13:44:29 -08:00
Jason Simmons
fd269f60bf
Use Skia's CSS3 style matcher for dynamically loaded font sets (#15468)
This will improve font matching for SkParagraph, which relies on the
FontStyleSet's matchStyle implementation to find the closest match for a
FontStyle.
2020-01-13 17:35:56 -08:00
Jason Simmons
0535b5e7df
[SkParagraph] Copy font features to the Skia layout engine text style (#15562) 2020-01-13 15:47:31 -08:00
Jason Simmons
bd322a69b0
[SkParagraph] Cache the font collection created for use by the Skia text shaper library (#15317) 2020-01-08 15:21:35 -08:00
Gary Qian
f9a2fab7c0
Fix RectHeightStyle::kMax ascent computation bug (#15106) 2020-01-07 10:43:42 -08:00
Jason Simmons
d6172fdcfa
libtxt: cache fallback fonts found by a Minikin font collection (#14482)
If a new fallback font is discovered during paragraph layout, the fallback
font cache in txt::FontCollection will use that font in future layouts.

However, that cache is not available if the new fallback font needs to be
used for other characters within the current layout.  This PR adds a cache
to minikin::FontCollection and checks whether fonts in the cache can handle
a character before calling the fallback font provider.

See https://github.com/flutter/engine/pull/13257
2019-12-13 15:18:37 -08:00
Jason Simmons
76d264ee71
[SkParagraph] Convert the height override flag in text styles (#14283) 2019-12-10 13:40:54 -08:00
Jason Simmons
bf99efe65b
libtxt: pass an RTL bool flag instead of a bidiFlags enum to measureText (#13736)
Fixes https://github.com/flutter/flutter/issues/41086
2019-11-08 15:18:06 -08:00
Gary Qian
0928c1af2f
Add 'Cough' test font and support multiple test fonts. (#13649) 2019-11-05 12:27:34 -08:00
Gary Qian
728e473f1a
Pass LinearTextFlat to SkFont - iOS13 letter spacing (#13321) 2019-10-28 11:09:26 -07:00
Gary Qian
5061b61a9a
Update harfbuzz to 2.6.2, Roll buildroot to a518e (#13242) 2019-10-22 15:18:36 -07:00
Gary Qian
ee1a140fa9
Add utils to disable on mac/windows, disable invalid LibLxt tests on mac (#13189) 2019-10-16 16:43:31 -07:00
Chinmay Garde
b6858d2092
Use the fixtures mechanism for txt unit-tests and benchmarks. (#13180)
These tests and benchmarks can now be run without needing additional flags on the command line.
2019-10-16 16:29:55 -07:00
Jason Simmons
c710a981f4
Integrate more SkParagraph builder patches (#13094)
* ParagraphBuilderSkia::AddPlaceholder implementation
* StrutStyle height override
2019-10-14 11:17:11 -07:00