From c2e8a2e3ceb64c9f81d18c8ef6e430ce96078b85 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 1 Sep 2017 16:09:47 -0700 Subject: [PATCH] Use a generic sans-serif font family on Android that will be recognized by Skia's font manager (#4055) --- third_party/txt/BUILD.gn | 2 ++ third_party/txt/src/txt/paragraph.cc | 4 ++-- third_party/txt/src/txt/platform_android.cc | 13 +++++++++++++ travis/licenses_golden/licenses_flutter | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 third_party/txt/src/txt/platform_android.cc diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index c331d14b09..cbcd00aae1 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -105,6 +105,8 @@ source_set("txt") { set_sources_assignment_filter([]) sources += [ "src/txt/platform_mac.mm" ] set_sources_assignment_filter(sources_assignment_filter) + } else if (is_android) { + sources += [ "src/txt/platform_android.cc" ] } else { sources += [ "src/txt/platform.cc" ] } diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index b7082ac33d..c8e0896c93 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -148,8 +148,8 @@ bool Paragraph::AddRunsToLineBreaker( auto collection = font_collection_->GetMinikinFontCollectionForFamily( run.style.font_family); if (collection == nullptr) { - FTL_DLOG(INFO) << "Could not find font collection for family \"" - << run.style.font_family << "\"."; + FTL_LOG(INFO) << "Could not find font collection for family \"" + << run.style.font_family << "\"."; return false; } breaker_.addStyleRun(&paint, collection, font, run.start, run.end, false, diff --git a/third_party/txt/src/txt/platform_android.cc b/third_party/txt/src/txt/platform_android.cc new file mode 100644 index 0000000000..e42a25dbf8 --- /dev/null +++ b/third_party/txt/src/txt/platform_android.cc @@ -0,0 +1,13 @@ +// Copyright 2017 The Chromium 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 "txt/platform.h" + +namespace txt { + +std::string GetDefaultFontFamily() { + return "sans-serif"; +} + +} // namespace txt diff --git a/travis/licenses_golden/licenses_flutter b/travis/licenses_golden/licenses_flutter index 1bc756dae6..a802d3da96 100644 --- a/travis/licenses_golden/licenses_flutter +++ b/travis/licenses_golden/licenses_flutter @@ -1194,6 +1194,7 @@ FILE: ../../../flutter/third_party/txt/src/txt/directory_asset_data_provider.cc FILE: ../../../flutter/third_party/txt/src/txt/directory_asset_data_provider.h FILE: ../../../flutter/third_party/txt/src/txt/platform.cc FILE: ../../../flutter/third_party/txt/src/txt/platform.h +FILE: ../../../flutter/third_party/txt/src/txt/platform_android.cc FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h -- GitLab