diff options
author | 2016-08-18 14:22:52 -0700 | |
---|---|---|
committer | 2016-08-18 14:22:52 -0700 | |
commit | 530032a18e373ee673ae96fdbfa1fae6292f8f08 (patch) | |
tree | 5edb6e14ca33bf75d3d7b1df73da47be56337b3a /src/pdf/SkPDFDevice.cpp | |
parent | 9637ea91b88ff8f8e95325bfc41417ffc4d5ee0b (diff) |
SkPDF: in-place font subsetting
Motivation: gross code simplification, also no bitset lookups at draw time.
SkPDFFont owns its glyph useage bitset.
SkPDFSubstituteMap goes away.
SkPDFObject interface is simplified.
SkPDFDocument tracks font usage (as hash set), not glyph usage.
SkPDFFont gets a simpler constructor.
SkPDFFont has first and last glyph set in constructor, not adjusted later.
SkPDFFont implementations are simplified.
SkPDFGlyphSet is replaced with simple SkBitSet.
SkPDFFont sizes its SkBitSets based on glyph count.
SkPDFGlyphSetMap goes away.
SkBitSet is now non-copyable.
SkBitSet now how utility methods to match old SkPDFGlyphSet.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253283004
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot
Review-Url: https://codereview.chromium.org/2253283004
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 290c1c4f56..edf17280ef 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; } |