aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r--src/pdf/SkPDFDevice.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 564fdc2123..736c50b9a6 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;