Flutter Engine
 
Loading...
Searching...
No Matches
asset_font_manager.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_TXT_SRC_TXT_ASSET_FONT_MANAGER_H_
6#define FLUTTER_TXT_SRC_TXT_ASSET_FONT_MANAGER_H_
7
8#include <memory>
9#include <utility>
10
11#include "flutter/fml/macros.h"
12#include "third_party/skia/include/core/SkFontMgr.h"
13#include "third_party/skia/include/core/SkStream.h"
16
17namespace txt {
18
19class AssetFontManager : public SkFontMgr {
20 public:
21 explicit AssetFontManager(std::unique_ptr<FontAssetProvider> font_provider);
22
24
25 protected:
26 // |SkFontMgr|
27 sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
28
29 std::unique_ptr<FontAssetProvider> font_provider_;
30
31 private:
32 // |SkFontMgr|
33 int onCountFamilies() const override;
34
35 // |SkFontMgr|
36 void onGetFamilyName(int index, SkString* familyName) const override;
37
38 // |SkFontMgr|
39 sk_sp<SkFontStyleSet> onCreateStyleSet(int index) const override;
40
41 // |SkFontMgr|
42 sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[],
43 const SkFontStyle&) const override;
44
45 // |SkFontMgr|
46 sk_sp<SkTypeface> onMatchFamilyStyleCharacter(
47 const char familyName[],
48 const SkFontStyle&,
49 const char* bcp47[],
50 int bcp47Count,
51 SkUnichar character) const override;
52
53 // |SkFontMgr|
54 sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
55
56 // |SkFontMgr|
57 sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
58 int ttcIndex) const override;
59
60 // |SkFontMgr|
61 sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
62 const SkFontArguments&) const override;
63
64 // |SkFontMgr|
65 sk_sp<SkTypeface> onMakeFromFile(const char path[],
66 int ttcIndex) const override;
67
68 // |SkFontMgr|
69 sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[],
70 SkFontStyle) const override;
71
73};
74
76 public:
79
81 return static_cast<TypefaceFontAssetProvider&>(*font_provider_);
82 }
83};
84
85} // namespace txt
86
87#endif // FLUTTER_TXT_SRC_TXT_ASSET_FONT_MANAGER_H_
~AssetFontManager() override
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override
std::unique_ptr< FontAssetProvider > font_provider_
TypefaceFontAssetProvider & font_provider() const
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
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 switch_defs.h:52
Definition ref_ptr.h:261