diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp index a6ac71b3fa..ec09a34d70 100644 --- a/src/core/SkGlyphRun.cpp +++ b/src/core/SkGlyphRun.cpp @@ -28,7 +28,7 @@ static SkTypeface::Encoding convert_encoding(SkPaint::TextEncoding encoding) { } // namespace // -- SkGlyphRun ----------------------------------------------------------------------------------- -SkGlyphRun::SkGlyphRun(const SkPaint& runPaint, +SkGlyphRun::SkGlyphRun(SkPaint&& runPaint, SkSpan denseIndices, SkSpan positions, SkSpan glyphIDs, @@ -41,7 +41,7 @@ SkGlyphRun::SkGlyphRun(const SkPaint& runPaint, , fUniqueGlyphIDs{uniqueGlyphIDs} , fText{text} , fClusters{clusters} - , fRunPaint{runPaint} {} + , fRunPaint{std::move(runPaint)} {} void SkGlyphRun::eachGlyphToGlyphRun(SkGlyphRun::PerGlyph perGlyph) { SkPaint paint{fRunPaint}; @@ -371,8 +371,12 @@ void SkGlyphRunBuilder::makeGlyphRun( // Ignore empty runs. if (!glyphIDs.empty()) { + SkPaint glyphRunPaint{runPaint}; + glyphRunPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + glyphRunPaint.setTextAlign(SkPaint::kLeft_Align); + fGlyphRunListStorage.emplace_back( - runPaint, + std::move(glyphRunPaint), uniqueGlyphIDIndices, positions, glyphIDs, diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h index b905cbff33..8a4e6e021b 100644 --- a/src/core/SkGlyphRun.h +++ b/src/core/SkGlyphRun.h @@ -85,7 +85,7 @@ public: class SkGlyphRun { public: SkGlyphRun() = default; - SkGlyphRun(const SkPaint& runPaint, + SkGlyphRun(SkPaint&& runPaint, SkSpan denseIndices, SkSpan positions, SkSpan glyphIDs, diff --git a/src/pdf/SkClusterator.cpp b/src/pdf/SkClusterator.cpp index f575407e8c..988c84590a 100644 --- a/src/pdf/SkClusterator.cpp +++ b/src/pdf/SkClusterator.cpp @@ -31,6 +31,7 @@ SkClusterator::SkClusterator(const SkGlyphRun& run) , fGlyphCount(SkToU32(run.shuntGlyphsIDs().size())) , fTextByteLength(SkToU32(run.text().size())) { + SkASSERT(SkPaint::kGlyphID_TextEncoding == run.paint().getTextEncoding()); if (fClusters) { SkASSERT(fUtf8Text && fTextByteLength > 0 && fGlyphCount > 0); fReversedChars = is_reversed(fClusters, fGlyphCount);