Skip to content

Commit f1278d0

Browse files
Link SkShaper/SkParagraph into the engine by default (flutter#23626)
1 parent cf42dbe commit f1278d0

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

common/config.gni

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ declare_args() {
1414
# The runtime mode ("debug", "profile", "release", or "jit_release")
1515
flutter_runtime_mode = "debug"
1616

17-
# Whether to use the Skia text shaper module
17+
# Whether to link the Skia text shaper module into the engine
1818
flutter_enable_skshaper = false
1919

20+
# Whether to use the Skia text shaper module for all text rendering
21+
flutter_always_use_skshaper = false
22+
2023
# Whether to use the legacy embedder when building for Fuchsia.
2124
flutter_enable_legacy_fuchsia_embedder = true
2225
}

lib/ui/BUILD.gn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ source_set("ui") {
135135
if (flutter_enable_skshaper) {
136136
defines += [ "FLUTTER_ENABLE_SKSHAPER" ]
137137
}
138+
if (flutter_always_use_skshaper) {
139+
defines += [ "FLUTTER_ALWAYS_USE_SKSHAPER" ]
140+
}
138141
if (is_win) {
139142
# Required for M_PI and others.
140143
defines += [ "_USE_MATH_DEFINES" ]

lib/ui/text/paragraph_builder.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,15 @@ ParagraphBuilder::ParagraphBuilder(
301301
ParagraphBuilderFactory factory = txt::ParagraphBuilder::CreateTxtBuilder;
302302

303303
#if FLUTTER_ENABLE_SKSHAPER
304-
if (UIDartState::Current()->enable_skparagraph()) {
304+
#if FLUTTER_ALWAYS_USE_SKSHAPER
305+
bool enable_skparagraph = true;
306+
#else
307+
bool enable_skparagraph = UIDartState::Current()->enable_skparagraph();
308+
#endif
309+
if (enable_skparagraph) {
305310
factory = txt::ParagraphBuilder::CreateSkiaBuilder;
306311
}
307-
#endif
312+
#endif // FLUTTER_ENABLE_SKSHAPER
308313

309314
m_paragraphBuilder = factory(style, font_collection.GetFontCollection());
310315
}

tools/gn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def to_gn_args(args):
107107
gn_args['flutter_enable_skshaper'] = args.enable_skshaper
108108
if args.enable_skshaper:
109109
gn_args['skia_use_icu'] = True
110+
gn_args['flutter_always_use_skshaper'] = args.always_use_skshaper
110111
gn_args['is_official_build'] = True # Disable Skia test utilities.
111112
gn_args['dart_component_kind'] = 'static_library' # Always link Dart in statically.
112113
gn_args['is_debug'] = args.unoptimized
@@ -388,9 +389,12 @@ def parse_args(args):
388389
parser.add_argument('--enable-vulkan', action='store_true', default=False)
389390

390391
parser.add_argument('--enable-fontconfig', action='store_true', default=False)
391-
parser.add_argument('--enable-skshaper', action='store_true', default=False)
392392
parser.add_argument('--enable-vulkan-validation-layers', action='store_true', default=False)
393393

394+
parser.add_argument('--enable-skshaper', action='store_true', default=True)
395+
parser.add_argument('--no-enable-skshaper', dest='enable_skshaper', action='store_false')
396+
parser.add_argument('--always-use-skshaper', action='store_true', default=False)
397+
394398
parser.add_argument('--embedder-for-target', dest='embedder_for_target', action='store_true', default=False)
395399

396400
parser.add_argument('--coverage', default=False, action='store_true')

0 commit comments

Comments
 (0)