Skip to content

Commit 9c75d7b

Browse files
committed
[Tizen] Cherrypicks from flutter-3.3.0-tizen
1 parent b24591e commit 9c75d7b

File tree

8 files changed

+60
-38
lines changed

8 files changed

+60
-38
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
@@ -96,7 +96,7 @@ vars = {
9696
"checkout_llvm": False,
9797

9898
# Setup Git hooks by default.
99-
"setup_githooks": True,
99+
"setup_githooks": False,
100100

101101
# Upstream URLs for third party dependencies, used in
102102
# determining common ancestor commit for vulnerability scanning

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: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,7 @@ def cpu_for_target_arch(arch):
9696

9797
def is_host_build(args):
9898
# If target_os == None, then this is a host build.
99-
if args.target_os is None:
100-
return True
101-
# For linux arm64 builds, we cross compile from x64 hosts, so the
102-
# target_os='linux' and linux-cpu='arm64'
103-
if args.target_os == 'linux' and args.linux_cpu == 'arm64':
104-
return True
105-
# The Mac and host targets are redundant. Again, necessary to disambiguate
106-
# during cross-compilation.
107-
if args.target_os == 'mac':
108-
return True
109-
return False
99+
return args.target_os is None
110100

111101

112102
# Determines whether a prebuilt Dart SDK can be used instead of building one.
@@ -435,7 +425,8 @@ def to_gn_args(args):
435425
else:
436426
gn_args['skia_use_gl'] = args.target_os != 'fuchsia'
437427

438-
if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia']:
428+
if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia',
429+
'linux']:
439430
# OpenGL is deprecated on macOS > 10.11.
440431
# This is not necessarily needed but enabling this until we have a way to
441432
# build a macOS metal only shell and a gl only shell.
@@ -529,8 +520,8 @@ def to_gn_args(args):
529520

530521
# Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
531522
# its inability to allocate address space without allocating memory.
532-
if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64', 'arm64'
533-
]:
523+
if args.target_os in ['android', 'linux'
524+
] and gn_args['target_cpu'] in ['x64', 'arm64']:
534525
gn_args['dart_use_compressed_pointers'] = True
535526

536527
if args.fuchsia_target_api_level is not None:
@@ -541,6 +532,10 @@ def to_gn_args(args):
541532
'fuchsia/target_api_level')) as file:
542533
gn_args['fuchsia_target_api_level'] = int(file.read().strip())
543534

535+
# Don't use the default Linux sysroot when buliding for Linux on macOS.
536+
if sys.platform == 'darwin' and args.target_os == 'linux':
537+
gn_args['use_default_linux_sysroot'] = False
538+
544539
# Flags for Dart features:
545540
if args.use_mallinfo2:
546541
gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
@@ -562,7 +557,7 @@ def to_gn_args(args):
562557
# There is a special case for Android on Windows because there we _only_ build
563558
# gen_snapshot, but the build defines otherwise make it look like the build is
564559
# for a host Windows build and make GN think we will be building ANGLE.
565-
if is_host_build(args) or (args.target_os == 'android' and
560+
if is_host_build(args) or (args.target_os == 'linux' and
566561
get_host_os() == 'win'):
567562
# Do not build unnecessary parts of the ANGLE tree.
568563
gn_args['angle_build_all'] = False

0 commit comments

Comments
 (0)