Index: src/pdf/SkPDFDevice.cpp |
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp |
index 290c1c4f565ae0f02e6ffc47bdbd5af72554766b..edf17280ef7b4220ab2d0128e562825f9d8a76e2 100644 |
--- a/src/pdf/SkPDFDevice.cpp |
+++ b/src/pdf/SkPDFDevice.cpp |
@@ -1153,7 +1153,6 @@ void SkPDFDevice::internalDrawText( |
font->multiByteGlyphs(), |
defaultPositioning, |
offset); |
- SkPDFGlyphSetMap* fontGlyphUsage = fDocument->getGlyphUsage(); |
const SkGlyphID* const glyphsEnd = glyphs + glyphCount; |
while (glyphs < glyphsEnd) { |
@@ -1184,7 +1183,7 @@ void SkPDFDevice::internalDrawText( |
return; |
} |
} |
- fontGlyphUsage->noteGlyphUsage(font, glyphs, stretch); |
+ font->noteGlyphUsage(glyphs, stretch); |
if (defaultPositioning) { |
(void)font->glyphsToPDFFontEncoding(glyphs, SkToInt(glyphsEnd - glyphs)); |
while (stretch-- > 0) { |
@@ -1318,10 +1317,6 @@ sk_sp<SkPDFDict> SkPDFDevice::makeResourceDict() const { |
&fonts); |
} |
-const SkTDArray<SkPDFFont*>& SkPDFDevice::getFontResources() const { |
- return fFontResources; |
-} |
- |
sk_sp<SkPDFArray> SkPDFDevice::copyMediaBox() const { |
auto mediaBox = sk_make_sp<SkPDFArray>(); |
mediaBox->reserve(4); |
@@ -1948,9 +1943,9 @@ int SkPDFDevice::getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID) { |
} |
int resourceIndex = fFontResources.find(newFont.get()); |
if (resourceIndex < 0) { |
+ fDocument->registerFont(newFont.get()); |
resourceIndex = fFontResources.count(); |
- fFontResources.push(newFont.get()); |
- newFont.get()->ref(); |
+ fFontResources.push(newFont.release()); |
} |
return resourceIndex; |
} |