10#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
11 const char* kColorEmojiFontMac =
"Apple Color Emoji";
13 const char* kColorEmojiLocale =
"und-Zsye";
20 return fFamilyNames == other.fFamilyNames &&
21 fFontStyle == other.fFontStyle &&
22 fFontArguments == other.fFontArguments;
28 hash ^= std::hash<std::string>()(family.
c_str());
31 std::hash<uint32_t>()(
key.fFontStyle.weight()) ^
32 std::hash<uint32_t>()(
key.fFontStyle.slant()) ^
33 std::hash<std::optional<FontArguments>>()(
key.fFontArguments);
37 : fEnableFontFallback(
true)
43 fAssetFontManager = std::move(font_manager);
47 fDynamicFontManager = std::move(font_manager);
51 fTestFontManager = std::move(font_manager);
55 const char defaultFamilyName[]) {
56 fDefaultFontManager = std::move(fontManager);
57 fDefaultFamilyNames.emplace_back(defaultFamilyName);
61 const std::vector<SkString>& defaultFamilyNames) {
62 fDefaultFontManager = std::move(fontManager);
63 fDefaultFamilyNames = defaultFamilyNames;
67 fDefaultFontManager = std::move(fontManager);
71std::vector<sk_sp<SkFontMgr>> FontCollection::getFontManagerOrder()
const {
72 std::vector<sk_sp<SkFontMgr>> order;
73 if (fDynamicFontManager) {
74 order.push_back(fDynamicFontManager);
76 if (fAssetFontManager) {
77 order.push_back(fAssetFontManager);
79 if (fTestFontManager) {
80 order.push_back(fTestFontManager);
82 if (fDefaultFontManager && fEnableFontFallback) {
83 order.push_back(fDefaultFontManager);
94 FamilyKey familyKey(familyNames, fontStyle, fontArgs);
95 auto found = fTypefaces.find(familyKey);
100 std::vector<sk_sp<SkTypeface>> typefaces;
101 for (
const SkString& familyName : familyNames) {
103 if (
match && fontArgs) {
107 typefaces.emplace_back(std::move(
match));
111 if (typefaces.empty()) {
113 for (
const SkString& familyName : fDefaultFamilyNames) {
114 match = matchTypeface(familyName, fontStyle);
120 for (
const auto&
manager : this->getFontManagerOrder()) {
121 match =
manager->legacyMakeTypeface(
nullptr, fontStyle);
128 typefaces.emplace_back(std::move(
match));
132 fTypefaces.set(familyKey, typefaces);
137 for (
const auto&
manager : this->getFontManagerOrder()) {
139 if (!
set ||
set->count() == 0) {
157 for (
const auto&
manager : this->getFontManagerOrder()) {
158 std::vector<const char*> bcp47;
160 bcp47.push_back(locale.
c_str());
163 nullptr, fontStyle, bcp47.data(), bcp47.size(),
unicode));
165 if (typeface !=
nullptr) {
177 for (
const auto&
manager : this->getFontManagerOrder()) {
178 std::vector<const char*> bcp47;
179#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
182 if (emojiTypeface !=
nullptr) {
183 return emojiTypeface;
186 bcp47.push_back(kColorEmojiLocale);
189 bcp47.push_back(locale.
c_str());
195 nullptr, fontStyle, bcp47.data(), bcp47.size(), emojiStart));
196 if (typeface !=
nullptr) {
205 if (fDefaultFontManager ==
nullptr) {
208 for (
const SkString& familyName : fDefaultFamilyNames) {
222 fParagraphCache.
reset();
static uint32_t hash(const SkShaderBase::GradientInfo &v)
#define DEFAULT_FONT_FAMILY
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
const char * c_str() const
size_t getFontManagersCount() const
sk_sp< SkTypeface > defaultEmojiFallback(SkUnichar emojiStart, SkFontStyle fontStyle, const SkString &locale)
std::vector< sk_sp< SkTypeface > > findTypefaces(const std::vector< SkString > &familyNames, SkFontStyle fontStyle)
void disableFontFallback()
void setDefaultFontManager(sk_sp< SkFontMgr > fontManager)
void setAssetFontManager(sk_sp< SkFontMgr > fontManager)
void enableFontFallback()
void setDynamicFontManager(sk_sp< SkFontMgr > fontManager)
void setTestFontManager(sk_sp< SkFontMgr > fontManager)
sk_sp< SkTypeface > defaultFallback()
SKSHAPER_API void PurgeCaches()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font manager
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
size_t operator()(const FamilyKey &key) const