diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-09 07:58:00 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-09 07:58:00 +0000 |
commit | 47f304f415afeb211f3a99ad94c16437d5a29da8 (patch) | |
tree | 5b9211b1061e9d10c6160c09f6a32a5c0ca0f499 /Build/source/texk/dvisvgm/dvisvgm-src/src | |
parent | 8aaa27e800cf87938478ac50bd50ab89fcd2f2ec (diff) |
Import dvisvgm 1.13.
git-svn-id: svn://tug.org/texlive/trunk@39061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
18 files changed, 155 insertions, 136 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp index 9553a9d7846..911ff62eb6c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -215,16 +215,6 @@ void DVIToSVGActions::special (const string &spc, double dvi2bp, bool preprocess } -/** This method is called when the DVI preamble was read - * @param[in] cmt preamble comment text. */ -void DVIToSVGActions::preamble (const string &cmt) { -} - - -void DVIToSVGActions::postamble () { -} - - /** This method is called when a "begin of page (bop)" command was found in the DVI file. * @param[in] pageno physical page number * @param[in] c array with 10 components representing \\count0 ... \\count9. c[0] contains the @@ -295,7 +285,7 @@ BoundingBox& DVIToSVGActions::bbox(const string& name, bool reset) { void DVIToSVGActions::progress (const char *id) { if (PROGRESSBAR_DELAY < 1000) { static double time=0; - // slow down updating of the progress indicator to prevent flickering + // slow down updating the progress indicator to prevent flickering if (System::time() - time > 0.1) { progress(0, 0, id); time = System::time(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h index 873f104550a..0ed9c2ce54d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h @@ -29,7 +29,6 @@ #include "SpecialActions.h" #include "SpecialManager.h" #include "SVGTree.h" -#include "DVIReader.h" class DVIToSVG; @@ -67,8 +66,6 @@ class DVIToSVGActions : public DVIActions, public SpecialActions void moveToY (double y); void setFont (int num, const Font *font); void special (const std::string &spc, double dvi2bp, bool preprocessing=false); - void preamble (const std::string &cmt); - void postamble (); void beginPage (unsigned pageno, Int32 *c); void endPage (unsigned pageno); void progress (size_t current, size_t total, const char *id=0); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp index 555e3549760..e813d41e1b8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp @@ -57,8 +57,14 @@ void EPSToSVG::convert () { "lly=" << bbox.minY() << " " "urx=" << bbox.maxX() << " " "ury=" << bbox.maxY(); - PsSpecialHandler pshandler; - pshandler.process("psfile=", ss, this); + try { + PsSpecialHandler pshandler; + pshandler.process("psfile=", ss, this); + } + catch (...) { + progress(0); // remove progress message + throw; + } progress(0); // output SVG file _svg.setBBox(_bbox); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp index d09f3c7d334..01cfa77b2ac 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp @@ -312,7 +312,7 @@ int PhysicalFont::descent () const { * @param[out] glyph path segments of the glyph outline * @param[in] cb optional callback object for tracer class * @return true if outline could be computed */ -bool PhysicalFont::getGlyph (int c, GraphicPath<Int32> &glyph, GFGlyphTracer::Callback *cb) const { +bool PhysicalFont::getGlyph (int c, GraphicsPath<Int32> &glyph, GFGlyphTracer::Callback *cb) const { if (type() == MF) { const Glyph *cached_glyph=0; if (CACHE_PATH) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h index e1959f202e1..cf7f574b445 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h @@ -33,7 +33,7 @@ #include "FontMetrics.h" #include "GFGlyphTracer.h" #include "Glyph.h" -#include "GraphicPath.h" +#include "GraphicsPath.h" #include "MessageException.h" #include "RangeMap.h" #include "ToUnicodeMap.h" diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h index d19f130ceaf..b0e12b76eb6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h @@ -21,8 +21,8 @@ #ifndef DVISVGM_GLYPH_H #define DVISVGM_GLYPH_H -#include "GraphicPath.h" +#include "GraphicsPath.h" -typedef GraphicPath<Int32> Glyph; +typedef GraphicsPath<Int32> Glyph; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h index 6d377eb8a59..59b91ae6f3b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h @@ -1,5 +1,5 @@ /************************************************************************* -** GraphicPath.h ** +** GraphicsPath.h ** ** ** ** This file is part of dvisvgm -- the DVI to SVG converter ** ** Copyright (C) 2005-2015 Martin Gieseking <martin.gieseking@uos.de> ** @@ -32,7 +32,7 @@ template <typename T> -class GraphicPath +class GraphicsPath { friend class PathClipper; public: @@ -101,7 +101,7 @@ class GraphicPath typedef typename std::vector<Command>::const_reverse_iterator ConstRevIterator; public: - GraphicPath (WindingRule wr=WR_NON_ZERO) : _windingRule(wr) {} + GraphicsPath (WindingRule wr=WR_NON_ZERO) : _windingRule(wr) {} void setWindingRule (WindingRule wr) {_windingRule = wr;} WindingRule windingRule () const {return _windingRule;} @@ -121,7 +121,7 @@ class GraphicPath } /// Insert another path at the beginning of this one. - void prepend (const GraphicPath &path) { + void prepend (const GraphicsPath &path) { _commands.insert(_commands.begin(), path._commands.begin(), path._commands.end()); } @@ -176,7 +176,7 @@ class GraphicPath * in the glyph's outline description. All open paths are automatically closed by the renderer. * This method detects all open paths and adds the missing closePath statement. */ void closeOpenSubPaths () { - Command *prevCommand = 0; + Command *prevCommand=0; FORALL(_commands, Iterator, it) { if (it->type == Command::MOVETO && prevCommand && prevCommand->type != Command::CLOSEPATH) { prevCommand = &(*it); @@ -191,6 +191,24 @@ class GraphicPath } + /** Removes redundant path commands commands. Currently, it only removes movetos. */ + void removeRedundantCommands () { + // remove trailing moveto commands + while (_commands.back().type == Command::MOVETO) + _commands.pop_back(); + // resolve intermediate sequences of moveto commands + Iterator it=_commands.begin(); + if (it == _commands.end()) + return; + Iterator prev = it; + for (++it; it != _commands.end(); ++it) { + if (prev->type == Command::MOVETO && it->type == Command::MOVETO) + _commands.erase(prev); + prev = it; + } + } + + /** Writes the path data as SVG path drawing command to a given output stream. * @param[in] os output stream used to write the SVG commands to * @param[in] relative if true, create relative rather than absolute coordinate values @@ -320,7 +338,7 @@ class GraphicPath * @param[in] actions template methods called by each iteration step * @param[in] optimize if true, shorthand drawing commands (sconicto, scubicto,...) are considered */ template <typename T> -void GraphicPath<T>::iterate (Actions &actions, bool optimize) const { +void GraphicsPath<T>::iterate (Actions &actions, bool optimize) const { ConstIterator prev = _commands.end(); // pointer to preceding command Point fp; // first point of current path Point cp; // current point diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am index 837dd0cd633..347862d6619 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -103,7 +103,7 @@ libdvisvgm_a_SOURCES = \ Ghostscript.h \ Glyph.h \ GlyphTracerMessages.h \ - GraphicPath.h \ + GraphicsPath.h \ HtmlSpecialHandler.cpp \ HtmlSpecialHandler.h \ InputBuffer.cpp \ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h index b9c9158a228..aadf40a6ccf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h @@ -25,7 +25,7 @@ #include <string> #include <vector> #include "Bezier.h" -#include "GraphicPath.h" +#include "GraphicsPath.h" #include "MessageException.h" @@ -34,7 +34,7 @@ using ClipperLib::IntPoint; class PathClipper { public: - typedef GraphicPath<double> CurvedPath; + typedef GraphicsPath<double> CurvedPath; public: PathClipper () : _numLines(0) {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index 7140b6be270..175a7b065b6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -318,24 +318,25 @@ void PsSpecialHandler::psfile (const string &fname, const map<string,string> &at _actions->setY(0); moveToDVIPos(); - _xmlnode = new XMLElementNode("g"); + _xmlnode = new XMLElementNode("g"); // append following elements to this group _psi.execute("\n@beginspecial @setspecial "); // enter \special environment _psi.limit(epsfile.pslength()); // limit the number of bytes to be processed _psi.execute(is); // process EPS file _psi.limit(0); // disable limitation _psi.execute("\n@endspecial "); // leave special environment - if (!_xmlnode->empty()) { // has anything been drawn? - Matrix m(1); - m.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); - m.translate(-llx, lly); - m.scale(sx, sy); // resize image to width "rwi" and height "rhi" - m.translate(x, y); // move image to current DVI position - _xmlnode->addAttribute("transform", m.getSVG()); + if (_xmlnode->empty()) // nothing been drawn? + delete _xmlnode; // => don't need to add empty group node + else { // has anything been drawn? + Matrix matrix(1); + matrix.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); + matrix.translate(-llx, lly); + matrix.scale(sx, sy); // resize image to width "rwi" and height "rhi" + matrix.translate(x, y); // move image to current DVI position + if (!matrix.isIdentity()) + _xmlnode->addAttribute("transform", matrix.getSVG()); _actions->appendToPage(_xmlnode); } - else - delete _xmlnode; - _xmlnode = 0; + _xmlnode = 0; // append following elements to page group again // restore DVI position _actions->setX(x); @@ -415,17 +416,17 @@ void PsSpecialHandler::dviEndPage (unsigned) { /////////////////////////////////////////////////////// -void PsSpecialHandler::gsave (vector<double> &p) { +void PsSpecialHandler::gsave (vector<double>&) { _clipStack.dup(); } -void PsSpecialHandler::grestore (vector<double> &p) { +void PsSpecialHandler::grestore (vector<double>&) { _clipStack.pop(); } -void PsSpecialHandler::grestoreall (vector<double> &p) { +void PsSpecialHandler::grestoreall (vector<double>&) { _clipStack.pop(-1, true); } @@ -455,7 +456,7 @@ void PsSpecialHandler::curveto (vector<double> &p) { } -void PsSpecialHandler::closepath (vector<double> &p) { +void PsSpecialHandler::closepath (vector<double>&) { _path.closepath(); } @@ -463,6 +464,7 @@ void PsSpecialHandler::closepath (vector<double> &p) { /** Draws the current path recorded by previously executed path commands (moveto, lineto,...). * @param[in] p not used */ void PsSpecialHandler::stroke (vector<double> &p) { + _path.removeRedundantCommands(); if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) return; @@ -544,6 +546,7 @@ void PsSpecialHandler::stroke (vector<double> &p) { * @param[in] p not used * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) { + _path.removeRedundantCommands(); if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) return; @@ -705,7 +708,7 @@ void PsSpecialHandler::clippath (std::vector<double>&) { * path (see PS language reference, 3rd edition, pp. 193, 542) * @param[in] p not used * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ -void PsSpecialHandler::clip (vector<double> &, bool evenodd) { +void PsSpecialHandler::clip (vector<double>&, bool evenodd) { clip(_path, evenodd); } @@ -716,7 +719,8 @@ void PsSpecialHandler::clip (vector<double> &, bool evenodd) { * @param[in] path path used to restrict the clipping region * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ void PsSpecialHandler::clip (Path &path, bool evenodd) { - // when this method is called, _path contains the clipping path + // when this method is called, _path contains the clipping path + _path.removeRedundantCommands(); if (path.empty() || !_actions) return; @@ -876,7 +880,7 @@ class ShadingCallback : public ShadingPatch::Callback { _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")"); } - void patchSegment (GraphicPath<double> &path, const Color &color) { + void patchSegment (GraphicsPath<double> &path, const Color &color) { if (!_actions->getMatrix().isIdentity()) path.transform(_actions->getMatrix()); @@ -913,7 +917,7 @@ void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace #if 0 if (bgcolorGiven) { // fill whole patch area with given background color - GraphicPath<double> outline; + GraphicsPath<double> outline; patch->getBoundaryPath(outline); callback.patchSegment(outline, bgcolor); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h index 38c04c50afa..31436f7aa49 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h @@ -25,7 +25,7 @@ #include <stack> #include <string> #include <vector> -#include "GraphicPath.h" +#include "GraphicsPath.h" #include "PSInterpreter.h" #include "SpecialHandler.h" #include "PSPattern.h" @@ -37,7 +37,7 @@ class XMLElementNode; class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, protected PSActions { - typedef GraphicPath<double> Path; + typedef GraphicsPath<double> Path; typedef std::vector<double>::const_iterator DoubleVecIt; typedef Color::ColorSpace ColorSpace; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h index 84c44041e5e..1afb1606fa9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h @@ -22,7 +22,7 @@ #define DVISVGM_SHADINGPATCH_H #include "Color.h" -#include "GraphicPath.h" +#include "GraphicsPath.h" #include "MessageException.h" @@ -31,7 +31,7 @@ class ShadingPatch public: struct Callback { virtual ~Callback () {} - virtual void patchSegment (GraphicPath<double> &path, const Color &color) =0; + virtual void patchSegment (GraphicsPath<double> &path, const Color &color) =0; }; typedef std::vector<DPair> PointVec; @@ -43,7 +43,7 @@ class ShadingPatch virtual int psShadingType () const =0; virtual void approximate (int gridsize, bool overlap, double delta, Callback &callback) const =0; virtual void getBBox (BoundingBox &bbox) const =0; - virtual void getBoundaryPath (GraphicPath<double> &path) const =0; + virtual void getBoundaryPath (GraphicsPath<double> &path) const =0; virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) =0; virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) =0; virtual int numPoints (int edgeflag) const =0; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp index 2ad8a4c29dc..9d120626465 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp @@ -202,7 +202,7 @@ Color TensorProductPatch::averageColor (const Color &c1, const Color &c2, const } -void TensorProductPatch::getBoundaryPath (GraphicPath<double> &path) const { +void TensorProductPatch::getBoundaryPath (GraphicsPath<double> &path) const { // Simple approach: Use the outer curves as boundary path. This doesn't always lead // to correct results since, depending on the control points, P(u,v) might exceed // the simple boundary. @@ -323,7 +323,7 @@ void TensorProductPatch::approximateRow (double v1, double inc, bool overlap, do Bezier b2(vbeziers[i + (overlap && i < vbeziers.size()-1 ? 1 : 0)], v1, ov2); Bezier b3(hbezier2, u1, ou2); Bezier b4(vbeziers[i-1], v1, ov2); - GraphicPath<double> path; + GraphicsPath<double> path; path.moveto(b1.point(0)); if (inc > delta) { path.cubicto(b1.point(1), b1.point(2), b1.point(3)); @@ -355,7 +355,7 @@ void TensorProductPatch::approximateRow (double v1, double inc, bool overlap, do void TensorProductPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { if (_colors[0] == _colors[1] && _colors[1] == _colors[2] && _colors[2] == _colors[3]) { // simple case: monochromatic patch - GraphicPath<double> path; + GraphicsPath<double> path; getBoundaryPath(path); callback.patchSegment(path, _colors[0]); } @@ -415,7 +415,7 @@ void TensorProductPatch::approximate (int gridsize, Callback &callback) const { // patch boundary are drawn as Bézier curves, all other edges are approximated // with straight lines. This ensures a smooth outline and reduces the number of // time consuming computations. - GraphicPath<double> path; + GraphicsPath<double> path; path.moveto(p0); if (v1 > 0) path.lineto(p1); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h index 50fcac5a1e5..cc9364ca100 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h @@ -53,7 +53,7 @@ class TensorProductPatch : public ShadingPatch Color averageColor () const; void horizontalCurve (double v, Bezier &bezier) const; void verticalCurve (double u, Bezier &bezier) const; - void getBoundaryPath (GraphicPath<double> &path) const; + void getBoundaryPath (GraphicsPath<double> &path) const; void subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const; DPair blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const; DPair blossomValue (double u[3], double v[3]) const {return blossomValue(u[0], u[1], u[2], v[0], v[1], v[2]);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 93fe0b19385..044b0ef57d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -26,7 +26,7 @@ #include "Color.h" #include "InputBuffer.h" #include "InputReader.h" -#include "GraphicPath.h" +#include "GraphicsPath.h" #include "SpecialActions.h" #include "SVGTree.h" #include "TpicSpecialHandler.h" @@ -128,7 +128,7 @@ void TpicSpecialHandler::drawSplines (double ddist, SpecialActions *actions) { drawLines(true, false, ddist, actions); else { DPair p(actions->getX(), actions->getY()); - GraphicPath<double> path; + GraphicsPath<double> path; path.moveto(p+_points[0]); DPair mid = p+_points[0]+(_points[1]-_points[0])/2.0; path.lineto(mid); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp index 75b3132345b..af8b317b63d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -161,7 +161,7 @@ static inline double snap (double x) { * @param[in] callback object notified */ void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { if (_colors[0] == _colors[1] && _colors[1] == _colors[2]) { - GraphicPath<double> path; + GraphicsPath<double> path; getBoundaryPath(path); callback.patchSegment(path, _colors[0]); } @@ -175,7 +175,7 @@ void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Cal double ov2 = (overlap && snap(v2+inc) <= 1 ? snap(v2+inc) : v2); if (!overlap || (snap(u1+ov2) <= 1 && snap(ou2+v1) <= 1)) { // create triangular segments pointing in the same orientation as the whole patch - GraphicPath<double> path; + GraphicsPath<double> path; path.moveto(valueAt(u1, v1)); path.lineto(valueAt(ou2, v1)); path.lineto(valueAt(u1, ov2)); @@ -197,7 +197,7 @@ void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Cal } -void TriangularPatch::getBoundaryPath(GraphicPath<double> &path) const { +void TriangularPatch::getBoundaryPath(GraphicsPath<double> &path) const { path.clear(); path.moveto(_points[0]); path.lineto(_points[1]); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h index d18d76ebb0a..18f2975f680 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h @@ -41,7 +41,7 @@ class TriangularPatch : public ShadingPatch void setColors (const Color &c1, const Color &c2, const Color &c3); void approximate (int gridsize, bool overlap, double delta, Callback &listener) const; void getBBox (BoundingBox &bbox) const; - void getBoundaryPath(GraphicPath<double> &path) const; + void getBoundaryPath(GraphicsPath<double> &path) const; int numPoints (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} int numColors (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp index a9a818a3fe7..e5a03bf41e8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -21,75 +21,79 @@ #include "PSInterpreter.h" const char *PSInterpreter::PSDEFS = -"3 dict dup begin/Install{matrix setmatrix}def/HWResolution[72 72]def/PageSize[" -"10000 10000]def end setpagedevice/@dodraw true store/@patcnt 0 store/@SD syste" -"mdict def/@UD userdict def true setglobal @SD/:save @SD/save get put @SD/:rest" -"ore @SD/restore get put @SD/:gsave @SD/gsave get put @SD/:grestore @SD/grestor" -"e get put @SD/:grestoreall @SD/grestoreall get put @SD/:newpath @SD/newpath ge" -"t put @SD/:stroke @SD/stroke get put @SD/:fill @SD/fill get put @SD/:eofill @S" -"D/eofill get put @SD/:clip @SD/clip get put @SD/:eoclip @SD/eoclip get put @SD" -"/:charpath @SD/charpath get put @SD/:show @SD/show get put @SD/.setopacityalph" -"a known not{@SD/.setopacityalpha{pop}put}if @SD/prseq{-1 1{-1 roll =only( )pri" -"nt}for(\\n)print}put @SD/prcmd{( )exch(\\ndvi.)3{print}repeat prseq}put @SD/cv" -"xall{{cvx}forall}put @SD/defpr{[exch[/copy @SD]cvxall 5 -1 roll dup 6 1 roll[/" -"get/exec]cvxall 6 -1 roll dup 7 1 roll 4 -1 roll dup 5 1 roll dup length strin" -"g cvs/prcmd cvx]cvx def}put @SD/querypos{{currentpoint}stopped{$error/newerror" -" false put}{2(querypos)prcmd}ifelse}put @SD/applyscalevals{1 0 transform 0 0 t" -"ransform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 0 1 transform 0 0" -" transform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 1 0 transform d" -"up mul exch dup dup mul 3 -1 roll add sqrt div 3(applyscalevals)prcmd}put @SD/" -"prpath{{2(moveto)prcmd}{2(lineto)prcmd}{6(curveto)prcmd}{0(closepath)prcmd}pat" -"hforall}put @SD/charpath{/@dodraw false store :charpath/@dodraw true store}put" -" @SD/show{@dodraw{dup :gsave currentpoint :newpath moveto true charpath eofill" -" :grestore/@dodraw false store :show/@dodraw true store}if}put @SD/newpath{:ne" -"wpath 0 1(newpath)prcmd}put @SD/stroke{@dodraw{1 1(newpath)prcmd prpath 0(stro" -"ke)prcmd :newpath}{:stroke}ifelse}put @SD/fill{@dodraw{1 1(newpath)prcmd prpat" -"h 0(fill)prcmd :newpath}{:fill}ifelse}put @SD/eofill{@dodraw{1 1(newpath)prcmd" -" prpath 0(eofill)prcmd :newpath}{:eofill}ifelse}put @SD/clip{:clip 0 1(newpath" -")prcmd prpath 0(clip)prcmd}put @SD/eoclip{:eoclip 1 1(newpath)prcmd prpath 0(e" -"oclip)prcmd}put @SD/shfill{begin currentdict/ShadingType known currentdict/Col" -"orSpace known and currentdict/DataSource known and currentdict/Function known " -"not and ShadingType 4 ge and DataSource type/arraytype eq and{<</DeviceGray 1/" -"DeviceRGB 3/DeviceCMYK 4/bgknown currentdict/Background known/bbknown currentd" -"ict/BBox known>>begin currentdict ColorSpace known{ShadingType ColorSpace load" -" bgknown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse S" -"hadingType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorS" -"pace load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if en" -"d}if end}put/@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 lt x" -"or{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto ex" -"ch 0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:newpat" -"h dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse cli" -"p :newpath}put @SD/rectfill{gsave :newpath dup type/arraytype eq{aload length " -"4 idiv{@rectcc}repeat}{@rectcc}ifelse fill grestore}put @SD/rectstroke{gsave :" -"newpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ifelse s" -"troke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/clippath " -"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 sysexec" -" applyscalevals 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defp" -"r/setmiterlimit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec applyscal" -"evals exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}def/setgst" -"ate{currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd cu" -"rrentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd curr" -"entrgbcolor 3(setrgbcolor)prcmd 6 array currentmatrix aload pop 6(setmatrix)pr" -"cmd currentdash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setd" -"ash)prcmd pop}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveI" -"D 1(save)prcmd}def/restore{:restore setgstate @UD/@saveID known{@UD begin @sav" -"eID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore setgsta" -"te 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(grestoreall)prcmd}" -"def/rotate{dup type/arraytype ne{dup 1(rotate)prcmd}if/rotate sysexec}def/scal" -"e{dup type/arraytype ne{2 copy 2(scale)prcmd}if/scale sysexec}def/translate{du" -"p type/arraytype ne{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatri" -"x{dup/setmatrix sysexec aload pop 6(setmatrix)prcmd}def/initmatrix{matrix setm" -"atrix}def/concat{matrix currentmatrix matrix concatmatrix setmatrix}def/makepa" -"ttern{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(makepattern)prcmd :newpath matrix setmatrix PaintProc 0 1(mak" -"epattern)prcmd end/@patcnt @patcnt 1 add store end grestore}def/setpattern{beg" -"in PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentco" -"lorspace aload length -1 roll pop]setcolorspace/setcolor sysexec XUID aload po" -"p exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd}{/setpattern sy" -"sexec}ifelse end}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysex" -"ec}ifelse}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbc" -"olor 3 defpr/.setopacityalpha{dup/.setopacityalpha sysexec 1(setopacityalpha)p" -"rcmd}def "; +"<</Install{matrix setmatrix}/HWResolution[72 72]/PageSize[10000 10000]/Imaging" +"BBox null>>setpagedevice/@dodraw true store/@patcnt 0 store/@SD systemdict def" +"/@UD userdict def true setglobal @SD/:save @SD/save get put @SD/:restore @SD/r" +"estore get put @SD/:gsave @SD/gsave get put @SD/:grestore @SD/grestore get put" +" @SD/:grestoreall @SD/grestoreall get put @SD/:newpath @SD/newpath get put @SD" +"/:stroke @SD/stroke get put @SD/:fill @SD/fill get put @SD/:eofill @SD/eofill " +"get put @SD/:clip @SD/clip get put @SD/:eoclip @SD/eoclip get put @SD/:charpat" +"h @SD/charpath get put @SD/:show @SD/show get put @SD/.setopacityalpha known n" +"ot{@SD/.setopacityalpha{pop}put}if @SD/prseq{-1 1{-1 roll =only( )print}for(\\" +"n)print}put @SD/prcmd{( )exch(\\ndvi.)3{print}repeat prseq}put @SD/cvxall{{cvx" +"}forall}put @SD/defpr{[exch[/copy @SD]cvxall 5 -1 roll dup 6 1 roll[/get/exec]" +"cvxall 6 -1 roll dup 7 1 roll 4 -1 roll dup 5 1 roll dup length string cvs/prc" +"md cvx]cvx def}put @SD/querypos{{currentpoint}stopped{$error/newerror false pu" +"t}{2(querypos)prcmd}ifelse}put @SD/applyscalevals{1 0 transform 0 0 transform " +"3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 0 1 transform 0 0 transfor" +"m 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 1 0 transform dup mul ex" +"ch dup dup mul 3 -1 roll add sqrt div 3(applyscalevals)prcmd}put @SD/prpath{{2" +"(moveto)prcmd}{2(lineto)prcmd}{6(curveto)prcmd}{0(closepath)prcmd}pathforall}p" +"ut @SD/charpath{/@dodraw false store :charpath/@dodraw true store}put @SD/show" +"{@dodraw{dup :gsave currentpoint 2{50 mul exch}repeat :newpath moveto 50 50/sc" +"ale sysexec true charpath eofill :grestore/@dodraw false store :show/@dodraw t" +"rue store}{pop}ifelse}put @SD/awidthshow{{1 string dup 0 5 index put :gsave sh" +"ow :grestore pop 0 rmoveto 3 index eq{4 index 4 index rmoveto}if 1 index 1 ind" +"ex rmoveto}exch cshow 5{pop}repeat}put @SD/widthshow{0 0 3 -1 roll pstack awid" +"thshow}put @SD/ashow{0 0 0 6 3 roll awidthshow}put @SD/newpath{:newpath 0 1(ne" +"wpath)prcmd}put @SD/stroke{@dodraw{1 1(newpath)prcmd prpath 0(stroke)prcmd :ne" +"wpath}{:stroke}ifelse}put @SD/fill{@dodraw{1 1(newpath)prcmd prpath 0(fill)prc" +"md :newpath}{:fill}ifelse}put @SD/eofill{@dodraw{1 1(newpath)prcmd prpath 0(eo" +"fill)prcmd :newpath}{:eofill}ifelse}put @SD/clip{:clip 0 1(newpath)prcmd prpat" +"h 0(clip)prcmd}put @SD/eoclip{:eoclip 1 1(newpath)prcmd prpath 0(eoclip)prcmd}" +"put @SD/shfill{begin currentdict/ShadingType known currentdict/ColorSpace know" +"n and currentdict/DataSource known and currentdict/Function known not and Shad" +"ingType 4 ge and DataSource type/arraytype eq and{<</DeviceGray 1/DeviceRGB 3/" +"DeviceCMYK 4/bgknown currentdict/Background known/bbknown currentdict/BBox kno" +"wn>>begin currentdict ColorSpace known{ShadingType ColorSpace load bgknown{1 B" +"ackground aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse ShadingType 5" +" eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorSpace load ad" +"d}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if end}if end}put" +"/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto c" +"losepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0 lt xor{dup 0 exc" +"h rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto exch 0 exch rl" +"ineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:newpath dup type/a" +"rraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse clip :newpath}p" +"ut @SD/rectfill{gsave :newpath dup type/arraytype eq{aload length 4 idiv{@rect" +"cc}repeat}{@rectcc}ifelse fill grestore}put @SD/rectstroke{gsave :newpath dup " +"type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ifelse stroke gresto" +"re}put false setglobal @SD readonly pop/initclip 0 defpr/clippath 0 defpr/syse" +"xec{@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 sysexec applyscalev" +"als 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defpr/setmiterli" +"mit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec applyscalevals exch a" +"load length 1 add -1 roll counttomark(setdash)prcmd pop}def/setgstate{currentl" +"inewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoi" +"n 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd currentrgbcolor " +"3(setrgbcolor)prcmd 6 array currentmatrix aload pop 6(setmatrix)prcmd currentd" +"ash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd po" +"p}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prc" +"md}def/restore{:restore setgstate @UD/@saveID known{@UD begin @saveID end}{0}i" +"felse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore setgstate 0(grestor" +"e)prcmd}def/grestoreall{:grestoreall setstate 0(grestoreall)prcmd}def/rotate{d" +"up type/arraytype ne{dup 1(rotate)prcmd}if/rotate sysexec}def/scale{dup type/a" +"rraytype ne{2 copy 2(scale)prcmd}if/scale sysexec}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}def/initmatrix{matrix setmatrix}def/co" +"ncat{matrix 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 po" +"p 15(makepattern)prcmd :newpath matrix setmatrix PaintProc 0 1(makepattern)prc" +"md end/@patcnt @patcnt 1 add store end grestore}def/setpattern{begin PatternTy" +"pe 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorspace alo" +"ad length -1 roll pop]setcolorspace/setcolor sysexec XUID aload pop exch pop c" +"urrentrgbcolor :grestore 4}ifelse(setpattern)prcmd}{/setpattern sysexec}ifelse" +" end}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrg" +"bcolor sysexec setrgbcolor}ifelse}def/setgray 1 defpr/setcmykcolor 4 defpr/set" +"hsbcolor 3 defpr/setrgbcolor 3 defpr/.setopacityalpha{dup/.setopacityalpha sys" +"exec 1(setopacityalpha)prcmd}def "; |