diff options
author | Norbert Preining <norbert@preining.info> | 2019-10-29 03:00:39 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-10-29 03:00:39 +0000 |
commit | 97f5151099967e6c823d640a90d87bca92c44035 (patch) | |
tree | 685caa49488599f87d0caa4e972833b2263d8567 /dviware/dvisvgm/src/DVIToSVG.cpp | |
parent | 25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff) |
CTAN sync 201910290300
Diffstat (limited to 'dviware/dvisvgm/src/DVIToSVG.cpp')
-rw-r--r-- | dviware/dvisvgm/src/DVIToSVG.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/dviware/dvisvgm/src/DVIToSVG.cpp b/dviware/dvisvgm/src/DVIToSVG.cpp index 4911dfe321..4801bd80a0 100644 --- a/dviware/dvisvgm/src/DVIToSVG.cpp +++ b/dviware/dvisvgm/src/DVIToSVG.cpp @@ -111,11 +111,11 @@ void DVIToSVG::convert (unsigned first, unsigned last, HashFunction *hashFunc) { combinedHash = hashFunc->digestString(); } const SVGOutput::HashTriple hashTriple(dviHash, shortenedOptHash, combinedHash); - string fname = _out.filename(i, numberOfPages(), hashTriple); - if (!dviHash.empty() && !PAGE_HASH_SETTINGS.isSet(HashSettings::P_REPLACE) && FileSystem::exists(fname)) { + FilePath path = _out.filepath(i, numberOfPages(), hashTriple); + if (!dviHash.empty() && !PAGE_HASH_SETTINGS.isSet(HashSettings::P_REPLACE) && path.exists()) { Message::mstream(false, Message::MC_PAGE_NUMBER) << "skipping page " << i; Message::mstream().indent(1); - Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\nfile " << fname << " exists\n"; + Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\nfile " << path.shorterAbsoluteOrRelative() << " exists\n"; Message::mstream().indent(0); } else { @@ -123,6 +123,7 @@ void DVIToSVG::convert (unsigned first, unsigned last, HashFunction *hashFunc) { SVGOptimizer(_svg).execute(); embedFonts(_svg.rootNode()); bool success = _svg.write(_out.getPageStream(currentPageNumber(), numberOfPages(), hashTriple)); + string fname = path.shorterAbsoluteOrRelative(); if (fname.empty()) fname = "<stdout>"; if (success) @@ -332,12 +333,16 @@ Matrix DVIToSVG::getPageTransformation () const { static void collect_chars (unordered_map<const Font*, set<int>> &fontmap) { + unordered_map<const Font*, set<int>> insertedChars; for (const auto &entry : fontmap) { - if (entry.first->uniqueFont() != entry.first) { + const Font *unique_font = entry.first->uniqueFont(); + if (unique_font != entry.first) { for (int c : entry.second) - fontmap[entry.first->uniqueFont()].insert(c); + insertedChars[unique_font].insert(c); } } + for (const auto &entry : insertedChars) + fontmap[entry.first].insert(entry.second.begin(), entry.second.end()); } @@ -421,8 +426,8 @@ void DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) { } -string DVIToSVG::getSVGFilename (unsigned pageno) const { - return _out.filename(pageno, numberOfPages()); +FilePath DVIToSVG::getSVGFilePath (unsigned pageno) const { + return _out.filepath(pageno, numberOfPages()); } @@ -568,6 +573,15 @@ void DVIToSVG::HashSettings::setParameters (const string ¶mstr) { _params.insert(it->second); else if (_algo.empty() && HashFunction::isSupportedAlgorithm(name)) _algo = name; + else if (!name.empty()) { + string msg = "invalid hash parameter '"+name+"' (supported algorithms: "; + for (string str : HashFunction::supportedAlgorithms()) + msg += str + ", "; + msg.pop_back(); + msg.pop_back(); + msg += ')'; + throw MessageException(msg); + } } // set default hash algorithm if none is given if (_algo.empty()) |