summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-28 22:04:29 +0000
committerKarl Berry <karl@freefriends.org>2022-02-28 22:04:29 +0000
commitcb2945afa2fa0c769b4846d155071a65cfeec375 (patch)
treea2fd3fb2ceed57fd85f52ebf59a0147eca645621
parent1a5617b426bda97e87e29668c4d180276eafd182 (diff)
dvisvgm 2.13.2
git-svn-id: svn://tug.org/texlive/trunk@62296 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/README2
-rwxr-xr-xBuild/source/texk/dvisvgm/configure22
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog39
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in3
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/NEWS7
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/configure.ac2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.117
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in9
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp16
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp1
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp23
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp1
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp94
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp43
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am6
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in35
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp4
-rw-r--r--Build/source/texk/dvisvgm/version.ac2
18 files changed, 281 insertions, 45 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README
index 4d4ebe5c868..9d0f0e6f258 100644
--- a/Build/source/texk/README
+++ b/Build/source/texk/README
@@ -64,7 +64,7 @@ dvipos - maintained here, by us
dvipsk - maintained here, by us
-dvisvgm 2.13.2 - checked 23feb22
+dvisvgm 2.13.3 - checked 28feb22
https://dvisvgm.de/Downloads/
https://github.com/mgieseki/dvisvgm
https://ctan.org/pkg/dvisvgm
diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure
index dceba59977c..06a9e5139a0 100755
--- a/Build/source/texk/dvisvgm/configure
+++ b/Build/source/texk/dvisvgm/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for dvisvgm (TeX Live) 2.13.2.
+# Generated by GNU Autoconf 2.71 for dvisvgm (TeX Live) 2.13.3.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -629,8 +629,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dvisvgm (TeX Live)'
PACKAGE_TARNAME='dvisvgm--tex-live-'
-PACKAGE_VERSION='2.13.2'
-PACKAGE_STRING='dvisvgm (TeX Live) 2.13.2'
+PACKAGE_VERSION='2.13.3'
+PACKAGE_STRING='dvisvgm (TeX Live) 2.13.3'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1437,7 +1437,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dvisvgm (TeX Live) 2.13.2 to adapt to many kinds of systems.
+\`configure' configures dvisvgm (TeX Live) 2.13.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1509,7 +1509,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dvisvgm (TeX Live) 2.13.2:";;
+ short | recursive ) echo "Configuration of dvisvgm (TeX Live) 2.13.3:";;
esac
cat <<\_ACEOF
@@ -1642,7 +1642,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dvisvgm (TeX Live) configure 2.13.2
+dvisvgm (TeX Live) configure 2.13.3
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2404,7 +2404,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dvisvgm (TeX Live) $as_me 2.13.2, which was
+It was created by dvisvgm (TeX Live) $as_me 2.13.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -9015,7 +9015,7 @@ fi
# Define the identity of the package.
PACKAGE='dvisvgm--tex-live-'
- VERSION='2.13.2'
+ VERSION='2.13.3'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -21413,7 +21413,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-dvisvgm (TeX Live) config.lt 2.13.2
+dvisvgm (TeX Live) config.lt 2.13.3
configured by $0, generated by GNU Autoconf 2.71.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -24822,7 +24822,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dvisvgm (TeX Live) $as_me 2.13.2, which was
+This file was extended by dvisvgm (TeX Live) $as_me 2.13.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24890,7 +24890,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-dvisvgm (TeX Live) config.status 2.13.2
+dvisvgm (TeX Live) config.status 2.13.3
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog
index 69220afffe4..d426c377561 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog
@@ -1,3 +1,42 @@
+2022-02-27 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .appveyor.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile,
+ src/version.hpp:
+ set version to 2.13.3
+
+ * NEWS:
+ updated NEWS
+
+2022-02-26 Martin Gieseking <martin.gieseking@uos.de>
+
+ * doc/dvisvgm.1, doc/dvisvgm.txt.in, src/optimizer/ClipPathReassigner.cpp,
+ src/optimizer/ClipPathReassigner.hpp, src/optimizer/Makefile.am,
+ src/optimizer/SVGOptimizer.cpp:
+ added optimizer module to remove identical clipPath elements
+
+ * doc/dvisvgm.1, doc/dvisvgm.txt.in, src/optimizer/SVGOptimizer.cpp:
+ renamed optimizer module 'remove-clippath' to 'remove-clippaths'
+
+ * src/optimizer/Makefile.am:
+ added missing include path
+
+2022-02-25 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/BoundingBox.cpp, src/BoundingBox.hpp, src/PsSpecialHandler.cpp,
+ src/PsSpecialHandler.hpp:
+ avoid adding clip-path attributes to all elements created from EPS/PDF
+ files
+
+2022-02-24 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PsSpecialHandler.cpp:
+ moved 'transform' attribute of 'svg' element to wrapping group
+closes
+ #178
+
+ * src/PsSpecialHandler.cpp:
+ properly wrap 'svg' element with group
+
2022-02-22 Martin Gieseking <martin.gieseking@uos.de>
* .appveyor.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile,
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
index 307bd6106a8..148e22d55ad 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
@@ -164,7 +164,8 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \
- INSTALL NEWS README
+ INSTALL NEWS README ar-lib compile config.guess config.sub \
+ depcomp install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS
index cd62713981c..a0cc6867abd 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS
@@ -1,3 +1,10 @@
+dvisvgm-2.13.3 (2022-02-27)
+- added SVG optimizer module 'reassign-clippaths' that searches for duplicate
+ clipPath elements, removes them, and updates the clip-path references
+- replaced method to clip embedded EPS/PDF graphics that usually results in
+ faster rendering of the affected SVG sections
+- fixed a regression regarding transformations of embedded EPS/PDF graphics
+
dvisvgm-2.13.2 (2022-02-23)
- improved clipping of embedded EPS/PDF graphics (GH issue #176)
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac
index 0e1a95f7049..5c25b9a4259 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac
@@ -4,7 +4,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([dvisvgm],[2.13.2],[martin.gieseking@uos.de])
+AC_INIT([dvisvgm],[2.13.3],[martin.gieseking@uos.de])
DATE="February 2022"
AC_CONFIG_SRCDIR(src)
AC_CONFIG_HEADERS([config.h])
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1
index 8d9274bfd7c..9356f2910e0 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1
@@ -2,12 +2,12 @@
.\" Title: dvisvgm
.\" Author: Martin Gieseking <martin.gieseking@uos.de>
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 2022-01-18
+.\" Date: 2022-02-26
.\" Manual: dvisvgm Manual
-.\" Source: dvisvgm 2.13.2
+.\" Source: dvisvgm 2.13.3
.\" Language: English
.\"
-.TH "DVISVGM" "1" "2022\-01\-18" "dvisvgm 2\&.13\&.2" "dvisvgm Manual"
+.TH "DVISVGM" "1" "2022\-02\-26" "dvisvgm 2\&.13\&.3" "dvisvgm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -628,7 +628,16 @@ or
\fBid\fR, prevents this\&.
.RE
.PP
-\fBremove\-clippath\fR
+\fBreassign\-clippaths\fR
+.RS 4
+Collects all
+\fBclipPath\fR
+elements that differ only by their IDs\&. Afterwards, the duplicates are removed so that only one remains\&. All
+\fBclip\-path\fR
+attributes referencing one of the duplicates are updated accordingly\&.
+.RE
+.PP
+\fBremove\-clippaths\fR
.RS 4
Removes all redundant
\fIclipPath\fR
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in
index 1fdd5b551bf..fcadbee66b1 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in
@@ -22,7 +22,7 @@ Martin Gieseking <@PACKAGE_BUGREPORT@>
:man source: dvisvgm
:man version: @VERSION@
:man manual: dvisvgm Manual
-:revdate: 2022-01-18 10:32 +0100
+:revdate: 2022-02-26 19:08 +0100
Name
----
@@ -436,7 +436,12 @@ The following list describes the currently available optimizer modules.
inheritable properties, such as +fill+ or +stroke-width+, into account and only removes them from
an element if none of the other attributes, like +id+, prevents this.
- *remove-clippath*;;
+ *reassign-clippaths*;;
+ Collects all +clipPath+ elements that differ only by their IDs. Afterwards, the duplicates are
+ removed so that only one remains. All +clip-path+ attributes referencing one of the duplicates
+ are updated accordingly.
+
+ *remove-clippaths*;;
Removes all redundant 'clipPath' elements. This optimization was already present in former versions
of dvisvgm and was always applied by default. This behavior is retained, i.e. dvisvgm executes
this module even if option *--optimize* is not given. You can use argument 'none' to prevent that.
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp
index d79848f8f91..64b24fd2333 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp
@@ -23,6 +23,7 @@
#include "BoundingBox.hpp"
#include "Matrix.hpp"
#include "utility.hpp"
+#include "SVGTree.hpp"
#include "XMLNode.hpp"
#include "XMLString.hpp"
@@ -272,3 +273,18 @@ unique_ptr<XMLElement> BoundingBox::createSVGRect () const {
rect->addAttribute("fill", "none");
return rect;
}
+
+
+unique_ptr<XMLElement> BoundingBox::createSVGPath () const {
+ GraphicsPath<double> path;
+ path.moveto(minX(), minY());
+ path.lineto(maxX(), minY());
+ path.lineto(maxX(), maxY());
+ path.lineto(minX(), maxY());
+ path.closepath();
+ ostringstream oss;
+ path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
+ auto pathElem = util::make_unique<XMLElement>("path");
+ pathElem->addAttribute("d", oss.str());
+ return pathElem;
+} \ No newline at end of file
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp
index e9ffe2c9465..51da4d04fb4 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp
@@ -79,6 +79,7 @@ class BoundingBox {
std::string svgViewBoxString () const;
std::ostream& write (std::ostream &os) const;
std::unique_ptr<XMLElement> createSVGRect () const;
+ std::unique_ptr<XMLElement> createSVGPath () const;
private:
double _ulx, _uly; ///< coordinates of upper left vertex (in PS point units)
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
index ff853c72ee4..45328fbd182 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
@@ -422,18 +422,8 @@ unique_ptr<SVGElement> PsSpecialHandler::createImageNode (FileType type, const s
node->addAttribute("xlink:href", href);
}
else { // PostScript or PDF
- if (!clip)
- node = util::make_unique<SVGElement>("g");
- else {
- // clip image to its bounding box if flag 'clip' is given
- node = util::make_unique<SVGElement>("svg");
- node->addAttribute("overflow", "hidden");
- node->addAttribute("x", bbox.minX());
- node->addAttribute("y", bbox.minY());
- node->addAttribute("width", bbox.width());
- node->addAttribute("height", bbox.height());
- node->addAttribute("viewBox", bbox.svgViewBoxString());
- }
+ node = util::make_unique<SVGElement>("g"); // put SVG nodes created from the EPS/PDF file in this group
+
_xmlnode = node.get();
_psi.execute(
"\n@beginspecial @setspecial" // enter special environment
@@ -447,6 +437,14 @@ unique_ptr<SVGElement> PsSpecialHandler::createImageNode (FileType type, const s
);
if (node->empty())
node.reset(nullptr);
+ else if (clip) {
+ // clip image to its bounding box if flag 'clip' is given
+ auto clippath = util::make_unique<SVGElement>("clipPath");
+ clippath->addAttribute("id", "imgclip"+ to_string(_imgClipCount));
+ clippath->append(bbox.createSVGPath());
+ node->setClipPathUrl("imgclip"+ to_string(_imgClipCount++));
+ _actions->svgTree().appendToDefs(std::move(clippath));
+ }
_xmlnode = nullptr; // append following elements to page group again
}
return node;
@@ -485,6 +483,7 @@ static bool transform_box_extents (const Matrix &matrix, double &w, double &h, d
void PsSpecialHandler::dviBeginPage (unsigned int pageno, SpecialActions &actions) {
_psi.execute("/@imgbase("+image_base_path(actions)+")store\n"); // path and basename of image files
+ _imgClipCount = 0;
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
index f4a9b333f4f..6a35052b272 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
@@ -184,6 +184,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
double _dashoffset; ///< current dash offset
std::vector<double> _dashpattern;
ClippingStack _clipStack;
+ int _imgClipCount=0; ///< current number of clip paths assigned to images
bool _makingPattern=false; ///< true if executing makepattern operator
std::map<int, std::unique_ptr<PSPattern>> _patterns;
PSTilingPattern *_pattern; ///< current pattern
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp
new file mode 100644
index 00000000000..0f684cd7ebd
--- /dev/null
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp
@@ -0,0 +1,94 @@
+/*************************************************************************
+** ClipPathReassigner.cpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2022 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 **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#include <algorithm>
+#include <set>
+#include <sstream>
+#include "ClipPathReassigner.hpp"
+#include "../XMLNode.hpp"
+#include "../XXHashFunction.hpp"
+
+using namespace std;
+
+const char* ClipPathReassigner::info () const {
+ return "remove duplicate clip paths and update the references";
+}
+
+
+/** Returns a hash value for an XML element where the id attribute is not taken into account.
+ * Two elements that differ only by their id attribute get the same hash value. */
+static uint64_t hash_value (XMLElement *elem) {
+ const char *id = elem->getAttributeValue("id");
+ elem->removeAttribute("id");
+ ostringstream oss;
+ elem->write(oss);
+ uint64_t value = XXH64HashFunction(oss.str().data(), oss.str().length()).digestValue();
+ if (id)
+ elem->addAttribute("id", id);
+ return value;
+}
+
+
+/** Extracts the ID from a local URL reference like url(#abcde) */
+static inline string extract_id_from_url (const string &url) {
+ if (url.length() >= 7) {
+ size_t first = url.find('#');
+ size_t last = url.rfind(')');
+ if (first != string::npos && last != string::npos && first < last)
+ return url.substr(first+1, last-first-1);
+ }
+ return "";
+}
+
+
+void ClipPathReassigner::execute (XMLElement *defs, XMLElement *context) {
+ vector<XMLElement*> clipPathElements;
+ if (!defs || !context || !defs->getDescendants("clipPath", nullptr, clipPathElements))
+ return;
+ map<uint64_t, vector<XMLElement*>> clipPathMap;
+ for (XMLElement *clipPathElement: clipPathElements) {
+ uint64_t hash = hash_value(clipPathElement);
+ clipPathMap[hash].push_back(clipPathElement); // put identical clipPath elements into a common vector
+ }
+ // replace clip path references
+ vector<XMLElement*> descendants;
+ context->getDescendants(nullptr, "clip-path", descendants);
+ for (auto &mapEntry : clipPathMap) {
+ vector<XMLElement*> &identicalClipPathElements = mapEntry.second;
+ set<string> ids;
+ for (auto elem : identicalClipPathElements)
+ ids.insert(elem->getAttributeValue("id"));
+ for (auto it = descendants.begin(); it != descendants.end();) {
+ string id = extract_id_from_url((*it)->getAttributeValue("clip-path"));
+ if (ids.find(id) == ids.end())
+ ++it;
+ else {
+ (*it)->addAttribute("clip-path", string("url(#") + (*ids.begin()) + ")");
+ it = descendants.erase(it); // no need to process this element again
+ }
+ }
+ }
+ // remove redundant clipPath elements
+ for (auto mapEntry : clipPathMap) {
+ auto it = mapEntry.second.begin();
+ for (++it; it != mapEntry.second.end(); ++it)
+ XMLElement::detach(*it);
+ }
+}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp
new file mode 100644
index 00000000000..6abe6d1e009
--- /dev/null
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp
@@ -0,0 +1,43 @@
+/*************************************************************************
+** ClipPathReassigner.hpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2022 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 **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#pragma once
+
+#include <string>
+#include <vector>
+#include "OptimizerModule.hpp"
+
+class ClipPathReassigner : public OptimizerModule {
+ struct NamedPathString {
+ NamedPathString () =default;
+ NamedPathString (const std::string &svgPathName, const char *svgPathString) : name(svgPathName), pathString(svgPathString) {}
+ std::string name;
+ const char *pathString = nullptr;
+ };
+
+ public:
+ void execute (XMLElement*, XMLElement *context) override;
+ const char* info () const override;
+
+ private:
+ std::vector<NamedPathString> _namedPathStrings;
+
+};
+
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am
index 10232c273d3..1b8444c09a4 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am
@@ -2,6 +2,7 @@ noinst_LIBRARIES = liboptimizer.a
liboptimizer_a_SOURCES = \
AttributeExtractor.hpp AttributeExtractor.cpp \
+ ClipPathReassigner.hpp ClipPathReassigner.cpp \
DependencyGraph.hpp \
GroupCollapser.hpp GroupCollapser.cpp \
OptimizerModule.hpp \
@@ -11,4 +12,7 @@ liboptimizer_a_SOURCES = \
TransformSimplifier.hpp TransformSimplifier.cpp \
WSNodeRemover.hpp WSNodeRemover.cpp
-AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include
+include ../../libs/defs.am
+
+AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include $(XXHASH_CFLAGS)
+
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in
index 70d282b3375..079d233ecc1 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in
@@ -88,6 +88,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@HAVE_BROTLI_FALSE@am__append_1 = -I$(dvisvgm_srcdir)/libs/brotli/include
+@HAVE_BROTLI_FALSE@am__append_2 = ../libs/brotli/libbrotli.a
+@HAVE_WOFF2_FALSE@am__append_3 = -I$(dvisvgm_srcdir)/libs/woff2/include
+@HAVE_WOFF2_FALSE@am__append_4 = ../libs/woff2/libwoff2.a
subdir = dvisvgm-src/src/optimizer
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
@@ -120,9 +124,10 @@ am__v_AR_1 =
liboptimizer_a_AR = $(AR) $(ARFLAGS)
liboptimizer_a_LIBADD =
am_liboptimizer_a_OBJECTS = AttributeExtractor.$(OBJEXT) \
- GroupCollapser.$(OBJEXT) RedundantElementRemover.$(OBJEXT) \
- SVGOptimizer.$(OBJEXT) TextSimplifier.$(OBJEXT) \
- TransformSimplifier.$(OBJEXT) WSNodeRemover.$(OBJEXT)
+ ClipPathReassigner.$(OBJEXT) GroupCollapser.$(OBJEXT) \
+ RedundantElementRemover.$(OBJEXT) SVGOptimizer.$(OBJEXT) \
+ TextSimplifier.$(OBJEXT) TransformSimplifier.$(OBJEXT) \
+ WSNodeRemover.$(OBJEXT)
liboptimizer_a_OBJECTS = $(am_liboptimizer_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -140,6 +145,7 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/AttributeExtractor.Po \
+ ./$(DEPDIR)/ClipPathReassigner.Po \
./$(DEPDIR)/GroupCollapser.Po \
./$(DEPDIR)/RedundantElementRemover.Po \
./$(DEPDIR)/SVGOptimizer.Po ./$(DEPDIR)/TextSimplifier.Po \
@@ -209,7 +215,7 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
-am__DIST_COMMON = $(srcdir)/Makefile.in \
+am__DIST_COMMON = $(srcdir)/../../libs/defs.am $(srcdir)/Makefile.in \
$(top_srcdir)/../../build-aux/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -223,8 +229,8 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BROTLI_CFLAGS = @BROTLI_CFLAGS@
-BROTLI_LIBS = @BROTLI_LIBS@
+BROTLI_CFLAGS = @BROTLI_CFLAGS@ $(am__append_1)
+BROTLI_LIBS = @BROTLI_LIBS@ $(am__append_2)
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -305,8 +311,8 @@ STRIP = @STRIP@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
-WOFF2_CFLAGS = @WOFF2_CFLAGS@
-WOFF2_LIBS = @WOFF2_LIBS@
+WOFF2_CFLAGS = @WOFF2_CFLAGS@ $(am__append_3)
+WOFF2_LIBS = @WOFF2_LIBS@ $(am__append_4)
ZLIB_DEPEND = @ZLIB_DEPEND@
ZLIB_INCLUDES = @ZLIB_INCLUDES@
ZLIB_LIBS = @ZLIB_LIBS@
@@ -368,6 +374,7 @@ top_srcdir = @top_srcdir@
noinst_LIBRARIES = liboptimizer.a
liboptimizer_a_SOURCES = \
AttributeExtractor.hpp AttributeExtractor.cpp \
+ ClipPathReassigner.hpp ClipPathReassigner.cpp \
DependencyGraph.hpp \
GroupCollapser.hpp GroupCollapser.cpp \
OptimizerModule.hpp \
@@ -377,12 +384,16 @@ liboptimizer_a_SOURCES = \
TransformSimplifier.hpp TransformSimplifier.cpp \
WSNodeRemover.hpp WSNodeRemover.cpp
-AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include
+@HAVE_POTRACE_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
+@HAVE_POTRACE_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
+@HAVE_XXHASH_FALSE@XXHASH_CFLAGS = -I$(dvisvgm_srcdir)/libs/xxHash
+@HAVE_XXHASH_FALSE@XXHASH_LIBS = ../libs/xxHash/libxxhash.a
+AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include $(XXHASH_CFLAGS)
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../libs/defs.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -402,6 +413,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
+$(srcdir)/../../libs/defs.am $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -427,6 +439,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AttributeExtractor.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClipPathReassigner.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GroupCollapser.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RedundantElementRemover.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGOptimizer.Po@am__quote@ # am--include-marker
@@ -595,6 +608,7 @@ clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
distclean: distclean-am
-rm -f ./$(DEPDIR)/AttributeExtractor.Po
+ -rm -f ./$(DEPDIR)/ClipPathReassigner.Po
-rm -f ./$(DEPDIR)/GroupCollapser.Po
-rm -f ./$(DEPDIR)/RedundantElementRemover.Po
-rm -f ./$(DEPDIR)/SVGOptimizer.Po
@@ -647,6 +661,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/AttributeExtractor.Po
+ -rm -f ./$(DEPDIR)/ClipPathReassigner.Po
-rm -f ./$(DEPDIR)/GroupCollapser.Po
-rm -f ./$(DEPDIR)/RedundantElementRemover.Po
-rm -f ./$(DEPDIR)/SVGOptimizer.Po
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 9ff1b8163f3..4809439c8e6 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp
@@ -25,6 +25,7 @@
#include "../SVGTree.hpp"
#include "AttributeExtractor.hpp"
+#include "ClipPathReassigner.hpp"
#include "GroupCollapser.hpp"
#include "RedundantElementRemover.hpp"
#include "TextSimplifier.hpp"
@@ -42,7 +43,8 @@ SVGOptimizer::SVGOptimizer (SVGTree *svg) : _svg(svg) {
_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("remove-clippath", util::make_unique<RedundantElementRemover>()));
+ _moduleEntries.emplace_back(ModuleEntry("remove-clippaths", util::make_unique<RedundantElementRemover>()));
+ _moduleEntries.emplace_back(ModuleEntry("reassign-clippaths", util::make_unique<ClipPathReassigner>()));
}
diff --git a/Build/source/texk/dvisvgm/version.ac b/Build/source/texk/dvisvgm/version.ac
index 9b9f98ceefd..21c119835dc 100644
--- a/Build/source/texk/dvisvgm/version.ac
+++ b/Build/source/texk/dvisvgm/version.ac
@@ -9,4 +9,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current dvisvgm version
-m4_define([dvisvgm_version], [2.13.2])
+m4_define([dvisvgm_version], [2.13.3])