From 70804d576fea1ca6d9427f2d14128b9d4625970e Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Wed, 4 Mar 2020 02:51:52 -0800 Subject: [PATCH 1/4] Add default system font lookup for Linux --- shell/platform/glfw/BUILD.gn | 5 ++++- shell/platform/glfw/flutter_glfw.cc | 15 +++++++++++++++ shell/platform/linux/BUILD.gn | 3 ++- shell/platform/linux/config/BUILD.gn | 9 +++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn index 546718bc14158..0b0cd55dd785b 100644 --- a/shell/platform/glfw/BUILD.gn +++ b/shell/platform/glfw/BUILD.gn @@ -60,7 +60,10 @@ source_set("flutter_glfw") { if (is_linux) { libs = [ "GL" ] - configs += [ "//flutter/shell/platform/linux/config:x11" ] + configs += [ + "//flutter/shell/platform/linux/config:x11", + "//flutter/shell/platform/linux/config:glib", + ] } else if (is_mac) { libs = [ "CoreVideo.framework", diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index da1176f4f0f5b..345e659e75c66 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -174,6 +175,20 @@ static double GetScreenCoordinatesPerInch() { return primary_monitor_mode->width / (primary_monitor_width_mm / 25.4); } +static std::string GetSystemDefaultFont() { + std::string result = ""; + g_autoptr(GSettngsSchema) schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), "org.gnome.desktop.interface", FALSE); + if (schema != NULL) { + g_autoptr(GSettingsBackend) backend = g_settings_backend_get_default (); + g_autoptr(GSettings) settings = g_settings_new_full (schema, backend, "org.gnome.desktop.interface"); + if (g_settings_schema_has_key (schema, "font-name")) { + g_autofree gchar *font_name = g_settings_get_string (settings, "font-name"); + result = std::string(font_name); + } + } + return result; +} + // Sends a window metrics update to the Flutter engine using the given // framebuffer size and the current window information in |state|. static void SendWindowMetrics(FlutterDesktopWindowControllerState* state, diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index db36000e0da21..c722858be6ac0 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -14,9 +14,10 @@ group("linux") { "//flutter/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", ] } + configs += [ "//flutter/shell/platform/linux/config:glib" ] } -# Temporary workraround for the issue describe in +# Temporary workaround for the issue describe in # https://github.com/flutter/flutter/issues/14509 and # https://github.com/flutter/flutter/issues/14438 # Remove once the build infrastructure moves to Ubuntu 18.04 or newer, where diff --git a/shell/platform/linux/config/BUILD.gn b/shell/platform/linux/config/BUILD.gn index 48cf022355cff..8f88f9ff4b3ab 100644 --- a/shell/platform/linux/config/BUILD.gn +++ b/shell/platform/linux/config/BUILD.gn @@ -7,3 +7,12 @@ import("//build/config/linux/pkg_config.gni") pkg_config("x11") { packages = [ "x11" ] } + +pkg_config("glib") { + packages = [ + "glib-2.0", + "gmodule-2.0", + "gobject-2.0", + "gthread-2.0", + ] +} From 750ec87b21968baa0afe561a143693b8903cc3d3 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Wed, 4 Mar 2020 07:59:59 -0800 Subject: [PATCH 2/4] Convert default font families to a list --- shell/platform/glfw/BUILD.gn | 1 - shell/platform/glfw/flutter_glfw.cc | 15 -------------- shell/platform/linux/BUILD.gn | 1 - shell/platform/linux/config/BUILD.gn | 9 --------- third_party/txt/BUILD.gn | 11 +++++++++++ third_party/txt/src/txt/font_collection.cc | 14 +++++++------ third_party/txt/src/txt/platform.cc | 5 +++-- third_party/txt/src/txt/platform.h | 4 +++- third_party/txt/src/txt/platform_android.cc | 5 +++-- third_party/txt/src/txt/platform_fuchsia.cc | 5 +++-- third_party/txt/src/txt/platform_linux.cc | 22 +++++++++++++++++++-- third_party/txt/src/txt/platform_mac.mm | 8 +++++--- third_party/txt/src/txt/platform_windows.cc | 5 +++-- third_party/txt/src/txt/text_style.cc | 2 +- 14 files changed, 60 insertions(+), 47 deletions(-) diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn index 0b0cd55dd785b..78c0d81d9b4ce 100644 --- a/shell/platform/glfw/BUILD.gn +++ b/shell/platform/glfw/BUILD.gn @@ -62,7 +62,6 @@ source_set("flutter_glfw") { configs += [ "//flutter/shell/platform/linux/config:x11", - "//flutter/shell/platform/linux/config:glib", ] } else if (is_mac) { libs = [ diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index 345e659e75c66..da1176f4f0f5b 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -175,20 +174,6 @@ static double GetScreenCoordinatesPerInch() { return primary_monitor_mode->width / (primary_monitor_width_mm / 25.4); } -static std::string GetSystemDefaultFont() { - std::string result = ""; - g_autoptr(GSettngsSchema) schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), "org.gnome.desktop.interface", FALSE); - if (schema != NULL) { - g_autoptr(GSettingsBackend) backend = g_settings_backend_get_default (); - g_autoptr(GSettings) settings = g_settings_new_full (schema, backend, "org.gnome.desktop.interface"); - if (g_settings_schema_has_key (schema, "font-name")) { - g_autofree gchar *font_name = g_settings_get_string (settings, "font-name"); - result = std::string(font_name); - } - } - return result; -} - // Sends a window metrics update to the Flutter engine using the given // framebuffer size and the current window information in |state|. static void SendWindowMetrics(FlutterDesktopWindowControllerState* state, diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index c722858be6ac0..54e1bbbd7c709 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -14,7 +14,6 @@ group("linux") { "//flutter/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", ] } - configs += [ "//flutter/shell/platform/linux/config:glib" ] } # Temporary workaround for the issue describe in diff --git a/shell/platform/linux/config/BUILD.gn b/shell/platform/linux/config/BUILD.gn index 8f88f9ff4b3ab..48cf022355cff 100644 --- a/shell/platform/linux/config/BUILD.gn +++ b/shell/platform/linux/config/BUILD.gn @@ -7,12 +7,3 @@ import("//build/config/linux/pkg_config.gni") pkg_config("x11") { packages = [ "x11" ] } - -pkg_config("glib") { - packages = [ - "glib-2.0", - "gmodule-2.0", - "gobject-2.0", - "gthread-2.0", - ] -} diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index 56b73a020bd2a..07a37e8689b73 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -14,6 +14,7 @@ import("//flutter/common/config.gni") import("//flutter/testing/testing.gni") +import("//build/config/linux/pkg_config.gni") declare_args() { flutter_use_fontconfig = false @@ -23,6 +24,12 @@ if (flutter_use_fontconfig) { assert(is_linux) } +pkg_config("glib") { + packages = [ + "gio-2.0", + ] +} + config("txt_config") { visibility = [ ":*" ] include_dirs = [ "src" ] @@ -136,6 +143,10 @@ source_set("txt") { public_configs = [ ":txt_config" ] + if (is_linux) { + configs += [ ":glib" ] + } + public_deps = [ "//flutter/fml", "//third_party/harfbuzz", diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 70104d90f8506..e20b22c839b94 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -150,11 +150,13 @@ FontCollection::GetMinikinFontCollectionForFamilies( } // Search for default font family if no user font families were found. if (minikin_families.empty()) { - const auto default_font_family = GetDefaultFontFamily(); - std::shared_ptr minikin_family = - FindFontFamilyInManagers(default_font_family); - if (minikin_family != nullptr) { - minikin_families.push_back(minikin_family); + const auto default_font_families = GetDefaultFontFamilies(); + for (auto family: default_font_families) { + std::shared_ptr minikin_family = + FindFontFamilyInManagers(family); + if (minikin_family != nullptr) { + minikin_families.push_back(minikin_family); + } } } // Default font family also not found. We fail to get a FontCollection. @@ -319,7 +321,7 @@ FontCollection::CreateSktFontCollection() { skt_collection_ = sk_make_sp(); skt_collection_->setDefaultFontManager(default_font_manager_, - GetDefaultFontFamily().c_str()); + GetDefaultFontFamilies()[0].c_str()); skt_collection_->setAssetFontManager(asset_font_manager_); skt_collection_->setDynamicFontManager(dynamic_font_manager_); skt_collection_->setTestFontManager(test_font_manager_); diff --git a/third_party/txt/src/txt/platform.cc b/third_party/txt/src/txt/platform.cc index 41831870d5335..ed10095329345 100644 --- a/third_party/txt/src/txt/platform.cc +++ b/third_party/txt/src/txt/platform.cc @@ -1,13 +1,14 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "txt/platform.h" namespace txt { -std::string GetDefaultFontFamily() { - return "Arial"; +std::vector GetDefaultFontFamilies() { + return { "Arial" }; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform.h b/third_party/txt/src/txt/platform.h index 3df3433011ea2..6c3a3cc53a984 100644 --- a/third_party/txt/src/txt/platform.h +++ b/third_party/txt/src/txt/platform.h @@ -6,13 +6,15 @@ #define TXT_PLATFORM_H_ #include +#include + #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkFontMgr.h" namespace txt { -std::string GetDefaultFontFamily(); +std::vector GetDefaultFontFamilies(); sk_sp GetDefaultFontManager(); diff --git a/third_party/txt/src/txt/platform_android.cc b/third_party/txt/src/txt/platform_android.cc index ae7fa2c77ec2c..e98b8bc804767 100644 --- a/third_party/txt/src/txt/platform_android.cc +++ b/third_party/txt/src/txt/platform_android.cc @@ -1,13 +1,14 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "txt/platform.h" namespace txt { -std::string GetDefaultFontFamily() { - return "sans-serif"; +std::vector GetDefaultFontFamilies() { + return { "sans-serif" }; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_fuchsia.cc b/third_party/txt/src/txt/platform_fuchsia.cc index fd5dc73fcf4c6..2b1bd5dfd13c5 100644 --- a/third_party/txt/src/txt/platform_fuchsia.cc +++ b/third_party/txt/src/txt/platform_fuchsia.cc @@ -1,13 +1,14 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "txt/platform.h" namespace txt { -std::string GetDefaultFontFamily() { - return "Roboto"; +std::vector GetDefaultFontFamilies() { + return { "Roboto" }; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_linux.cc b/third_party/txt/src/txt/platform_linux.cc index 36df613eecb90..d52b8ebc4ae3c 100644 --- a/third_party/txt/src/txt/platform_linux.cc +++ b/third_party/txt/src/txt/platform_linux.cc @@ -2,6 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include +#include + +#include +#include + #include "txt/platform.h" #ifdef FLUTTER_USE_FONTCONFIG @@ -12,8 +18,20 @@ namespace txt { -std::string GetDefaultFontFamily() { - return "Arial"; +std::vector GetDefaultFontFamilies() { + return { "Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", "Arial" }; +// std::string result = "DejaVu Sans"; +// g_autoptr(GSettingsSchema) schema = g_settings_schema_source_lookup(g_settings_schema_source_get_default(), "org.gnome.desktop.interface", FALSE); +// if (schema != NULL) { +// g_autoptr(GSettings) settings = g_settings_new_full(schema, NULL, NULL); +// if (g_settings_schema_has_key(schema, "font-name")) { +// g_autofree gchar *font_name = g_settings_get_string(settings, "font-name"); +// result = std::string(font_name); +// result = result.substr(0, result.rfind(' ')); +// } +// } +// std::cout << "default font: " << result << std::endl; +// return result; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_mac.mm b/third_party/txt/src/txt/platform_mac.mm index 3dce7b6ca3954..efc1b8b751d1a 100644 --- a/third_party/txt/src/txt/platform_mac.mm +++ b/third_party/txt/src/txt/platform_mac.mm @@ -1,6 +1,8 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include +#include #include #include "flutter/fml/platform/darwin/platform_version.h" @@ -16,11 +18,11 @@ namespace txt { -std::string GetDefaultFontFamily() { +std::vector GetDefaultFontFamilies() { if (fml::IsPlatformVersionAtLeast(9)) { - return [FONT_CLASS systemFontOfSize:14].familyName.UTF8String; + return { [FONT_CLASS systemFontOfSize:14].familyName.UTF8String }; } else { - return "Helvetica"; + return { "Helvetica" }; } } diff --git a/third_party/txt/src/txt/platform_windows.cc b/third_party/txt/src/txt/platform_windows.cc index c16e30386252a..4deede3a2791f 100644 --- a/third_party/txt/src/txt/platform_windows.cc +++ b/third_party/txt/src/txt/platform_windows.cc @@ -1,14 +1,15 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "third_party/skia/include/ports/SkTypeface_win.h" #include "txt/platform.h" namespace txt { -std::string GetDefaultFontFamily() { - return "Arial"; +std::vector GetDefaultFontFamilies() { + return { "Arial" }; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/text_style.cc b/third_party/txt/src/txt/text_style.cc index 8ca0c42a1e4cb..27c6e954bbb49 100644 --- a/third_party/txt/src/txt/text_style.cc +++ b/third_party/txt/src/txt/text_style.cc @@ -24,7 +24,7 @@ namespace txt { TextStyle::TextStyle() - : font_families(std::vector(1, GetDefaultFontFamily())) {} + : font_families(GetDefaultFontFamilies()) {} bool TextStyle::equals(const TextStyle& other) const { if (color != other.color) From 1019b90eaf1157feccfc49034e07bc11d288b374 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Wed, 4 Mar 2020 08:04:51 -0800 Subject: [PATCH 3/4] Remove glib remains --- shell/platform/glfw/BUILD.gn | 4 +--- third_party/txt/BUILD.gn | 11 ----------- third_party/txt/src/txt/font_collection.cc | 2 +- third_party/txt/src/txt/platform.cc | 3 +-- third_party/txt/src/txt/platform_android.cc | 3 +-- third_party/txt/src/txt/platform_fuchsia.cc | 3 +-- third_party/txt/src/txt/platform_linux.cc | 20 +------------------- third_party/txt/src/txt/platform_mac.mm | 6 ++---- third_party/txt/src/txt/platform_windows.cc | 3 +-- third_party/txt/src/txt/text_style.cc | 3 +-- 10 files changed, 10 insertions(+), 48 deletions(-) diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn index 78c0d81d9b4ce..546718bc14158 100644 --- a/shell/platform/glfw/BUILD.gn +++ b/shell/platform/glfw/BUILD.gn @@ -60,9 +60,7 @@ source_set("flutter_glfw") { if (is_linux) { libs = [ "GL" ] - configs += [ - "//flutter/shell/platform/linux/config:x11", - ] + configs += [ "//flutter/shell/platform/linux/config:x11" ] } else if (is_mac) { libs = [ "CoreVideo.framework", diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index 07a37e8689b73..56b73a020bd2a 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -14,7 +14,6 @@ import("//flutter/common/config.gni") import("//flutter/testing/testing.gni") -import("//build/config/linux/pkg_config.gni") declare_args() { flutter_use_fontconfig = false @@ -24,12 +23,6 @@ if (flutter_use_fontconfig) { assert(is_linux) } -pkg_config("glib") { - packages = [ - "gio-2.0", - ] -} - config("txt_config") { visibility = [ ":*" ] include_dirs = [ "src" ] @@ -143,10 +136,6 @@ source_set("txt") { public_configs = [ ":txt_config" ] - if (is_linux) { - configs += [ ":glib" ] - } - public_deps = [ "//flutter/fml", "//third_party/harfbuzz", diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index e20b22c839b94..d1815eb41781e 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -151,7 +151,7 @@ FontCollection::GetMinikinFontCollectionForFamilies( // Search for default font family if no user font families were found. if (minikin_families.empty()) { const auto default_font_families = GetDefaultFontFamilies(); - for (auto family: default_font_families) { + for (auto family : default_font_families) { std::shared_ptr minikin_family = FindFontFamilyInManagers(family); if (minikin_family != nullptr) { diff --git a/third_party/txt/src/txt/platform.cc b/third_party/txt/src/txt/platform.cc index ed10095329345..c60731b3758b5 100644 --- a/third_party/txt/src/txt/platform.cc +++ b/third_party/txt/src/txt/platform.cc @@ -1,14 +1,13 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include #include "txt/platform.h" namespace txt { std::vector GetDefaultFontFamilies() { - return { "Arial" }; + return {"Arial"}; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_android.cc b/third_party/txt/src/txt/platform_android.cc index e98b8bc804767..1e42a7c770b7c 100644 --- a/third_party/txt/src/txt/platform_android.cc +++ b/third_party/txt/src/txt/platform_android.cc @@ -1,14 +1,13 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include #include "txt/platform.h" namespace txt { std::vector GetDefaultFontFamilies() { - return { "sans-serif" }; + return {"sans-serif"}; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_fuchsia.cc b/third_party/txt/src/txt/platform_fuchsia.cc index 2b1bd5dfd13c5..23b0e96900b16 100644 --- a/third_party/txt/src/txt/platform_fuchsia.cc +++ b/third_party/txt/src/txt/platform_fuchsia.cc @@ -1,14 +1,13 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include #include "txt/platform.h" namespace txt { std::vector GetDefaultFontFamilies() { - return { "Roboto" }; + return {"Roboto"}; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_linux.cc b/third_party/txt/src/txt/platform_linux.cc index d52b8ebc4ae3c..9e13898d49e7a 100644 --- a/third_party/txt/src/txt/platform_linux.cc +++ b/third_party/txt/src/txt/platform_linux.cc @@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include -#include - -#include -#include - #include "txt/platform.h" #ifdef FLUTTER_USE_FONTCONFIG @@ -19,19 +13,7 @@ namespace txt { std::vector GetDefaultFontFamilies() { - return { "Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", "Arial" }; -// std::string result = "DejaVu Sans"; -// g_autoptr(GSettingsSchema) schema = g_settings_schema_source_lookup(g_settings_schema_source_get_default(), "org.gnome.desktop.interface", FALSE); -// if (schema != NULL) { -// g_autoptr(GSettings) settings = g_settings_new_full(schema, NULL, NULL); -// if (g_settings_schema_has_key(schema, "font-name")) { -// g_autofree gchar *font_name = g_settings_get_string(settings, "font-name"); -// result = std::string(font_name); -// result = result.substr(0, result.rfind(' ')); -// } -// } -// std::cout << "default font: " << result << std::endl; -// return result; + return {"Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", "Arial"}; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/platform_mac.mm b/third_party/txt/src/txt/platform_mac.mm index efc1b8b751d1a..da9847458928e 100644 --- a/third_party/txt/src/txt/platform_mac.mm +++ b/third_party/txt/src/txt/platform_mac.mm @@ -1,8 +1,6 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include -#include #include #include "flutter/fml/platform/darwin/platform_version.h" @@ -20,9 +18,9 @@ std::vector GetDefaultFontFamilies() { if (fml::IsPlatformVersionAtLeast(9)) { - return { [FONT_CLASS systemFontOfSize:14].familyName.UTF8String }; + return {[FONT_CLASS systemFontOfSize:14].familyName.UTF8String}; } else { - return { "Helvetica" }; + return {"Helvetica"}; } } diff --git a/third_party/txt/src/txt/platform_windows.cc b/third_party/txt/src/txt/platform_windows.cc index 4deede3a2791f..da44b9fd1c3b6 100644 --- a/third_party/txt/src/txt/platform_windows.cc +++ b/third_party/txt/src/txt/platform_windows.cc @@ -1,7 +1,6 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include #include "third_party/skia/include/ports/SkTypeface_win.h" #include "txt/platform.h" @@ -9,7 +8,7 @@ namespace txt { std::vector GetDefaultFontFamilies() { - return { "Arial" }; + return {"Segoe UI", "Arial"}; } sk_sp GetDefaultFontManager() { diff --git a/third_party/txt/src/txt/text_style.cc b/third_party/txt/src/txt/text_style.cc index 27c6e954bbb49..04589659b6539 100644 --- a/third_party/txt/src/txt/text_style.cc +++ b/third_party/txt/src/txt/text_style.cc @@ -23,8 +23,7 @@ namespace txt { -TextStyle::TextStyle() - : font_families(GetDefaultFontFamilies()) {} +TextStyle::TextStyle() : font_families(GetDefaultFontFamilies()) {} bool TextStyle::equals(const TextStyle& other) const { if (color != other.color) From d9df638098e440ea663acb5a8ce72cf505f659a9 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Wed, 4 Mar 2020 22:11:22 +0100 Subject: [PATCH 4/4] Review Changes --- third_party/txt/src/txt/font_collection.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index d1815eb41781e..3b550f7f313fb 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -156,6 +156,7 @@ FontCollection::GetMinikinFontCollectionForFamilies( FindFontFamilyInManagers(family); if (minikin_family != nullptr) { minikin_families.push_back(minikin_family); + break; } } }