72 {
73 {
76
79
82 create(&origBitmap, origRect);
84
86
87
90
94
95 {
100 if (!deserializedTypeface) {
102 return;
103 }
104
106 bool mustSerializeData = false;
109
111 create(&deserializedBitmap, origRect);
112 SkCanvas deserializedCanvas(deserializedBitmap);
113
114 font.setTypeface(deserializedTypeface);
115 drawBG(&deserializedCanvas);
116 deserializedCanvas.drawString(
"A", point.
fX, point.
fY,
font,
paint);
117
119 }
120
121 {
122 int ttcIndex;
123 std::unique_ptr<SkStreamAsset> fontData = typeface->
openStream(&ttcIndex);
124 if (!fontData) {
126 return;
127 }
128
130 if (!streamTypeface) {
131
132
133 return;
134 }
135
137 create(&streamBitmap, origRect);
138 SkCanvas streamCanvas(streamBitmap);
139
141 bool mustSerializeData = false;
142 streamTypeface->getFontDescriptor(&
desc, &mustSerializeData);
144
145 font.setTypeface(streamTypeface);
147 streamCanvas.drawString(
"A", point.
fX, point.
fY,
font,
paint);
148
150 }
151 }
152
154}
static void create(SkBitmap *bm, SkIRect bound)
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
static void drawBG(SkCanvas *canvas)
#define SkASSERT_RELEASE(cond)
constexpr SkColor SK_ColorGRAY
#define REPORTER_ASSERT(r, cond,...)
std::unique_ptr< SkStreamAsset > detachAsStream()
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
@ kAlias
no transparent pixels on glyph edges
static void PurgeFontCache()
void getFontDescriptor(SkFontDescriptor *desc, bool *isLocal) const
void serialize(SkWStream *, SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
static sk_sp< SkTypeface > MakeDeserialize(SkStream *, sk_sp< SkFontMgr > lastResortMgr)
std::unique_ptr< SkStreamAsset > openStream(int *ttcIndex) const
font
Font Metadata and Metrics.
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkPoint Make(float x, float y)