diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
238 files changed, 1138 insertions, 888 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp index c1d460273a5..67c6dbcea16 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp @@ -2,7 +2,7 @@ ** AGLTable.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp index bb30154e7ba..d37a89c20cc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp @@ -2,7 +2,7 @@ ** BasicDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -154,6 +154,47 @@ int BasicDVIReader::executeCommand () { } +void BasicDVIReader::executePreamble () { + clearStream(); + if (isStreamValid()) { + seek(0); + if (readByte() == OP_PRE) { + cmdPre(0); + return; + } + } + throw DVIException("invalid DVI file"); +} + + +/** Moves stream pointer to begin of postamble */ +void BasicDVIReader::goToPostamble () { + clearStream(); + if (!isStreamValid()) + throw DVIException("invalid DVI file"); + + seek(-1, ios::end); // stream pointer to last byte + int count=0; + while (peek() == DVI_FILL) { // skip fill bytes + seek(-1, ios::cur); + count++; + } + if (count < 4) // the standard requires at least 4 trailing fill bytes + throw DVIException("missing fill bytes at end of file"); + + seek(-4, ios::cur); // now at first byte of q (pointer to begin of postamble) + uint32_t q = readUnsigned(4); // pointer to begin of postamble + seek(q); // now at begin of postamble +} + + +/** Reads and executes the commands of the postamble. */ +void BasicDVIReader::executePostamble () { + goToPostamble(); + while (executeCommand() != OP_POSTPOST); // executes all commands until post_post (= 249) is reached +} + + void BasicDVIReader::executePostPost () { clearStream(); // reset all status bits if (!isStreamValid()) @@ -172,6 +213,37 @@ void BasicDVIReader::executePostPost () { } +void BasicDVIReader::executeFontDefs () { + goToPostamble(); + seek(1+28, ios::cur); // now on first fontdef or postpost + if (peek() != OP_POSTPOST) + while (executeCommand() != OP_POSTPOST); +} + + +/** Collects and records the file offsets of all bop commands. */ +vector<uint32_t> BasicDVIReader::collectBopOffsets () { + std::vector<uint32_t> bopOffsets; + goToPostamble(); + bopOffsets.push_back(tell()); // also add offset of postamble + readByte(); // skip post command + uint32_t offset = readUnsigned(4); // offset of final bop + while (int32_t(offset) != -1) { // not yet on first bop? + bopOffsets.push_back(offset); // record offset + seek(offset); // now on previous bop + if (readByte() != OP_BOP) + throw DVIException("bop offset at "+to_string(offset)+" doesn't point to bop command" ); + seek(40, ios::cur); // skip the 10 \count values => now on offset of previous bop + uint32_t prevOffset = readUnsigned(4); + if ((prevOffset >= offset && int32_t(prevOffset) != -1)) + throw DVIException("invalid bop offset at "+to_string(tell()-static_cast<streamoff>(4))); + offset = prevOffset; + } + reverse(bopOffsets.begin(), bopOffsets.end()); + return bopOffsets; +} + + void BasicDVIReader::executeAllPages () { if (_dviVersion == DVI_NONE) executePostPost(); // get version ID from post_post diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp index 7ce1f989e2a..a71c547fa55 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp @@ -2,7 +2,7 @@ ** BasicDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -52,6 +52,7 @@ class BasicDVIReader : public StreamReader { public: explicit BasicDVIReader (std::istream &is); virtual void executeAllPages (); + virtual void executeFontDefs (); virtual double getXPos () const {return 0;} virtual double getYPos () const {return 0;} virtual void finishLine () {} @@ -66,7 +67,11 @@ class BasicDVIReader : public StreamReader { DVIVersion getDVIVersion () const {return _dviVersion;} virtual int evalCommand (CommandHandler &handler, int ¶m); virtual int executeCommand (); + void executePreamble (); + void executePostamble (); void executePostPost (); + void goToPostamble (); + std::vector<uint32_t> collectBopOffsets (); bool evalXDVOpcode (int op, CommandHandler &handler) const; // The following template methods represent the single DVI commands. They diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp index 87a0070621d..b26ed711494 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp @@ -2,7 +2,7 @@ ** Bezier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp index 322dd4e72d3..18050ca8578 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp @@ -2,7 +2,7 @@ ** Bezier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp index 3b315b50a32..acf2c40a80f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp index 9334a5c5417..07c13437e57 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp index 64ebd6195e1..c59e4446086 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp @@ -2,7 +2,7 @@ ** Bitmap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp index 0d04aa2a694..f0bba3b41ea 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp @@ -2,7 +2,7 @@ ** Bitmap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp index 2dbcc2ebcda..78f3a19ee58 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp @@ -2,7 +2,7 @@ ** BoundingBox.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp index c52312a24a4..e3b59ebf5de 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp @@ -2,7 +2,7 @@ ** BoundingBox.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp index 1f6bb4475e7..ae245699c57 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp @@ -2,7 +2,7 @@ ** CLCommandLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp index 257ff4160f8..9f9814368bc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp @@ -2,7 +2,7 @@ ** CLCommandLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp index d9da7ae008f..594610b896f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp @@ -2,7 +2,7 @@ ** CLOption.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp index 747fb5ad50e..6c9b10ed10c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp @@ -2,7 +2,7 @@ ** CMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,6 +23,7 @@ #include "CMap.hpp" #include "CMapManager.hpp" #include "FileFinder.hpp" +#include "Unicode.hpp" using namespace std; @@ -38,6 +39,22 @@ const FontEncoding* CMap::findCompatibleBaseFontMap (const PhysicalFont *font, C ////////////////////////////////////////////////////////////////////// +void SegmentedCMap::addCIDRange (uint32_t first, uint32_t last, uint32_t cid) { + if (uint32_t cp = Unicode::fromSurrogate(first)) // is 'first' a surrogate? + first = cp; + if (uint32_t cp = Unicode::fromSurrogate(last)) // is 'last' a surrogate? + last = cp; + _cidranges.addRange(first, last, cid); +} + + +void SegmentedCMap::addBFRange (uint32_t first, uint32_t last, uint32_t chrcode) { + if (uint32_t cp = Unicode::fromSurrogate(chrcode)) // is 'chrcode' a surrogate? + chrcode = cp; + _bfranges.addRange(first, last, chrcode); +} + + /** Returns the RO (Registry-Ordering) string of the CMap. */ string SegmentedCMap::getROString() const { if (_registry.empty() || _ordering.empty()) @@ -46,6 +63,17 @@ string SegmentedCMap::getROString() const { } +bool SegmentedCMap::mapsToUnicode () const { + vector<string> encstrings = {"UTF8", "UTF16", "UCS2", "UCS4", "UCS32"}; + for (const string &encstr : encstrings) { + size_t pos = _filename.find(encstr); + if (pos != string::npos && (pos == 0 || _filename[pos-1] == '-')) + return true; + } + return false; +} + + /** Returns the CID for a given character code. */ uint32_t SegmentedCMap::cid (uint32_t c) const { if (_cidranges.valueExists(c)) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp index 63761ff2ff9..606a401ff72 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp @@ -2,7 +2,7 @@ ** CMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -74,6 +74,7 @@ struct UnicodeCMap : public CMap { uint32_t cid (uint32_t c) const override {return c;} uint32_t bfcode (uint32_t cid) const override {return cid;} std::string getROString () const override {return "";} + bool mapsToUnicode () const override {return true;} }; @@ -85,19 +86,21 @@ class SegmentedCMap : public CMap { const char* name () const override {return _filename.c_str();} uint32_t cid (uint32_t c) const override; uint32_t bfcode (uint32_t cid) const override; - void addCIDRange (uint32_t first, uint32_t last, uint32_t cid) {_cidranges.addRange(first, last, cid);} - void addBFRange (uint32_t first, uint32_t last, uint32_t chrcode) {_bfranges.addRange(first, last, chrcode);} + void addCIDRange (uint32_t first, uint32_t last, uint32_t cid); + void addBFRange (uint32_t first, uint32_t last, uint32_t chrcode); void write (std::ostream &os) const; bool vertical () const override {return _vertical;} bool mapsToCID () const override {return _mapsToCID;} size_t numCIDRanges () const {return _cidranges.numRanges();} size_t numBFRanges () const {return _bfranges.numRanges();} std::string getROString () const override; + bool mapsToUnicode () const override; private: std::string _filename; std::string _registry; std::string _ordering; + std::string _cmaptype; CMap *_basemap = nullptr; bool _vertical = false; bool _mapsToCID = true; // true: chrcode->CID, false: CID->charcode diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp index 52b323ebc62..dfc564f7f2b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp @@ -2,7 +2,7 @@ ** CMapManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp index aeb9156e847..eab32e76466 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp @@ -2,7 +2,7 @@ ** CMapManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp index 51ba52b95da..c56d3bd463a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp @@ -2,7 +2,7 @@ ** CMapReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -114,6 +114,8 @@ void CMapReader::op_def (InputReader&) { else throw CMapReaderException("invalid WMode (0 or 1 expected)"); } + else if (name == "CMapType") + _cmap->_cmaptype = val; else if (name == "Registry") _cmap->_registry = val; else if (name == "Ordering") diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp index 04ce5740c00..6e9a03ce980 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp @@ -2,7 +2,7 @@ ** CMapReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp index 0fdcf0f2fa3..00490efa045 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp @@ -2,7 +2,7 @@ ** Calculator.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -25,20 +25,19 @@ using namespace std; -// token types -const char END = 0; -const char NUMBER = 1; -const char NAME = 2; - - /** Evaluates a given arithmetic expression and returns its value. * The evaluator is implemented as a recursive descent parser. * @param[in] is reads expression from this stream * @return expression value */ -double Calculator::eval (istream &is) { +double Calculator::eval (istream &is) const { double ret = expr(is, false); - if (lookAhead(is) > 0) + try { + // check if expression has been fully evaluated (next token is of type bool) + mpark::get<bool>(lookAhead(is)); + } + catch (mpark::bad_variant_access &e) { throw CalculatorException("expression syntax error"); + } return ret; } @@ -46,7 +45,7 @@ double Calculator::eval (istream &is) { /** Evaluates a given arithmetic expression and returns its value. * @param[in] expr expression to evaluate * @return expression value */ -double Calculator::eval (const string &expr) { +double Calculator::eval (const string &expr) const { istringstream iss; iss.str(expr); return eval(iss); @@ -54,133 +53,150 @@ double Calculator::eval (const string &expr) { /** Evaluates the root rule of the expression grammar. */ -double Calculator::expr (istream &is, bool skip) { // expr: +double Calculator::expr (istream &is, bool skip) const { // expr: double left = term(is, skip); - for (;;) { - switch (lookAhead(is)) { - case '+': left += term(is, true); break; // term '+' term => $1 + $3 - case '-': left -= term(is, true); break; // term '-' term => $1 - $3 - default : return left; // term => $1 + bool ready=false; + while (!ready) { + Token token = lookAhead(is); + char *op = mpark::get_if<char>(&token); + if (!op) + ready = true; + else { + switch (*op) { + case '+': left += term(is, true); break; // term '+' term => $1 + $3 + case '-': left -= term(is, true); break; // term '-' term => $1 - $3 + default : ready = true; + } } } + return left; // term => $1 } -double Calculator::term (istream &is, bool skip) { // term: +double Calculator::term (istream &is, bool skip) const { // term: double left = prim(is, skip); - for (;;) - switch (lookAhead(is)) { - case '*': left *= prim(is, true); break; // prim '*' prim => $1 * $3 - case '(': left *= prim(is, false); break; // prim '*' prim => $1 * $3 - case '/': { // prim '/' prim => $1 / $3 - double denom = prim(is, true); - if (denom == 0) - throw CalculatorException("division by zero"); - left /= denom; - break; + bool ready=false; + while (!ready) { + Token token = lookAhead(is); + char *op = mpark::get_if<char>(&token); + if (!op) + ready = true; + else { + switch (*op) { + case '*': left *= prim(is, true); break; // prim '*' prim => $1 * $3 + case '(': left *= prim(is, false); break; // prim '(' prim => $1 * $3 + case '/': { // prim '/' prim => $1 / $3 + double denom = prim(is, true); + if (denom == 0) + throw CalculatorException("division by zero"); + left /= denom; + break; + } + case '%': { // prim '%' prim => $1 mod $3 + double denom = prim(is, true); + if (denom == 0) + throw CalculatorException("division by zero"); + left -= denom * floor(left / denom); + break; + } + default: + ready = true; } - case '%': { // prim '%' prim => $1 mod $3 - double denom = prim(is, true); - if (denom == 0) - throw CalculatorException("division by zero"); - left -= denom*floor(left/denom); - break; - } - default: // prim => $1 - return left; } + } + return left; } -double Calculator::prim (istream &is, bool skip) { // prim: +/** Evaluates a primary expression of the grammar which doesn't contain any binary operators. */ +double Calculator::prim (istream &is, bool skip) const { // prim: if (skip) lex(is); - switch (lookAhead(is)) { - case NUMBER: { // NUMBER => $1 - lex(is); - double ret = _numValue; - if (lookAhead(is) == NAME) { // NUMBER NAME => $1 * $2 - lex(is); - ret *= getVariable(_strValue); + Token token = lookAhead(is); + if (mpark::get_if<double>(&token)) { // NUMBER => $1 + double ret = mpark::get<double>(lex(is)); + token = lookAhead(is); + if (mpark::get_if<string>(&token)) // NUMBER STRING => $1 * $2 + ret *= getVariable(mpark::get<string>(lex(is))); + return ret; + } + if (mpark::get_if<string>(&token)) // STRING => getVariable($1) + return getVariable(mpark::get<string>(lex(is))); + if (char *op = mpark::get_if<char>(&token)) { + switch (*op) { + case '-': // '-' prim => -$2 + return -prim(is, true); + case '(': { // '(' expr ')' => $2 + double e = expr(is, true); + try { + if (mpark::get<char>(lookAhead(is)) != ')') + throw CalculatorException("')' expected"); + } + catch (mpark::bad_variant_access &e) { + throw CalculatorException("')' expected"); + } + is.get(); // skip processed char + return e; } - return ret; - } - case NAME: { // NAME => getVariable($1) - lex(is); - return getVariable(_strValue); - } - case '-': // '-' prim => -$2 - return -prim(is, true); - case '(': { // '(' expr ')' => $2 - double e = expr(is, true); - if (lookAhead(is) != ')') - throw CalculatorException("')' expected"); - lex(is); - return e; } - default: - throw CalculatorException("primary expression expected"); } + throw CalculatorException("primary expression expected"); +} + + +/** Returns the value of a previously defined variable. If there + * is no variable of the given name, a CalculatorException is thrown. + * @param[in] name name of variable + * @return assigned value */ +double Calculator::getVariable (const string &name) const { + auto it = _variables.find(name); + if (it == _variables.end()) + throw CalculatorException("undefined variable '" + name + "'"); + return it->second; } -/** Determines type of next token without swallowing it. That means - * the same token will be read again next time. */ -char Calculator::lookAhead (istream &is) { +/** Determines the type of the next token without swallowing it. That means + * the same token will be read again next time. The value of the returned token + * object is only set for character tokens and should be considered undefined + * for the other types. */ +Calculator::Token Calculator::lookAhead (istream &is) { is >> ws; int c = is.peek(); if (is.eof()) - return END; + return false; if (isdigit(c) || c == '.') - return NUMBER; + return double(0); if (isalpha(c)) - return NAME; + return string(); return char(c); } -/** Reads next token and returns its type. The token value is either assigned - * to the object members numValue or strValue depending on the type. The token - * type is represented by a unique integer. In contrast to method 'lookAhead' - * lex consumes the read token. +/** Reads and swallows the next token. The returned Token object is represented by + * a variant and thus contains both its type and value. * @param[in] is next token is read from this stream - * @return token type */ -char Calculator::lex (istream &is) { - int tokenType = lookAhead(is); - switch (tokenType) { - case NUMBER: { - string str; - while (isdigit(is.peek()) || is.peek() == '.') - str += char(is.get()); - try { - _numValue = stod(str); - } - catch (const exception&) { - throw CalculatorException("invalid number: "+str); - } - break; + * @return the read token */ +Calculator::Token Calculator::lex (istream &is) { + Token token = lookAhead(is); + if (mpark::get_if<char>(&token)) + is.get(); // token already contains the value from look ahead + else if (mpark::get_if<double>(&token)) { + string str; + while (isdigit(is.peek()) || is.peek() == '.') + str += char(is.get()); + try { + token.emplace<double>(stod(str)); } - case NAME: { - _strValue.clear(); - while (isalpha(is.peek())) - _strValue += char(is.get()); - break; + catch (const exception&) { + throw CalculatorException("invalid number: "+str); } - default: - tokenType = is.get(); } - return char(tokenType); -} - - -/** Returns the value of a previously defined variable. If there - * is no variable of the given name, a CalculatorException is thrown. - * @param[in] name name of variable - * @return assigned value */ -double Calculator::getVariable (const string &name) const { - auto it = _variables.find(name); - if (it == _variables.end()) - throw CalculatorException("undefined variable '" + name + "'"); - return it->second; + else if (mpark::get_if<string>(&token)) { + string name; + while (isalpha(is.peek())) + name += char(is.get()); + token.emplace<string>(name); + } + return token; } - diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp index 92ec4e40b1e..50f8fb959cc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp @@ -2,7 +2,7 @@ ** Calculator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -24,31 +24,31 @@ #include <istream> #include <map> #include <string> +#include <mpark/variant.hpp> #include "MessageException.hpp" - struct CalculatorException : public MessageException { explicit CalculatorException (const std::string &msg) : MessageException(msg) {} }; class Calculator { public: - double eval (std::istream &is); - double eval (const std::string &expr); + double eval (std::istream &is) const; + double eval (const std::string &expr) const; void setVariable (const std::string &name, double value) {_variables[name] = value;} double getVariable (const std::string &name) const; protected: - double expr (std::istream &is, bool skip); - double term (std::istream &is, bool skip); - double prim (std::istream &is, bool skip); - char lex (std::istream &is); - char lookAhead (std::istream &is); + double expr (std::istream &is, bool skip) const; + double term (std::istream &is, bool skip) const; + double prim (std::istream &is, bool skip) const; + + using Token = mpark::variant<bool, char, double, std::string>; + static Token lex (std::istream &is); + static Token lookAhead (std::istream &is); private: std::map<std::string,double> _variables; - double _numValue=0; - std::string _strValue; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp index 9c56afc73aa..0020b38d047 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp @@ -2,7 +2,7 @@ ** CharMapID.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp index ed044a9cf37..8b8890bc3ab 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp @@ -2,7 +2,7 @@ ** CharMapID.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp index 667a583100d..1e381f93111 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp @@ -2,7 +2,7 @@ ** Character.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp index bf9a05d7a30..60107be9de4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp @@ -2,7 +2,7 @@ ** Color.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp index 6f6f812207f..061e3e1236a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp @@ -2,7 +2,7 @@ ** Color.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp index 2cacf829922..fed3a985f47 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp index eeab300f470..0d90283503d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp index 7ea6ddd76e2..c4a215b301d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp @@ -2,7 +2,7 @@ // It is part of the dvisvgm package and published under the terms // of the GNU General Public License version 3, or (at your option) any later version. // See file COPYING for further details. -// Copyright (C) 2016-2020 Martin Gieseking <martin.gieseking@uos.de> +// Copyright (C) 2016-2021 Martin Gieseking <martin.gieseking@uos.de> #ifndef COMMANDLINE_HPP #define COMMANDLINE_HPP @@ -20,7 +20,7 @@ class CommandLine : public CL::CommandLine { CommandLine () : CL::CommandLine( "This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.", "[options] dvifile\n--eps [options] epsfile\n--pdf [options] pdffile", - "Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>" + "Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>" ) {} CommandLine (int argc, char **argv) : CommandLine() { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp index 9a974e89d99..064368c24a7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp @@ -2,7 +2,7 @@ ** DLLoader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp index 469fd1c4aa0..558c27d0c3f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp @@ -2,7 +2,7 @@ ** DLLoader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp index 31ea693477e..f51120ab772 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp @@ -2,7 +2,7 @@ ** DVIActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp index 417efe9304d..05d87b89086 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp @@ -2,7 +2,7 @@ ** DVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,8 +19,6 @@ *************************************************************************/ #include <algorithm> -#include <cstdarg> -#include <fstream> #include <sstream> #include "Color.hpp" #include "DVIActions.hpp" @@ -28,27 +26,20 @@ #include "Font.hpp" #include "FontManager.hpp" #include "HashFunction.hpp" +#include "JFM.hpp" +#include "utility.hpp" #include "VectorStream.hpp" using namespace std; DVIReader::DVIReader (istream &is) : BasicDVIReader(is) { - _inPage = false; - _dvi2bp = 0.0; - _inPostamble = false; - _currFontNum = 0; - _currPageNum = 0; - _mag = 1; executePreamble(); - collectBopOffsets(); - executePostamble(); -} - - -int DVIReader::executeCommand () { - int opcode = BasicDVIReader::executeCommand(); - return opcode; + _bopOffsets = collectBopOffsets(); + // read data from postamble but don't process font definitions + goToPostamble(); + executeCommand(); + executePostPost(); } @@ -79,75 +70,12 @@ bool DVIReader::executePage (unsigned n) { return false; seek(_bopOffsets[n-1]); // goto bop of n-th page - _inPostamble = false; // not in postamble _currPageNum = n; while (executeCommand() != OP_EOP); return true; } -void DVIReader::executePreamble () { - clearStream(); - if (isStreamValid()) { - seek(0); - if (readByte() == OP_PRE) { - cmdPre(0); - return; - } - } - throw DVIException("invalid DVI file"); -} - - -/** Moves stream pointer to begin of postamble */ -void DVIReader::goToPostamble () { - clearStream(); - if (!isStreamValid()) - throw DVIException("invalid DVI file"); - - seek(-1, ios::end); // stream pointer to last byte - int count=0; - while (peek() == DVI_FILL) { // skip fill bytes - seek(-1, ios::cur); - count++; - } - if (count < 4) // the standard requires at least 4 trailing fill bytes - throw DVIException("missing fill bytes at end of file"); - - seek(-4, ios::cur); // now at first byte of q (pointer to begin of postamble) - uint32_t q = readUnsigned(4); // pointer to begin of postamble - seek(q); // now at begin of postamble -} - - -/** Reads and executes the commands of the postamble. */ -void DVIReader::executePostamble () { - goToPostamble(); - while (executeCommand() != OP_POSTPOST); // executes all commands until post_post (= 249) is reached -} - - -/** Collects and records the file offsets of all bop commands. */ -void DVIReader::collectBopOffsets () { - goToPostamble(); - _bopOffsets.push_back(tell()); // also add offset of postamble - readByte(); // skip post command - uint32_t offset = readUnsigned(4); // offset of final bop - while (int32_t(offset) != -1) { // not yet on first bop? - _bopOffsets.push_back(offset); // record offset - seek(offset); // now on previous bop - if (readByte() != OP_BOP) - throw DVIException("bop offset at "+to_string(offset)+" doesn't point to bop command" ); - seek(40, ios::cur); // skip the 10 \count values => now on offset of previous bop - uint32_t prevOffset = readUnsigned(4); - if ((prevOffset >= offset && int32_t(prevOffset) != -1)) - throw DVIException("invalid bop offset at "+to_string(tell()-static_cast<streamoff>(4))); - offset = prevOffset; - } - reverse(_bopOffsets.begin(), _bopOffsets.end()); -} - - /** Computes a hash value for a given page. The hash algorithm is selected by * a HashFunction object which will also contain the resulting hash value if * this function returns true. @@ -213,7 +141,6 @@ void DVIReader::cmdPost (int) { // 1 dviunit * num/den == multiples of 0.0000001m // 1 dviunit * _dvi2bp: length of 1 dviunit in PS points * _mag/1000 _dvi2bp = numer/254000.0*72.0/denom*_mag/1000.0; - _inPostamble = true; dviPost(stackDepth, numPages, pageWidth*_dvi2bp, pageHeight*_dvi2bp, _mag, numer, denom, prevBopOffset); } @@ -221,7 +148,6 @@ void DVIReader::cmdPost (int) { /** Reads and executes DVI post_post command. * Format: post_post q[4] i[1] 223[>=4] */ void DVIReader::cmdPostPost (int) { - _inPostamble = false; uint32_t postOffset = readUnsigned(4); // pointer to begin of postamble uint8_t id = readUnsigned(1); setDVIVersion(DVIVersion(id)); // identification byte @@ -278,16 +204,22 @@ void DVIReader::cmdPop (int) { * @param[in] c character to typeset */ void DVIReader::putVFChar (Font *font, uint32_t c) { if (auto vf = dynamic_cast<VirtualFont*>(font)) { // is current font a virtual font? - if (const vector<uint8_t> *dvi = vf->getDVI(c)) { // try to get DVI snippet that represents character c - FontManager &fm = FontManager::instance(); - DVIState savedState = _dviState; // save current cursor position - _dviState.x = _dviState.y = _dviState.w = _dviState.z = 0; - int savedFontNum = _currFontNum; // save current font number - fm.enterVF(vf); // enter VF font number context - setFont(fm.vfFirstFontNum(vf), SetFontMode::VF_ENTER); - double savedScale = _dvi2bp; + FontManager &fm = FontManager::instance(); + const vector<uint8_t> *dvi = vf->getDVI(c); // try to get DVI snippet that represents character c + Font *firstFont = fm.vfFirstFont(vf); + if (!dvi && (!firstFont || !dynamic_cast<const JFM*>(firstFont->getMetrics()))) + return; + fm.enterVF(vf); // enter VF font number context + int savedFontNum = _currFontNum; // save current font number + setFont(fm.vfFirstFontNum(vf), SetFontMode::VF_ENTER); + if (!dvi) // no definition present for current (Japanese) char? + dviPutChar(c, firstFont); // fallback for JFM-based virtual fonts + else { // DVI units in virtual fonts are multiples of 1^(-20) times the scaled size of the VF + double savedScale = _dvi2bp; _dvi2bp = vf->scaledSize()/(1 << 20); + DVIState savedState = _dviState; // save current cursor position + _dviState.x = _dviState.y = _dviState.w = _dviState.z = 0; VectorInputStream<uint8_t> vis(*dvi); istream &is = replaceStream(vis); try { @@ -296,12 +228,12 @@ void DVIReader::putVFChar (Font *font, uint32_t c) { catch (const DVIException &e) { // Message::estream(true) << "invalid dvi in vf: " << e.getMessage() << endl; // @@ } - replaceStream(is); // restore previous input stream - _dvi2bp = savedScale; // restore previous scale factor - fm.leaveVF(); // restore previous font number context - setFont(savedFontNum, SetFontMode::VF_LEAVE); // restore previous font number + replaceStream(is); // restore previous input stream _dviState = savedState; // restore previous cursor position + _dvi2bp = savedScale; // restore previous scale factor } + fm.leaveVF(); // restore previous font number context + setFont(savedFontNum, SetFontMode::VF_LEAVE); // restore previous font number } } @@ -504,26 +436,64 @@ void DVIReader::cmdFontNum (int len) { } +/** Parses a sequence of font attributes given as key1=val1;key2=val2;...;keyn=valn */ +static map<string,string> parse_font_attribs (const string &str) { + map<string,string> attribs; + if (!str.empty()) { + for (const string &attr : util::split(str, ";")) { + vector<string> keyval = util::split(attr, "="); + if (keyval.size() == 2) + attribs[keyval[0]] = keyval[1]; + } + } + return attribs; +} + + /** Helper function to handle a font definition. * @param[in] fontnum local font number - * @param[in] name font name + * @param[in] name font name (or file path if enclosed in square brackets) * @param[in] cs checksum to be compared with TFM checksum - * @param[in] ds design size in PS point units - * @param[in] ss scaled size in PS point units */ -const Font* DVIReader::defineFont (uint32_t fontnum, const string &name, uint32_t cs, double ds, double ss) { + * @param[in] dsize design size of font in PS point units + * @param[in] ssize scaled size of font in PS point units */ +const Font* DVIReader::defineFont (uint32_t fontnum, const string &name, uint32_t cs, double dsize, double ssize) { FontManager &fm = FontManager::instance(); Font *font = fm.getFont(fontnum); - if (!font) { - int id = fm.registerFont(fontnum, name, cs, ds, ss); - font = fm.getFontById(id); - if (auto vf = dynamic_cast<VirtualFont*>(font)) { - // read vf file, register its font and character definitions - fm.enterVF(vf); - ifstream ifs(vf->path(), ios::binary); - VFReader vfReader(ifs); - vfReader.replaceActions(this); - vfReader.executeAll(); - fm.leaveVF(); + if (!font && !name.empty()) { // font not registered yet? + if (name[0] == '[') { // LuaTeX native font reference? + size_t last = name.rfind(']'); + if (last != string::npos) { + string path = name.substr(1, last-1); + FontStyle style; + int fontIndex=0; + if (name.size() > last && name[last+1] == ':') { // look for font attributes? + auto attribs = parse_font_attribs(name.substr(last+2)); + auto it = attribs.begin(); + if ((it = attribs.find("index")) != attribs.end()) + fontIndex = stoi(it->second); + if ((it = attribs.find("embolden")) != attribs.end()) + style.bold = stoi(it->second)/65536.0; + if ((it = attribs.find("extend")) != attribs.end()) + style.extend = stoi(it->second)/65536.0; + if ((it = attribs.find("slant")) != attribs.end()) + style.slant = stoi(it->second)/65536.0; + } + int id = fm.registerFont(fontnum, path, fontIndex, ssize, style, Color::BLACK); + font = fm.getFontById(id); + } + } + else { // TFM-based font specified by name + int id = fm.registerFont(fontnum, name, cs, dsize, ssize); + font = fm.getFontById(id); + if (auto vf = dynamic_cast<VirtualFont*>(font)) { + // read vf file, register its font and character definitions + fm.enterVF(vf); + ifstream ifs(vf->path(), ios::binary); + VFReader vfReader(ifs); + vfReader.replaceActions(this); + vfReader.executeAll(); + fm.leaveVF(); + } } } return font; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp index fc1424aca31..ff8390f5150 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp @@ -2,7 +2,7 @@ ** DVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -53,10 +53,7 @@ class DVIReader : public BasicDVIReader, public VFActions { explicit DVIReader (std::istream &is); bool executeDocument (); void executeAll (); - void executePreamble (); - void executePostamble (); bool executePage (unsigned n); - bool inPostamble () const {return _inPostamble;} double getXPos () const override {return _dviState.h;} double getYPos () const override {return _dviState.v;} int stackDepth () const override {return _stateStack.size();} @@ -65,16 +62,13 @@ class DVIReader : public BasicDVIReader, public VFActions { unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} protected: - int executeCommand () override; - void collectBopOffsets (); size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} bool computePageHash (size_t pageno, HashFunction &hashFunc); - void goToPostamble (); virtual void moveRight (double dx, MoveMode mode); virtual void moveDown (double dy, MoveMode mode); void putVFChar (Font *font, uint32_t c); double putGlyphArray (bool xonly, std::vector<double> &dx, std::vector<double> &dy, std::vector<uint16_t> &glyphs); - const Font* defineFont (uint32_t fontnum, const std::string &name, uint32_t cs, double ds, double ss); + const Font* defineFont (uint32_t fontnum, const std::string &name, uint32_t cs, double dsize, double ssize); void setFont (int num, SetFontMode mode); const DVIState& dviState() const {return _dviState;} double dvi2bp () const {return _dvi2bp;} @@ -160,13 +154,12 @@ class DVIReader : public BasicDVIReader, public VFActions { void cmdXTextAndGlyphs (int len) override; private: - bool _inPage; ///< true if stream pointer is between bop and eop - unsigned _currPageNum; ///< current page number (1 is first page) - int _currFontNum; ///< current font number - double _dvi2bp; ///< factor to convert dvi units to PS points - uint32_t _mag; ///< magnification factor * 1000 - bool _inPostamble; ///< true if stream pointer is inside the postamble - DVIState _dviState; ///< current state of the DVI registers + bool _inPage=false; ///< true if stream pointer is between bop and eop + unsigned _currPageNum=0; ///< current page number (1 is first page) + int _currFontNum=0; ///< current font number + double _dvi2bp=0.0; ///< factor to convert dvi units to PS points + uint32_t _mag=1; ///< magnification factor * 1000 + DVIState _dviState; ///< current state of the DVI registers std::stack<DVIState> _stateStack; std::vector<uint32_t> _bopOffsets; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp index 7280495e834..c2defd06fe9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -2,7 +2,7 @@ ** DVIToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -169,6 +169,7 @@ void DVIToSVG::convert (const string &rangestr, pair<int,int> *pageinfo) { prescan.executeAllPages(); actions->setDVIReader(*this); SpecialManager::instance().notifyPreprocessingFinished(); + executeFontDefs(); } unique_ptr<HashFunction> hashFunc; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp index 1bafa7cb3d8..45c957e0868 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp @@ -2,7 +2,7 @@ ** DVIToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp index 6239be3b01b..b44843c6bf3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -122,7 +122,7 @@ void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, co bbox.transform(getMatrix()); embed(bbox); #if 0 - XMLElement *rect = new XMLElement("rect"); + auto rect = util::make_unique<XMLElement>("rect"); rect->addAttribute("x", x-metrics.wl); rect->addAttribute("y", y-metrics.h); rect->addAttribute("width", metrics.wl+metrics.wr); @@ -130,26 +130,26 @@ void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, co rect->addAttribute("fill", "none"); rect->addAttribute("stroke", "red"); rect->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(rect); + _svg.appendToPage(std::move(rect)); if (metrics.d > 0) { - XMLElement *line = new XMLElement("line"); + auto line = util::make_unique<XMLElement>("line"); line->addAttribute("x1", x-metrics.wl); line->addAttribute("y1", y); line->addAttribute("x2", x+metrics.wr); line->addAttribute("y2", y); line->addAttribute("stroke", "blue"); line->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(line); + _svg.appendToPage(std::move(line)); } if (metrics.wl > 0) { - XMLElement *line = new XMLElement("line"); + auto line = util::make_unique<XMLElement>("line"); line->addAttribute("x1", x); line->addAttribute("y1", y-metrics.h); line->addAttribute("x2", x); line->addAttribute("y2", y+metrics.d); line->addAttribute("stroke", "blue"); line->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(line); + _svg.appendToPage(std::move(line)); } #endif } @@ -227,7 +227,12 @@ void DVIToSVGActions::beginPage (unsigned pageno, const vector<int32_t>&) { /** This method is called when an "end of page (eop)" command was found in the DVI file. */ void DVIToSVGActions::endPage (unsigned pageno) { - SpecialManager::instance().notifyEndPage(pageno, *this); + try { + SpecialManager::instance().notifyEndPage(pageno, *this); + } + catch (const SpecialException &e) { + Message::estream(true) << "error in special: " << e.what() << '\n'; + } Matrix matrix = _dvireader->getPageTransformation(); _svg.transformPage(matrix); if (_bgcolor != Color::TRANSPARENT) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp index 2ae3fb9a2e2..ed8a5f9c9b5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp index e7200a0dc36..224165e2556 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp @@ -2,7 +2,7 @@ ** Directory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp index d617b4fcbd0..14360a9f670 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp @@ -2,7 +2,7 @@ ** Directory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp index 1f331659f03..67463a4c597 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -209,7 +209,9 @@ static void evaluate_expressions (string &str, SpecialActions &actions) { else { try { double val = calc.eval(expr); - str.replace(left, right-left+2, XMLString(val)); + XMLString valstr(val); + str.replace(left, right-left+2, valstr); + right = left+valstr.length()-1; } catch (CalculatorException &e) { throw SpecialException(string(e.what())+" in '{?("+expr+")}'"); @@ -413,8 +415,8 @@ void DvisvgmSpecialHandler::dviPreprocessingFinished () { void DvisvgmSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) { - _defsParser.flush(actions); - _pageParser.flush(actions); + _defsParser.finish(actions); + _pageParser.finish(actions); actions.bbox().unlock(); for (auto &strvecpair : _macros) { StringVector &vec = strvecpair.second; @@ -437,8 +439,8 @@ vector<const char*> DvisvgmSpecialHandler::prefixes() const { /** Parses a fragment of XML code, creates corresponding XML nodes and adds them * to the SVG tree. The code may be split and processed by several calls of this * function. Incomplete chunks that can't be processed yet are stored and picked - * up again together with the next incoming XML fragment. If no further code should - * be appended, parameter 'finish' must be set. + * up again together with the next incoming XML fragment. If a call of this function + * is supposed to finish the parsing of an XML subtree, parameter 'finish' must be set. * @param[in] xml XML fragment to parse * @param[in] actions object providing the SVG tree functions * @param[in] finish if true, no more XML is expected and parsing is finished */ @@ -447,59 +449,65 @@ void DvisvgmSpecialHandler::XMLParser::parse (const string &xml, SpecialActions // incomplete tags are held back _xmlbuf += xml; size_t left=0, right; - while (left != string::npos) { - right = _xmlbuf.find('<', left); - if (left < right && left < _xmlbuf.length()) // plain text found? - (actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left))); - if (right != string::npos) { - left = right; - if (_xmlbuf.compare(left, 9, "<![CDATA[") == 0) { - right = _xmlbuf.find("]]>", left+9); - if (right == string::npos) { - if (finish) throw SpecialException("expected ']]>' at end of CDATA block"); - break; + try { + while (left != string::npos) { + right = _xmlbuf.find('<', left); + if (left < right && left < _xmlbuf.length()) // plain text found? + (actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left))); + if (right != string::npos) { + left = right; + if (_xmlbuf.compare(left, 9, "<![CDATA[") == 0) { + right = _xmlbuf.find("]]>", left+9); + if (right == string::npos) { + if (finish) throw SpecialException("expected ']]>' at end of CDATA block"); + break; + } + (actions.svgTree().*_append)(util::make_unique<XMLCData>(_xmlbuf.substr(left+9, right-left-9))); + right += 2; } - (actions.svgTree().*_append)(util::make_unique<XMLCData>(_xmlbuf.substr(left+9, right-left-9))); - right += 2; - } - else if (_xmlbuf.compare(left, 4, "<!--") == 0) { - right = _xmlbuf.find("-->", left+4); - if (right == string::npos) { - if (finish) throw SpecialException("expected '-->' at end of comment"); - break; + else if (_xmlbuf.compare(left, 4, "<!--") == 0) { + right = _xmlbuf.find("-->", left+4); + if (right == string::npos) { + if (finish) throw SpecialException("expected '-->' at end of comment"); + break; + } + (actions.svgTree().*_append)(util::make_unique<XMLComment>(_xmlbuf.substr(left+4, right-left-4))); + right += 2; } - (actions.svgTree().*_append)(util::make_unique<XMLComment>(_xmlbuf.substr(left+4, right-left-4))); - right += 2; - } - else if (_xmlbuf.compare(left, 2, "<?") == 0) { - right = _xmlbuf.find("?>", left+2); - if (right == string::npos) { - if (finish) throw SpecialException("expected '?>' at end of processing instruction"); - break; + else if (_xmlbuf.compare(left, 2, "<?") == 0) { + right = _xmlbuf.find("?>", left+2); + if (right == string::npos) { + if (finish) throw SpecialException("expected '?>' at end of processing instruction"); + break; + } + (actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left+2))); + right++; } - (actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left+2))); - right++; - } - else if (_xmlbuf.compare(left, 2, "</") == 0) { - right = _xmlbuf.find('>', left+2); - if (right == string::npos) { - if (finish) throw SpecialException("missing '>' at end of closing XML tag"); - break; + else if (_xmlbuf.compare(left, 2, "</") == 0) { + right = _xmlbuf.find('>', left+2); + if (right == string::npos) { + if (finish) throw SpecialException("missing '>' at end of closing XML tag"); + break; + } + closeElement(_xmlbuf.substr(left+2, right-left-2), actions); } - closeElement(_xmlbuf.substr(left+2, right-left-2), actions); - } - else { - right = _xmlbuf.find('>', left+1); - if (right == string::npos) { - if (finish) throw SpecialException("missing '>' or '/>' at end of opening XML tag"); - break; + else { + right = _xmlbuf.find('>', left+1); + if (right == string::npos) { + if (finish) throw SpecialException("missing '>' or '/>' at end of opening XML tag"); + break; + } + openElement(_xmlbuf.substr(left+1, right-left-1), actions); } - openElement(_xmlbuf.substr(left+1, right-left-1), actions); } + left = right; + if (right != string::npos) + left++; } - left = right; - if (right != string::npos) - left++; + } + catch (const SpecialException &e) { + _error = true; + throw; } if (left == string::npos) _xmlbuf.clear(); @@ -545,7 +553,7 @@ void DvisvgmSpecialHandler::XMLParser::closeElement (const string &tag, SpecialA if (_nameStack.empty()) throw SpecialException("spurious closing tag </" + name + ">"); if (_nameStack.back() != name) - throw SpecialException("expected </" + name + "> but found </" + _nameStack.back() + ">"); + throw SpecialException("expected </" + _nameStack.back() + "> but found </" + name + ">"); (actions.svgTree().*_popContext)(); _nameStack.pop_back(); } @@ -553,9 +561,10 @@ void DvisvgmSpecialHandler::XMLParser::closeElement (const string &tag, SpecialA /** Processes any remaining XML fragments, checks for missing closing tags, * and resets the parser state. */ -void DvisvgmSpecialHandler::XMLParser::flush (SpecialActions &actions) { +void DvisvgmSpecialHandler::XMLParser::finish (SpecialActions &actions) { if (!_xmlbuf.empty()) { - parse("", actions, true); + if (!_error) + parse("", actions, true); _xmlbuf.clear(); } string tags; @@ -563,8 +572,8 @@ void DvisvgmSpecialHandler::XMLParser::flush (SpecialActions &actions) { tags += "</"+_nameStack.back()+">, "; _nameStack.pop_back(); } - if (!tags.empty()) { + if (!tags.empty() && !_error) { tags.resize(tags.length()-2); - throw SpecialException("missing closing tags: "+tags); + throw SpecialException("missing closing tag(s): "+tags); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp index 0f73c73ecd1..f90c283429c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -53,7 +53,7 @@ class DvisvgmSpecialHandler : public SpecialHandler { : _append(append), _pushContext(push), _popContext(pop) {} void parse (const std::string &xml, SpecialActions &actions, bool finish=false); - void flush (SpecialActions &actions); + void finish (SpecialActions &actions); protected: void openElement (const std::string &tag, SpecialActions &actions); @@ -65,6 +65,7 @@ class DvisvgmSpecialHandler : public SpecialHandler { PopFunc _popContext; std::string _xmlbuf; NameStack _nameStack; ///< names of nested elements still missing a closing tag + bool _error=false; }; using StringVector = std::vector<std::string>; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp index 1a19c07cc76..2f61f9f07dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp @@ -2,7 +2,7 @@ ** EPSFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp index 7b02db95b19..384af7225ee 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp @@ -2,7 +2,7 @@ ** EPSFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp index 64f5ac604dd..75a574cf38b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp @@ -2,7 +2,7 @@ ** EPSToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp index a151c513070..bfb3dffd7ed 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp @@ -2,7 +2,7 @@ ** EllipticalArc.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp index 422a40b207e..78785c4ff12 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp @@ -2,7 +2,7 @@ ** EllipticalArc.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp index efbd7abef38..95dc58a4ec4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp index e20339e548a..fc9f14a4689 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp index ce0f18d81e5..d08791c03ea 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp @@ -2,7 +2,7 @@ ** EncFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp index 8f2b14c430f..0e5f90bcb34 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp @@ -2,7 +2,7 @@ ** EncFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp index a52ccd37d3f..3358d5c273c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp @@ -2,7 +2,7 @@ ** FileFinder.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp index 7218bf6c0b0..5774f8165ce 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp @@ -2,7 +2,7 @@ ** FileFinder.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp index 2150cf31f79..a8e6a258a1e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp @@ -2,7 +2,7 @@ ** FilePath.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp index e9d55562c5b..af81db66f45 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp @@ -2,7 +2,7 @@ ** FilePath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp index a1fafbdeceb..476c0c8e58e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp @@ -2,7 +2,7 @@ ** FileSystem.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -20,12 +20,14 @@ #include <config.h> #include <algorithm> +#include <chrono> #include <cstdlib> #include <cstring> #include <fstream> #include "FileSystem.hpp" #include "utility.hpp" #include "version.hpp" +#include "XXHashFunction.hpp" #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -51,7 +53,7 @@ using namespace std; string FileSystem::TMPDIR; -const char *FileSystem::TMPSUBDIR = nullptr; +FileSystem::TemporaryDirectory FileSystem::_tmpdir; /** Private wrapper function for mkdir: creates a single folder. @@ -79,13 +81,6 @@ static bool inline s_rmdir (const string &dirname) { } -FileSystem::~FileSystem () { - // remove the subdirectory from the system's temp folder (if empty) - if (TMPSUBDIR) - s_rmdir(tmpdir()); -} - - bool FileSystem::remove (const string &fname) { return unlink(fname.c_str()) == 0; } @@ -192,36 +187,29 @@ const char* FileSystem::userdir () { /** Returns the path of the temporary folder. */ string FileSystem::tmpdir () { - string ret; - if (!TMPDIR.empty()) - ret = TMPDIR; - else { + if (_tmpdir.path().empty()) { + string basedir; + if (!TMPDIR.empty()) + basedir = TMPDIR; + else { #ifdef _WIN32 - char buf[MAX_PATH]; - if (GetTempPath(MAX_PATH, buf)) - ret = ensureForwardSlashes(buf); - else - ret = "."; + char buf[MAX_PATH]; + if (GetTempPath(MAX_PATH, buf)) + basedir = ensureForwardSlashes(buf); + else + basedir = "."; #else - if (const char *path = getenv("TMPDIR")) - ret = path; - else - ret = "/tmp"; + if (const char *path = getenv("TMPDIR")) + basedir = path; + else + basedir = "/tmp"; #endif - if (ret.back() == '/') - ret.pop_back(); - static bool initialized=false; - if (!initialized && ret != ".") { - TMPSUBDIR = PROGRAM_NAME; - s_mkdir(ret + "/" + TMPSUBDIR); - initialized = true; + if (basedir.back() == '/') + basedir.pop_back(); } - if (TMPSUBDIR) - ret += string("/") + TMPSUBDIR; + _tmpdir = TemporaryDirectory(basedir, PROGRAM_NAME); } - if (!ret.empty() && ret.back() != '/') - ret += '/'; - return ret; + return _tmpdir.path(); } @@ -368,3 +356,33 @@ int FileSystem::collect (const std::string &dirname, vector<string> &entries) { #endif return entries.size(); } + + +/** Creates a temporary directory in a given folder. + * @param[in] folder folder path in which the directory is to be created + * @param[in] prefix initial string of the directory name */ +FileSystem::TemporaryDirectory::TemporaryDirectory (const std::string &folder, string prefix) { + using namespace std::chrono; + auto now = system_clock::now().time_since_epoch(); + auto now_ms = duration_cast<milliseconds>(now).count(); + auto hash = XXH64HashFunction(to_string(now_ms)).digestValue(); + if (!prefix.empty() && prefix.back() != '-') + prefix += "-"; + for (int i=0; i < 10 && _path.empty(); i++) { + hash++; + stringstream oss; + oss << folder << '/' << prefix << hex << hash; + if (exists(oss.str())) + continue; + if (s_mkdir(oss.str())) + _path = oss.str() + "/"; + else + break; + } +} + + +FileSystem::TemporaryDirectory::~TemporaryDirectory () { + if (!_path.empty()) + s_rmdir(_path); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp index f82ff1e8709..ad0e70f9737 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp @@ -2,7 +2,7 @@ ** FileSystem.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -25,8 +25,23 @@ #include <vector> class FileSystem { + class TemporaryDirectory { + friend class FileSystem; + public: + TemporaryDirectory (const std::string &folder, std::string prefix); + TemporaryDirectory (TemporaryDirectory &&tmpdir) =default; + ~TemporaryDirectory (); + TemporaryDirectory& operator = (TemporaryDirectory &&tmpdir) =default; + const std::string& path () const {return _path;} + + protected: + TemporaryDirectory () =default; + + private: + std::string _path; + }; + public: - ~FileSystem (); static bool remove (const std::string &fname); static bool rename (const std::string &oldname, const std::string &newname); static bool copy (const std::string &src, const std::string &dest, bool remove_src=false); @@ -48,8 +63,9 @@ class FileSystem { protected: FileSystem () =default; - bool system_tmpdir_available (); - static const char* TMPSUBDIR; ///< subdirectory of the system's temporary folder + + private: + static TemporaryDirectory _tmpdir; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp index 3414e1ead4b..b6166b15dca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp @@ -2,7 +2,7 @@ ** FixWord.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp index e40ad8a3929..ff93c81cd0b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp @@ -2,7 +2,7 @@ ** Font.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -495,7 +495,7 @@ const FontEncoding* PhysicalFontImpl::encoding () const { bool PhysicalFontImpl::findAndAssignBaseFontMap () { const FontEncoding *enc = encoding(); - if (enc && enc->mapsToCharIndex()) { + if (enc && !enc->mapsToUnicode() && enc->mapsToCharIndex()) { // try to find a base font map that maps from character indexes to a suitable // target encoding supported by the font file if (const FontEncoding *bfmap = enc->findCompatibleBaseFontMap(this, _charmapID)) @@ -607,8 +607,13 @@ PhysicalFont::Type NativeFont::type () const { double NativeFont::charWidth (int c) const { FontEngine::instance().setFont(*this); int upem = FontEngine::instance().getUnitsPerEM(); - double w = upem ? (scaledSize()*FontEngine::instance().getAdvance(c)/upem*_style.extend) : 0; - w += abs(_style.slant*charHeight(c)); + return upem ? (scaledSize()*FontEngine::instance().getAdvance(c)/upem*_style.extend) : 0; +} + + +double NativeFont::italicCorr(int c) const { + double w = abs(_style.slant*charHeight(c)); // slant := tan(phi) = dx/height + w *= _style.extend; return w; } @@ -631,7 +636,7 @@ bool NativeFontImpl::findAndAssignBaseFontMap () { FontEngine &fe = FontEngine::instance(); fe.setFont(*this); fe.setUnicodeCharMap(); - fe.buildCharMap(_toUnicodeMap); + fe.buildGidToCharCodeMap(_toUnicodeMap); if (!_toUnicodeMap.addMissingMappings(fe.getNumGlyphs())) Message::wstream(true) << "incomplete Unicode mapping for native font " << name() << " (" << filename() << ")\n"; return true; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp index 59556e7a813..0c341b8e69d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp @@ -2,7 +2,7 @@ ** Font.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -266,7 +266,7 @@ class NativeFont : public PhysicalFont { double charWidth (int c) const override; double charDepth (int c) const override; double charHeight (int c) const override; - double italicCorr (int c) const override {return 0;} + double italicCorr (int c) const override; const FontMetrics* getMetrics () const override {return nullptr;} const FontStyle* style () const override {return &_style;} Color color () const override {return _color;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp index e024558913f..09a88a2d2a8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp @@ -2,7 +2,7 @@ ** FontCache.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -160,7 +160,7 @@ bool FontCache::write (const string &fontname, ostream &os) const { XXH32HashFunction hashfunc; sw.writeUnsigned(FORMAT_VERSION, 1, hashfunc); - sw.writeBytes(hashfunc.digestValue()); // space for checksum + sw.writeBytes(hashfunc.digestBytes()); // space for checksum sw.writeString(fontname, hashfunc, true); sw.writeUnsigned(_glyphs.size(), 4, hashfunc); WriteActions actions(sw, hashfunc); @@ -171,7 +171,7 @@ bool FontCache::write (const string &fontname, ostream &os) const { glyph.iterate(actions, false); } os.seekp(1); - auto digest = hashfunc.digestValue(); + auto digest = hashfunc.digestBytes(); sw.writeBytes(digest); // insert checksum os.seekp(0, ios::end); return true; @@ -215,7 +215,7 @@ bool FontCache::read (const string &fontname, istream &is) { auto hashcmp = sr.readBytes(hashfunc.digestSize()); hashfunc.update(is); - if (hashfunc.digestValue() != hashcmp) + if (hashfunc.digestBytes() != hashcmp) return false; is.clear(); @@ -309,7 +309,7 @@ bool FontCache::fontinfo (std::istream &is, FontInfo &info) { info.checksum = sr.readBytes(hashfunc.digestSize()); hashfunc.update(is); - if (hashfunc.digestValue() != info.checksum) + if (hashfunc.digestBytes() != info.checksum) return false; is.clear(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp index 8a6025a3d2c..e7bbf36126f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp @@ -2,7 +2,7 @@ ** FontCache.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp index 8f2673f1231..afc221063e5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp @@ -2,7 +2,7 @@ ** FontEncoding.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -72,6 +72,15 @@ bool FontEncodingPair::mapsToCharIndex () const { } +bool FontEncodingPair::mapsToUnicode () const { + if (_enc2) + return _enc2->mapsToUnicode(); + if (_enc1) + return _enc1->mapsToUnicode(); + return false; +} + + const FontEncoding* FontEncodingPair::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { if (_enc2) return _enc2->findCompatibleBaseFontMap(font, charmapID); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp index 1c4a979aa9a..141f4486fe5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp @@ -2,7 +2,7 @@ ** FontEncoding.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -32,6 +32,7 @@ struct FontEncoding { virtual ~FontEncoding () =default; virtual Character decode (uint32_t c) const =0; virtual bool mapsToCharIndex () const =0; + virtual bool mapsToUnicode () const {return false;} virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const {return nullptr;} static FontEncoding* encoding (const std::string &encname); }; @@ -49,6 +50,7 @@ class FontEncodingPair : public FontEncoding { FontEncodingPair (const FontEncoding *enc1, const FontEncoding *enc2) : _enc1(enc1), _enc2(enc2) {} Character decode (uint32_t c) const override; bool mapsToCharIndex () const override; + bool mapsToUnicode () const override; const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const override; const FontEncoding* enc1 () const {return _enc1;} const FontEncoding* enc2 () const {return _enc2;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp index bee1ca886d8..56ae0a9f78c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp @@ -2,7 +2,7 @@ ** FontEngine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -131,37 +131,38 @@ bool FontEngine::setCharMap (const CharMapID &charMapID) { } -/** Returns a character map that maps from character indexes to character codes +/** Returns a character map that maps from glyph indexes to character codes * of the current encoding. * @param[out] charmap the resulting charmap */ -void FontEngine::buildCharMap (RangeMap &charmap) { +void FontEngine::buildGidToCharCodeMap (RangeMap &charmap) { charmap.clear(); - FT_UInt glyph_index; - uint32_t charcode = FT_Get_First_Char(_currentFace, &glyph_index); - while (glyph_index) { - charmap.addRange(glyph_index, glyph_index, charcode); - charcode = FT_Get_Next_Char(_currentFace, charcode, &glyph_index); + FT_UInt gid; // index of current glyph + uint32_t charcode = FT_Get_First_Char(_currentFace, &gid); + while (gid) { + if (!charmap.valueAt(gid)) + charmap.addRange(gid, gid, charcode); + charcode = FT_Get_Next_Char(_currentFace, charcode, &gid); } } -/** Creates a charmap that maps from the custom character encoding to unicode. +/** Creates a charmap that maps from the custom character encoding to Unicode. * @return pointer to charmap if it could be created, 0 otherwise */ unique_ptr<const RangeMap> FontEngine::createCustomToUnicodeMap () { FT_CharMap ftcharmap = _currentFace->charmap; if (FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) != 0) return nullptr; - RangeMap index_to_source_chrcode; - buildCharMap(index_to_source_chrcode); + RangeMap gidToCharCodeMap; + buildGidToCharCodeMap(gidToCharCodeMap); if (FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) != 0) return nullptr; auto charmap = util::make_unique<RangeMap>(); - FT_UInt glyph_index; - uint32_t unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); - while (glyph_index) { - uint32_t custom_charcode = index_to_source_chrcode.valueAt(glyph_index); - charmap->addRange(custom_charcode, custom_charcode, unicode_point); - unicode_point = FT_Get_Next_Char(_currentFace, unicode_point, &glyph_index); + FT_UInt gid; // index of current glyph + uint32_t ucCharcode = FT_Get_First_Char(_currentFace, &gid); // Unicode code point + while (gid) { + uint32_t customCharcode = gidToCharCodeMap.valueAt(gid); + charmap->addRange(customCharcode, customCharcode, ucCharcode); + ucCharcode = FT_Get_Next_Char(_currentFace, ucCharcode, &gid); } FT_Set_Charmap(_currentFace, ftcharmap); return std::move(charmap); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp index 5796c2b1b3e..45d9c6d3b63 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp @@ -2,7 +2,7 @@ ** FontEngine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -64,7 +64,7 @@ class FontEngine { std::string getGlyphName (const Character &c) const; int getCharByGlyphName (const char *name) const; bool setCharMap (const CharMapID &charMapID); - void buildCharMap (RangeMap &charmap); + void buildGidToCharCodeMap (RangeMap &charmap); std::unique_ptr<const RangeMap> createCustomToUnicodeMap (); protected: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp index 58d2dfc2616..33135135c1b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp @@ -2,7 +2,7 @@ ** FontManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -101,8 +101,14 @@ int FontManager::fontnum (int id) const { int FontManager::vfFirstFontNum (const VirtualFont *vf) const { + auto it = _vfFirstFontNumMap.find(vf); + return (it == _vfFirstFontNumMap.end()) ? -1 : (int) it->second; +} + + +Font* FontManager::vfFirstFont (const VirtualFont *vf) const { auto it = _vfFirstFontMap.find(vf); - return (it == _vfFirstFontMap.end()) ? -1 : (int) it->second; + return (it == _vfFirstFontMap.end()) ? nullptr : it->second; } @@ -221,8 +227,10 @@ int FontManager::registerFont (uint32_t fontnum, const string &name, uint32_t ch else { // register font referenced in vf file const VirtualFont *vf = _vfStack.top(); _vfnum2id[vf][fontnum] = newid; - if (_vfFirstFontMap.find(vf) == _vfFirstFontMap.end()) // first fontdef of VF? - _vfFirstFontMap[vf] = fontnum; + if (_vfFirstFontNumMap.find(vf) == _vfFirstFontNumMap.end()) { // first fontdef of VF? + _vfFirstFontNumMap.emplace(vf, fontnum); + _vfFirstFontMap.emplace(vf, _fonts.back().get()); + } } return newid; } @@ -255,8 +263,6 @@ int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex, if (id >= 0) return id; - if (!filename.empty() && filename[0] == '[' && filename[filename.size()-1] == ']') - filename = filename.substr(1, filename.size()-2); string fontname = NativeFont::uniqueName(filename, style); const char *path = filename.c_str(); unique_ptr<Font> newfont; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp index 2fe88bee38a..413b649169f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp @@ -2,7 +2,7 @@ ** FontManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -41,12 +41,12 @@ class VirtualFont; * we need a single list with unique IDs of all physical fonts. Characters of * virtual fonts are completely replaced by their DVI description so they don't * appear anywhere in the output. */ -class FontManager -{ - using Num2IdMap = std::unordered_map<uint32_t,int>; - using Name2IdMap = std::unordered_map<std::string,int>; - using VfNum2IdMap = std::unordered_map<const VirtualFont*,Num2IdMap>; - using VfFirstFontMap = std::unordered_map<const VirtualFont*,uint32_t>; +class FontManager { + using Num2IdMap = std::unordered_map<uint32_t, int>; + using Name2IdMap = std::unordered_map<std::string, int>; + using VfNum2IdMap = std::unordered_map<const VirtualFont*, Num2IdMap>; + using VfFirstFontNumMap = std::unordered_map<const VirtualFont*, uint32_t>; + using VfFirstFontMap = std::unordered_map<const VirtualFont*, Font*>; using VfStack = std::stack<VirtualFont*>; public: @@ -63,6 +63,7 @@ class FontManager int fontID (const std::string &name) const; int fontnum (int id) const; int vfFirstFontNum (const VirtualFont *vf) const; + Font* vfFirstFont (const VirtualFont *vf) const; void enterVF (VirtualFont *vf); void leaveVF (); void assignVFChar (int c, std::vector<uint8_t> &&dvi); @@ -77,7 +78,8 @@ class FontManager Name2IdMap _name2id; ///< fontname -> fontID VfNum2IdMap _vfnum2id; VfStack _vfStack; ///< stack of currently processed virtual fonts - VfFirstFontMap _vfFirstFontMap; ///< VF -> local font number of first font defined in VF + VfFirstFontNumMap _vfFirstFontNumMap; ///< VF -> local font number of first font defined in VF + VfFirstFontMap _vfFirstFontMap; ///< VF -> first font defined }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp index 727fdd83ba8..a16d38aa2f0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp @@ -2,7 +2,7 @@ ** FontMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -162,7 +162,7 @@ bool FontMap::append (const MapLine &mapline) { if (!mapline.fontfname().empty() || !mapline.encname().empty()) { vector<Subfont*> subfonts; if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); + subfonts = mapline.sfd()->subfonts(); else subfonts.push_back(nullptr); for (Subfont *subfont : subfonts) { @@ -191,7 +191,7 @@ bool FontMap::replace (const MapLine &mapline) { vector<Subfont*> subfonts; if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); + subfonts = mapline.sfd()->subfonts(); else subfonts.push_back(nullptr); for (Subfont *subfont : subfonts) { @@ -215,7 +215,7 @@ bool FontMap::remove (const MapLine &mapline) { if (!mapline.texname().empty()) { vector<Subfont*> subfonts; if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); + subfonts = mapline.sfd()->subfonts(); else subfonts.push_back(nullptr); for (const Subfont *subfont : subfonts) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp index f4824aa7f16..8ed65199220 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp @@ -2,7 +2,7 @@ ** FontMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp index 7d858fea90e..b2cba248181 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp @@ -2,7 +2,7 @@ ** FontMetrics.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp index 66637e30444..53cafbb827d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp @@ -2,7 +2,7 @@ ** FontMetrics.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp index 79a03dac367..094ba2da1f8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp @@ -2,7 +2,7 @@ ** FontStyle.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp index 4dd4c5c0d8c..ad1a6dd77c0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp @@ -2,7 +2,7 @@ ** FontWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp index e6cad37e885..1fa5dab4db6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp @@ -2,7 +2,7 @@ ** FontWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp index db77ae1dc80..fc900dc6a92 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp index d0d45ffd615..2f3ed818143 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp index 4712de41d3b..3fdba80d9c2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp @@ -2,7 +2,7 @@ ** GFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp index e829bf8ffa8..401f89babbb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp @@ -2,7 +2,7 @@ ** GFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp index 4a3fa5e7761..408fb49d0bb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp @@ -2,7 +2,7 @@ ** GFTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp index e72848896df..f52ffd6cc82 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp @@ -2,7 +2,7 @@ ** GFTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp index 1ff82314ecf..bef8a68b92a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp @@ -2,7 +2,7 @@ ** Ghostscript.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -239,10 +239,18 @@ int Ghostscript::revision () { string Ghostscript::revisionstr () { string revstr; if (int rev = revision()) { - revstr = to_string(rev/100) + "."; - if (rev % 100 < 10) - revstr += "0"; - revstr += to_string(rev%100); + if (rev < 1000) { // until GS 9.52 + revstr = to_string(rev/100) + "."; + if (rev % 100 < 10) + revstr += "0"; + revstr += to_string(rev%100); + } + else { // as of GS 9.52.1, see ghostpdl/base/gsmisc.c + int major = rev / 1000; + int minor = (rev - major*1000)/10; + int patch = rev % 10; + revstr = to_string(major) + "." + to_string(minor) + "." + to_string(patch); + } } return revstr; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp index 8c9a429798d..883b42d1762 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp @@ -2,7 +2,7 @@ ** Ghostscript.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp index dfa8cb366ac..37de9bd58cb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp @@ -2,7 +2,7 @@ ** Glyph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp index f291d05ccce..32f4f08955d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp @@ -2,7 +2,7 @@ ** GlyphTracerMessages.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp index 565251c0d06..27d45472524 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp @@ -2,7 +2,7 @@ ** GraphicsPath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -732,7 +732,7 @@ class GraphicsPath { private: std::deque<CommandVariant> _commands; ///< sequence of path commands - WindingRule _windingRule; + WindingRule _windingRule = WindingRule::NON_ZERO; Point _startPoint; ///< start point of final sub-path Point _finalPoint; ///< final point reached by last command in path }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp index 7f99dacaf0f..bada148b6c7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp @@ -2,7 +2,7 @@ ** HashFunction.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -96,7 +96,7 @@ void HashFunction::update (istream &is) { string HashFunction::digestString () const { ostringstream oss; oss << hex << setfill('0'); - for (int byte : digestValue()) + for (int byte : digestBytes()) oss << setw(2) << byte; return oss.str(); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp index b13ee39a50c..5efbdf84684 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp @@ -2,7 +2,7 @@ ** HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -35,7 +35,7 @@ class HashFunction { virtual void update (const char *data, size_t length) =0; virtual void update (const std::string &data) =0; virtual void update (const std::vector<uint8_t> &data) =0; - virtual std::vector<uint8_t> digestValue () const =0; + virtual std::vector<uint8_t> digestBytes () const =0; void update (std::istream &is); std::string digestString () const; static std::vector<std::string> supportedAlgorithms (); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp index 01051f9d649..dca8111405d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp index e09a6d7b51b..2122ed749d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp index ef636c5aac0..09b48156307 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp @@ -2,7 +2,7 @@ ** HyperlinkManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp index ca8d4fd0efa..4859e0784e7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp @@ -2,7 +2,7 @@ ** HyperlinkManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp index dfb7943a06f..6c52a0b8268 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp @@ -2,7 +2,7 @@ ** ImageToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp index 92a860949c1..d3da961c0eb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp @@ -2,7 +2,7 @@ ** ImageToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp index b6e85f27e19..6ee562da7d0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp @@ -2,7 +2,7 @@ ** InputBuffer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp index 1474ce0a528..cc3c593e8f1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp @@ -2,7 +2,7 @@ ** InputBuffer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp index 074c1848227..6b5a7b70f09 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp @@ -2,7 +2,7 @@ ** InputReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp index 9825156c090..d9b697963bf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp @@ -2,7 +2,7 @@ ** InputReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp index 7c749fd34e3..d0dd13c9b96 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -2,7 +2,7 @@ ** JFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp index 8d4a1daf213..9080212b798 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp @@ -2,7 +2,7 @@ ** JFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp index d20af5056c5..d4992c77efe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp @@ -2,7 +2,7 @@ ** Length.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp index 1b0d35d35f3..f03711ecd28 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp @@ -2,7 +2,7 @@ ** Length.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp index f0eda874f23..e34db106022 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp @@ -2,7 +2,7 @@ ** MD5HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -42,7 +42,7 @@ class MD5HashFunction : public HashFunction { void update (const std::string &data) override {update(data.data(), data.length());} void update (const std::vector<uint8_t> &data) override {update(reinterpret_cast<const char*>(data.data()), data.size());} - std::vector<uint8_t> digestValue () const override { + std::vector<uint8_t> digestBytes () const override { std::vector<uint8_t> hash(16); MD5_CTX savedContext = _context; MD5_Final(hash.data(), &_context); // also erases the context structure diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am index 84ed9930757..c7e7d3e65dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -1,5 +1,5 @@ ## This file is part of dvisvgm -## Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> +## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ## ## Process this file with automake. diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp index cd3d8ae7ea6..5b43cd448a1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp @@ -2,7 +2,7 @@ ** MapLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp index 9a6fa17648a..2d756653536 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp @@ -2,7 +2,7 @@ ** MapLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp index d0dcb2124d2..f1f2b47721f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -2,7 +2,7 @@ ** Matrix.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp index 154ac8a37b3..76c6e075148 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp @@ -2,7 +2,7 @@ ** Matrix.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp index caf8051f884..ca465adcc5b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp @@ -2,7 +2,7 @@ ** Message.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp index fd6f0486224..afb93d94326 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp @@ -2,7 +2,7 @@ ** Message.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp index 325e83e403f..1cfcb49e7dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp @@ -2,7 +2,7 @@ ** MessageException.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp index 11667fb5e7a..7788bef3d9c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp @@ -2,7 +2,7 @@ ** MetafontWrapper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp index 582a146aeed..4ec5afd304c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp @@ -2,7 +2,7 @@ ** MetafontWrapper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp index 9cd02edf41f..1bbd40cae61 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp @@ -2,7 +2,7 @@ ** MiKTeXCom.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp index 3da270cea15..b05b26a1322 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp @@ -2,7 +2,7 @@ ** MiKTeXCom.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp index f5b3d7244ee..77af3d9d0c7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp index 9af3d47df5f..b4af33ab6c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp index 1669f7ddce2..5102b715b07 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp @@ -2,7 +2,7 @@ ** NumericRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp index e511d4dc394..aaf50886ec1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp @@ -2,7 +2,7 @@ ** PDFParser.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp index b261ee9cf7d..a342e740cdb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp @@ -2,7 +2,7 @@ ** PDFParser.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp index a6c71f964b4..91792689a20 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp @@ -2,7 +2,7 @@ ** PDFToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp index 87aff89a7c9..59a4565d1de 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp @@ -2,7 +2,7 @@ ** PSFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp index 038e1326f20..b82cec9b962 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp @@ -2,7 +2,7 @@ ** PSInterpreter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -256,49 +256,50 @@ void PSInterpreter::callActions (InputReader &in) { void (PSActions::*handler)(vector<double> &p); // operation handler }; static const unordered_map<string, Operator> operators { - {"applyscalevals", { 3, &PSActions::applyscalevals}}, - {"clip", { 0, &PSActions::clip}}, - {"clippath", { 0, &PSActions::clippath}}, - {"closepath", { 0, &PSActions::closepath}}, - {"curveto", { 6, &PSActions::curveto}}, - {"eoclip", { 0, &PSActions::eoclip}}, - {"eofill", { 0, &PSActions::eofill}}, - {"fill", { 0, &PSActions::fill}}, - {"grestore", { 0, &PSActions::grestore}}, - {"grestoreall", { 0, &PSActions::grestoreall}}, - {"gsave", { 0, &PSActions::gsave}}, - {"image", { 3, &PSActions::image}}, - {"initclip", { 0, &PSActions::initclip}}, - {"lineto", { 2, &PSActions::lineto}}, - {"makepattern", {-1, &PSActions::makepattern}}, - {"moveto", { 2, &PSActions::moveto}}, - {"newpath", { 1, &PSActions::newpath}}, - {"querypos", { 2, &PSActions::querypos}}, - {"raw", {-1, nullptr}}, - {"restore", { 1, &PSActions::restore}}, - {"rotate", { 1, &PSActions::rotate}}, - {"save", { 1, &PSActions::save}}, - {"scale", { 2, &PSActions::scale}}, - {"setblendmode", { 1, &PSActions::setblendmode}}, - {"setcolorspace", { 1, &PSActions::setcolorspace}}, - {"setcmykcolor", { 4, &PSActions::setcmykcolor}}, - {"setdash", {-1, &PSActions::setdash}}, - {"setgray", { 1, &PSActions::setgray}}, - {"sethsbcolor", { 3, &PSActions::sethsbcolor}}, - {"setlinecap", { 1, &PSActions::setlinecap}}, - {"setlinejoin", { 1, &PSActions::setlinejoin}}, - {"setlinewidth", { 1, &PSActions::setlinewidth}}, - {"setmatrix", { 6, &PSActions::setmatrix}}, - {"setmiterlimit", { 1, &PSActions::setmiterlimit}}, - {"setnulldevice", { 1, &PSActions::setnulldevice}}, - {"setopacityalpha",{ 1, &PSActions::setopacityalpha}}, - {"setshapealpha", { 1, &PSActions::setshapealpha}}, - {"setpagedevice", { 0, &PSActions::setpagedevice}}, - {"setpattern", {-1, &PSActions::setpattern}}, - {"setrgbcolor", { 3, &PSActions::setrgbcolor}}, - {"shfill", {-1, &PSActions::shfill}}, - {"stroke", { 0, &PSActions::stroke}}, - {"translate", { 2, &PSActions::translate}}, + {"applyscalevals", { 3, &PSActions::applyscalevals}}, + {"clip", { 0, &PSActions::clip}}, + {"clippath", { 0, &PSActions::clippath}}, + {"closepath", { 0, &PSActions::closepath}}, + {"curveto", { 6, &PSActions::curveto}}, + {"eoclip", { 0, &PSActions::eoclip}}, + {"eofill", { 0, &PSActions::eofill}}, + {"fill", { 0, &PSActions::fill}}, + {"grestore", { 0, &PSActions::grestore}}, + {"grestoreall", { 0, &PSActions::grestoreall}}, + {"gsave", { 0, &PSActions::gsave}}, + {"image", { 3, &PSActions::image}}, + {"initclip", { 0, &PSActions::initclip}}, + {"lineto", { 2, &PSActions::lineto}}, + {"makepattern", {-1, &PSActions::makepattern}}, + {"moveto", { 2, &PSActions::moveto}}, + {"newpath", { 1, &PSActions::newpath}}, + {"querypos", { 2, &PSActions::querypos}}, + {"raw", {-1, nullptr}}, + {"restore", { 1, &PSActions::restore}}, + {"rotate", { 1, &PSActions::rotate}}, + {"save", { 1, &PSActions::save}}, + {"scale", { 2, &PSActions::scale}}, + {"setblendmode", { 1, &PSActions::setblendmode}}, + {"setcolorspace", { 1, &PSActions::setcolorspace}}, + {"setcmykcolor", { 4, &PSActions::setcmykcolor}}, + {"setdash", {-1, &PSActions::setdash}}, + {"setfillconstantalpha", { 1, &PSActions::setfillconstantalpha}}, + {"setgray", { 1, &PSActions::setgray}}, + {"sethsbcolor", { 3, &PSActions::sethsbcolor}}, + {"setisshapealpha", { 1, &PSActions::setisshapealpha}}, + {"setlinecap", { 1, &PSActions::setlinecap}}, + {"setlinejoin", { 1, &PSActions::setlinejoin}}, + {"setlinewidth", { 1, &PSActions::setlinewidth}}, + {"setmatrix", { 6, &PSActions::setmatrix}}, + {"setmiterlimit", { 1, &PSActions::setmiterlimit}}, + {"setnulldevice", { 1, &PSActions::setnulldevice}}, + {"setpagedevice", { 0, &PSActions::setpagedevice}}, + {"setpattern", {-1, &PSActions::setpattern}}, + {"setrgbcolor", { 3, &PSActions::setrgbcolor}}, + {"setstrokeconstantalpha", { 1, &PSActions::setstrokeconstantalpha}}, + {"shfill", {-1, &PSActions::shfill}}, + {"stroke", { 0, &PSActions::stroke}}, + {"translate", { 2, &PSActions::translate}}, }; if (_actions) { in.skipSpace(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp index 138242abb77..71454f696e1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp @@ -2,7 +2,7 @@ ** PSInterpreter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -66,19 +66,20 @@ struct PSActions { virtual void setcolorspace (std::vector<double> &p) =0; virtual void setcmykcolor (std::vector<double> &cmyk) =0; virtual void setdash (std::vector<double> &p) =0; + virtual void setfillconstantalpha (std::vector<double> &p) =0; virtual void setgray (std::vector<double> &p) =0; virtual void sethsbcolor (std::vector<double> &hsb) =0; + virtual void setisshapealpha (std::vector<double> &p) =0; virtual void setlinecap (std::vector<double> &p) =0; virtual void setlinejoin (std::vector<double> &p) =0; virtual void setlinewidth (std::vector<double> &p) =0; virtual void setmatrix (std::vector<double> &p) =0; virtual void setmiterlimit (std::vector<double> &p) =0; virtual void setnulldevice (std::vector<double> &p) =0; - virtual void setopacityalpha (std::vector<double> &p) =0; - virtual void setshapealpha (std::vector<double> &p) =0; virtual void setpagedevice (std::vector<double> &p) =0; virtual void setpattern (std::vector<double> &p) =0; virtual void setrgbcolor (std::vector<double> &rgb) =0; + virtual void setstrokeconstantalpha (std::vector<double> &p) =0; virtual void shfill (std::vector<double> &p) =0; virtual void stroke (std::vector<double> &p) =0; virtual void translate (std::vector<double> &p) =0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp index 4659dc7a849..135965299e6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp @@ -2,7 +2,7 @@ ** PSPattern.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp index 2c53dd2b3e2..62794317c21 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp @@ -2,7 +2,7 @@ ** PSPattern.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp index 20e8b53643d..312b3eb6def 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp index acadf9f39e8..62860b6932e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp index 2623d2ef468..46f27078214 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp @@ -2,7 +2,7 @@ ** PageRanges.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp index 555338449a2..f03dfc51622 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp @@ -2,7 +2,7 @@ ** PageRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp index ac8e1c52753..8b5c29445ba 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp @@ -2,7 +2,7 @@ ** PageSize.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp index 43c555b9dd5..4eb4e5e201f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp @@ -2,7 +2,7 @@ ** PageSize.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp index 63806c5b6af..466e6fd8f29 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp @@ -2,7 +2,7 @@ ** Pair.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp index c2ab96a8a88..864ccbaa123 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp index ed836f37d72..02599d8c32d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp index 4aa4373f463..a36dc5d3dfc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp @@ -2,7 +2,7 @@ ** PathClipper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -310,22 +310,37 @@ inline PolyFillType polyFillType (CurvedPath::WindingRule wr) { } -/** Computes the intersection of to curved paths. +/** Combines two curved paths by applying a boolean operation on them. + * @param[in] op operation to perform * @param[in] p1 first curved path * @param[in] p2 second curved path - * @param[out] result intersection of p1 and p2 */ -void PathClipper::intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result) { - if (p1.size() < 2 || p2.size() < 2) - return; - Clipper clipper; - Polygons polygons; - flatten(p1, polygons); - clipper.AddPaths(polygons, ptSubject, true); - polygons.clear(); - flatten(p2, polygons); - clipper.AddPaths(polygons, ptClip, true); - clipper.ZFillFunction(callback); - Polygons flattenedPath; - clipper.Execute(ctIntersection, flattenedPath, polyFillType(p1.windingRule()), polyFillType(p2.windingRule())); - reconstruct(flattenedPath, result); + * @return intersection of p1 and p2 */ +CurvedPath PathClipper::combine (ClipType op, const CurvedPath &p1, const CurvedPath &p2) { + CurvedPath result; + if (p1.size() > 1 && p2.size() > 1) { + Clipper clipper; + Polygons polygons; + flatten(p1, polygons); + clipper.AddPaths(polygons, ptSubject, true); + polygons.clear(); + flatten(p2, polygons); + clipper.AddPaths(polygons, ptClip, true); + clipper.ZFillFunction(callback); + Polygons flattenedPath; + clipper.Execute(op, flattenedPath, polyFillType(p1.windingRule()), polyFillType(p2.windingRule())); + reconstruct(flattenedPath, result); + } + return result; +} + + +/** Returns the intersection of two curved paths. */ +CurvedPath PathClipper::intersect (const CurvedPath &p1, const CurvedPath &p2) { + return combine(ctIntersection, p1, p2); +} + + +/** Returns the union of two curved paths. */ +CurvedPath PathClipper::unite (const CurvedPath &p1, const CurvedPath &p2) { + return combine(ctUnion, p1, p2); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp index e3e6bd1681d..8ab9b48c4f0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp @@ -2,7 +2,7 @@ ** PathClipper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -36,9 +36,11 @@ class PathClipper { using CurvedPath = GraphicsPath<double>; public: - void intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result); + CurvedPath intersect (const CurvedPath &p1, const CurvedPath &p2); + CurvedPath unite (const CurvedPath &p1, const CurvedPath &p2); protected: + CurvedPath combine (ClipperLib::ClipType op, const CurvedPath &p1, const CurvedPath &p2); void flatten (const CurvedPath &gp, ClipperLib::Paths &polygons); void reconstruct (const ClipperLib::Path &polygon, CurvedPath &path); void reconstruct (const ClipperLib::Paths &polygons, CurvedPath &path); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp index 3466e44f8ec..6368d979756 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -48,7 +48,9 @@ void PdfSpecialHandler::preprocess (const string&, istream &is, SpecialActions & {"bannot", &PdfSpecialHandler::preprocessBeginAnn}, {"beginann", &PdfSpecialHandler::preprocessBeginAnn}, {"dest", &PdfSpecialHandler::preprocessDest}, - {"pagesize", &PdfSpecialHandler::preprocessPagesize} + {"pagesize", &PdfSpecialHandler::preprocessPagesize}, + {"mapfile", &PdfSpecialHandler::preprocessMapfile}, + {"mapline", &PdfSpecialHandler::preprocessMapline} }; auto it = commands.find(cmdstr); if (it != commands.end()) @@ -71,8 +73,6 @@ bool PdfSpecialHandler::process (const string&, istream &is, SpecialActions &act {"eannot", &PdfSpecialHandler::processEndAnn}, {"endann", &PdfSpecialHandler::processEndAnn}, {"dest", &PdfSpecialHandler::processDest}, - {"mapfile", &PdfSpecialHandler::processMapfile}, - {"mapline", &PdfSpecialHandler::processMapline} }; auto it = commands.find(cmdstr); if (it != commands.end()) @@ -116,7 +116,7 @@ void PdfSpecialHandler::preprocessPagesize (StreamInputReader &ir, SpecialAction } -void PdfSpecialHandler::processMapfile (StreamInputReader &ir, SpecialActions&) { +void PdfSpecialHandler::preprocessMapfile (StreamInputReader &ir, SpecialActions&) { char modechar = prepare_mode(ir); string fname = ir.getString(); if (!FontMap::instance().read(fname, modechar)) @@ -124,7 +124,7 @@ void PdfSpecialHandler::processMapfile (StreamInputReader &ir, SpecialActions&) } -void PdfSpecialHandler::processMapline (StreamInputReader &ir, SpecialActions&) { +void PdfSpecialHandler::preprocessMapline (StreamInputReader &ir, SpecialActions&) { char modechar = prepare_mode(ir); try { MapLine mapline(ir.getStream()); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp index 67512dd403d..e7a18bacce2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -38,11 +38,11 @@ class PdfSpecialHandler : public SpecialHandler { void preprocessBeginAnn (StreamInputReader &ir, SpecialActions &actions); void preprocessDest (StreamInputReader &ir, SpecialActions &actions); void preprocessPagesize (StreamInputReader &ir, SpecialActions &actions); + void preprocessMapfile (StreamInputReader &ir, SpecialActions &actions); + void preprocessMapline (StreamInputReader &ir, SpecialActions &actions); void processBeginAnn (StreamInputReader &ir, SpecialActions &actions); void processEndAnn (StreamInputReader &ir, SpecialActions &actions); void processDest (StreamInputReader &ir, SpecialActions &actions); - void processMapfile (StreamInputReader &ir, SpecialActions &actions); - void processMapline (StreamInputReader &ir, SpecialActions &actions); void dviMovedTo (double x, double y, SpecialActions &actions) override; void dviEndPage (unsigned pageno, SpecialActions &actions) override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp index 8e255ef088f..ef862f02cc3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp index 900fd1fc015..a0e5a5fc644 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp index 2e15153b9ec..2010b05db93 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp @@ -2,7 +2,7 @@ ** Process.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp index 53311921c90..3e9417d7bb6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp @@ -2,7 +2,7 @@ ** Process.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index 2301eeb571f..fbb43f38fbe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -81,8 +81,9 @@ void PsSpecialHandler::initgraphics () { _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; _xmlnode = _savenode = nullptr; - _opacityalpha = _shapealpha = 1; // fully opaque - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent + _blendmode = 0; // "normal" mode (no blending) _sx = _sy = _cos = 1.0; _pattern = nullptr; _patternEnabled = false; @@ -555,8 +556,9 @@ void PsSpecialHandler::setpagedevice (std::vector<double> &p) { _linewidth = 1; _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; - _opacityalpha = _shapealpha = 1; // fully opaque - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent + _blendmode = 0; // "normal" mode (no blending) _sx = _sy = _cos = 1.0; _pattern = nullptr; _currentcolor = Color::BLACK; @@ -671,8 +673,8 @@ void PsSpecialHandler::stroke (vector<double> &p) { path->addAttribute("stroke-linecap", _linecap == 1 ? "round" : "square"); if (_linejoin > 0) // default value is "miter", no need to set it explicitly path->addAttribute("stroke-linejoin", _linecap == 1 ? "round" : "bevel"); - if (_opacityalpha < 1 || _shapealpha < 1) - path->addAttribute("stroke-opacity", _opacityalpha*_shapealpha); + if (_strokealpha[0] < 1 || _strokealpha[1] < 1) + path->addAttribute("stroke-opacity", _strokealpha[0] * _strokealpha[1]); if (_blendmode > 0 && _blendmode < 16) path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); if (!_dashpattern.empty()) { @@ -735,8 +737,8 @@ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) { } if (evenodd) // SVG default fill rule is "nonzero" algorithm path->addAttribute("fill-rule", "evenodd"); - if (_opacityalpha < 1 || _shapealpha < 1) - path->addAttribute("fill-opacity", _opacityalpha*_shapealpha); + if (_fillalpha[0] < 1 || _fillalpha[1] < 1) + path->addAttribute("fill-opacity", _fillalpha[0] * _fillalpha[1]); if (_blendmode > 0 && _blendmode < 16) path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); if (_xmlnode) @@ -941,7 +943,7 @@ void PsSpecialHandler::clip (Path path, bool evenodd) { if (!_actions->getMatrix().isIdentity()) path.transform(_actions->getMatrix()); if (_clipStack.prependedPath()) - path.prepend(*_clipStack.prependedPath()); + path = PathClipper().unite(*_clipStack.prependedPath(), path); int oldID = _clipStack.topID(); @@ -954,9 +956,7 @@ void PsSpecialHandler::clip (Path path, bool evenodd) { else { // compute the intersection of the current clipping path with the current graphics path const Path *oldPath = _clipStack.path(); - Path intersectedPath(windingRule); - PathClipper clipper; - clipper.intersect(*oldPath, path, intersectedPath); + Path intersectedPath = PathClipper().intersect(*oldPath, path); pathReplaced = _clipStack.replace(intersectedPath); intersectedPath.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp index 9dcbc2d4ce2..efdd5dd238f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -142,19 +142,20 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void setcolorspace (std::vector<double> &p) override {_patternEnabled = bool(p[0]);} void setcmykcolor (std::vector<double> &cmyk) override; void setdash (std::vector<double> &p) override; + void setfillconstantalpha (std::vector<double> &p) override {_fillalpha[_isshapealpha ? 1 : 0] = p[0];} void setgray (std::vector<double> &p) override; void sethsbcolor (std::vector<double> &hsb) override; + void setisshapealpha (std::vector<double> &p) override {_isshapealpha = bool(p[0]);} void setlinecap (std::vector<double> &p) override {_linecap = uint8_t(p[0]);} void setlinejoin (std::vector<double> &p) override {_linejoin = uint8_t(p[0]);} void setlinewidth (std::vector<double> &p) override {_linewidth = scale(p[0] ? p[0] : 0.5);} void setmatrix (std::vector<double> &p) override; void setmiterlimit (std::vector<double> &p) override {_miterlimit = p[0];} void setnulldevice (std::vector<double> &p) override; - void setopacityalpha (std::vector<double> &p) override {_opacityalpha = p[0];} - void setshapealpha (std::vector<double> &p) override {_shapealpha = p[0];} void setpagedevice (std::vector<double> &p) override; void setpattern (std::vector<double> &p) override; void setrgbcolor (std::vector<double> &rgb) override; + void setstrokeconstantalpha (std::vector<double> &p) override {_strokealpha[_isshapealpha ? 1 : 0] = p[0];} void shfill (std::vector<double> &p) override; void stroke (std::vector<double> &p) override; void translate (std::vector<double> &p) override; @@ -163,29 +164,30 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { private: PSInterpreter _psi; SpecialActions *_actions=nullptr; - PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package - PsSection _psSection=PS_NONE; ///< current section processed (nothing yet, headers, or body specials) - XMLElement *_xmlnode=nullptr; ///< if != 0, created SVG elements are appended to this node - XMLElement *_savenode=nullptr; ///< pointer to temporaryly store _xmlnode - std::string _headerCode; ///< collected literal PS header code + PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package + PsSection _psSection=PS_NONE; ///< current section processed (nothing yet, headers, or body specials) + XMLElement *_xmlnode=nullptr; ///< if != 0, created SVG elements are appended to this node + XMLElement *_savenode=nullptr; ///< pointer to temporaryly store _xmlnode + std::string _headerCode; ///< collected literal PS header code Path _path; - DPair _currentpoint; ///< current PS position in bp units - Color _currentcolor; ///< current stroke/fill color - double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" - double _cos; ///< cosine of angle between (1,0) and transform(1,0) - double _linewidth; ///< current line width in bp units - double _miterlimit; ///< current miter limit in bp units - double _opacityalpha; ///< opacity level (0=fully transparent, ..., 1=opaque) - double _shapealpha; ///< shape opacity level (0=fully transparent, ..., 1=opaque) - int _blendmode; ///< blend mode used when overlaying colored areas - uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) - uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) - double _dashoffset; ///< current dash offset + DPair _currentpoint; ///< current PS position in bp units + Color _currentcolor; ///< current stroke/fill color + double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" + double _cos; ///< cosine of angle between (1,0) and transform(1,0) + double _linewidth; ///< current line width in bp units + double _miterlimit; ///< current miter limit in bp units + bool _isshapealpha; ///< if true, opacity operators act on index 1 (shape component), otherwise on index 0 (constant component) + std::array<double,2> _fillalpha; ///< constant and shape opacity used for fill operations (0=fully transparent, ..., 1=opaque) + std::array<double,2> _strokealpha; ///< constant and shape opacity used for stroke operations (0=fully transparent, ..., 1=opaque) + int _blendmode; ///< blend mode used when overlaying colored areas + uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) + uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) + double _dashoffset; ///< current dash offset std::vector<double> _dashpattern; ClippingStack _clipStack; std::map<int, std::unique_ptr<PSPattern>> _patterns; - PSTilingPattern *_pattern; ///< current pattern - bool _patternEnabled; ///< true if active color space is a pattern + PSTilingPattern *_pattern; ///< current pattern + bool _patternEnabled; ///< true if active color space is a pattern }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp index 86190cacf91..3d208c8a8f9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp @@ -2,7 +2,7 @@ ** RangeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp index 3e3bff9d4bf..3f5cb7a6e5f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp @@ -2,7 +2,7 @@ ** RangeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp index f8d75a28d35..4ba6c88a7d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp index f75df472156..241b28b7ef8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp index 397943ace09..0a4666f5ae7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp index f37b9977c24..a43257bc158 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp index 7a766bae495..02f83e8c999 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp index c404cbcd5ab..a70bf293465 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp index 6b89348dc1a..772dee12954 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp index b847965a1a4..0357387d6c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp index 18702be7765..59a26764a7b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp @@ -2,7 +2,7 @@ ** SVGOutput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp index f29a0326743..96acf807e3e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp @@ -2,7 +2,7 @@ ** SVGOutput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp index 89d1c548b03..d61e298a017 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp index 67fcabd44c8..57f05a4b07d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp index e35a14d9b39..372dd28bf22 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp @@ -2,7 +2,7 @@ ** SVGTree.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp index a441a314a5a..84c9e111580 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp @@ -2,7 +2,7 @@ ** SVGTree.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp index 847dc3aa0c7..a734c4c48b3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp @@ -2,7 +2,7 @@ ** ShadingPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp index 573188b77b7..2a8103d0443 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp @@ -2,7 +2,7 @@ ** ShadingPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp index 14badba0859..129b010d729 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp @@ -2,7 +2,7 @@ ** SignalHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp index 647a3650fc7..ef6a0a4e556 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp @@ -2,7 +2,7 @@ ** SignalHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp index 5cd2e22749c..55196c76ce8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp @@ -2,7 +2,7 @@ ** SourceInput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp index 63f4af9b7ab..7d7a08c88fc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp @@ -2,7 +2,7 @@ ** SourceInput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp index f8eba3fd12e..12e9c90ec12 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp @@ -2,7 +2,7 @@ ** SpecialActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp index 6c676a6ba08..382f0e53d12 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp @@ -2,7 +2,7 @@ ** SpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp index f3b2f3aa50c..68e1c68b515 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp @@ -2,7 +2,7 @@ ** SpecialManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp index 4c4ccae2811..76cdb3e2e66 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp @@ -2,7 +2,7 @@ ** SpecialManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp index 200b6592d95..8924d885b52 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp @@ -2,7 +2,7 @@ ** StreamReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp index 653b451b698..08a4fd36361 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp @@ -2,7 +2,7 @@ ** StreamReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp index c0885c31b1c..21eefd1b9e1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp @@ -2,7 +2,7 @@ ** StreamWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp index 16a54b10501..5128bbf7365 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp @@ -2,7 +2,7 @@ ** StreamWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp index eb7f244cdb6..44f3bcaeb24 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp @@ -2,7 +2,7 @@ ** Subfont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -97,10 +97,11 @@ Subfont* SubfontDefinition::subfont (const string &id) const { /** Returns all subfonts defined in this SFD. */ -int SubfontDefinition::subfonts (vector<Subfont*> &sfs) const { +vector<Subfont*> SubfontDefinition::subfonts () const { + vector<Subfont*> subfonts; for (const auto &strsfpair : _subfonts) - sfs.push_back(strsfpair.second.get()); - return int(sfs.size()); + subfonts.push_back(strsfpair.second.get()); + return subfonts; } ////////////////////////////////////////////////////////////////////// diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp index 5125194e9d0..961720a99cb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp @@ -2,7 +2,7 @@ ** Subfont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -43,7 +43,7 @@ class SubfontDefinition { const std::string& name() const {return _sfname;} std::string filename() const {return _sfname+".sfd";} Subfont* subfont (const std::string &id) const; - int subfonts (std::vector<Subfont*> &sfs) const; + std::vector<Subfont*> subfonts () const; const char* path () const; protected: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp index ed14df68211..4f8b0a139cb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp @@ -2,7 +2,7 @@ ** System.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp index 72a0cb3da82..fb698d303bd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp @@ -2,7 +2,7 @@ ** System.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp index ea6f2ecbe4e..011e659dc93 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp @@ -2,7 +2,7 @@ ** TFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp index 261a5ce736a..0bb881df8f2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp @@ -2,7 +2,7 @@ ** TFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp index ad1b03f21a0..6e8fbefd48d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp @@ -2,7 +2,7 @@ ** TTFAutohint.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp index d23ceb2be0d..3d774984c70 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp @@ -2,7 +2,7 @@ ** TTFAutohint.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp index dcd31e275db..8c5d7448966 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp @@ -2,7 +2,7 @@ ** TensorProductPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp index e53604cf529..654271b90df 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp @@ -2,7 +2,7 @@ ** TensorProductPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp index 3b2ff2b8713..274426443a1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp @@ -2,7 +2,7 @@ ** Terminal.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp index fd7a920c16a..f84d47b707a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp @@ -2,7 +2,7 @@ ** Terminal.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp index 6ab99a248eb..0a0b069e965 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp index 74d6dcb648b..806233e12f8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 47d3e469889..54034126db0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp index f6ec271994c..8a9b458056f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp index fadeb725ff0..76f58618396 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -2,7 +2,7 @@ ** TriangularPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp index 797068bacd1..8d4453e5dbe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp @@ -2,7 +2,7 @@ ** TriangularPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp index 2921af59ea2..945c20bd403 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp @@ -2,7 +2,7 @@ ** TrueTypeFont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp index 0ae155c52c2..a287f305faa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp @@ -2,7 +2,7 @@ ** TrueTypeFont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp index 950209bda01..5b7fb3d2388 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp @@ -2,7 +2,7 @@ ** Unicode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -113,6 +113,41 @@ string Unicode::utf8 (int32_t cp) { return utf8; } + +/** Converts a surrogate pair to its code point. + * @param[in] high high-surrogate value (upper 16 bits) + * @param[in] low low-surrogate value (lower 16 bits) + * @return corresponding code point or 0 if the surrogate is invalid */ +uint32_t Unicode::fromSurrogate (uint32_t high, uint32_t low) { + if (high < 0xD800 || high > 0xDBff || low < 0xDC00 || low > 0xDFFF) + return 0; + // http://www.unicode.org/versions/Unicode3.0.0/ch03.pdf, p. 45 + return (high-0xD800)*0x400 + low-0xDC00 + 0x10000; +} + + +/** Converts a surrogate value to its code point. + * @param[in] surrogate combined high and low surrogate value + * @return corresponding code point or 0 if the surrogate is invalid */ +uint32_t Unicode::fromSurrogate (uint32_t surrogate) { + return fromSurrogate(surrogate >> 16, surrogate & 0xFFFF); +} + + +/** Converts a code point of the surrogate range (0x10000--0x10FFFF) + * to its surrogate value. + * @param[in] cp code point to convert + * @return 32-bit surrogate (combined high and low values) */ +uint32_t Unicode::toSurrogate (uint32_t cp) { + if (cp < 0x10000 || cp > 0x10FFFF) + return 0; + // http://www.unicode.org/versions/Unicode3.0.0/ch03.pdf, p. 45 + uint32_t high = (cp-0x10000)/0x400 + 0xD800; + uint32_t low = (cp-0x10000)%0x400 + 0xDC00; + return (high << 16) | low; +} + + #include "AGLTable.hpp" /** Tries to extract the codepoint from AGL character names like "uni1234" or "u1234". diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp index bc9db7e731d..1547e3f7d40 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp @@ -2,7 +2,7 @@ ** Unicode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -23,11 +23,13 @@ #include <string> -struct Unicode -{ +struct Unicode { static bool isValidCodepoint (uint32_t code); static uint32_t charToCodepoint (uint32_t c); static std::string utf8 (int32_t c); + static uint32_t fromSurrogate (uint32_t high, uint32_t low); + static uint32_t fromSurrogate (uint32_t cp); + static uint32_t toSurrogate (uint32_t cp); static int32_t aglNameToCodepoint (const std::string &name); }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp index 2d4a2a2c5f5..6939d8e710e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp @@ -2,7 +2,7 @@ ** VFActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp index eb1193ddaac..6533333b5ea 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp @@ -2,7 +2,7 @@ ** VFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp index bbf4986d7f7..dabad674608 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp @@ -2,7 +2,7 @@ ** VFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp index 0fb53d78e47..9663490a196 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp @@ -2,7 +2,7 @@ ** VectorIterator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp index 0372d368d0e..22709803ca5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp @@ -2,7 +2,7 @@ ** VectorStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp index ffe23b1f806..992b01f3cf0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp @@ -2,7 +2,7 @@ ** XMLDocument.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp index 2eaaee4a281..c6b56452264 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp @@ -2,7 +2,7 @@ ** XMLDocument.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp index db07d95dd2d..b71ac7e8074 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp @@ -2,7 +2,7 @@ ** XMLNode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -259,7 +259,7 @@ XMLElement* XMLElement::wrap (XMLNode *first, XMLNode *last, const string &name) XMLNode *child = first; while (child && child != last) { XMLNode *next = child->next(); - wrapper->insertLast(remove(child)); + wrapper->insertLast(detach(child)); child = next; } XMLElement *ret = wrapper.get(); @@ -277,44 +277,41 @@ XMLElement* XMLElement::wrap (XMLNode *first, XMLNode *last, const string &name) * Example: unwrap a child element b of a: * <a>text1<b><c/>text2<d/></b></a> => <a>text1<c/>text2<d/></a> * @param[in] child child element to unwrap - * @return raw pointer to the first node C1 of the unwrapped sequence */ -XMLNode* XMLElement::unwrap (XMLElement *child) { - if (!child || !child->parent()) + * @return raw pointer to the first node C1 of the unwrapped sequence or nullptr if element was empty */ +XMLNode* XMLElement::unwrap (XMLElement *element) { + if (!element || !element->parent()) return nullptr; - XMLElement *parent = child->parent()->toElement(); - auto removedChild = remove(child); - if (child->empty()) - return child->next(); - XMLNode *firstGrandchild = child->firstChild(); - XMLNode *prev = child->prev(); - unique_ptr<XMLNode> grandchild = std::move(child->_firstChild); - while (grandchild) { - prev = parent->insertAfter(std::move(grandchild), prev); - grandchild = std::move(prev->_next); - } - return firstGrandchild; -} - - -/** Removes a child node from the element. - * @param[in] child pointer to child to remove - * @return pointer to removed child or nullptr if given child doesn't belong to this element */ -unique_ptr<XMLNode> XMLElement::remove (XMLNode *child) { - unique_ptr<XMLNode> node; - if (child && child->parent()) { - XMLElement *parent = child->parent()->toElement(); - if (child == parent->_lastChild) - parent->_lastChild = child->prev(); - if (child != parent->firstChild()) - node = child->prev()->removeNext(); + XMLElement *parent = element->parent()->toElement(); + XMLNode *prev = element->prev(); + auto detachedElement = util::static_unique_ptr_cast<XMLElement>(detach(element)); + if (detachedElement->empty()) + return nullptr; + XMLNode *firstChild = detachedElement->firstChild(); + while (auto child = detach(detachedElement->firstChild())) + prev = parent->insertAfter(std::move(child), prev); + return firstChild; +} + + +/** Isolates a node and its descendants from a subtree. + * @param[in] node raw pointer to node to be detached + * @return unique pointer to the detached node. */ +unique_ptr<XMLNode> XMLElement::detach (XMLNode *node) { + unique_ptr<XMLNode> uniqueNode; + if (node && node->parent()) { + XMLElement *parent = node->parent()->toElement(); + if (node == parent->_lastChild) + parent->_lastChild = node->prev(); + if (node != parent->firstChild()) + uniqueNode = node->prev()->removeNext(); else { - node = std::move(parent->_firstChild); - if ((parent->_firstChild = std::move(node->_next))) + uniqueNode = std::move(parent->_firstChild); + if ((parent->_firstChild = std::move(uniqueNode->_next))) parent->_firstChild->prev(nullptr); } - child->parent(nullptr); + node->parent(nullptr); } - return node; + return uniqueNode; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp index 534ae87bd72..ba9f68ad549 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp @@ -2,7 +2,7 @@ ** XMLNode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -157,7 +157,7 @@ class XMLElement : public XMLNode { const XMLElement* toElement () const override {return this;} const Attribute* getAttribute (const std::string &name) const; - static std::unique_ptr<XMLNode> remove (XMLNode *child); + static std::unique_ptr<XMLNode> detach (XMLNode *node); static XMLElement* wrap (XMLNode *first, XMLNode *last, const std::string &name); static XMLNode* unwrap (XMLElement *child); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp index 31de6a7b338..72026bdd767 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp @@ -2,7 +2,7 @@ ** XMLString.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp index 52c227ae8a4..36ef2bee55c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp @@ -2,7 +2,7 @@ ** XMLString.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp index e44083f1821..4478a2204cf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp @@ -2,7 +2,7 @@ ** XXHashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -36,6 +36,7 @@ struct XXHInterface { template<> struct XXHInterface<4> { using State = XXH32_state_t; + using Digest = XXH32_hash_t; static constexpr auto createState = &XXH32_createState; static constexpr auto freeState = &XXH32_freeState; static constexpr auto reset = &XXH32_reset; @@ -46,6 +47,7 @@ struct XXHInterface<4> { template<> struct XXHInterface<8> { using State = XXH64_state_t; + using Digest = XXH64_hash_t; static constexpr auto createState = &XXH64_createState; static constexpr auto freeState = &XXH64_freeState; static constexpr auto reset = &XXH64_reset; @@ -57,6 +59,7 @@ struct XXHInterface<8> { template<> struct XXHInterface<16> { using State = XXH3_state_t; + using Digest = XXH128_hash_t; static constexpr auto createState = &XXH3_createState; static constexpr auto freeState = &XXH3_freeState; static constexpr auto reset = &XXH3_128bits_reset_withSeed; @@ -71,7 +74,7 @@ class XXHashFunction : public HashFunction { using Interface = XXHInterface<HASH_BYTES>; public: XXHashFunction () : _state(Interface::createState()) {Interface::reset(_state, 0);} - XXHashFunction(const char *data, size_t length) : XXHashFunction() {update(data, length);} + XXHashFunction (const char *data, size_t length) : XXHashFunction() {update(data, length);} explicit XXHashFunction(const std::string &data) : XXHashFunction() {update(data);} explicit XXHashFunction(const std::vector<uint8_t> &data) : XXHashFunction() {update(data);} ~XXHashFunction () override {Interface::freeState(_state);} @@ -83,10 +86,11 @@ class XXHashFunction : public HashFunction { using HashFunction::update; // unhide update(istream &is) defined in base class - std::vector<uint8_t> digestValue () const override { + std::vector<uint8_t> digestBytes () const override { return util::bytes(Interface::digest(_state), HASH_BYTES); } + typename Interface::Digest digestValue () const {return Interface::digest(_state);} static unsigned version () {return XXH_versionNumber();} private: @@ -100,7 +104,7 @@ using XXH64HashFunction = XXHashFunction<8>; using XXH128HashFunction = XXHashFunction<16>; template<> -inline std::vector<uint8_t> XXHashFunction<16>::digestValue () const { +inline std::vector<uint8_t> XXHashFunction<16>::digestBytes () const { std::vector<uint8_t> hash; auto digest = Interface::digest(_state); for (auto chunk : {digest.high64, digest.low64}) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp index c1c065e3574..a995dbf01e9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp @@ -2,7 +2,7 @@ ** ZLibOutputStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp index 74a8e83abcc..15f15958353 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -2,7 +2,7 @@ ** dvisvgm.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -480,16 +480,20 @@ int main (int argc, char *argv[]) { } catch (DVIException &e) { Message::estream() << "\nDVI error: " << e.what() << '\n'; + return -1; } catch (PSException &e) { Message::estream() << "\nPostScript error: " << e.what() << '\n'; + return -2; } catch (SignalException &e) { Message::wstream().clearline(); Message::wstream(true) << "execution interrupted by user\n"; + return -3; } catch (exception &e) { Message::estream(true) << e.what() << '\n'; + return -4; } return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c index 61f17fdc6dc..4f89c2b6d19 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c @@ -2,7 +2,7 @@ ** ffwrapper.c ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h index e3e2f988329..6474d854a2c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h @@ -2,7 +2,7 @@ ** ffwrapper.h ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp index 0a037760572..907e402c8c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp @@ -2,7 +2,7 @@ ** macros.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp index 28046e45a2e..e5f3b955367 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp @@ -2,7 +2,7 @@ ** AttributeExtractor.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp index b4c6f2775c3..c8ab6bd61a1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp @@ -2,7 +2,7 @@ ** AttributeExtractor.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp index 98d2a8d699e..912d4a91107 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp @@ -2,7 +2,7 @@ ** DependencyGraph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp index b8a32786c18..47c0ac44ee5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp @@ -2,7 +2,7 @@ ** GroupCollapser.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -61,7 +61,7 @@ static void remove_ws_nodes (XMLElement *elem) { node = node->next(); else { XMLNode *next = node->next(); - XMLElement::remove(node); + XMLElement::detach(node); node = next; } } @@ -69,29 +69,31 @@ static void remove_ws_nodes (XMLElement *elem) { /** Recursively removes all redundant group elements from the given context element - * and moves their attributes to the corresponding parent element. + * and moves their attributes to the corresponding parent elements. * @param[in] context root of the subtree to process */ void GroupCollapser::execute (XMLElement *context) { if (!context) return; - XMLNode *node=context->firstChild(); - while (node) { - XMLNode *next = node->next(); // keep safe pointer to next node - if (XMLElement *elem = node->toElement()) - execute(elem); - node = next; - } - if (context->name() == "g" && context->attributes().empty()) { - // unwrap group without attributes - remove_ws_nodes(context); - XMLElement::unwrap(context); + + XMLNode *child=context->firstChild(); + while (child) { + XMLNode *next=child->next(); + if (XMLElement *childElement = child->toElement()) { + execute(childElement); + // check for groups without attributes and remove them + if (childElement->name() == "g" && childElement->attributes().empty()) { + remove_ws_nodes(childElement); + if (XMLNode *firstUnwrappedNode = XMLElement::unwrap(childElement)) + next = firstUnwrappedNode; + } + } + child = next; } - else { - XMLElement *child = only_child_element(context); - if (child && collapsible(*context)) { - if (child->name() == "g" && unwrappable(*child, *context) && moveAttributes(*child, *context)) { + if (XMLElement *childElement = only_child_element(context)) { + if (collapsible(*context)) { + if (childElement->name() == "g" && unwrappable(*childElement, *context) && moveAttributes(*childElement, *context)) { remove_ws_nodes(context); - XMLElement::unwrap(child); + XMLElement::unwrap(childElement); } } } @@ -147,12 +149,15 @@ bool GroupCollapser::collapsible (const XMLElement &element) { * @param[in] source element whose children and attributes should be moved * @param[in] dest element that should receive the children and attributes */ bool GroupCollapser::unwrappable (const XMLElement &source, const XMLElement &dest) { - // check for colliding clip-path attributes - if (const char *cp1 = source.getAttributeValue("clip-path")) { - if (const char *cp2 = dest.getAttributeValue("clip-path")) { - if (string(cp1) != cp2) - return false; - } + const char *cp1 = source.getAttributeValue("clip-path"); + const char *cp2 = dest.getAttributeValue("clip-path"); + if (cp2) { + // check for colliding clip-path attributes + if (cp1 && string(cp1) != string(cp2)) + return false; + // don't apply inner transformations to outer clipping paths + if (source.hasAttribute("transform")) + return false; } // these attributes prevent a group from being unwrapped static const char *attribs[] = { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp index 08db518a90c..2694c4f3558 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp @@ -2,7 +2,7 @@ ** GroupCollapser.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp index 276cfa55783..91f0263bb86 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp @@ -2,7 +2,7 @@ ** OptimizerModule.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp index 906ccc2d144..f8d040a3299 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp @@ -2,7 +2,7 @@ ** RedundantElementRemover.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -64,6 +64,6 @@ void RedundantElementRemover::execute (XMLElement *defs, XMLElement *context) { descendants.clear(); for (const string &str : idTree.getKeys()) { XMLElement *node = defs->getFirstDescendant("clipPath", "id", str.c_str()); - XMLElement::remove(node); + XMLElement::detach(node); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp index 8d5a6b689fb..52ce905c8eb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp @@ -2,7 +2,7 @@ ** RedundantElementRemover.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp index b2d45176e72..8f9635a8365 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp @@ -2,7 +2,7 @@ ** SVGOptimizer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -39,9 +39,9 @@ SVGOptimizer::SVGOptimizer (SVGTree *svg) : _svg(svg) { // optimizer modules available to the user; must be listed in default order // _moduleEntries.emplace_back(ModuleEntry("remove-ws", util::make_unique<WSNodeRemover>())); _moduleEntries.emplace_back(ModuleEntry("simplify-text", util::make_unique<TextSimplifier>())); + _moduleEntries.emplace_back(ModuleEntry("simplify-transform", util::make_unique<TransformSimplifier>())); _moduleEntries.emplace_back(ModuleEntry("group-attributes", util::make_unique<AttributeExtractor>())); _moduleEntries.emplace_back(ModuleEntry("collapse-groups", util::make_unique<GroupCollapser>())); - _moduleEntries.emplace_back(ModuleEntry("simplify-transform", util::make_unique<TransformSimplifier>())); _moduleEntries.emplace_back(ModuleEntry("remove-clippath", util::make_unique<RedundantElementRemover>())); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp index 0da157fbbbe..b15723d9ea4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp @@ -2,7 +2,7 @@ ** SVGOptimizer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp index b94ab9458eb..72cb0c5bb5e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp @@ -2,7 +2,7 @@ ** TextSimplifier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp index cfdd548e872..9ad3e0edb04 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp @@ -2,7 +2,7 @@ ** TextSimplifier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp index 461698b62ab..ce0a6d8d7ae 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp @@ -2,7 +2,7 @@ ** TransformSimplifier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -79,8 +79,9 @@ bool TransformSimplifier::incorporateTransform (XMLElement *elem, const Matrix & if (const char *ystr = elem->getAttributeValue("y")) y = strtod(ystr, nullptr); // width and height attributes must not become negative. Hence, only apply the scaling - // values if they are non-negative. Otherwise, keep a scaling matrix - if (sx < 0 || sy < 0) { + // values if they are non-negative. Otherwise, keep a scaling matrix. Also retain scaling + // transformations in image elements to avoid the need of attribute 'preseveAspectRatio'. + if (sx < 0 || sy < 0 || elem->name() == "image") { x += (sx == 0 ? 0 : tx/sx); y += (sy == 0 ? 0 : ty/sy); elem->addAttribute("transform", "scale("+XMLString(sx)+","+XMLString(sy)+")"); @@ -120,7 +121,7 @@ static string scale_cmd (double sx, double sy) { XMLString sxstr(sx), systr(sy); if (sxstr != "1" || systr != "1") { ret = "scale("+sxstr; - if (systr != "1") + if (systr != sxstr) ret += " "+systr; ret += ')'; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp index 5d503635ba2..10591dc271f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp @@ -2,7 +2,7 @@ ** TransformSimplifier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp index be58bf70fde..09de2f19bbf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp @@ -2,7 +2,7 @@ ** WSNodeRemover.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -34,7 +34,7 @@ void WSNodeRemover::execute (XMLElement *context) { while (child) { if (removeWS && child->toWSNode()) { XMLNode *next = child->next(); - XMLElement::remove(child); + XMLElement::detach(child); child = next; continue; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp index 8c21ce2b6e4..438c21c8fdd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp @@ -2,7 +2,7 @@ ** WSNodeRemover.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd index d2806badced..21c33a168a2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd @@ -3,7 +3,7 @@ ** options.dtd ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml index b1911694ddd..1d0d09e3d6d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml @@ -3,7 +3,7 @@ ** options.xml ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -26,7 +26,7 @@ <usage>--eps [options] epsfile</usage> <usage>--pdf [options] pdffile</usage> <description>This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.</description> - <copyright>Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de></copyright> + <copyright>Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de></copyright> </program> <options> <section title="Input options"> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp index 9c5991217d6..40de4677d14 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -2,7 +2,7 @@ ** psdefs.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -66,88 +66,96 @@ const char *PSInterpreter::PSDEFS = "felse}put @SD/fill{@dodraw @GD/@nulldev get not and{prcolor 0 1(newpath)prcmd " "prpath 0(fill)prcmd :newpath}{:fill}ifelse}put @SD/eofill{@dodraw @GD/@nulldev" " get not and{prcolor 0 1(newpath)prcmd prpath 0(eofill)prcmd :newpath}{:eofill" -"}ifelse}put @SD/clip{:clip @GD/@nulldev get not{0 1(newpath)prcmd prpath 0(cli" -"p)prcmd}if}put @SD/eoclip{:eoclip @GD/@nulldev get not{0 1(newpath)prcmd prpat" -"h 0(eoclip)prcmd}}put @SD/shfill{begin currentdict/ShadingType known currentdi" -"ct/ColorSpace known and currentdict/DataSource known and currentdict/Function " -"known not and ShadingType 4 ge{DataSource type/arraytype eq{<</DeviceGray 1/De" -"viceRGB 3/DeviceCMYK 4/bgknown currentdict/Background known/bbknown currentdic" -"t/BBox known>>begin currentdict ColorSpace known{ShadingType ColorSpace load b" -"gknown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse Sha" -"dingType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorSpa" -"ce load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if end}" -"if}if end}put @SD/image{dup type/dicttype eq{dup}{<</Width 6 index/Height 7 in" -"dex/colorimg false>>}ifelse @execimg}put @SD/colorimage{<<2 index{/Width 2 ind" -"ex 8 add index/Height 4 index 9 add index}{/Width 8 index/Height 9 index}ifels" -"e/colorimg true>>@execimg}put/@imgbase(./)def/@imgdevice(jpeg)def/@execimg{@GD" -"/@imgcnt 2 copy .knownget{1 add}{1}ifelse put begin<</imgdev null/imgid @GD/@i" -"mgcnt get/ispng @imgdevice 0 3 getinterval(png)eq dup/suffix exch{(.png)}{(.jp" -"g)}ifelse/colorimg currentdict/colorimg .knownget dup{pop}if/colordev 1 index " -"currentcolorspace dup length 1 ne exch 0 get/DeviceGray ne or or>>begin @imgde" -"vice(png)ne @imgdevice(jpeg)ne and{@imgdevice cvn}{colordev{ispng{/png16m}{/jp" -"eg}ifelse}{ispng{/pnggray}{/jpeggray}ifelse}ifelse}ifelse dup devicedict exch " -"known{:gsave/imgdev exch finddevice def mark/OutputFile @imgbase imgid 20 stri" -"ng cvs strconcat suffix strconcat/PageSize[Width Height]/UseFastColor true isp" -"ng{@imgdevice(pngmonod)eq{/MinFeatureSize where{pop/MinFeatureSize MinFeatureS" -"ize}if}if}{/JPEGQ where{pop/JPEGQ JPEGQ}if}ifelse imgdev putdeviceprops setdev" -"ice[Width 0 0 Height neg 0 Height]/setmatrix sysexec colorimg{:colorimage}{:im" -"age}ifelse/copypage sysexec mark/OutputFile()imgdev putdeviceprops pop :gresto" -"re imgid Width Height 3(image)prcmd}{pop colorimg{:colorimage}{:image}ifelse}i" -"felse end end}def/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlinet" -"o neg 0 rlineto closepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0" -" lt xor{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rline" -"to exch 0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:n" -"ewpath dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifels" -"e clip :newpath}put @SD/rectfill{:gsave :newpath dup type/arraytype eq{aload l" -"ength 4 idiv{@rectcc}repeat}{@rectcc}ifelse fill :grestore}put @SD/rectstroke{" -"gsave :newpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}i" -"felse stroke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/cl" -"ippath 0 defpr/sysexec{@SD exch get exec}def/adddot{dup length 1 add string du" -"p 0 46 put dup 3 -1 roll 1 exch putinterval}def/setlinewidth{dup/setlinewidth " -"sysexec 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defpr/setmit" -"erlimit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec exch aload length" -" 1 add -1 roll counttomark(setdash)prcmd pop}def/@setpagedevice{pop<<>>/setpag" -"edevice sysexec matrix setmatrix newpath 0(setpagedevice)prcmd}def/@checknulld" -"ev{@GD/@nulldev get{currentpagedevice maxlength 0 ne{@GD/@nulldev false put 0 " -"1(setnulldevice)prcmd}if}if}def/prcolor{currentcolorspace @setcolorspace curre" -"ntrgbcolor 3(setrgbcolor)prcmd}def/printgstate{@dodraw @GD/@nulldev get not an" -"d{matrix currentmatrix aload pop 6(setmatrix)prcmd applyscalevals currentlinew" -"idth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoin 1(" -"setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd prcolor currentdash " -"mark 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}if" -"}def/strconcat{exch dup length 2 index length add string dup dup 4 2 roll copy" -" length 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgstate}def" -"/save{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prcmd}de" -"f/restore{:restore @checknulldev printgstate @UD/@saveID known{@UD begin @save" -"ID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore @checknu" -"lldev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @checknulldev " -"setstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup " -"1(rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype n" -"e @dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def/transla" -"te{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/translate sys" -"exec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd a" -"pplyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{matrix cu" -"rrentmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1 roll" -">>begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin Pattern" -"Type 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload po" -"p 15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(makepattern" -")prcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpattern{begin " -"PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolor" -"space aload length -1 roll pop]/setcolorspace sysexec/setcolor sysexec XUID al" -"oad pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd currentco" -"lorspace 0 get/Pattern ne{[/Pattern currentcolorspace]/setcolorspace sysexec}i" -"f currentcolorspace @setcolorspace}{/setpattern sysexec}ifelse end}def/setcolo" -"r{dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor sysexec s" -"etrgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sysexec @setcolorspace}d" -"ef/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern eq{1}{0}ifelse 1(setc" -"olorspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/s" -"etrgbcolor 3 defpr/.setopacityalpha{dup/.setopacityalpha sysexec 1(setopacitya" -"lpha)prcmd}def/.setshapealpha{dup/.setshapealpha sysexec 1(setshapealpha)prcmd" -"}def/.setblendmode{dup/.setblendmode sysexec<</Normal 0/Compatible 0/Multiply " -"1/Screen 2/Overlay 3/SoftLight 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8" -"/Lighten 9/Difference 10/Exclusion 11/Hue 12/Saturation 13/Color 14/Luminosity" -" 15/CompatibleOverprint 16>>exch get 1(setblendmode)prcmd}def/@pdfpagecount{(r" -")file runpdfbegin pdfpagecount runpdfend}def/@pdfpagebox{(r)file runpdfbegin d" -"up dup 1 lt exch pdfpagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload po" -"p}ifelse runpdfend}def DELAYBIND{.bindnow}if "; +"}ifelse}put/.fillstroke{:gsave fill :grestore .swapcolors stroke .swapcolors}b" +"ind def/.eofillstroke{:gsave eofill :grestore .swapcolors stroke .swapcolors}b" +"ind def @SD/clip{:clip @GD/@nulldev get not{0 1(newpath)prcmd prpath 0(clip)pr" +"cmd}if}put @SD/eoclip{:eoclip @GD/@nulldev get not{0 1(newpath)prcmd prpath 0(" +"eoclip)prcmd}if}put @SD/shfill{begin currentdict/ShadingType known currentdict" +"/ColorSpace known and currentdict/DataSource known and currentdict/Function kn" +"own not and ShadingType 4 ge{DataSource type/arraytype eq{<</DeviceGray 1/Devi" +"ceRGB 3/DeviceCMYK 4/bgknown currentdict/Background known/bbknown currentdict/" +"BBox known>>begin currentdict ColorSpace known{ShadingType ColorSpace load bgk" +"nown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse Shadi" +"ngType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorSpace" +" load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if end}if" +"}if end}put @SD/image{dup type/dicttype eq{dup}{<</Width 6 index/Height 7 inde" +"x/colorimg false>>}ifelse @execimg}put @SD/colorimage{<<2 index{/Width 2 index" +" 8 add index/Height 4 index 9 add index}{/Width 8 index/Height 9 index}ifelse/" +"colorimg true>>@execimg}put/@imgbase(./)def/@imgdevice(jpeg)def/@execimg{@GD/@" +"imgcnt 2 copy .knownget{1 add}{1}ifelse put begin<</imgdev null/imgid @GD/@img" +"cnt get/ispng @imgdevice 0 3 getinterval(png)eq dup/suffix exch{(.png)}{(.jpg)" +"}ifelse/colorimg currentdict/colorimg .knownget dup{pop}if/colordev 1 index cu" +"rrentcolorspace dup length 1 ne exch 0 get/DeviceGray ne or or>>begin @imgdevi" +"ce(png)ne @imgdevice(jpeg)ne and{@imgdevice cvn}{colordev{ispng{/png16m}{/jpeg" +"}ifelse}{ispng{/pnggray}{/jpeggray}ifelse}ifelse}ifelse dup devicedict exch kn" +"own{:gsave/imgdev exch finddevice def mark/OutputFile @imgbase imgid 20 string" +" cvs strconcat suffix strconcat/PageSize[Width Height]/UseFastColor true ispng" +"{@imgdevice(pngmonod)eq{/MinFeatureSize where{pop/MinFeatureSize MinFeatureSiz" +"e}if}if}{/JPEGQ where{pop/JPEGQ JPEGQ}if}ifelse imgdev putdeviceprops setdevic" +"e[Width 0 0 Height neg 0 Height]/setmatrix sysexec colorimg{:colorimage}{:imag" +"e}ifelse/copypage sysexec mark/OutputFile()imgdev putdeviceprops pop :grestore" +" imgid Width Height 3(image)prcmd}{pop colorimg{:colorimage}{:image}ifelse}ife" +"lse end end}def/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlineto " +"neg 0 rlineto closepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0 l" +"t xor{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto" +" exch 0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:new" +"path dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse " +"clip :newpath}put @SD/rectfill{:gsave :newpath dup type/arraytype eq{aload len" +"gth 4 idiv{@rectcc}repeat}{@rectcc}ifelse fill :grestore}put @SD/rectstroke{gs" +"ave :newpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ife" +"lse stroke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/clip" +"path 0 defpr/sysexec{@SD exch get exec}def/adddot{dup length 1 add string dup " +"0 46 put dup 3 -1 roll 1 exch putinterval}def/setlinewidth{dup/setlinewidth sy" +"sexec 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defpr/setmiter" +"limit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec exch aload length 1" +" add -1 roll counttomark(setdash)prcmd pop}def/@setpagedevice{pop<<>>/setpaged" +"evice sysexec matrix setmatrix newpath 0(setpagedevice)prcmd}def/@checknulldev" +"{@GD/@nulldev get{currentpagedevice maxlength 0 ne{@GD/@nulldev false put 0 1(" +"setnulldevice)prcmd}if}if}def/prcolor{currentcolorspace @setcolorspace current" +"rgbcolor 3(setrgbcolor)prcmd}def/printgstate{@dodraw @GD/@nulldev get not and{" +"matrix currentmatrix aload pop 6(setmatrix)prcmd applyscalevals currentlinewid" +"th 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoin 1(se" +"tlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd prcolor currentdash ma" +"rk 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}if}d" +"ef/strconcat{exch dup length 2 index length add string dup dup 4 2 roll copy l" +"ength 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgstate}def/s" +"ave{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prcmd}def/" +"restore{:restore @checknulldev printgstate @UD/@saveID known{@UD begin @saveID" +" end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore @checknull" +"dev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @checknulldev se" +"tstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup 1(" +"rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype ne " +"@dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate" +"{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/translate sysex" +"ec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd app" +"lyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{matrix curr" +"entmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1 roll>>" +"begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin PatternTy" +"pe 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload pop " +"15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(makepattern)p" +"rcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpattern{begin Pa" +"tternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorsp" +"ace aload length -1 roll pop]/setcolorspace sysexec/setcolor sysexec XUID aloa" +"d pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd currentcolo" +"rspace 0 get/Pattern ne{[/Pattern currentcolorspace]/setcolorspace sysexec}if " +"currentcolorspace @setcolorspace}{/setpattern sysexec}ifelse end}def/setcolor{" +"dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor sysexec set" +"rgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sysexec @setcolorspace}def" +"/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern eq{1}{0}ifelse 1(setcol" +"orspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/set" +"rgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape known{dup/.setalphaissh" +"ape sysexec}if{1}{0}ifelse 1(setisshapealpha)prcmd}bind def/.setfillconstantal" +"pha{@SD/.setfillconstantalpha known{dup/.setfillconstantalpha sysexec}if 1(set" +"fillconstantalpha)prcmd}bind def/.setstrokeconstantalpha{@SD/.setstrokeconstan" +"talpha known{dup/.setstrokeconstantalpha sysexec}if 1(setstrokeconstantalpha)p" +"rcmd}bind def/.setopacityalpha{false .setalphaisshape dup .setfillconstantalph" +"a .setstrokeconstantalpha}bind def/.setshapealpha{true .setalphaisshape dup .s" +"etfillconstantalpha .setstrokeconstantalpha}bind def/.setblendmode{dup/.setble" +"ndmode sysexec<</Normal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3/SoftLight" +" 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Lighten 9/Difference 10/Exclu" +"sion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverprint 16>>ex" +"ch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file runpdfbegin pdfpagecount" +" runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup 1 lt exch pdfpagecount " +"gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse runpdfend}def DELAYBI" +"ND{.bindnow}if "; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp index 8fe31fcf2dc..f702d67ce54 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp @@ -2,7 +2,7 @@ ** utility.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp index 7ad3bc8d690..ff8387a4190 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp @@ -2,7 +2,7 @@ ** utility.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in index 20ba32bbd58..70d27f6e48d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in @@ -2,7 +2,7 @@ ** version.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp index 114420c3d51..5f71bbed1e4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp @@ -2,7 +2,7 @@ ** windows.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** |