diff options
author | Herb Derby <herb@google.com> | 2018-05-01 11:57:56 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-01 21:12:15 +0000 |
commit | c86c5c0144b85d0bc8ec791f9609ee2d4e7d835a (patch) | |
tree | dc0e00ea79487ce08f90fca2b4408b525271b82c /src/core/SkFindAndPlaceGlyph.h | |
parent | 0f91bb874dc3201dbc3cce3b946f66e3e484c6fc (diff) |
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>
Diffstat (limited to 'src/core/SkFindAndPlaceGlyph.h')
-rw-r--r-- | src/core/SkFindAndPlaceGlyph.h | 38 |
1 files changed, 10 insertions, 28 deletions
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); } |