Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
font_collection.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LIB_TXT_SRC_FONT_COLLECTION_H_
18#define LIB_TXT_SRC_FONT_COLLECTION_H_
19
20#include <memory>
21#include <set>
22#include <string>
23#include <unordered_map>
24
25#include "flutter/fml/macros.h"
26#include "third_party/googletest/googletest/include/gtest/gtest_prod.h" // nogncheck
31#include "txt/text_style.h"
32
33namespace txt {
34
35class FontCollection : public std::enable_shared_from_this<FontCollection> {
36 public:
38
40
41 size_t GetFontManagersCount() const;
42
43 void SetupDefaultFontManager(uint32_t font_initialization_data);
44 void SetDefaultFontManager(sk_sp<SkFontMgr> font_manager);
45 void SetAssetFontManager(sk_sp<SkFontMgr> font_manager);
46 void SetDynamicFontManager(sk_sp<SkFontMgr> font_manager);
47 void SetTestFontManager(sk_sp<SkFontMgr> font_manager);
48
49 // Do not provide alternative fonts that can match characters which are
50 // missing from the requested font family.
52
53 // Remove all entries in the font family cache.
55
56 // Construct a Skia text layout FontCollection based on this collection.
58
59 private:
60 sk_sp<SkFontMgr> default_font_manager_;
61 sk_sp<SkFontMgr> asset_font_manager_;
62 sk_sp<SkFontMgr> dynamic_font_manager_;
63 sk_sp<SkFontMgr> test_font_manager_;
64 bool enable_font_fallback_;
65
66 // An equivalent font collection usable by the Skia text shaper library.
68
69 std::vector<sk_sp<SkFontMgr>> GetFontManagerOrder() const;
70
72};
73
74} // namespace txt
75
76#endif // LIB_TXT_SRC_FONT_COLLECTION_H_
void SetTestFontManager(sk_sp< SkFontMgr > font_manager)
size_t GetFontManagersCount() const
void SetupDefaultFontManager(uint32_t font_initialization_data)
void SetDynamicFontManager(sk_sp< SkFontMgr > font_manager)
void SetDefaultFontManager(sk_sp< SkFontMgr > font_manager)
sk_sp< skia::textlayout::FontCollection > CreateSktFontCollection()
void SetAssetFontManager(sk_sp< SkFontMgr > font_manager)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27