Skip to content

Commit 7ab4d7a

Browse files
committed
[Tizen] Cherrypicks from flutter-3.3.0-tizen
1 parent 857bd6b commit 7ab4d7a

File tree

9 files changed

+60
-35
lines changed

9 files changed

+60
-35
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ vars = {
9595
"checkout_llvm": False,
9696

9797
# Setup Git hooks by default.
98-
"setup_githooks": True,
98+
"setup_githooks": False,
9999
}
100100

101101
gclient_gn_args_file = 'src/third_party/dart/build/config/gclient_args.gni'

common/config.gni

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,4 @@ if (flutter_prebuilt_dart_sdk) {
127127
# for cross-compiled desktop targets.
128128
# TODO: We can't build the engine artifacts for arm (32-bit) right now;
129129
# see https://github.com/flutter/flutter/issues/74322
130-
build_engine_artifacts =
131-
current_toolchain == host_toolchain ||
132-
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac
130+
build_engine_artifacts = current_toolchain == host_toolchain || is_mac

third_party/txt/src/minikin/FontCollection.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,9 @@ void FontCollection::itemize(const uint16_t* string,
509509
if (!shouldContinueRun) {
510510
const std::shared_ptr<FontFamily>& family = getFamilyForChar(
511511
ch, isVariationSelector(nextCh) ? nextCh : 0, langListId, variant);
512-
if (utf16Pos == 0 || family.get() != lastFamily) {
512+
if (utf16Pos == 0 || family.get() != lastFamily ||
513+
(!(U_GET_GC_MASK(prevCh) & U_GC_L_MASK) &&
514+
(U_GET_GC_MASK(ch) & U_GC_L_MASK))) {
513515
size_t start = utf16Pos;
514516
// Workaround for combining marks and emoji modifiers until we implement
515517
// per-cluster font selection: if a combining mark or an emoji modifier
@@ -528,8 +530,8 @@ void FontCollection::itemize(const uint16_t* string,
528530
}
529531
start -= prevChLength;
530532
}
531-
result->push_back(
532-
{family->getClosestMatch(style), static_cast<int>(start), 0});
533+
result->push_back({family->getClosestMatch(style, ch, variant),
534+
static_cast<int>(start), 0});
533535
run = &result->back();
534536
lastFamily = family.get();
535537
}

third_party/txt/src/minikin/FontFamily.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,28 @@ static FontFakery computeFakery(FontStyle wanted, FontStyle actual) {
146146
return FontFakery(isFakeBold, isFakeItalic);
147147
}
148148

149-
FakedFont FontFamily::getClosestMatch(FontStyle style) const {
149+
FakedFont FontFamily::getClosestMatch(
150+
FontStyle style,
151+
uint32_t codepoint /* = 0 */,
152+
uint32_t variationSelector /* = 0 */) const {
150153
const Font* bestFont = nullptr;
151-
int bestMatch = 0;
154+
int bestMatch = INT_MAX;
152155
for (size_t i = 0; i < mFonts.size(); i++) {
153156
const Font& font = mFonts[i];
154157
int match = computeMatch(font.style, style);
155-
if (i == 0 || match < bestMatch) {
156-
bestFont = &font;
157-
bestMatch = match;
158+
bool result = false;
159+
if (codepoint != 0) {
160+
hb_font_t* hbFont = getHbFontLocked(font.typeface.get());
161+
uint32_t unusedGlyph = 0;
162+
result =
163+
hb_font_get_glyph(hbFont, codepoint, variationSelector, &unusedGlyph);
164+
hb_font_destroy(hbFont);
165+
}
166+
if (codepoint == 0 || (codepoint != 0 && result)) {
167+
if (match < bestMatch) {
168+
bestFont = &font;
169+
bestMatch = match;
170+
}
158171
}
159172
}
160173
if (bestFont != nullptr) {

third_party/txt/src/minikin/FontFamily.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ class FontFamily {
140140
static bool analyzeStyle(const std::shared_ptr<MinikinFont>& typeface,
141141
int* weight,
142142
bool* italic);
143-
FakedFont getClosestMatch(FontStyle style) const;
143+
FakedFont getClosestMatch(FontStyle style,
144+
uint32_t codepoint = 0,
145+
uint32_t variationSelector = 0) const;
144146

145147
uint32_t langId() const { return mLangId; }
146148
int variant() const { return mVariant; }

third_party/txt/src/txt/font_collection.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,27 @@ void FontCollection::SortSkTypefaces(
243243
std::sort(
244244
sk_typefaces.begin(), sk_typefaces.end(),
245245
[](const sk_sp<SkTypeface>& a, const sk_sp<SkTypeface>& b) {
246+
{
247+
// A workaround to prevent emoji fonts being selected for normal text
248+
// when normal and emoji fonts are mixed in the same font family.
249+
bool a_isEmojiFont = false;
250+
bool b_isEmojiFont = false;
251+
SkString postScriptName;
252+
a->getPostScriptName(&postScriptName);
253+
if (postScriptName.contains("Emoji")) {
254+
a_isEmojiFont = true;
255+
}
256+
b->getPostScriptName(&postScriptName);
257+
if (postScriptName.contains("Emoji")) {
258+
b_isEmojiFont = true;
259+
}
260+
if (a_isEmojiFont && !b_isEmojiFont) {
261+
return false;
262+
} else if (!a_isEmojiFont && b_isEmojiFont) {
263+
return true;
264+
}
265+
}
266+
246267
SkFontStyle a_style = a->fontStyle();
247268
SkFontStyle b_style = b->fontStyle();
248269

third_party/txt/src/txt/platform_linux.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
namespace txt {
1414

1515
std::vector<std::string> GetDefaultFontFamilies() {
16-
return {"Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", "Arial"};
16+
return {"TizenDefaultFont", "SamsungOneUI"};
1717
}
1818

1919
sk_sp<SkFontMgr> GetDefaultFontManager(uint32_t font_initialization_data) {
2020
#ifdef FLUTTER_USE_FONTCONFIG
21-
return SkFontMgr_New_FontConfig(nullptr);
21+
return SkFontMgr::RefDefault();
2222
#else
2323
return SkFontMgr_New_Custom_Directory("/usr/share/fonts/");
2424
#endif

tools/gn

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ def cpu_for_target_arch(arch):
9494

9595
def is_host_build(args):
9696
# If target_os == None, then this is a host build.
97-
# However, for linux arm64 builds, we cross compile from x64 hosts, so the
98-
# target_os='linux' and linux-cpu='arm64'
99-
return args.target_os is None or (
100-
args.target_os == 'linux' and args.linux_cpu == 'arm64'
101-
)
97+
return args.target_os is None
10298

10399

104100
# Determines whether a prebuilt Dart SDK can be used instead of building one.
@@ -406,7 +402,7 @@ def to_gn_args(args):
406402
gn_args['skia_enable_api_available_macro'] = args.runtime_mode != 'release'
407403

408404
if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia',
409-
'wasm']:
405+
'linux', 'wasm']:
410406
# OpenGL is deprecated on macOS > 10.11.
411407
# This is not necessarily needed but enabling this until we have a way to
412408
# build a macOS metal only shell and a gl only shell.
@@ -501,8 +497,8 @@ def to_gn_args(args):
501497

502498
# Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
503499
# its inability to allocate address space without allocating memory.
504-
if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64', 'arm64'
505-
]:
500+
if args.target_os in ['android', 'linux'
501+
] and gn_args['target_cpu'] in ['x64', 'arm64']:
506502
gn_args['dart_use_compressed_pointers'] = True
507503

508504
if args.fuchsia_target_api_level is not None:
@@ -513,6 +509,10 @@ def to_gn_args(args):
513509
'fuchsia/target_api_level')) as file:
514510
gn_args['fuchsia_target_api_level'] = int(file.read().strip())
515511

512+
# Don't use the default Linux sysroot when buliding for Linux on macOS.
513+
if sys.platform == 'darwin' and args.target_os == 'linux':
514+
gn_args['use_default_linux_sysroot'] = False
515+
516516
# Flags for Dart features:
517517
if args.use_mallinfo2:
518518
gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
@@ -534,7 +534,7 @@ def to_gn_args(args):
534534
# There is a special case for Android on Windows because there we _only_ build
535535
# gen_snapshot, but the build defines otherwise make it look like the build is
536536
# for a host Windows build and make GN think we will be building ANGLE.
537-
if is_host_build(args) or (args.target_os == 'android' and
537+
if is_host_build(args) or (args.target_os == 'linux' and
538538
get_host_os() == 'win'):
539539
# Do not build unnecessary parts of the ANGLE tree.
540540
gn_args['angle_build_all'] = False

0 commit comments

Comments
 (0)