diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
8 files changed, 70 insertions, 47 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp index 57456ba36b0..433787739ef 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -90,6 +90,17 @@ Matrix::Matrix (const string &cmds, Calculator &calc) { } +Matrix::Matrix (initializer_list<double> initlist) { + int count=0; + for (auto it=initlist.begin(); it != initlist.end() && count < 9; ++it) { + _values[count/3][count%3] = *it; + count++; + } + for (; count < 9; count++) + _values[count/3][count%3] = (count%4 ? 0 : 1); +} + + Matrix& Matrix::set (double d) { for (int i=0; i < 3; i++) for (int j=0; j < 3; j++) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp index 9ea836b9837..8be82df4e13 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp @@ -21,6 +21,7 @@ #ifndef MATRIX_HPP #define MATRIX_HPP +#include <initializer_list> #include <istream> #include <string> #include <vector> @@ -28,15 +29,13 @@ #include "Pair.hpp" -struct ParserException : public MessageException -{ +struct ParserException : public MessageException { ParserException (const std::string &msg) : MessageException(msg) {} }; class Calculator; -class Matrix -{ +class Matrix { friend double det (const Matrix &m); friend double det (const Matrix &m, int row, int col); @@ -45,6 +44,7 @@ class Matrix Matrix (double d=0); Matrix (double v[], unsigned size=9); Matrix (const std::vector<double> &v, int start=0); + Matrix (std::initializer_list<double> initlist); Matrix& set (double d); Matrix& set (double v[], unsigned size); Matrix& set (const std::vector<double> &v, int start=0); @@ -80,20 +80,17 @@ class Matrix }; -struct TranslationMatrix : public Matrix -{ +struct TranslationMatrix : public Matrix { TranslationMatrix (double tx, double ty); }; -struct ScalingMatrix : public Matrix -{ +struct ScalingMatrix : public Matrix { ScalingMatrix (double sx, double sy); }; -struct RotationMatrix : public Matrix -{ +struct RotationMatrix : public Matrix { RotationMatrix (double deg); }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp index c33bffb8927..57441da6eca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp @@ -36,7 +36,7 @@ using namespace std; const char *PSInterpreter::GSARGS[] = { "gs", // dummy name "-q", // be quiet, suppress gs banner - "-dSAFER", // disallow writing of files +// "-dSAFER", // disallow writing of files "-dNODISPLAY", // we don't need a display device "-dNOPAUSE", // keep going "-dWRITESYSTEMDICT", // leave systemdict writable as some operators must be replaced @@ -281,6 +281,7 @@ void PSInterpreter::callActions (InputReader &in) { {"setmatrix", { 6, &PSActions::setmatrix}}, {"setmiterlimit", { 1, &PSActions::setmiterlimit}}, {"setopacityalpha",{ 1, &PSActions::setopacityalpha}}, + {"setpagedevice", { 0, &PSActions::setpagedevice}}, {"setpattern", {-1, &PSActions::setpattern}}, {"setrgbcolor", { 3, &PSActions::setrgbcolor}}, {"shfill", {-1, &PSActions::shfill}}, diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp index 503c45dac65..ae75152899e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp @@ -30,16 +30,14 @@ #include "MessageException.hpp" -struct PSException : public MessageException -{ +struct PSException : public MessageException { PSException (const std::string &msg) : MessageException(msg) {} }; /** This interface provides the template methods called by PSInterpreter when executing a PS snippet. * Each method corresponds to a PostScript operator of the same name. */ -struct PSActions -{ +struct PSActions { virtual ~PSActions () =default; virtual void applyscalevals (std::vector<double> &p) =0; virtual void clip (std::vector<double> &p) =0; @@ -72,6 +70,7 @@ struct PSActions virtual void setmatrix (std::vector<double> &p) =0; virtual void setmiterlimit (std::vector<double> &p) =0; virtual void setopacityalpha (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 shfill (std::vector<double> &rgb) =0; @@ -84,8 +83,7 @@ class PSFilter; /** This class provides methods to execute chunks of PostScript code and calls * several template methods on invocation of selected PS operators (see PSActions). */ -class PSInterpreter -{ +class PSInterpreter { enum Mode {PS_NONE, PS_RUNNING, PS_QUIT}; public: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index c0624cc8c8a..8c5e7276ddb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -69,7 +69,7 @@ void PsSpecialHandler::initialize () { if (_psSection == PS_NONE) { initgraphics(); // execute dvips prologue/header files - for (const char *fname : {"tex.pro", "texps.pro", "special.pro"}) + for (const char *fname : {"tex.pro", "texps.pro", "special.pro", "color.pro"}) processHeaderFile(fname); // disable bop/eop operators to prevent side-effects by // unexpected bops/eops present in PS specials @@ -330,7 +330,7 @@ void PsSpecialHandler::psfile (const string &fname, const unordered_map<string,s auto groupNode = util::make_unique<XMLElementNode>("g"); // append following elements to this group _xmlnode = groupNode.get(); - _psi.execute("\n@beginspecial @setspecial "); // enter \special environment + _psi.execute("\n@beginspecial @setspecial /setpagedevice{@setpagedevice}def "); // enter \special environment EPSFile epsfile(filepath); _psi.limit(epsfile.pslength()); // limit the number of bytes going to be processed _psi.execute(epsfile.istream()); // process EPS file @@ -470,6 +470,20 @@ void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) { /////////////////////////////////////////////////////// +void PsSpecialHandler::setpagedevice (std::vector<double> &p) { + _linewidth = 1; + _linecap = _linejoin = 0; // butt end caps and miter joins + _miterlimit = 4; + _opacityalpha = 1; // fully opaque + _sx = _sy = _cos = 1.0; + _pattern = nullptr; + _currentcolor = Color::BLACK; + _dashoffset = 0; + _dashpattern.clear(); + _path.clear(); +} + + void PsSpecialHandler::gsave (vector<double>&) { _clipStack.dup(); } @@ -645,7 +659,7 @@ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) { } -/** Creates a Matrix object out of a given sequence of 6 double values. +/** Creates a Matrix object from a given sequence of 6 double values. * The given values must be arranged in PostScript matrix order. * @param[in] v vector containing the matrix values * @param[in] startindex vector index of first component diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp index 310a6b8c34e..a9683be77d6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp @@ -142,6 +142,7 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote void setmatrix (std::vector<double> &p) override; void setmiterlimit (std::vector<double> &p) override {_miterlimit = p[0];} void setopacityalpha (std::vector<double> &p) override {_opacityalpha = p[0];} + void setpagedevice (std::vector<double> &p) override; void setpattern (std::vector<double> &p) override; void setrgbcolor (std::vector<double> &rgb) override; void shfill (std::vector<double> &p) override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp index 520d831a1d1..4b17c9cd7e4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -71,29 +71,30 @@ const char *PSInterpreter::PSDEFS = "ength 1 add string dup 0 46 put dup 3 -1 roll 1 exch putinterval}def/setlinewi" "dth{dup/setlinewidth sysexec 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setli" "nejoin 1 defpr/setmiterlimit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash syse" -"xec exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}def/setgstat" -"e{currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd curr" -"entlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd curren" -"trgbcolor 3(setrgbcolor)prcmd matrix currentmatrix aload pop 6(setmatrix)prcmd" -" applyscalevals currentdash mark 3 1 roll exch aload length 1 add -1 roll coun" -"ttomark(setdash)prcmd pop}def/save{@UD begin/@saveID vmstatus pop pop def end " -":save @saveID 1(save)prcmd}def/restore{:restore setgstate @UD/@saveID known{@U" -"D begin @saveID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:gres" -"tore setgstate 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(gresto" -"reall)prcmd}def/rotate{dup type/arraytype ne{dup 1(rotate)prcmd}if/rotate syse" -"xec applyscalevals}def/scale{dup type/arraytype ne{2 copy 2(scale)prcmd}if/sca" -"le sysexec applyscalevals}def/translate{dup type/arraytype ne{2 copy 2(transla" -"te)prcmd}if/translate sysexec}def/setmatrix{dup/setmatrix sysexec aload pop 6(" -"setmatrix)prcmd applyscalevals}def/initmatrix{matrix setmatrix}def/concat{matr" -"ix currentmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1" -" roll>>begin dup/XUID[1000000 @patcnt]put mx/makepattern sysexec dup dup begin" -" PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload pop 15(make" -"pattern)prcmd :newpath matrix setmatrix PaintProc 0 1(makepattern)prcmd end/@p" -"atcnt @patcnt 1 add store end grestore}def/setpattern{begin PatternType 1 eq{P" -"aintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorspace aload length" -" -1 roll pop]setcolorspace/setcolor sysexec XUID aload pop exch pop currentrgb" -"color :grestore 4}ifelse(setpattern)prcmd}{/setpattern sysexec}ifelse end}def/" -"setcolor{dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor sy" -"sexec setrgbcolor}ifelse}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor " -"3 defpr/setrgbcolor 3 defpr/.setopacityalpha{dup/.setopacityalpha sysexec 1(se" -"topacityalpha)prcmd}def "; +"xec exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}def/@setpage" +"device{pop<<>>/setpagedevice sysexec[1 0 0 -1 0 0]setmatrix newpath 0(setpaged" +"evice)prcmd}def/setgstate{currentlinewidth 1(setlinewidth)prcmd currentlinecap" +" 1(setlinecap)prcmd currentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(se" +"tmiterlimit)prcmd currentrgbcolor 3(setrgbcolor)prcmd matrix currentmatrix alo" +"ad pop 6(setmatrix)prcmd applyscalevals currentdash mark 3 1 roll exch aload l" +"ength 1 add -1 roll counttomark(setdash)prcmd pop}def/save{@UD begin/@saveID v" +"mstatus pop pop def end :save @saveID 1(save)prcmd}def/restore{:restore setgst" +"ate @UD/@saveID known{@UD begin @saveID end}{0}ifelse 1(restore)prcmd}def/gsav" +"e 0 defpr/grestore{:grestore setgstate 0(grestore)prcmd}def/grestoreall{:grest" +"oreall setstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne{dup 1(rot" +"ate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype ne{2 c" +"opy 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate{dup type/array" +"type ne{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatrix{dup/setmat" +"rix sysexec aload pop 6(setmatrix)prcmd applyscalevals}def/initmatrix{matrix s" +"etmatrix}def/concat{matrix currentmatrix matrix concatmatrix setmatrix}def/mak" +"epattern{gsave<</mx 3 -1 roll>>begin dup/XUID[1000000 @patcnt]put mx/makepatte" +"rn sysexec dup dup begin PatternType @patcnt BBox aload pop XStep YStep PaintT" +"ype mx aload pop 15(makepattern)prcmd :newpath matrix setmatrix PaintProc 0 1(" +"makepattern)prcmd end/@patcnt @patcnt 1 add store end grestore}def/setpattern{" +"begin PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[curren" +"tcolorspace aload length -1 roll pop]setcolorspace/setcolor sysexec XUID aload" +" pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd}{/setpattern" +" sysexec}ifelse end}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sy" +"sexec/currentrgbcolor sysexec setrgbcolor}ifelse}def/setgray 1 defpr/setcmykco" +"lor 4 defpr/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.setopacityalpha{dup/.seto" +"pacityalpha sysexec 1(setopacityalpha)prcmd}def "; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp index 38a8e51c3f9..95200e15cf9 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.3.4"; +constexpr const char *PROGRAM_VERSION = "2.3.5"; #endif |