summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/dvisvgm-src/src
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-10 18:21:29 +0000
committerKarl Berry <karl@freefriends.org>2019-03-10 18:21:29 +0000
commit91ac7ad85948786bbdd7ab9f6fce6ed4c8245840 (patch)
tree8839301daa4cf5bc5422e3a2191b0ed28ff5d61f /Build/source/texk/dvisvgm/dvisvgm-src/src
parentf9504a41dd5a2be3574174cecf5ff0071bd70663 (diff)
dvisvgm 2.6.3
git-svn-id: svn://tug.org/texlive/trunk@50315 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp10
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp13
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp14
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp1
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp26
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp6
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp64
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp4
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp32
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp11
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp8
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp74
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp2
16 files changed, 151 insertions, 120 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp
index bc1780f5481..876e5e07834 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp
@@ -22,18 +22,16 @@
#define CALCULATOR_HPP
#include <istream>
+#include <map>
#include <string>
-#include <unordered_map>
#include "MessageException.hpp"
-struct CalculatorException : public MessageException
-{
+struct CalculatorException : public MessageException {
CalculatorException (const std::string &msg) : MessageException(msg) {}
};
-class Calculator
-{
+class Calculator {
public:
Calculator () : _numValue(0) {}
double eval (std::istream &is);
@@ -49,7 +47,7 @@ class Calculator
char lookAhead (std::istream &is);
private:
- std::unordered_map<std::string,double> _variables;
+ std::map<std::string,double> _variables;
double _numValue;
std::string _strValue;
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp
index 916403c859b..aa6b90b4063 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp
@@ -222,6 +222,9 @@ Color Color::operator *= (double c) {
}
+/** Returns an RGB string representing the color. Depending on the
+ * color value, the string either consists of 3 or 6 hex digits
+ * plus a leading '#' character. */
string Color::rgbString () const {
ostringstream oss;
oss << '#';
@@ -229,7 +232,15 @@ string Color::rgbString () const {
oss << setbase(16) << setfill('0') << setw(2)
<< (((_rgb >> (8*i)) & 0xff));
}
- return oss.str();
+ // check if RGB string can be reduced to a three digit hex value
+ // #RRGGBB => #RGB, e.g. #112233 => #123
+ string hexstr = oss.str();
+ if (hexstr[1] == hexstr[2] && hexstr[3] == hexstr[4] && hexstr[5] == hexstr[6]) {
+ hexstr[2] = hexstr[3];
+ hexstr[3] = hexstr[5];
+ hexstr.resize(4);
+ }
+ return hexstr;
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp
index da6ac3ca23b..1bdcbcdbedb 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp
@@ -246,7 +246,7 @@ int FontEngine::charIndex (const Character &c) const {
case Character::CHRCODE:
return FT_Get_Char_Index(_currentFace, (FT_ULong)c.number());
case Character::NAME:
- return FT_Get_Name_Index(_currentFace, (FT_String*)c.name());
+ return FT_Get_Name_Index(_currentFace, const_cast<FT_String*>(c.name()));
default:
return c.number();
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp
index cc8f21a5d11..ff57d213b1d 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp
@@ -193,7 +193,7 @@ bool Ghostscript::init (int argc, const char **argv, void *caller) {
if (status < 0)
_inst = 0;
else {
- init_with_args(argc, (char**)argv);
+ init_with_args(argc, const_cast<char**>(argv));
}
}
return _inst != 0;
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp
index bcd0f818547..b7f4e9664f6 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp
@@ -30,9 +30,9 @@ void HtmlSpecialHandler::preprocess (const string&, istream &is, SpecialActions
StreamInputReader ir(is);
ir.skipSpace();
// collect page number and ID of named anchors
- unordered_map<string,string> attribs;
- if (ir.check("<a ") && ir.parseAttributes(attribs, '"') > 0) {
- unordered_map<string,string>::iterator it;
+ map<string,string> attribs;
+ if (ir.check("<a ") && ir.parseAttributes(attribs, "\"") > 0) {
+ map<string,string>::iterator it;
if ((it = attribs.find("name")) != attribs.end())
HyperlinkManager::instance().addNameAchor(it->second, actions.getCurrentPageNumber());
else if ((it = attribs.find("href")) != attribs.end())
@@ -45,9 +45,9 @@ bool HtmlSpecialHandler::process (const string&, istream &is, SpecialActions &ac
_active = true;
StreamInputReader ir(is);
ir.skipSpace();
- unordered_map<string,string> attribs;
- unordered_map<string,string>::iterator it;
- if (ir.check("<a ") && ir.parseAttributes(attribs, '"') > 0) {
+ map<string,string> attribs;
+ map<string,string>::iterator it;
+ if (ir.check("<a ") && ir.parseAttributes(attribs, "\"") > 0) {
if ((it = attribs.find("href")) != attribs.end()) // <a href="URI">
HyperlinkManager::instance().createLink(it->second, actions);
else if ((it = attribs.find("name")) != attribs.end()) // <a name="ID">
@@ -59,7 +59,7 @@ bool HtmlSpecialHandler::process (const string&, istream &is, SpecialActions &ac
HyperlinkManager::instance().closeAnchor(actions);
else if (ir.check("<img src=")) {
}
- else if (ir.check("<base ") && ir.parseAttributes(attribs, '"') > 0 && (it = attribs.find("href")) != attribs.end())
+ else if (ir.check("<base ") && ir.parseAttributes(attribs, "\"") > 0 && (it = attribs.find("href")) != attribs.end())
HyperlinkManager::instance().setBaseUrl(it->second);
return true;
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp
index f33fea863a3..0d4e3e4e11f 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp
@@ -22,7 +22,6 @@
#define HTMLSPECIALHANDLER_HPP
#include <string>
-#include <unordered_map>
#include "Color.hpp"
#include "SpecialHandler.hpp"
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp
index 4497a911894..9a317b4bf96 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp
@@ -261,23 +261,23 @@ char InputReader::getPunct () {
}
-/** Reads a string delimited by a given quotation character.
+/** Reads a string optionally delimited by a given quotation character.
* Before reading the string, all leading whitespace is skipped. Then, the function checks
- * for the given quotation character. If it is found, all characters until the second
- * appearance of the quotation char are appended to the result. Otherwise, an empty string
- * is returned. If the quotation character is 0, the behavior of this function is identical to
- * a call of getString().
- * @param[in] quotechar the quotation character bounding the string to be read
+ * for one of the the given quotation characters. If it is found, all characters until the
+ * second appearance of the same quotation char are appended to the result. Otherwise, an
+ * empty string is returned. If the quotation character is 0, the behavior of this function
+ * is identical to a call of getString().
+ * @param[in] quotechars recognized quotation characters bounding the string to be read
* @return the string read */
-string InputReader::getQuotedString (char quotechar) {
- if (quotechar == 0)
+string InputReader::getQuotedString (const char *quotechars) {
+ if (!quotechars)
return getString();
string ret;
skipSpace();
- if (peek() == quotechar) {
+ if (const char *quotechar = strchr(quotechars, peek())) {
get();
- while (!eof() && peek() != quotechar)
+ while (!eof() && peek() != *quotechar)
ret += get();
get();
}
@@ -337,9 +337,9 @@ string InputReader::getLine () {
/** Parses a sequence of key-value pairs of the form KEY=VALUE or KEY="VALUE"
* @param[out] attr the scanned atributes
- * @param[in] quotechar quote character used to enclose the attribute values
+ * @param[in] quotechars recognized quote characters used to enclose the attribute values
* @return number of attributes scanned */
-int InputReader::parseAttributes (unordered_map<string,string> &attr, char quotechar) {
+int InputReader::parseAttributes (map<string,string> &attr, const char *quotechars) {
bool ready=false;
while (!eof() && !ready) {
string key;
@@ -350,7 +350,7 @@ int InputReader::parseAttributes (unordered_map<string,string> &attr, char quote
if (peek() == '=') {
get();
skipSpace();
- string val = getQuotedString(quotechar);
+ string val = getQuotedString(quotechars);
attr[key] = val;
}
else
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp
index 1fc70820471..5523499f073 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp
@@ -22,8 +22,8 @@
#define INPUTREADER_HPP
#include <istream>
+#include <map>
#include <string>
-#include <unordered_map>
#include <vector>
#include "InputBuffer.hpp"
@@ -48,12 +48,12 @@ class InputReader {
virtual double getDouble ();
virtual std::string getWord ();
virtual char getPunct ();
- virtual std::string getQuotedString (char quotechar);
+ virtual std::string getQuotedString (const char *quotechars);
virtual std::string getString ();
virtual std::string getString (size_t n);
virtual std::string getString (const char *delim);
virtual std::string getLine ();
- virtual int parseAttributes (std::unordered_map<std::string,std::string> &attr, char quotechar=0);
+ virtual int parseAttributes (std::map<std::string,std::string> &attr, const char *quotechars=nullptr);
virtual operator bool () const {return !eof();}
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp
index ea9cdacd161..eb82372ce58 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp
@@ -132,7 +132,7 @@ void MapLine::parseDVIPSLine (InputReader &ir) {
_fontfname = name;
}
else { // ir.peek() == '"' => list of PS font operators
- string options = ir.getQuotedString('"');
+ string options = ir.getQuotedString("\"");
StringInputBuffer sib(options);
BufferInputReader sir(sib);
while (!sir.eof()) {
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
index e383f4c5806..4b503d34bee 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
@@ -203,8 +203,8 @@ bool PsSpecialHandler::process (const string &prefix, istream &is, SpecialAction
else if (prefix == "psfile=" || prefix == "PSfile=" || prefix == "pdffile=") {
if (_actions) {
StreamInputReader in(is);
- const string fname = in.getQuotedString(in.peek() == '"' ? '"' : 0);
- unordered_map<string,string> attr;
+ const string fname = in.getQuotedString(in.peek() == '"' ? "\"" : nullptr);
+ map<string,string> attr;
in.parseAttributes(attr);
imgfile(prefix == "pdffile=" ? FileType::PDF : FileType::EPS, fname, attr);
}
@@ -266,20 +266,22 @@ bool PsSpecialHandler::process (const string &prefix, istream &is, SpecialAction
* @param[in] filetype type of file to process (EPS or PDF)
* @param[in] fname EPS/PDF file to be included
* @param[in] attr attributes given with psfile/pdffile special */
-void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const unordered_map<string,string> &attr) {
+void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const map<string,string> &attr) {
// prevent warning about missing image file "/dev/null" which is
// added by option "psfixbb" of the preview package
if (fname == "/dev/null")
return;
- const char *filepath = FileFinder::instance().lookup(fname, false);
- if (!filepath && FileSystem::exists(fname))
- filepath = fname.c_str();
- if (!filepath) {
+ string filepath;
+ if (const char *path = FileFinder::instance().lookup(fname, false))
+ filepath = FileSystem::adaptPathSeperators(path);
+ if ((filepath.empty() || !FileSystem::exists(filepath)) && FileSystem::exists(fname))
+ filepath = fname;
+ if (filepath.empty()) {
Message::wstream(true) << "file '" << fname << "' not found\n";
return;
}
- unordered_map<string,string>::const_iterator it;
+ map<string,string>::const_iterator it;
// bounding box of EPS figure in PS point units (lower left and upper right corner)
double llx = (it = attr.find("llx")) != attr.end() ? stod(it->second) : 0;
@@ -333,26 +335,30 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const un
_actions->setY(0);
moveToDVIPos();
- auto groupNode = util::make_unique<XMLElementNode>("g"); // append following elements to this group
+ auto groupNode = util::make_unique<XMLElementNode>("g"); // put SVG nodes created from the EPS/PDF file in this group
_xmlnode = groupNode.get();
_psi.execute(
"\n@beginspecial @setspecial" // enter special environment
- "/setpagedevice{@setpagedevice}def" // activate processing of operator "setpagedevice"
- "[1 0 0 -1 0 0] setmatrix" // don't apply outer PS transformations
+ "/setpagedevice{@setpagedevice}def " // activate processing of operator "setpagedevice"
+ "matrix setmatrix" // don't apply outer PS transformations
"/FirstPage "+to_string(pageno)+" def" // set number of fisrt page to convert (PDF only)
"/LastPage "+to_string(pageno)+" def" // set number of last page to convert (PDF only)
- "(" + string(filepath) + ")run " // execute file content
+ "("+ filepath + ")run " // execute file content
"@endspecial " // leave special environment
);
- if (!groupNode->empty()) { // has anything been drawn?
+ if (!groupNode->empty()) { // has anything been drawn?
Matrix matrix(1);
- if (filetype == FileType::PDF)
- matrix.translate(-llx, -lly).scale(1, -1); //.translate(0, lly); // flip vertically
- else
- matrix.translate(-llx, lly);
- matrix.scale(sx, sy).rotate(-angle).scale(hscale/100, vscale/100);
- matrix.translate(x+hoffset, y-voffset); // move image to current DVI position
+ matrix.scale(sx, -sy).rotate(-angle).scale(hscale/100, vscale/100); // apply transformation attributes
+ matrix.translate(x+hoffset, y-voffset); // move image to current DVI position
matrix.rmultiply(_actions->getMatrix());
+
+ // update bounding box
+ BoundingBox bbox(0, 0, urx-llx, ury-lly);
+ bbox.transform(matrix);
+ _actions->embed(bbox);
+
+ // insert group containing SVG nodes created from image
+ matrix.lmultiply(TranslationMatrix(-llx, -lly)); // move lower left corner of image to origin
if (!matrix.isIdentity())
groupNode->addAttribute("transform", matrix.getSVG());
_actions->appendToPage(std::move(groupNode));
@@ -363,15 +369,6 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const un
_actions->setX(x);
_actions->setY(y);
moveToDVIPos();
-
- // update bounding box
- BoundingBox bbox(0, 0, urx-llx, ury-lly);
- Matrix matrix(1);
- matrix.scale(sx, -sy).rotate(-angle).scale(hscale/100, vscale/100);
- matrix.translate(x+hoffset, y-voffset);
- matrix.rmultiply(_actions->getMatrix());
- bbox.transform(matrix);
- _actions->embed(bbox);
}
@@ -1020,17 +1017,16 @@ void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace
}
-struct PatchVertex {
- DPair point;
- Color color;
-};
-
-
void PsSpecialHandler::processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator<double> &it) {
int verticesPerRow = static_cast<int>(*it++);
if (verticesPerRow < 2)
return;
+ struct PatchVertex {
+ DPair point;
+ Color color;
+ };
+
// hold two adjacent rows of vertices and colors
vector<PatchVertex> row1(verticesPerRow);
vector<PatchVertex> row2(verticesPerRow);
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
index 1acb6732f14..188c4527189 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
@@ -103,7 +103,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void moveToDVIPos ();
void executeAndSync (std::istream &is, bool updatePos);
void processHeaderFile (const char *fname);
- void imgfile (FileType type, const std::string &fname, const std::unordered_map<std::string,std::string> &attr);
+ void imgfile (FileType type, const std::string &fname, const std::map<std::string,std::string> &attr);
void dviEndPage (unsigned pageno, SpecialActions &actions) override;
void clip (Path path, bool evenodd);
void processSequentialPatchMesh (int shadingTypeID, ColorSpace cspace, VectorIterator<double> &it);
@@ -178,7 +178,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
double _dashoffset; ///< current dash offset
std::vector<double> _dashpattern;
ClippingStack _clipStack;
- std::unordered_map<int, std::unique_ptr<PSPattern>> _patterns;
+ std::map<int, std::unique_ptr<PSPattern>> _patterns;
PSTilingPattern *_pattern; ///< current pattern
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp
index 3f2947caf32..e0598c4956a 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp
@@ -54,12 +54,15 @@ void XMLElementNode::clear () {
void XMLElementNode::addAttribute (const string &name, const string &value) {
- _attributes.emplace(name, value);
+ if (Attribute *attr = getAttribute(name))
+ attr->value = value;
+ else
+ _attributes.emplace_back(Attribute(name, value));
}
void XMLElementNode::addAttribute (const string &name, double value) {
- _attributes.emplace(name, XMLString(value));
+ addAttribute(name, XMLString(value));
}
@@ -198,7 +201,7 @@ XMLElementNode* XMLElementNode::getFirstDescendant (const char *name, const char
ostream& XMLElementNode::write (ostream &os) const {
os << '<' << _name;
for (const auto &attrib : _attributes)
- os << ' ' << attrib.first << "='" << attrib.second << '\'';
+ os << ' ' << attrib.name << "='" << attrib.value << '\'';
if (_children.empty())
os << "/>";
else {
@@ -223,7 +226,7 @@ ostream& XMLElementNode::write (ostream &os) const {
/** Returns true if this element has an attribute of given name. */
bool XMLElementNode::hasAttribute (const string &name) const {
- return _attributes.find(name) != _attributes.end();
+ return getAttribute(name) != nullptr;
}
@@ -231,13 +234,28 @@ bool XMLElementNode::hasAttribute (const string &name) const {
* @param[in] name name of attribute
* @return attribute value or 0 if attribute doesn't exist */
const char* XMLElementNode::getAttributeValue (const std::string& name) const {
- auto it = _attributes.find(name);
- if (it != _attributes.end())
- return it->second.c_str();
+ if (const Attribute *attr = getAttribute(name))
+ return attr->value.c_str();
return nullptr;
}
+XMLElementNode::Attribute* XMLElementNode::getAttribute (const string &name) {
+ auto it = find_if(_attributes.begin(), _attributes.end(), [&](const Attribute &attr) {
+ return attr.name == name;
+ });
+ return it != _attributes.end() ? &(*it) : nullptr;
+}
+
+
+const XMLElementNode::Attribute* XMLElementNode::getAttribute (const string &name) const {
+ auto it = find_if(_attributes.begin(), _attributes.end(), [&](const Attribute &attr) {
+ return attr.name == name;
+ });
+ return it != _attributes.end() ? &(*it) : nullptr;
+}
+
+
//////////////////////
void XMLTextNode::append (unique_ptr<XMLNode> &&node) {
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp
index af3aa81820d..b9a75fa0588 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp
@@ -41,7 +41,11 @@ class XMLNode {
class XMLElementNode : public XMLNode {
public:
- using AttribMap = std::map<std::string,std::string>;
+ struct Attribute {
+ Attribute (const std::string &nam, const std::string &val) : name(nam), value(val) {}
+ std::string name;
+ std::string value;
+ };
using ChildList = std::deque<std::unique_ptr<XMLNode>>;
public:
@@ -66,10 +70,13 @@ class XMLElementNode : public XMLNode {
bool empty () const {return _children.empty();}
const ChildList& children () const {return _children;}
const std::string& getName () const {return _name;}
+ protected:
+ Attribute* getAttribute (const std::string &name);
+ const Attribute* getAttribute (const std::string &name) const;
private:
std::string _name; // element name (<name a1="v1" .. an="vn">...</name>)
- AttribMap _attributes;
+ std::vector<Attribute> _attributes;
ChildList _children; // child nodes
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp
index a9f4518ac93..b82709f1f55 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp
@@ -165,9 +165,11 @@ static void check_bbox (const string &bboxstr) {
throw MessageException("invalid bounding box format '" + bboxstr + "'");
}
}
- // check if given bbox argument is valid, i.e. doesn't throw an exception
- BoundingBox bbox;
- bbox.set(bboxstr);
+ else {
+ // check if given bbox argument is valid, i.e. doesn't throw an exception
+ BoundingBox bbox;
+ bbox.set(bboxstr);
+ }
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp
index 84d6496ea00..5baf1a0bc0a 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp
@@ -75,40 +75,40 @@ const char *PSInterpreter::PSDEFS =
"erval}def/setlinewidth{dup/setlinewidth sysexec 1(setlinewidth)prcmd}def/setli"
"necap 1 defpr/setlinejoin 1 defpr/setmiterlimit 1 defpr/setdash{mark 3 1 roll "
"2 copy/setdash sysexec exch aload length 1 add -1 roll counttomark(setdash)prc"
-"md pop}def/@setpagedevice{pop<<>>/setpagedevice sysexec[1 0 0 -1 0 0]setmatrix"
-" newpath 0(setpagedevice)prcmd}def/prcolor{currentrgbcolor 3(setrgbcolor)prcmd"
-"}def/printgstate{@dodraw{matrix currentmatrix aload pop 6(setmatrix)prcmd appl"
-"yscalevals currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)p"
-"rcmd currentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prc"
-"md currentrgbcolor 3(setrgbcolor)prcmd currentdash mark 3 1 roll exch aload le"
-"ngth 1 add -1 roll counttomark(setdash)prcmd pop}if}def/setgstate{/setgstate s"
-"ysexec printgstate}def/save{@UD begin/@saveID vmstatus pop pop def end :save @"
-"saveID 1(save)prcmd}def/restore{:restore printgstate @UD/@saveID known{@UD beg"
-"in @saveID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore "
-"printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(grestorea"
-"ll)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup 1(rotate)prcmd}if/ro"
-"tate sysexec applyscalevals}def/scale{dup type/arraytype ne @dodraw and{2 copy"
-" 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate{dup type/arraytyp"
-"e ne @dodraw and{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatrix{d"
-"up/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd applyscalevals}if}def"
-"/initmatrix{matrix setmatrix}def/concat{matrix currentmatrix matrix concatmatr"
-"ix setmatrix}def/makepattern{gsave<</mx 3 -1 roll>>begin dup/XUID[1000000 @pat"
-"cnt]put mx/makepattern sysexec dup dup begin PatternType @patcnt BBox aload po"
-"p XStep YStep PaintType mx aload pop 15(makepattern)prcmd :newpath matrix setm"
-"atrix PaintProc 0 1(makepattern)prcmd end/@patcnt @patcnt 1 add store end gres"
-"tore}def/setpattern{begin PatternType 1 eq{PaintType 1 eq{XUID aload pop exch "
-"pop 1}{:gsave[currentcolorspace aload length -1 roll pop]setcolorspace/setcolo"
-"r sysexec XUID aload pop exch pop currentrgbcolor :grestore 4}ifelse(setpatter"
-"n)prcmd}{/setpattern sysexec}ifelse end}def/setcolor{dup type/dicttype eq{setp"
-"attern}{/setcolor sysexec/currentrgbcolor sysexec setrgbcolor}ifelse}def/setgr"
-"ay 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.setop"
-"acityalpha{dup/.setopacityalpha sysexec 1(setopacityalpha)prcmd}def/.setshapea"
-"lpha{dup/.setshapealpha sysexec 1(setshapealpha)prcmd}def/.setblendmode{dup/.s"
-"etblendmode sysexec<</Normal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3/Soft"
-"Light 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Lighten 9/Difference 10/"
-"Exclusion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverprint 1"
-"6>>exch get 1(setblendmode)prcmd}def/@pdfpagecount{GS_PDF_ProcSet begin pdfdic"
-"t begin(r)file pdfopen begin pdfpagecount currentdict pdfclose end end end}def"
-"/@pdfpagebox{GS_PDF_ProcSet begin pdfdict begin(r)file pdfopen begin dup dup 1"
-" lt exch pdfpagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse"
-" currentdict pdfclose end end end}def DELAYBIND{.bindnow}if ";
+"md pop}def/@setpagedevice{pop<<>>/setpagedevice sysexec matrix setmatrix newpa"
+"th 0(setpagedevice)prcmd}def/prcolor{currentrgbcolor 3(setrgbcolor)prcmd}def/p"
+"rintgstate{@dodraw{matrix currentmatrix aload pop 6(setmatrix)prcmd applyscale"
+"vals currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd c"
+"urrentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd cur"
+"rentrgbcolor 3(setrgbcolor)prcmd currentdash mark 3 1 roll exch aload length 1"
+" add -1 roll counttomark(setdash)prcmd pop}if}def/setgstate{/setgstate sysexec"
+" printgstate}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveID"
+" 1(save)prcmd}def/restore{:restore printgstate @UD/@saveID known{@UD begin @sa"
+"veID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore printg"
+"state 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(grestoreall)prc"
+"md}def/rotate{dup type/arraytype ne @dodraw and{dup 1(rotate)prcmd}if/rotate s"
+"ysexec applyscalevals}def/scale{dup type/arraytype ne @dodraw and{2 copy 2(sca"
+"le)prcmd}if/scale sysexec applyscalevals}def/translate{dup type/arraytype ne @"
+"dodraw and{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatrix{dup/set"
+"matrix sysexec @dodraw{aload pop 6(setmatrix)prcmd applyscalevals}if}def/initm"
+"atrix{matrix setmatrix}def/concat{matrix currentmatrix matrix concatmatrix set"
+"matrix}def/makepattern{gsave<</mx 3 -1 roll>>begin dup/XUID[1000000 @patcnt]pu"
+"t mx/makepattern sysexec dup dup begin PatternType @patcnt BBox aload pop XSte"
+"p YStep PaintType mx aload pop 15(makepattern)prcmd :newpath matrix setmatrix "
+"PaintProc 0 1(makepattern)prcmd end/@patcnt @patcnt 1 add store end grestore}d"
+"ef/setpattern{begin PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}"
+"{:gsave[currentcolorspace aload length -1 roll pop]setcolorspace/setcolor syse"
+"xec XUID aload pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcm"
+"d}{/setpattern sysexec}ifelse end}def/setcolor{dup type/dicttype eq{setpattern"
+"}{/setcolor sysexec/currentrgbcolor sysexec setrgbcolor}ifelse}def/setgray 1 d"
+"efpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.setopacitya"
+"lpha{dup/.setopacityalpha sysexec 1(setopacityalpha)prcmd}def/.setshapealpha{d"
+"up/.setshapealpha sysexec 1(setshapealpha)prcmd}def/.setblendmode{dup/.setblen"
+"dmode 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/Exclus"
+"ion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverprint 16>>exc"
+"h get 1(setblendmode)prcmd}def/@pdfpagecount{GS_PDF_ProcSet begin pdfdict begi"
+"n(r)file pdfopen begin pdfpagecount currentdict pdfclose end end end}def/@pdfp"
+"agebox{GS_PDF_ProcSet begin pdfdict begin(r)file pdfopen begin dup dup 1 lt ex"
+"ch pdfpagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse curre"
+"ntdict pdfclose end end end}def DELAYBIND{.bindnow}if ";
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp
index 0de72d2445e..22305f75f2b 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp
@@ -22,7 +22,7 @@
#define VERSION_HPP
constexpr const char *PROGRAM_NAME = "dvisvgm";
-constexpr const char *PROGRAM_VERSION = "2.6.2";
+constexpr const char *PROGRAM_VERSION = "2.6.3";
#endif