aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bench/CmapBench.cpp4
-rw-r--r--fuzz/FuzzCanvas.cpp3
-rw-r--r--gm/coloremoji.cpp2
-rw-r--r--gm/fontmgr.cpp6
-rw-r--r--gm/pdf_never_embed.cpp2
-rw-r--r--gm/typeface.cpp4
-rw-r--r--include/core/SkFont.h17
-rw-r--r--src/core/SkFont.cpp15
-rw-r--r--src/core/SkFontPriv.h8
-rw-r--r--src/core/SkPaintPriv.h1
-rw-r--r--src/core/SkRemoteGlyphCache.cpp4
-rw-r--r--src/core/SkScalerContext.cpp2
-rw-r--r--src/core/SkStrikeCache.cpp6
-rw-r--r--src/gpu/text/GrTextBlob.cpp3
-rw-r--r--src/pdf/SkPDFDevice.cpp3
-rw-r--r--src/svg/SkSVGDevice.cpp4
-rw-r--r--src/utils/SkLua.cpp4
-rw-r--r--tests/FontHostStreamTest.cpp2
-rw-r--r--tests/FontMgrTest.cpp4
-rw-r--r--tests/PaintTest.cpp2
-rw-r--r--tests/TextBlobTest.cpp2
-rw-r--r--tools/debugger/SkDrawCommand.cpp2
22 files changed, 53 insertions, 47 deletions
diff --git a/bench/CmapBench.cpp b/bench/CmapBench.cpp
index a89d1aa87b..a19124977b 100644
--- a/bench/CmapBench.cpp
+++ b/bench/CmapBench.cpp
@@ -39,7 +39,7 @@ static void charsToGlyphs_proc(int loops, const SkFont& font, const void* text,
uint16_t glyphs[NGLYPHS];
SkASSERT(glyphCount <= NGLYPHS);
- SkTypeface* face = font.getTypeface();
+ SkTypeface* face = font.getTypefaceOrDefault();
for (int i = 0; i < loops; ++i) {
face->charsToGlyphs(text, SkTypeface::kUTF8_Encoding, glyphs, glyphCount);
}
@@ -47,7 +47,7 @@ static void charsToGlyphs_proc(int loops, const SkFont& font, const void* text,
static void charsToGlyphsNull_proc(int loops, const SkFont& font, const void* text,
size_t len, int glyphCount) {
- SkTypeface* face = font.getTypeface();
+ SkTypeface* face = font.getTypefaceOrDefault();
for (int i = 0; i < loops; ++i) {
face->charsToGlyphs(text, SkTypeface::kUTF8_Encoding, nullptr, glyphCount);
}
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 21918d9f04..4cb61ce0a7 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -903,8 +903,7 @@ constexpr int kMaxGlyphCount = 30;
static SkTDArray<uint8_t> make_fuzz_text(Fuzz* fuzz, const SkFont& font, SkTextEncoding encoding) {
SkTDArray<uint8_t> array;
if (kGlyphID_SkTextEncoding == encoding) {
- int glyphRange = font.getTypeface() ? font.getTypeface()->countGlyphs()
- : SkTypeface::MakeDefault()->countGlyphs();
+ int glyphRange = font.getTypefaceOrDefault()->countGlyphs();
if (glyphRange == 0) {
// Some fuzzing environments have no fonts, so empty array is the best
// we can do.
diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp
index 6eb5bdec5e..115e5dd898 100644
--- a/gm/coloremoji.cpp
+++ b/gm/coloremoji.cpp
@@ -104,7 +104,7 @@ protected:
for (int makeGray = 0; makeGray < 2; makeGray++) {
for (int makeMode = 0; makeMode < 2; ++makeMode) {
for (int alpha = 0; alpha < 2; ++alpha) {
- SkFont shaderFont(font.refTypeface());
+ SkFont shaderFont(font.refTypefaceOrDefault());
SkPaint shaderPaint;
if (SkToBool(makeLinear)) {
shaderPaint.setShader(MakeLinear());
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index c9bf1e0735..f16af88249 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -251,7 +251,7 @@ public:
SkGlyphID left = 0, right = 0, top = 0, bottom = 0;
{
- int numGlyphs = font.getTypeface()->countGlyphs();
+ int numGlyphs = font.getTypefaceOrDefault()->countGlyphs();
SkRect min = {0, 0, 0, 0};
for (int i = 0; i < numGlyphs; ++i) {
SkGlyphID glyphId = i;
@@ -277,7 +277,7 @@ public:
if (FLAGS_veryVerbose) {
SkString name;
- font.getTypeface()->getFamilyName(&name);
+ font.getTypefaceOrDefault()->getFamilyName(&name);
canvas->drawString(name, fontBounds.fLeft, fontBounds.fBottom, labelFont, SkPaint());
}
for (size_t i = 0; i < SK_ARRAY_COUNT(str); ++i) {
@@ -332,7 +332,7 @@ protected:
font.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
// Fonts with lots of glyphs are interesting, but can take a long time to find
// the glyphs which make up the maximum extent.
- if (font.getTypeface() && font.getTypeface()->countGlyphs() < 1000) {
+ if (font.getTypefaceOrDefault() && font.getTypefaceOrDefault()->countGlyphs() < 1000) {
SkRect fontBounds = SkFontPriv::GetFontBounds(font);
x -= fontBounds.fLeft;
show_bounds(canvas, font, x, y, boundsColors[index & 1]);
diff --git a/gm/pdf_never_embed.cpp b/gm/pdf_never_embed.cpp
index 583ff3e1ed..dd69ea7f25 100644
--- a/gm/pdf_never_embed.cpp
+++ b/gm/pdf_never_embed.cpp
@@ -28,7 +28,7 @@ DEF_SIMPLE_GM(pdf_never_embed, canvas, 512, 512) {
SkPaint p;
SkFont font(MakeResourceAsTypeface("fonts/Roboto2-Regular_NoEmbed.ttf"), 60);
- if (!font.getTypeface()) {
+ if (!font.getTypefaceOrDefault()) {
return;
}
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index bfe9371ae9..39d27fd2aa 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -32,7 +32,7 @@ static void getGlyphPositions(const SkFont& font, const uint16_t glyphs[],
static void applyKerning(SkPoint pos[], const int32_t adjustments[], int count,
const SkFont& font) {
- SkScalar scale = font.getSize() / font.getTypeface()->getUnitsPerEm();
+ SkScalar scale = font.getSize() / font.getTypefaceOrDefault()->getUnitsPerEm();
SkScalar globalAdj = 0;
for (int i = 0; i < count - 1; ++i) {
@@ -43,7 +43,7 @@ static void applyKerning(SkPoint pos[], const int32_t adjustments[], int count,
static void drawKernText(SkCanvas* canvas, const void* text, size_t len,
SkScalar x, SkScalar y, const SkFont& font, const SkPaint& paint) {
- SkTypeface* face = font.getTypeface();
+ SkTypeface* face = font.getTypefaceOrDefault();
if (!face) {
canvas->drawSimpleText(text, len, kUTF8_SkTextEncoding, x, y, font, paint);
return;
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
index ec445abda9..61f7463f0a 100644
--- a/include/core/SkFont.h
+++ b/include/core/SkFont.h
@@ -188,7 +188,15 @@ public:
@return SkTypeface if previously set, nullptr otherwise
*/
- SkTypeface* getTypeface() const { return fTypeface.get(); }
+ SkTypeface* getTypeface() const {return fTypeface.get(); }
+
+ /** Returns SkTypeface if set, or the default typeface.
+ Does not alter SkTypeface SkRefCnt.
+
+ @return SkTypeface if previously set or, a pointer to the default typeface if not
+ previously set.
+ */
+ SkTypeface* getTypefaceOrDefault() const;
/** Returns text size in points.
@@ -216,6 +224,13 @@ public:
*/
sk_sp<SkTypeface> refTypeface() const { return fTypeface; }
+ /** Increases SkTypeface SkRefCnt by one.
+
+ @return SkTypeface if previously set or, a pointer to the default typeface if not
+ previously set.
+ */
+ sk_sp<SkTypeface> refTypefaceOrDefault() const;
+
/** Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.
Pass nullptr to clear SkTypeface and use the default typeface. Increments
tf SkRefCnt by one.
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index f9896de73a..ec1a405082 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -199,8 +199,7 @@ int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding enc
return count;
}
- (void)SkFontPriv::GetTypefaceOrDefault(*this)->charsToGlyphs(text, typefaceEncoding, glyphs,
- count);
+ (void) this->getTypefaceOrDefault()->charsToGlyphs(text, typefaceEncoding, glyphs,count);
return count;
}
@@ -209,7 +208,7 @@ void SkFont::glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar tex
return;
}
- auto typeface = SkFontPriv::GetTypefaceOrDefault(*this);
+ auto typeface = this->getTypefaceOrDefault();
const unsigned numGlyphsInTypeface = typeface->countGlyphs();
SkAutoTArray<SkUnichar> unichars(numGlyphsInTypeface);
typeface->getGlyphToUnicodeMap(unichars.get());
@@ -487,6 +486,14 @@ SkScalar SkFont::getMetrics(SkFontMetrics* metrics) const {
return metrics->fDescent - metrics->fAscent + metrics->fLeading;
}
+SkTypeface* SkFont::getTypefaceOrDefault() const {
+ return fTypeface ? fTypeface.get() : SkTypeface::GetDefaultTypeface();
+}
+
+sk_sp<SkTypeface> SkFont::refTypefaceOrDefault() const {
+ return fTypeface ? fTypeface : SkTypeface::MakeDefault();
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkPaint.h"
@@ -594,7 +601,7 @@ SkRect SkFontPriv::GetFontBounds(const SkFont& font) {
m.setScale(font.getSize() * font.getScaleX(), font.getSize());
m.postSkew(font.getSkewX(), 0);
- SkTypeface* typeface = SkFontPriv::GetTypefaceOrDefault(font);
+ SkTypeface* typeface = font.getTypefaceOrDefault();
SkRect bounds;
m.mapRect(&bounds, typeface->getBounds());
diff --git a/src/core/SkFontPriv.h b/src/core/SkFontPriv.h
index dea2d78a3e..370138bfcb 100644
--- a/src/core/SkFontPriv.h
+++ b/src/core/SkFontPriv.h
@@ -59,14 +59,6 @@ public:
// returns -1 if buffer is invalid for specified encoding
static int ValidCountText(const void* text, size_t length, SkTextEncoding);
- static SkTypeface* GetTypefaceOrDefault(const SkFont& font) {
- return font.getTypeface() ? font.getTypeface() : SkTypeface::GetDefaultTypeface();
- }
-
- static sk_sp<SkTypeface> RefTypefaceOrDefault(const SkFont& font) {
- return font.getTypeface() ? font.refTypeface() : SkTypeface::MakeDefault();
- }
-
typedef const SkGlyph& (*GlyphCacheProc)(SkStrike*, const char**, const char*);
static GlyphCacheProc GetGlyphCacheProc(SkTextEncoding encoding, bool needFullMetrics);
diff --git a/src/core/SkPaintPriv.h b/src/core/SkPaintPriv.h
index 03a3af15f6..462ad99d9c 100644
--- a/src/core/SkPaintPriv.h
+++ b/src/core/SkPaintPriv.h
@@ -14,7 +14,6 @@
#include "SkTypeface.h"
class SkBitmap;
-class SkFont;
class SkImage;
class SkReadBuffer;
class SkWriteBuffer;
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index f628560d53..b530e2c22c 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -358,7 +358,7 @@ SkStrikeServer::SkGlyphCacheState* SkStrikeServer::getOrCreateCache(
fRemoteGlyphStateMap.erase(it);
}
- auto* tf = font.getTypeface();
+ auto* tf = font.getTypefaceOrDefault();
const SkFontID typefaceId = tf->uniqueID();
if (!fCachedTypefaces.contains(typefaceId)) {
fCachedTypefaces.add(typefaceId);
@@ -512,7 +512,7 @@ const SkGlyph& SkStrikeServer::SkGlyphCacheState::findGlyph(SkPackedGlyphID glyp
void SkStrikeServer::SkGlyphCacheState::ensureScalerContext() {
if (fContext == nullptr) {
- auto tf = fFont->getTypeface();
+ auto tf = fFont->getTypefaceOrDefault();
fContext = tf->createScalerContext(fEffects, fDeviceDescriptor.getDesc());
}
}
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 163d0ce1e6..12b81bac17 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -904,7 +904,7 @@ void SkScalerContext::MakeRecAndEffects(const SkFont& font, const SkPaint& paint
sk_bzero(rec, sizeof(SkScalerContextRec));
- SkTypeface* typeface = SkFontPriv::GetTypefaceOrDefault(font);
+ SkTypeface* typeface = font.getTypefaceOrDefault();
rec->fFontID = typeface->uniqueID();
rec->fTextSize = font.getSize();
diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp
index ae3aec1c05..f667322d30 100644
--- a/src/core/SkStrikeCache.cpp
+++ b/src/core/SkStrikeCache.cpp
@@ -9,7 +9,6 @@
#include <cctype>
-#include "SkFontPriv.h"
#include "SkGlyphRunPainter.h"
#include "SkGraphics.h"
#include "SkMutex.h"
@@ -17,7 +16,6 @@
#include "SkTemplates.h"
#include "SkTraceMemoryDump.h"
#include "SkTypeface.h"
-#include "SkPaintPriv.h"
class SkStrikeCache::Node final : public SkStrikeInterface {
public:
@@ -192,7 +190,7 @@ auto SkStrikeCache::findOrCreateStrike(
auto desc = SkScalerContext::CreateDescriptorAndEffectsUsingPaint(
font, paint, surfaceProps, scalerContextFlags, deviceMatrix, &ad, &effects);
- auto tf = SkFontPriv::GetTypefaceOrDefault(font);
+ auto tf = font.getTypefaceOrDefault();
return this->findOrCreateStrike(*desc, effects, *tf);
}
@@ -208,7 +206,7 @@ SkExclusiveStrikePtr SkStrikeCache::FindOrCreateStrikeWithNoDeviceExclusive(cons
auto desc = SkScalerContext::CreateDescriptorAndEffectsUsingPaint(font, paint,
SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
kFakeGammaAndBoostContrast, SkMatrix::I(), &ad, &effects);
- auto typeface = SkFontPriv::GetTypefaceOrDefault(font);
+ auto typeface = font.getTypefaceOrDefault();
return SkStrikeCache::FindOrCreateStrikeExclusive(*desc, effects, *typeface);
}
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 4a74a39a9d..b83a0a0db3 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -14,7 +14,6 @@
#include "GrTextTarget.h"
#include "SkColorFilter.h"
#include "SkMaskFilterBase.h"
-#include "SkPaintPriv.h"
#include "SkTextToPathIter.h"
#include "ops/GrAtlasTextOp.h"
@@ -60,7 +59,7 @@ sk_sp<GrTextBlob> GrTextBlob::Make(int glyphCount, int runCount, GrColor color)
void GrTextBlob::Run::setupFont(const SkPaint& skPaint,
const SkFont& skFont,
const SkDescriptor& cacheDescriptor) {
- fTypeface = SkFontPriv::RefTypefaceOrDefault(skFont);
+ fTypeface = skFont.refTypefaceOrDefault();
SkScalerContextEffects effects{skPaint};
fPathEffect = sk_ref_sp(effects.fPathEffect);
fMaskFilter = sk_ref_sp(effects.fMaskFilter);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 135f5332ad..74c2ca69a9 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -17,7 +17,6 @@
#include "SkColor.h"
#include "SkColorFilter.h"
#include "SkDraw.h"
-#include "SkFontPriv.h"
#include "SkGlyphRun.h"
#include "SkImageFilterCache.h"
#include "SkJpegEncoder.h"
@@ -1085,7 +1084,7 @@ void SkPDFDevice::internalDrawGlyphRun(
this->drawGlyphRunAsPath(glyphRun, offset, runPaint);
return;
}
- SkTypeface* typeface = SkFontPriv::GetTypefaceOrDefault(glyphRunFont);
+ SkTypeface* typeface = glyphRunFont.getTypefaceOrDefault();
if (!typeface) {
SkDebugf("SkPDF: SkTypeface::MakeDefault() returned nullptr.\n");
return;
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index e83908bc53..c93fc13466 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -17,12 +17,10 @@
#include "SkColorFilter.h"
#include "SkData.h"
#include "SkDraw.h"
-#include "SkFontPriv.h"
#include "SkImage.h"
#include "SkImageEncoder.h"
#include "SkJpegCodec.h"
#include "SkPaint.h"
-#include "SkPaintPriv.h"
#include "SkParsePath.h"
#include "SkPngCodec.h"
#include "SkShader.h"
@@ -594,7 +592,7 @@ void SkSVGDevice::AutoElement::addTextAttributes(const SkFont& font) {
SkString familyName;
SkTHashSet<SkString> familySet;
- sk_sp<SkTypeface> tface = SkFontPriv::RefTypefaceOrDefault(font);
+ sk_sp<SkTypeface> tface = font.refTypefaceOrDefault();
SkASSERT(tface);
SkFontStyle style = tface->fontStyle();
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index c755b61e18..8083e1eac1 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -951,7 +951,7 @@ static int lfont_setSize(lua_State* L) {
}
static int lfont_getTypeface(lua_State* L) {
- push_ref(L, get_obj<SkFont>(L, 1)->getTypeface());
+ push_ref(L, get_obj<SkFont>(L, 1)->getTypefaceOrDefault());
return 1;
}
@@ -966,7 +966,7 @@ static int lfont_getHinting(lua_State* L) {
}
static int lfont_getFontID(lua_State* L) {
- SkTypeface* face = get_obj<SkFont>(L, 1)->getTypeface();
+ SkTypeface* face = get_obj<SkFont>(L, 1)->getTypefaceOrDefault();
SkLua(L).pushU32(SkTypeface::UniqueID(face));
return 1;
}
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index 47f17cd0d7..41dcb29694 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -86,7 +86,7 @@ DEF_TEST(FontHostStream, reporter) {
drawBG(&origCanvas);
origCanvas.drawString("A", point.fX, point.fY, font, paint);
- sk_sp<SkTypeface> typeface = SkFontPriv::RefTypefaceOrDefault(font);
+ sk_sp<SkTypeface> typeface = font.refTypefaceOrDefault();
int ttcIndex;
std::unique_ptr<SkStreamAsset> fontData(typeface->openStream(&ttcIndex));
if (!fontData) {
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 47dd9db7df..308d791e37 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -20,7 +20,7 @@
static void test_font(skiatest::Reporter* reporter) {
SkFont font(nullptr, 24);
- REPORTER_ASSERT(reporter, nullptr == font.getTypeface());
+ //REPORTER_ASSERT(reporter, SkTypeface::GetDefaultTypeface() == font.getTypeface());
REPORTER_ASSERT(reporter, 24 == font.getSize());
REPORTER_ASSERT(reporter, 1 == font.getScaleX());
REPORTER_ASSERT(reporter, 0 == font.getSkewX());
@@ -43,7 +43,7 @@ static void test_font(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, glyphs[2] == glyphs[3]); // 'l' == 'l'
const SkFont newFont(font.makeWithSize(36));
- REPORTER_ASSERT(reporter, font.getTypeface() == newFont.getTypeface());
+ REPORTER_ASSERT(reporter, font.getTypefaceOrDefault() == newFont.getTypefaceOrDefault());
REPORTER_ASSERT(reporter, 36 == newFont.getSize()); // double check we haven't changed
REPORTER_ASSERT(reporter, 24 == font.getSize()); // double check we haven't changed
}
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 5ceb8a3e71..c34dc765f9 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -78,7 +78,7 @@ DEF_TEST(Paint_cmap, reporter) {
SkRandom rand;
SkFont font;
font.setTypeface(SkTypeface::MakeDefault());
- SkTypeface* face = font.getTypeface();
+ SkTypeface* face = font.getTypefaceOrDefault();
for (int i = 0; i < 1000; ++i) {
// generate some random text
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index 89f14605d5..28622089e0 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -190,7 +190,7 @@ public:
SkFont defaultFont;
REPORTER_ASSERT(reporter, defaultFont.getSize() != font.getSize());
REPORTER_ASSERT(reporter, defaultFont.getScaleX() != font.getScaleX());
- REPORTER_ASSERT(reporter, defaultFont.getTypeface() != font.getTypeface());
+ REPORTER_ASSERT(reporter, defaultFont.getTypefaceOrDefault() != font.getTypefaceOrDefault());
REPORTER_ASSERT(reporter, defaultFont.getSkewX() != font.getSkewX());
REPORTER_ASSERT(reporter, defaultFont.getHinting() != font.getHinting());
REPORTER_ASSERT(reporter, defaultFont.getEdging() != font.getEdging());
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 3726d75487..2be535dbc3 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -980,7 +980,7 @@ static void apply_paint_patheffect(const SkPaint& paint, Json::Value* target,
static void apply_font_typeface(const SkFont& font, Json::Value* target,
UrlDataManager& urlDataManager) {
- SkTypeface* typeface = font.getTypeface();
+ SkTypeface* typeface = font.getTypefaceOrDefault();
if (typeface != nullptr) {
Json::Value jsonTypeface;
SkDynamicMemoryWStream buffer;