Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkOrderedFontMgr.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkOrderedFontMgr_DEFINED
9#define SkOrderedFontMgr_DEFINED
10
14
15#include <memory>
16#include <vector>
17
18class SkData;
19class SkFontStyle;
20class SkStreamAsset;
21class SkString;
22class SkTypeface;
23struct SkFontArguments;
24
25/**
26 * Collects an order list of other font managers, and visits them in order
27 * when a request to find or match is issued.
28 *
29 * Note: this explicitly fails on any attempt to Make a typeface: all of
30 * those requests will return null.
31 */
33public:
35 ~SkOrderedFontMgr() override;
36
38
39protected:
40 int onCountFamilies() const override;
41 void onGetFamilyName(int index, SkString* familyName) const override;
42 sk_sp<SkFontStyleSet> onCreateStyleSet(int index)const override;
43
44 sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
45
46 sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[],
47 const SkFontStyle&) const override;
48 sk_sp<SkTypeface> onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
49 const char* bcp47[], int bcp47Count,
50 SkUnichar character) const override;
51
52 // Note: all of these always return null
53 sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
54 sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
55 int ttcIndex) const override;
56 sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
57 const SkFontArguments&) const override;
58 sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const override;
59
60 sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override;
61
62private:
63 std::vector<sk_sp<SkFontMgr>> fList;
64};
65
66#endif
#define SK_API
Definition SkAPI.h:35
int32_t SkUnichar
Definition SkTypes.h:175
virtual void onGetFamilyName(int index, SkString *familyName) const =0
virtual sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const =0
virtual sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const =0
virtual sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0
virtual sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
virtual sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const =0
virtual sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const =0
virtual sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const =0
virtual int onCountFamilies() const =0
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition editor.cpp:211