diff options
Diffstat (limited to 'Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc')
-rw-r--r-- | Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc index c755caa4a9e..b466bc69a61 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc @@ -32,6 +32,7 @@ // Copyright (C) 2015 Marek Kasik <mkasik@redhat.com> // Copyright (C) 2016 Caolán McNamara <caolanm@redhat.com> // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -53,7 +54,6 @@ #include <algorithm> #include "goo/GooString.h" #include "goo/GooList.h" -#include "goo/GooHash.h" #include "poppler-config.h" #include "GlobalParams.h" #include "Object.h" @@ -1108,8 +1108,6 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, customCodeCbkData = customCodeCbkDataA; fontIDs = nullptr; - fontNames = new GooHash(gTrue); - fontMaxValidGlyph = new GooHash(gTrue); t1FontNames = nullptr; font8Info = nullptr; font16Enc = nullptr; @@ -1177,8 +1175,6 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, customCodeCbkData = customCodeCbkDataA; fontIDs = nullptr; - fontNames = new GooHash(gTrue); - fontMaxValidGlyph = new GooHash(gTrue); t1FontNames = nullptr; font8Info = nullptr; font16Enc = nullptr; @@ -1409,7 +1405,7 @@ void PSOutputDev::postInit() fontIDLen = 0; fontIDs = (Ref *)gmallocn(fontIDSize, sizeof(Ref)); for (i = 0; i < 14; ++i) { - fontNames->add(new GooString(psBase14SubstFonts[i].psName), 1); + fontNames.emplace(psBase14SubstFonts[i].psName); } t1FontNameSize = 64; t1FontNameLen = 0; @@ -1499,8 +1495,6 @@ PSOutputDev::~PSOutputDev() { if (fontIDs) { gfree(fontIDs); } - delete fontNames; - delete fontMaxValidGlyph; if (t1FontNames) { for (i = 0; i < t1FontNameLen; ++i) { delete t1FontNames[i].psName; @@ -2128,10 +2122,9 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { GBool writePadding = gTrue; // check if font is already embedded - if (fontNames->lookupInt(psName)) { + if (!fontNames.emplace(psName->toStr()).second) { return; } - fontNames->add(psName->copy(), 1); // get the font stream and info Object obj1, obj2, obj3; @@ -2307,10 +2300,9 @@ void PSOutputDev::setupExternalType1Font(GooString *fileName, GooString *psName) FILE *fontFile; int c; - if (fontNames->lookupInt(psName)) { + if (!fontNames.emplace(psName->toStr()).second) { return; } - fontNames->add(psName->copy(), 1); // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); @@ -2546,8 +2538,9 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, GooString *fileName, void PSOutputDev::updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph) { if (maxValidGlyph >= 0 && font->getName()) { - if (maxValidGlyph > fontMaxValidGlyph->lookupInt(font->getName())) { - fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph); + auto& fontMaxValidGlyph = this->fontMaxValidGlyph[font->getName()->toStr()]; + if (fontMaxValidGlyph < maxValidGlyph) { + fontMaxValidGlyph = maxValidGlyph; } } } @@ -2872,16 +2865,14 @@ GooString *PSOutputDev::makePSFontName(GfxFont *font, const Ref *id) { if ((s = font->getEmbeddedFontName())) { psName = filterPSName(s); - if (!fontNames->lookupInt(psName)) { - fontNames->add(psName->copy(), 1); + if (fontNames.emplace(psName->toStr()).second) { return psName; } delete psName; } if ((s = font->getName())) { psName = filterPSName(s); - if (!fontNames->lookupInt(psName)) { - fontNames->add(psName->copy(), 1); + if (fontNames.emplace(psName->toStr()).second) { return psName; } delete psName; @@ -2896,7 +2887,7 @@ GooString *PSOutputDev::makePSFontName(GfxFont *font, const Ref *id) { psName->append('_')->append(s); delete s; } - fontNames->add(psName->copy(), 1); + fontNames.emplace(psName->toStr()); return psName; } @@ -5042,7 +5033,7 @@ void PSOutputDev::drawString(GfxState *state, const GooString *s) { if (!(font = state->getFont())) { return; } - maxGlyphInt = (font->getName()? fontMaxValidGlyph->lookupInt(font->getName()): 0); + maxGlyphInt = (font->getName() ? fontMaxValidGlyph[font->getName()->toStr()] : 0); if (maxGlyphInt < 0) maxGlyphInt = 0; maxGlyph = (CharCode) maxGlyphInt; wMode = font->getWMode(); |