Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
typeface_font_asset_provider.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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_TYPEFACE_FONT_ASSET_PROVIDER_H_
18#define TXT_TYPEFACE_FONT_ASSET_PROVIDER_H_
19
20#include <string>
21#include <unordered_map>
22#include <vector>
23
24#include "flutter/fml/macros.h"
27
28namespace txt {
29
31 public:
33
35
37
38 // |SkFontStyleSet|
39 int count() override;
40
41 // |SkFontStyleSet|
42 void getStyle(int index, SkFontStyle* style, SkString* name) override;
43
44 // |SkFontStyleSet|
45 sk_sp<SkTypeface> createTypeface(int index) override;
46
47 // |SkFontStyleSet|
48 sk_sp<SkTypeface> matchStyle(const SkFontStyle& pattern) override;
49
50 private:
51 std::vector<sk_sp<SkTypeface>> typefaces_;
52
54};
55
57 public:
60
62
64 std::string family_name_alias);
65
66 // |FontAssetProvider|
67 size_t GetFamilyCount() const override;
68
69 // |FontAssetProvider|
70 std::string GetFamilyName(int index) const override;
71
72 // |FontAssetProvider|
73 sk_sp<SkFontStyleSet> MatchFamily(const std::string& family_name) override;
74
75 private:
76 std::unordered_map<std::string, sk_sp<TypefaceFontStyleSet>>
77 registered_families_;
78 std::vector<std::string> family_names_;
79
81};
82
83} // namespace txt
84
85#endif // TXT_TYPEFACE_FONT_ASSET_PROVIDER_H_
void RegisterTypeface(sk_sp< SkTypeface > typeface)
std::string GetFamilyName(int index) const override
sk_sp< SkFontStyleSet > MatchFamily(const std::string &family_name) override
sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern) override
~TypefaceFontStyleSet() override
void getStyle(int index, SkFontStyle *style, SkString *name) override
sk_sp< SkTypeface > createTypeface(int index) override
void registerTypeface(sk_sp< SkTypeface > typeface)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32