Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SkTypeface_remote.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 SkRemoteTypeface_DEFINED
9#define SkRemoteTypeface_DEFINED
10
20
21#include <cstddef>
22#include <cstdint>
23#include <memory>
24#include <optional>
25
26class SkArenaAlloc;
27class SkDescriptor;
28class SkDrawable;
30class SkGlyph;
31class SkPath;
32class SkReadBuffer;
33class SkStreamAsset;
34class SkTypefaceProxy;
35class SkWriteBuffer;
37struct SkFontMetrics;
38
40public:
42 const SkScalerContextEffects& effects,
43 const SkDescriptor* desc,
45
46protected:
48 void generateImage(const SkGlyph&, void*) override;
49 bool generatePath(const SkGlyph& glyph, SkPath* path) override;
51 void generateFontMetrics(SkFontMetrics* metrics) override;
53
54private:
57};
58
59// SkTypefaceProxyPrototype is the serialization format for SkTypefaceProxy.
61public:
62 static std::optional<SkTypefaceProxyPrototype> MakeFromBuffer(SkReadBuffer& buffer);
63 explicit SkTypefaceProxyPrototype(const SkTypeface& typeface);
65 int glyphCount,
66 int32_t styleValue,
67 bool isFixedPitch,
68 bool glyphMaskNeedsCurrentColor);
69
70 void flatten(SkWriteBuffer&buffer) const;
71 SkTypefaceID serverTypefaceID() const { return fServerTypefaceID; }
72
73private:
74 friend class SkTypefaceProxy;
75 SkFontStyle style() const {
76 SkFontStyle style;
77 style.fValue = fStyleValue;
78 return style;
79 }
80 const SkTypefaceID fServerTypefaceID;
81 const int fGlyphCount;
82 const int32_t fStyleValue;
83 const bool fIsFixedPitch;
84 // Used for COLRv0 or COLRv1 fonts that may need the 0xFFFF special palette
85 // index to represent foreground color. This information needs to be on here
86 // to determine how this typeface can be cached.
87 const bool fGlyphMaskNeedsCurrentColor;
88};
89
91public:
94 bool isLogging = true);
95
97 int glyphCount,
98 const SkFontStyle& style,
99 bool isFixedPitch,
100 bool glyphMaskNeedsCurrentColor,
102 bool isLogging = true);
103
104 SkTypefaceID remoteTypefaceID() const {return fTypefaceID;}
105
106 int glyphCount() const {return fGlyphCount;}
107
108 bool isLogging() const {return fIsLogging;}
109
110protected:
111 int onGetUPEM() const override { SK_ABORT("Should never be called."); }
112 std::unique_ptr<SkStreamAsset> onOpenStream(int* ttcIndex) const override {
113 SK_ABORT("Should never be called.");
114 }
116 SK_ABORT("Should never be called.");
117 }
118 bool onGlyphMaskNeedsCurrentColor() const override {
119 return fGlyphMaskNeedsCurrentColor;
120 }
122 int coordinateCount) const override {
123 SK_ABORT("Should never be called.");
124 }
126 int parameterCount) const override {
127 SK_ABORT("Should never be called.");
128 }
129 void onGetFamilyName(SkString* familyName) const override {
130 // Used by SkStrikeCache::DumpMemoryStatistics.
131 *familyName = "";
132 }
133 bool onGetPostScriptName(SkString*) const override {
134 SK_ABORT("Should never be called.");
135 }
137 SK_ABORT("Should never be called.");
138 }
139 int onGetTableTags(SkFontTableTag tags[]) const override {
140 SK_ABORT("Should never be called.");
141 }
142 size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void* data) const override {
143 SK_ABORT("Should never be called.");
144 }
145 std::unique_ptr<SkScalerContext> onCreateScalerContext(
146 const SkScalerContextEffects& effects, const SkDescriptor* desc) const override
147 {
148 return std::make_unique<SkScalerContextProxy>(
149 sk_ref_sp(const_cast<SkTypefaceProxy*>(this)), effects, desc, fDiscardableManager);
150 }
151 void onFilterRec(SkScalerContextRec* rec) const override {
152 // The rec filtering is already applied by the server when generating
153 // the glyphs.
154 }
155 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override {
156 SK_ABORT("Should never be called.");
157 }
158 void getGlyphToUnicodeMap(SkUnichar*) const override {
159 SK_ABORT("Should never be called.");
160 }
161
162 void getPostScriptGlyphNames(SkString*) const override {
163 SK_ABORT("Should never be called.");
164 }
165
166 std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override {
167 SK_ABORT("Should never be called.");
168 }
169 void onCharsToGlyphs(const SkUnichar* chars, int count, SkGlyphID glyphs[]) const override {
170 SK_ABORT("Should never be called.");
171 }
172 int onCountGlyphs() const override {
173 return this->glyphCount();
174 }
175
176 void* onGetCTFontRef() const override {
177 SK_ABORT("Should never be called.");
178 }
179
180private:
181 const SkTypefaceID fTypefaceID;
182 const int fGlyphCount;
183 const bool fIsLogging;
184 const bool fGlyphMaskNeedsCurrentColor;
186};
187
188#endif // SkRemoteTypeface_DEFINED
uint16_t glyphs[5]
Definition: FontMgrTest.cpp:46
int count
Definition: FontMgrTest.cpp:50
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
uint32_t SkFontTableTag
Definition: SkTypeface.h:41
uint32_t SkTypefaceID
Definition: SkTypeface.h:38
int32_t SkUnichar
Definition: SkTypes.h:175
uint16_t SkGlyphID
Definition: SkTypes.h:179
Definition: SkPath.h:59
SkScalerContextProxy(sk_sp< SkTypeface > tf, const SkScalerContextEffects &effects, const SkDescriptor *desc, sk_sp< SkStrikeClient::DiscardableHandleManager > manager)
void generateFontMetrics(SkFontMetrics *metrics) override
sk_sp< SkDrawable > generateDrawable(const SkGlyph &) override
bool generatePath(const SkGlyph &glyph, SkPath *path) override
SkTypefaceProxy * getProxyTypeface() const
void generateImage(const SkGlyph &, void *) override
GlyphMetrics generateMetrics(const SkGlyph &, SkArenaAlloc *) override
SkScalerContext(sk_sp< SkTypeface >, const SkScalerContextEffects &, const SkDescriptor *)
void flatten(SkWriteBuffer &buffer) const
static std::optional< SkTypefaceProxyPrototype > MakeFromBuffer(SkReadBuffer &buffer)
SkTypefaceID serverTypefaceID() const
SkTypefaceProxyPrototype(const SkTypeface &typeface)
bool onGlyphMaskNeedsCurrentColor() const override
std::unique_ptr< SkScalerContext > onCreateScalerContext(const SkScalerContextEffects &effects, const SkDescriptor *desc) const override
void onFilterRec(SkScalerContextRec *rec) const override
void getPostScriptGlyphNames(SkString *) const override
std::unique_ptr< SkAdvancedTypefaceMetrics > onGetAdvancedMetrics() const override
int onGetTableTags(SkFontTableTag tags[]) const override
size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void *data) const override
bool isLogging() const
void onGetFontDescriptor(SkFontDescriptor *, bool *) const override
int onGetUPEM() const override
void * onGetCTFontRef() const override
SkTypefaceProxy(const SkTypefaceProxyPrototype &prototype, sk_sp< SkStrikeClient::DiscardableHandleManager > manager, bool isLogging=true)
void onGetFamilyName(SkString *familyName) const override
void getGlyphToUnicodeMap(SkUnichar *) const override
SkTypeface::LocalizedStrings * onCreateFamilyNameIterator() const override
bool onGetPostScriptName(SkString *) const override
int glyphCount() const
SkTypefaceID remoteTypefaceID() const
sk_sp< SkTypeface > onMakeClone(const SkFontArguments &args) const override
int onCountGlyphs() const override
int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const override
void onCharsToGlyphs(const SkUnichar *chars, int count, SkGlyphID glyphs[]) const override
std::unique_ptr< SkStreamAsset > onOpenStream(int *ttcIndex) const override
int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const override
bool isFixedPitch() const
Definition: SkTypeface.h:68
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
size_t length
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font manager
Definition: switches.h:218
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
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
SeparatedVector2 offset
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63