Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
TypefaceFontProvider.h
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2#ifndef TypefaceFontProvider_DEFINED
3#define TypefaceFontProvider_DEFINED
4
10#include "src/core/SkTHash.h"
11
12#include <string>
13#include <unordered_map>
14#include <vector>
15
16namespace skia {
17namespace textlayout {
18
20public:
21 explicit TypefaceFontStyleSet(const SkString& familyName);
22
23 int count() override;
24 void getStyle(int index, SkFontStyle*, SkString* name) override;
25 sk_sp<SkTypeface> createTypeface(int index) override;
26 sk_sp<SkTypeface> matchStyle(const SkFontStyle& pattern) override;
27
28 SkString getFamilyName() const { return fFamilyName; }
29 SkString getAlias() const { return fAlias; }
30 void appendTypeface(sk_sp<SkTypeface> typeface);
31
32private:
34 SkString fFamilyName;
35 SkString fAlias;
36};
37
39public:
40 size_t registerTypeface(sk_sp<SkTypeface> typeface);
41 size_t registerTypeface(sk_sp<SkTypeface> typeface, const SkString& alias);
42
43 int onCountFamilies() const override;
44
45 void onGetFamilyName(int index, SkString* familyName) const override;
46
47 sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
48
49 sk_sp<SkFontStyleSet> onCreateStyleSet(int) const override;
50 sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[], const SkFontStyle& pattern) const override;
52 const char*[], int,
53 SkUnichar) const override {
54 return nullptr;
55 }
56
57 sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int) const override { return nullptr; }
58 sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int) const override {
59 return nullptr;
60 }
61 sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
62 const SkFontArguments&) const override {
63 return nullptr;
64 }
65 sk_sp<SkTypeface> onMakeFromFile(const char[], int) const override {
66 return nullptr;
67 }
68
69 sk_sp<SkTypeface> onLegacyMakeTypeface(const char[], SkFontStyle) const override;
70
71private:
74};
75
76} // namespace textlayout
77} // namespace skia
78
79#endif // TypefaceFontProvider_DEFINED
int32_t SkUnichar
Definition SkTypes.h:175
void onGetFamilyName(int index, SkString *familyName) const override
sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int) const override
sk_sp< SkFontStyleSet > onCreateStyleSet(int) const override
sk_sp< SkTypeface > onLegacyMakeTypeface(const char[], SkFontStyle) const override
sk_sp< SkTypeface > onMakeFromFile(const char[], int) const override
sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int) const override
size_t registerTypeface(sk_sp< SkTypeface > typeface)
sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const override
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override
sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char[], const SkFontStyle &, const char *[], int, SkUnichar) const override
sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &pattern) const override
sk_sp< SkTypeface > createTypeface(int index) override
void getStyle(int index, SkFontStyle *, SkString *name) override
sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern) override
void appendTypeface(sk_sp< SkTypeface > typeface)
const char * name
Definition fuchsia.cc:50