Flutter Engine
The Flutter Engine
asset_font_manager.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 TXT_ASSET_FONT_MANAGER_H_
18#define TXT_ASSET_FONT_MANAGER_H_
19
20#include <memory>
21#include <utility>
22
23#include "flutter/fml/macros.h"
28
29namespace txt {
30
32 public:
33 explicit AssetFontManager(std::unique_ptr<FontAssetProvider> font_provider);
34
36
37 protected:
38 // |SkFontMgr|
39 sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
40
41 std::unique_ptr<FontAssetProvider> font_provider_;
42
43 private:
44 // |SkFontMgr|
45 int onCountFamilies() const override;
46
47 // |SkFontMgr|
48 void onGetFamilyName(int index, SkString* familyName) const override;
49
50 // |SkFontMgr|
51 sk_sp<SkFontStyleSet> onCreateStyleSet(int index) const override;
52
53 // |SkFontMgr|
54 sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[],
55 const SkFontStyle&) const override;
56
57 // |SkFontMgr|
58 sk_sp<SkTypeface> onMatchFamilyStyleCharacter(
59 const char familyName[],
60 const SkFontStyle&,
61 const char* bcp47[],
62 int bcp47Count,
63 SkUnichar character) const override;
64
65 // |SkFontMgr|
66 sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
67
68 // |SkFontMgr|
69 sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
70 int ttcIndex) const override;
71
72 // |SkFontMgr|
73 sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
74 const SkFontArguments&) const override;
75
76 // |SkFontMgr|
77 sk_sp<SkTypeface> onMakeFromFile(const char path[],
78 int ttcIndex) const override;
79
80 // |SkFontMgr|
81 sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[],
82 SkFontStyle) const override;
83
84 FML_DISALLOW_COPY_AND_ASSIGN(AssetFontManager);
85};
86
88 public:
91
93 return static_cast<TypefaceFontAssetProvider&>(*font_provider_);
94 }
95};
96
97} // namespace txt
98
99#endif // TXT_ASSET_FONT_MANAGER_H_
int32_t SkUnichar
Definition: SkTypes.h:175
~AssetFontManager() override
AssetFontManager(std::unique_ptr< FontAssetProvider > font_provider)
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override
std::unique_ptr< FontAssetProvider > font_provider_
TypefaceFontAssetProvider & font_provider() const
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
Definition: switches.h:57
Definition: ref_ptr.h:256