From e34f17d23699abfc672289f51319b37294b3c257 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 19 Jul 2016 07:59:22 -0700 Subject: Make SkFont a bit more useable Split out of https://codereview.chromium.org/2163483002/ (Use SkFont in GrStencilAndCoverTextContext) GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163633002 Review-Url: https://codereview.chromium.org/2163633002 --- src/gpu/text/GrStencilAndCoverTextContext.cpp | 8 ++++++-- src/gpu/text/GrTextUtils.cpp | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index dd93025526..632bdcdaf1 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -469,7 +469,9 @@ void GrStencilAndCoverTextContext::TextRun::setText(const char text[], size_t by SkASSERT(byteLength == 0 || text != nullptr); SkGlyphCache* glyphCache = this->getGlyphCache(); - SkPaint::GlyphCacheProc glyphCacheProc = fFont.getGlyphCacheProc(true); + SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(fFont.getTextEncoding(), + fFont.isDevKernText(), + true); fTotalGlyphCount = fFont.countText(text, byteLength); fInstanceData.reset(InstanceData::Alloc(GrPathRendering::kTranslate_PathTransformType, @@ -529,7 +531,9 @@ void GrStencilAndCoverTextContext::TextRun::setPosText(const char text[], size_t SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); SkGlyphCache* glyphCache = this->getGlyphCache(); - SkPaint::GlyphCacheProc glyphCacheProc = fFont.getGlyphCacheProc(true); + SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(fFont.getTextEncoding(), + fFont.isDevKernText(), + true); fTotalGlyphCount = fFont.countText(text, byteLength); fInstanceData.reset(InstanceData::Alloc(GrPathRendering::kTranslate_PathTransformType, diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 9205d2fd7c..56d4ec1c00 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -253,7 +253,9 @@ void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex, return; } - SkPaint::GlyphCacheProc glyphCacheProc = skPaint.getGlyphCacheProc(true); + SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), + skPaint.isDevKernText(), + true); SkAutoDescriptor desc; SkScalerContextEffects effects; // We apply the fake-gamma by altering the distance in the shader, so we ignore the @@ -345,7 +347,9 @@ void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex, // passed-in scaler context flags. (It's only used when we fall-back to bitmap text). SkGlyphCache* cache = blob->setupCache(runIndex, props, SkPaint::kNone_ScalerContextFlags, dfPaint, nullptr); - SkPaint::GlyphCacheProc glyphCacheProc = dfPaint.getGlyphCacheProc(true); + SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(dfPaint.getTextEncoding(), + dfPaint.isDevKernText(), + true); const char* stop = text + byteLength; @@ -508,7 +512,9 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context, paint.setStyle(SkPaint::kFill_Style); paint.setPathEffect(nullptr); - SkPaint::GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(true); + SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), + paint.isDevKernText(), + true); SkAutoGlyphCache autoCache(paint, &props, nullptr); SkGlyphCache* cache = autoCache.getCache(); -- cgit v1.2.3