| Index: src/pdf/SkPDFDevice.cpp
|
| diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
|
| index 564fdc212393b82b6a5700ce9c3622abb7ca157b..736c50b9a6d8b0151ca8fbd7c1f445b545078883 100644
|
| --- a/src/pdf/SkPDFDevice.cpp
|
| +++ b/src/pdf/SkPDFDevice.cpp
|
| @@ -1124,17 +1124,21 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
|
| set_text_transform(x, y, textPaint.getTextSkewX(),
|
| &content.entry()->fContent);
|
| int consumedGlyphCount = 0;
|
| +
|
| + SkTDArray<uint16_t> glyphIDsCopy(glyphIDs, numGlyphs);
|
| +
|
| while (numGlyphs > consumedGlyphCount) {
|
| updateFont(textPaint, glyphIDs[consumedGlyphCount], content.entry());
|
| SkPDFFont* font = content.entry()->fState.fFont;
|
| - //TODO: the const_cast here is a bug if the encoding started out as glyph encoding.
|
| - int availableGlyphs =
|
| - font->glyphsToPDFFontEncoding(const_cast<uint16_t*>(glyphIDs) + consumedGlyphCount,
|
| - numGlyphs - consumedGlyphCount);
|
| - fFontGlyphUsage->noteGlyphUsage(font, glyphIDs + consumedGlyphCount,
|
| - availableGlyphs);
|
| +
|
| + int availableGlyphs = font->glyphsToPDFFontEncoding(
|
| + glyphIDsCopy.begin() + consumedGlyphCount,
|
| + numGlyphs - consumedGlyphCount);
|
| + fFontGlyphUsage->noteGlyphUsage(
|
| + font, glyphIDsCopy.begin() + consumedGlyphCount,
|
| + availableGlyphs);
|
| SkString encodedString =
|
| - SkPDFString::FormatString(glyphIDs + consumedGlyphCount,
|
| + SkPDFString::FormatString(glyphIDsCopy.begin() + consumedGlyphCount,
|
| availableGlyphs, font->multiByteGlyphs());
|
| content.entry()->fContent.writeText(encodedString.c_str());
|
| consumedGlyphCount += availableGlyphs;
|
|
|