Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ FILE: ../../../flutter/synchronization/semaphore_unittest.cc
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_linux.cc
FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm
FILE: ../../../flutter/vulkan/skia_vulkan_header.h
FILE: ../../../flutter/vulkan/vulkan_application.cc
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/text/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void _LoadFontFromList(Dart_NativeArguments args) {

FontCollection::FontCollection()
: collection_(std::make_shared<txt::FontCollection>()) {
collection_->SetDefaultFontManager(SkFontMgr::RefDefault());
collection_->SetupDefaultFontManager();

dynamic_font_manager_ = sk_make_sp<txt::DynamicFontManager>();
collection_->SetDynamicFontManager(dynamic_font_manager_);
Expand Down
2 changes: 2 additions & 0 deletions third_party/txt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ source_set("txt") {
deps += [ "$flutter_root/fml" ]
} else if (is_android) {
sources += [ "src/txt/platform_android.cc" ]
} else if (is_linux) {
sources += [ "src/txt/platform_linux.cc" ]
} else {
sources += [ "src/txt/platform.cc" ]
}
Expand Down
4 changes: 2 additions & 2 deletions third_party/txt/src/txt/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ size_t FontCollection::GetFontManagersCount() const {
return GetFontManagerOrder().size();
}

void FontCollection::SetDefaultFontManager(sk_sp<SkFontMgr> font_manager) {
default_font_manager_ = font_manager;
void FontCollection::SetupDefaultFontManager() {
default_font_manager_ = GetDefaultFontManager();
}

void FontCollection::SetAssetFontManager(sk_sp<SkFontMgr> font_manager) {
Expand Down
2 changes: 1 addition & 1 deletion third_party/txt/src/txt/font_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {

size_t GetFontManagersCount() const;

void SetDefaultFontManager(sk_sp<SkFontMgr> font_manager);
void SetupDefaultFontManager();
void SetAssetFontManager(sk_sp<SkFontMgr> font_manager);
void SetDynamicFontManager(sk_sp<SkFontMgr> font_manager);
void SetTestFontManager(sk_sp<SkFontMgr> font_manager);
Expand Down
4 changes: 4 additions & 0 deletions third_party/txt/src/txt/platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ std::string GetDefaultFontFamily() {
return "Arial";
}

sk_sp<SkFontMgr> GetDefaultFontManager() {
return SkFontMgr::RefDefault();
}

} // namespace txt
4 changes: 4 additions & 0 deletions third_party/txt/src/txt/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
#include <string>
#include "flutter/fml/macros.h"

#include "third_party/skia/include/core/SkFontMgr.h"

namespace txt {

std::string GetDefaultFontFamily();

sk_sp<SkFontMgr> GetDefaultFontManager();

} // namespace txt

#endif // TXT_PLATFORM_H_
4 changes: 4 additions & 0 deletions third_party/txt/src/txt/platform_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ std::string GetDefaultFontFamily() {
return "sans-serif";
}

sk_sp<SkFontMgr> GetDefaultFontManager() {
return SkFontMgr::RefDefault();
}

} // namespace txt
19 changes: 19 additions & 0 deletions third_party/txt/src/txt/platform_linux.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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 "txt/platform.h"

#include "third_party/skia/include/ports/SkFontMgr_directory.h"

namespace txt {

std::string GetDefaultFontFamily() {
return "Arial";
}

sk_sp<SkFontMgr> GetDefaultFontManager() {
return SkFontMgr_New_Custom_Directory("/usr/share/fonts/");
}

} // namespace txt
4 changes: 4 additions & 0 deletions third_party/txt/src/txt/platform_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
}
}

sk_sp<SkFontMgr> GetDefaultFontManager() {
return SkFontMgr::RefDefault();
}

} // namespace txt