Skip to content

Commit

Permalink
Use a generic sans-serif font family on Android that will be recogniz…
Browse files Browse the repository at this point in the history
…ed by Skia's font manager (flutter#4055)
  • Loading branch information
jason-simmons authored Sep 1, 2017
1 parent 1c6433f commit c2e8a2e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions third_party/txt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
4 changes: 2 additions & 2 deletions third_party/txt/src/txt/paragraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 13 additions & 0 deletions third_party/txt/src/txt/platform_android.cc
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions travis/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2e8a2e

Please sign in to comment.