aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-05-01 11:57:56 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-02 15:15:08 +0000
commitfcac00f2f19e345e813f38f7fc9372b6d6eebf4b (patch)
tree5c6b360d138b00a3d5d9c167d2f71ad43451e7e9 /src
parentefe39bcfb82ddf8404b1df6f58809ff53dff4b99 (diff)
Reland "Remove devKerning"
This is a reland of c86c5c0144b85d0bc8ec791f9609ee2d4e7d835a Original change's description: > Remove devKerning > > Dev kerning is not supported by any scalers. This is > mostly removed. The remaining fields fRsbDelta and > fLsbDelta are kept to keep Android compiling. > > Change-Id: If1a9ee9bb599d4e1bdf4b3751ac0c65246350809 > Reviewed-on: https://skia-review.googlesource.com/124921 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Herb Derby <herb@google.com> Change-Id: Ibf5fac5f1442c7e62392d5146ad460da27b10d5c Reviewed-on: https://skia-review.googlesource.com/125300 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkAutoKern.h51
-rw-r--r--src/core/SkDraw.cpp1
-rw-r--r--src/core/SkFindAndPlaceGlyph.h38
-rw-r--r--src/core/SkGlyph.cpp2
-rw-r--r--src/core/SkGlyph.h4
-rw-r--r--src/core/SkPaint.cpp161
-rw-r--r--src/core/SkScalerContext.cpp15
-rw-r--r--src/core/SkScalerContext.h2
-rw-r--r--src/core/SkTextBlob.cpp1
-rw-r--r--src/core/SkTextToPathIter.h2
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp11
-rw-r--r--src/gpu/text/GrTextUtils.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType.cpp10
-rw-r--r--src/ports/SkFontHost_mac.cpp3
-rw-r--r--src/ports/SkFontHost_win.cpp3
-rw-r--r--src/ports/SkScalerContext_win_dw.cpp6
-rw-r--r--src/ports/SkTypeface_win_dw.cpp1
17 files changed, 54 insertions, 259 deletions
diff --git a/src/core/SkAutoKern.h b/src/core/SkAutoKern.h
deleted file mode 100644
index 8b032519b3..0000000000
--- a/src/core/SkAutoKern.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkAutoKern_DEFINED
-#define SkAutoKern_DEFINED
-
-#include "SkGlyph.h"
-
-#define SkAutoKern_Adjust(prev, next) SkIntToScalar(((next) - (prev) + 32) >> 6)
-
-/* this is a helper class to perform auto-kerning
- * the adjust() method returns a SkScalar corresponding
- * to a +1/0/-1 pixel adjustment
- */
-
-class SkAutoKern {
-public:
- SkAutoKern() : fPrevRsbDelta(0) {}
-
- SkScalar adjust(const SkGlyph& glyph)
- {
-// if (SkAbs32(glyph.fLsbDelta) > 47 || SkAbs32(glyph.fRsbDelta) > 47)
-// printf("------- %d> L %d R %d\n", glyph.f_GlyphID, glyph.fLsbDelta, glyph.fRsbDelta);
-
-#if 0
- int distort = fPrevRsbDelta - glyph.fLsbDelta;
-
- fPrevRsbDelta = glyph.fRsbDelta;
-
- if (distort >= 32)
- return -SK_Scalar1;
- else if (distort < -32)
- return +SK_Scalar1;
- else
- return 0;
-#else
- SkScalar adjust = SkAutoKern_Adjust(fPrevRsbDelta, glyph.fLsbDelta);
- fPrevRsbDelta = glyph.fRsbDelta;
- return adjust;
-#endif
- }
-private:
- int fPrevRsbDelta;
-};
-
-#endif
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index e3c81ba258..0526f76f8e 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1571,7 +1571,6 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, const SkS
paint.setPathEffect(nullptr);
SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
- paint.isDevKernText(),
true);
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(
paint, props, this->scalerContextFlags(), nullptr);
diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h
index d92edb6b17..00417152ab 100644
--- a/src/core/SkFindAndPlaceGlyph.h
+++ b/src/core/SkFindAndPlaceGlyph.h
@@ -9,7 +9,6 @@
#define SkFindAndPositionGlyph_DEFINED
#include "SkArenaAlloc.h"
-#include "SkAutoKern.h"
#include "SkGlyph.h"
#include "SkGlyphCache.h"
#include "SkMatrixPriv.h"
@@ -320,8 +319,8 @@ private:
virtual ~GlyphFindAndPlaceInterface() { }
// findAndPositionGlyph calculates the position of the glyph, finds the glyph, and
- // returns the position of where the next glyph will be using the glyph's advance and
- // possibly kerning. The returned position is used by drawText, but ignored by drawPosText.
+ // returns the position of where the next glyph will be using the glyph's advance. The
+ // returned position is used by drawText, but ignored by drawPosText.
// The compiler should prune all this calculation if the return value is not used.
//
// This should be a pure virtual, but some versions of GCC <= 4.8 have a bug that causes a
@@ -383,31 +382,20 @@ private:
GlyphFinderInterface* fGlyphFinder;
};
- enum SelectKerning {
- kNoKerning = false,
- kUseKerning = true
- };
-
// GlyphFindAndPlaceFullPixel handles finding and placing glyphs when no sub-pixel
- // positioning is requested. The kUseKerning argument should be true for drawText, and false
- // for drawPosText.
- template<typename ProcessOneGlyph, SkPaint::Align kTextAlignment, SelectKerning kUseKerning>
+ // positioning is requested.
+ template<typename ProcessOneGlyph, SkPaint::Align kTextAlignment>
class GlyphFindAndPlaceFullPixel final : public GlyphFindAndPlaceInterface<ProcessOneGlyph> {
public:
explicit GlyphFindAndPlaceFullPixel(GlyphFinderInterface* glyphFinder)
: fGlyphFinder(glyphFinder) {
- // Kerning can only be used with SkPaint::kLeft_Align
- static_assert(!kUseKerning || SkPaint::kLeft_Align == kTextAlignment,
- "Kerning can only be used with left aligned text.");
}
SkPoint findAndPositionGlyph(
const char** text, SkPoint position, ProcessOneGlyph&& processOneGlyph) override {
SkPoint finalPosition = position;
const SkGlyph& glyph = fGlyphFinder->lookupGlyph(text);
- if (kUseKerning) {
- finalPosition += {fAutoKern.adjust(glyph), 0.0f};
- }
+
if (glyph.fWidth > 0) {
finalPosition -= TextAlignmentAdjustment(kTextAlignment, glyph);
processOneGlyph(glyph, finalPosition, {SK_ScalarHalf, SK_ScalarHalf});
@@ -418,8 +406,6 @@ private:
private:
GlyphFinderInterface* fGlyphFinder;
-
- SkAutoKern fAutoKern;
};
template <typename ProcessOneGlyph, SkPaint::Align kTextAlignment>
@@ -446,14 +432,12 @@ private:
SkScalar x = 0, y = 0;
const char* stop = text + byteLength;
- SkAutoKern autokern;
-
while (text < stop) {
// don't need x, y here, since all subpixel variants will have the
// same advance
const SkGlyph& glyph = glyphFinder->lookupGlyph(&text);
- x += autokern.adjust(glyph) + SkFloatToScalar(glyph.fAdvanceX);
+ x += SkFloatToScalar(glyph.fAdvanceX);
y += SkFloatToScalar(glyph.fAdvanceY);
}
SkASSERT(text == stop);
@@ -543,18 +527,17 @@ inline void SkFindAndPlaceGlyph::ProcessPosText(
switch (textAlignment) {
case SkPaint::kLeft_Align:
findAndPosition = arena.make<
- GlyphFindAndPlaceFullPixel<ProcessOneGlyph,
- SkPaint::kLeft_Align, kNoKerning>>(glyphFinder);
+ GlyphFindAndPlaceFullPixel<ProcessOneGlyph, SkPaint::kLeft_Align>>(glyphFinder);
break;
case SkPaint::kCenter_Align:
findAndPosition = arena.make<
GlyphFindAndPlaceFullPixel<ProcessOneGlyph,
- SkPaint::kCenter_Align, kNoKerning>>(glyphFinder);
+ SkPaint::kCenter_Align>>(glyphFinder);
break;
case SkPaint::kRight_Align:
findAndPosition = arena.make<
GlyphFindAndPlaceFullPixel<ProcessOneGlyph,
- SkPaint::kRight_Align, kNoKerning>>(glyphFinder);
+ SkPaint::kRight_Align>>(glyphFinder);
break;
}
}
@@ -595,8 +578,7 @@ inline void SkFindAndPlaceGlyph::ProcessText(
findAndPosition = getSubpixel<ProcessOneGlyph, SkPaint::kLeft_Align>(
&arena, axisAlignment, glyphFinder);
} else {
- using FullPixel =
- GlyphFindAndPlaceFullPixel<ProcessOneGlyph, SkPaint::kLeft_Align, kUseKerning>;
+ using FullPixel = GlyphFindAndPlaceFullPixel<ProcessOneGlyph, SkPaint::kLeft_Align>;
findAndPosition = arena.make<FullPixel>(glyphFinder);
}
diff --git a/src/core/SkGlyph.cpp b/src/core/SkGlyph.cpp
index 2abe98aa1e..33246cc2dc 100644
--- a/src/core/SkGlyph.cpp
+++ b/src/core/SkGlyph.cpp
@@ -31,8 +31,6 @@ void SkGlyph::zeroMetrics() {
fHeight = 0;
fTop = 0;
fLeft = 0;
- fRsbDelta = 0;
- fLsbDelta = 0;
}
static size_t bits_to_bytes(size_t bits) {
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 211039e520..87cd852bd8 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -131,7 +131,6 @@ struct SkPackedUnicharID : public SkPackedID {
}
};
-SK_BEGIN_REQUIRE_DENSE
class SkGlyph {
// Support horizontal and vertical skipping strike-through / underlines.
// The caller walks the linked list looking for a match. For a horizontal underline,
@@ -159,7 +158,9 @@ public:
int16_t fTop, fLeft;
uint8_t fMaskFormat;
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
int8_t fRsbDelta, fLsbDelta; // used by auto-kerning
+#endif
int8_t fForceBW;
void initWithGlyphID(SkPackedGlyphID glyph_id);
@@ -224,6 +225,5 @@ public:
#endif
SkPackedGlyphID fID;
};
-SK_END_REQUIRE_DENSE
#endif
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 141b60b252..ab3e2da9b5 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -7,7 +7,6 @@
#include "SkPaint.h"
#include "SkPaintPriv.h"
-#include "SkAutoKern.h"
#include "SkColorFilter.h"
#include "SkData.h"
#include "SkDraw.h"
@@ -245,10 +244,6 @@ void SkPaint::setFakeBoldText(bool doFakeBold) {
this->setFlags(set_clear_mask(fBitfields.fFlags, doFakeBold, kFakeBoldText_Flag));
}
-void SkPaint::setDevKernText(bool doDevKern) {
- this->setFlags(set_clear_mask(fBitfields.fFlags, doDevKern, kDevKernText_Flag));
-}
-
void SkPaint::setStyle(Style style) {
if ((unsigned)style < kStyleCount) {
fBitfields.fStyle = style;
@@ -625,8 +620,7 @@ static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache,
}
SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding,
- bool isDevKern,
- bool needFullMetrics) {
+ bool needFullMetrics) {
static const GlyphCacheProc gGlyphCacheProcs[] = {
sk_getMetrics_utf8_next,
sk_getMetrics_utf16_next,
@@ -641,7 +635,7 @@ SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding,
unsigned index = encoding;
- if (!needFullMetrics && !isDevKern) {
+ if (!needFullMetrics) {
index += 4;
}
@@ -652,7 +646,6 @@ SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding,
///////////////////////////////////////////////////////////////////////////////
#define TEXT_AS_PATHS_PAINT_FLAGS_TO_IGNORE ( \
-SkPaint::kDevKernText_Flag | \
SkPaint::kLinearText_Flag | \
SkPaint::kLCDRenderText_Flag | \
SkPaint::kEmbeddedBitmapText_Flag | \
@@ -739,7 +732,6 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
}
GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(this->getTextEncoding(),
- this->isDevKernText(),
nullptr != bounds);
int xyIndex;
@@ -758,33 +750,16 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkScalar x = advance(*g, xyIndex);
if (nullptr == bounds) {
- if (this->isDevKernText()) {
- for (; text < stop; n++) {
- const int rsb = g->fRsbDelta;
- g = &glyphCacheProc(cache, &text);
- x += SkAutoKern_Adjust(rsb, g->fLsbDelta) + advance(*g, xyIndex);
- }
- } else {
- for (; text < stop; n++) {
- x += advance(glyphCacheProc(cache, &text), xyIndex);
- }
+ for (; text < stop; n++) {
+ x += advance(glyphCacheProc(cache, &text), xyIndex);
}
} else {
set_bounds(*g, bounds);
- if (this->isDevKernText()) {
- for (; text < stop; n++) {
- const int rsb = g->fRsbDelta;
- g = &glyphCacheProc(cache, &text);
- x += SkAutoKern_Adjust(rsb, g->fLsbDelta);
- joinBoundsProc(*g, bounds, x);
- x += advance(*g, xyIndex);
- }
- } else {
- for (; text < stop; n++) {
- g = &glyphCacheProc(cache, &text);
- joinBoundsProc(*g, bounds, x);
- x += advance(*g, xyIndex);
- }
+
+ for (; text < stop; n++) {
+ g = &glyphCacheProc(cache, &text);
+ joinBoundsProc(*g, bounds, x);
+ x += advance(*g, xyIndex);
}
}
SkASSERT(text == stop);
@@ -857,33 +832,17 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(paint);
GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
- paint.isDevKernText(),
false);
const int xyIndex = paint.isVerticalText() ? 1 : 0;
SkScalar width = 0;
- if (this->isDevKernText()) {
- int rsb = 0;
- while (text < stop) {
- const char* curr = text;
- const SkGlyph& g = glyphCacheProc(cache.get(), &text);
- SkScalar x = SkAutoKern_Adjust(rsb, g.fLsbDelta) + advance(g, xyIndex);
- if ((width += x) > maxWidth) {
- width -= x;
- text = curr;
- break;
- }
- rsb = g.fRsbDelta;
- }
- } else {
- while (text < stop) {
- const char* curr = text;
- SkScalar x = advance(glyphCacheProc(cache.get(), &text), xyIndex);
- if ((width += x) > maxWidth) {
- width -= x;
- text = curr;
- break;
- }
+ while (text < stop) {
+ const char* curr = text;
+ SkScalar x = advance(glyphCacheProc(cache.get(), &text), xyIndex);
+ if ((width += x) > maxWidth) {
+ width -= x;
+ text = curr;
+ break;
}
}
@@ -961,7 +920,6 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(paint);
GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
- paint.isDevKernText(),
nullptr != bounds);
const char* text = (const char*)textData;
@@ -969,73 +927,27 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
int count = 0;
const int xyIndex = paint.isVerticalText() ? 1 : 0;
- if (this->isDevKernText()) {
- // we adjust the widths returned here through auto-kerning
- SkAutoKern autokern;
- SkScalar prevWidth = 0;
-
- if (scale) {
- while (text < stop) {
- const SkGlyph& g = glyphCacheProc(cache.get(), &text);
- if (widths) {
- SkScalar adjust = autokern.adjust(g);
-
- if (count > 0) {
- *widths++ = (prevWidth + adjust) * scale;
- }
- prevWidth = advance(g, xyIndex);
- }
- if (bounds) {
- set_bounds(g, bounds++, scale);
- }
- ++count;
- }
- if (count > 0 && widths) {
- *widths = prevWidth * scale;
- }
- } else {
- while (text < stop) {
- const SkGlyph& g = glyphCacheProc(cache.get(), &text);
- if (widths) {
- SkScalar adjust = autokern.adjust(g);
-
- if (count > 0) {
- *widths++ = prevWidth + adjust;
- }
- prevWidth = advance(g, xyIndex);
- }
- if (bounds) {
- set_bounds(g, bounds++);
- }
- ++count;
+ if (scale) {
+ while (text < stop) {
+ const SkGlyph& g = glyphCacheProc(cache.get(), &text);
+ if (widths) {
+ *widths++ = advance(g, xyIndex) * scale;
}
- if (count > 0 && widths) {
- *widths = prevWidth;
+ if (bounds) {
+ set_bounds(g, bounds++, scale);
}
+ ++count;
}
- } else { // no devkern
- if (scale) {
- while (text < stop) {
- const SkGlyph& g = glyphCacheProc(cache.get(), &text);
- if (widths) {
- *widths++ = advance(g, xyIndex) * scale;
- }
- if (bounds) {
- set_bounds(g, bounds++, scale);
- }
- ++count;
+ } else {
+ while (text < stop) {
+ const SkGlyph& g = glyphCacheProc(cache.get(), &text);
+ if (widths) {
+ *widths++ = advance(g, xyIndex);
}
- } else {
- while (text < stop) {
- const SkGlyph& g = glyphCacheProc(cache.get(), &text);
- if (widths) {
- *widths++ = advance(g, xyIndex);
- }
- if (bounds) {
- set_bounds(g, bounds++);
- }
- ++count;
+ if (bounds) {
+ set_bounds(g, bounds++);
}
+ ++count;
}
}
@@ -1649,7 +1561,6 @@ void SkPaint::toString(SkString* str) const {
SkAddFlagToString(str, this->isFakeBoldText(), "FakeBoldText", &needSeparator);
SkAddFlagToString(str, this->isLinearText(), "LinearText", &needSeparator);
SkAddFlagToString(str, this->isSubpixelText(), "SubpixelText", &needSeparator);
- SkAddFlagToString(str, this->isDevKernText(), "DevKernText", &needSeparator);
SkAddFlagToString(str, this->isLCDRenderText(), "LCDRenderText", &needSeparator);
SkAddFlagToString(str, this->isEmbeddedBitmapText(),
"EmbeddedBitmapText", &needSeparator);
@@ -1709,9 +1620,7 @@ SkTextBaseIter::SkTextBaseIter(const char text[], size_t length,
const SkPaint& paint,
bool applyStrokeAndPathEffects)
: fPaint(paint) {
- fGlyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
- paint.isDevKernText(),
- true);
+ fGlyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), true);
fPaint.setLinearText(true);
fPaint.setMaskFilter(nullptr); // don't want this affecting our path-cache lookup
@@ -1780,7 +1689,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) {
if (fText < fStop) {
const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText);
- fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale;
+ fXPos += fPrevAdvance * fScale;
fPrevAdvance = advance(glyph, fXYIndex); // + fPaint.getTextTracking();
if (glyph.fWidth) {
@@ -1802,7 +1711,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) {
bool SkTextInterceptsIter::next(SkScalar* array, int* count) {
const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText);
- fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale;
+ fXPos += fPrevAdvance * fScale;
fPrevAdvance = advance(glyph, fXYIndex); // + fPaint.getTextTracking();
if (fCache->findPath(glyph)) {
fCache->findIntercepts(fBounds, fScale, fXPos, SkToBool(fXYIndex),
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index b8cd107bd3..57d8bc1ddf 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -106,15 +106,6 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
}
}
- // for now we have separate cache entries for devkerning on and off
- // in the future we might share caches, but make our measure/draw
- // code make the distinction. Thus we zap the values if the caller
- // has not asked for them.
- if ((fRec.fFlags & SkScalerContext::kDevKernText_Flag) == 0) {
- // no devkern, so zap the fields
- glyph->fLsbDelta = glyph->fRsbDelta = 0;
- }
-
// if either dimension is empty, zap the image bounds of the glyph
if (0 == glyph->fWidth || 0 == glyph->fHeight) {
glyph->fWidth = 0;
@@ -162,8 +153,6 @@ SK_ERROR:
glyph->fTop = 0;
glyph->fWidth = 0;
glyph->fHeight = 0;
- glyph->fLsbDelta = 0;
- glyph->fRsbDelta = 0;
// put a valid value here, in case it was earlier set to
// MASK_FORMAT_JUST_ADVANCE
glyph->fMaskFormat = fRec.fMaskFormat;
@@ -885,10 +874,6 @@ void SkScalerContext::MakeRecAndEffects(const SkPaint& paint,
#endif
}
- if (paint.isDevKernText()) {
- flags |= SkScalerContext::kDevKernText_Flag;
- }
-
if (style != SkPaint::kFill_Style && strokeWidth > 0) {
rec->fFrameWidth = strokeWidth;
rec->fMiterLimit = paint.getStrokeMiter();
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 84abdcc1a4..a15e276bcc 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -224,7 +224,7 @@ class SkScalerContext {
public:
enum Flags {
kFrameAndFill_Flag = 0x0001,
- kDevKernText_Flag = 0x0002,
+ kUnused = 0x0002,
kEmbeddedBitmapText_Flag = 0x0004,
kEmbolden_Flag = 0x0008,
kSubpixelPositioning_Flag = 0x0010,
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index 2c29d9d613..e2d3be4518 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -67,7 +67,6 @@ private:
SkPaint::kFakeBoldText_Flag |
SkPaint::kLinearText_Flag |
SkPaint::kSubpixelText_Flag |
- SkPaint::kDevKernText_Flag |
SkPaint::kLCDRenderText_Flag |
SkPaint::kEmbeddedBitmapText_Flag |
SkPaint::kAutoHinting_Flag |
diff --git a/src/core/SkTextToPathIter.h b/src/core/SkTextToPathIter.h
index 49564d96af..c135de620b 100644
--- a/src/core/SkTextToPathIter.h
+++ b/src/core/SkTextToPathIter.h
@@ -8,7 +8,6 @@
#ifndef SkTextToPathIter_DEFINED
#define SkTextToPathIter_DEFINED
-#include "SkAutoKern.h"
#include "SkPaint.h"
#include "SkStrikeCache.h"
@@ -27,7 +26,6 @@ protected:
SkPaint::GlyphCacheProc fGlyphCacheProc;
SkScalar fXPos; // accumulated xpos, returned in next
- SkAutoKern fAutoKern;
int fXYIndex; // cache for horizontal -vs- vertical text
};
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 27c8dea670..e99d9df044 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -498,7 +498,6 @@ void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runInd
pathPaint.setPathEffect(nullptr);
SkPaint::GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(pathPaint.getTextEncoding(),
- pathPaint.isDevKernText(),
true);
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(
pathPaint, &props, SkScalerContextFlags::kFakeGammaAndBoostContrast, nullptr);
@@ -679,7 +678,7 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex,
const SkPaint& skPaint = paint.skPaint();
SkPaint::GlyphCacheProc glyphCacheProc =
- SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), skPaint.isDevKernText(), true);
+ SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), true);
SkTArray<SkScalar> positions;
@@ -705,14 +704,13 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex,
auto origPaintCache =
SkStrikeCache::FindOrCreateStrikeExclusive(*desc.getDesc(), effects, *typeface);
- SkAutoKern autokern;
const char* stop = text + byteLength;
while (textPtr < stop) {
// don't need x, y here, since all subpixel variants will have the
// same advance
const SkGlyph& glyph = glyphCacheProc(origPaintCache.get(), &textPtr);
- SkScalar width = SkFloatToScalar(glyph.fAdvanceX) + autokern.adjust(glyph);
+ SkScalar width = SkFloatToScalar(glyph.fAdvanceX);
positions.push_back(stopX + origin * width);
SkScalar height = SkFloatToScalar(glyph.fAdvanceY);
@@ -777,7 +775,7 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex,
auto cache = blob->setupCache(runIndex, props, SkScalerContextFlags::kNone, dfPaint,
nullptr);
SkPaint::GlyphCacheProc glyphCacheProc =
- SkPaint::GetGlyphCacheProc(dfPaint.getTextEncoding(), dfPaint.isDevKernText(), true);
+ SkPaint::GetGlyphCacheProc(dfPaint.getTextEncoding(), true);
const char* stop = text + byteLength;
@@ -884,8 +882,7 @@ void GrAtlasTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int
SkExclusiveStrikePtr cache;
const SkPaint& skPaint = paint.skPaint();
SkPaint::GlyphCacheProc glyphCacheProc =
- SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(),
- skPaint.isDevKernText(), true);
+ SkPaint::GetGlyphCacheProc(skPaint.getTextEncoding(), true);
SkColor textColor = paint.filteredPremulColor();
SkScalar textRatio = SK_Scalar1;
if (fUseScaledFallback) {
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index 738cfb68be..ab332e0417 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -62,7 +62,7 @@ bool GrTextUtils::PathTextIter::next(const SkGlyph** skGlyph, const SkPath** pat
if (fText < fStop) {
const SkGlyph& glyph = fGlyphCacheProc(fCache.get(), &fText);
- fXPos += (fPrevAdvance + fAutoKern.adjust(glyph)) * fScale;
+ fXPos += fPrevAdvance * fScale;
SkASSERT(0 == fXYIndex || 1 == fXYIndex);
fPrevAdvance = SkFloatToScalar((&glyph.fAdvanceX)[fXYIndex]);
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 4c4c6d4f65..c5e8a65733 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -994,8 +994,6 @@ void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) {
fLoadGlyphFlags | FT_ADVANCE_FLAG_FAST_ONLY,
&advance );
if (0 == error) {
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
const SkScalar advanceScalar = SkFT_FixedToScalar(advance);
glyph->fAdvanceX = SkScalarToFloat(fMatrix22Scalar.getScaleX() * advanceScalar);
glyph->fAdvanceY = SkScalarToFloat(fMatrix22Scalar.getSkewY() * advanceScalar);
@@ -1091,9 +1089,6 @@ bool SkScalerContext_FreeType::shouldSubpixelBitmap(const SkGlyph& glyph, const
void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
SkAutoMutexAcquire ac(gFTMutex);
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
-
FT_Error err;
if (this->setupSize()) {
@@ -1184,11 +1179,6 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
} else {
glyph->fAdvanceX = SkFDot6ToFloat(fFace->glyph->advance.x);
glyph->fAdvanceY = -SkFDot6ToFloat(fFace->glyph->advance.y);
-
- if (fRec.fFlags & kDevKernText_Flag) {
- glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta);
- glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta);
- }
}
}
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index efd74f6f8e..8047c4352f 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -2249,8 +2249,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
rec->setHinting(SkPaint::kNormal_Hinting);
}
- unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag |
- SkScalerContext::kForceAutohinting_Flag |
+ unsigned flagsWeDontSupport = SkScalerContext::kForceAutohinting_Flag |
SkScalerContext::kLCD_BGROrder_Flag |
SkScalerContext::kLCD_Vertical_Flag;
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 7bc1e298aa..35a0a74b22 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -943,8 +943,6 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
// TODO(benjaminwagner): What is the type of gm.gmCellInc[XY]?
glyph->fAdvanceX = (float)((int)gm.gmCellIncX);
glyph->fAdvanceY = (float)((int)gm.gmCellIncY);
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
if (this->isSubpixel()) {
sk_bzero(&gm, sizeof(gm));
@@ -2265,7 +2263,6 @@ void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
}
unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag |
- SkScalerContext::kDevKernText_Flag |
SkScalerContext::kForceAutohinting_Flag |
SkScalerContext::kEmbeddedBitmapText_Flag |
SkScalerContext::kEmbolden_Flag |
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 8e73b16047..98d8ca812e 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -377,12 +377,6 @@ uint16_t SkScalerContext_DW::generateCharToGlyph(SkUnichar uni) {
}
void SkScalerContext_DW::generateAdvance(SkGlyph* glyph) {
- //Delta is the difference between the right/left side bearing metric
- //and where the right/left side bearing ends up after hinting.
- //DirectWrite does not provide this information.
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
-
glyph->fAdvanceX = 0;
glyph->fAdvanceY = 0;
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 69be774612..69bf7ff034 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -258,7 +258,6 @@ void DWriteFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
}
unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag |
- SkScalerContext::kDevKernText_Flag |
SkScalerContext::kForceAutohinting_Flag |
SkScalerContext::kEmbolden_Flag |
SkScalerContext::kLCD_Vertical_Flag;