texlive[62296] Build/source/texk: dvisvgm 2.13.2

commits+karl at tug.org commits+karl at tug.org
Mon Feb 28 23:04:30 CET 2022


Revision: 62296
          http://tug.org/svn/texlive?view=revision&revision=62296
Author:   karl
Date:     2022-02-28 23:04:29 +0100 (Mon, 28 Feb 2022)
Log Message:
-----------
dvisvgm 2.13.2

Modified Paths:
--------------
    trunk/Build/source/texk/README
    trunk/Build/source/texk/dvisvgm/configure
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/NEWS
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp
    trunk/Build/source/texk/dvisvgm/version.ac

Added Paths:
-----------
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp

Modified: trunk/Build/source/texk/README
===================================================================
--- trunk/Build/source/texk/README	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/README	2022-02-28 22:04:29 UTC (rev 62296)
@@ -64,7 +64,7 @@
 
 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

Modified: trunk/Build/source/texk/dvisvgm/configure
===================================================================
--- trunk/Build/source/texk/dvisvgm/configure	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/configure	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 at tug.org>.
 #
@@ -629,8 +629,8 @@
 # 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 at tug.org'
 PACKAGE_URL=''
 
@@ -1437,7 +1437,7 @@
   # 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 @@
 
 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 @@
 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 @@
 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 @@
 
 # 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 @@
 Report bugs to <bug-libtool at 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 @@
 # 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 @@
 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\\"
 

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog	2022-02-28 22:04:29 UTC (rev 62296)
@@ -1,3 +1,42 @@
+2022-02-27  Martin Gieseking  <martin.gieseking at 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 at 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 at 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 at 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 at uos.de>
 
   * .appveyor.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile, 

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in	2022-02-28 22:04:29 UTC (rev 62296)
@@ -164,7 +164,8 @@
   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`; \

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/NEWS
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/NEWS	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/NEWS	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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)
 

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 at uos.de])
+AC_INIT([dvisvgm],[2.13.3],[martin.gieseking at uos.de])
 DATE="February 2022"
 AC_CONFIG_SRCDIR(src)
 AC_CONFIG_HEADERS([config.h])

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1	2022-02-28 22:04:29 UTC (rev 62296)
@@ -2,12 +2,12 @@
 .\"     Title: dvisvgm
 .\"    Author: Martin Gieseking <martin.gieseking at 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,8 +628,17 @@
 \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
 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

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in	2022-02-28 22:04:29 UTC (rev 62296)
@@ -22,7 +22,7 @@
 :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 @@
   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.

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 @@
 	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

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -79,6 +79,7 @@
 		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)

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -422,18 +422,8 @@
 		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 at beginspecial @setspecial"            // enter special environment
@@ -447,6 +437,14 @@
 		);
 		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 @@
 
 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;
 }
 
 

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -184,6 +184,7 @@
 		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

Added: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp	                        (rev 0)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 at 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);
+	}
+}


Property changes on: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.cpp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp	                        (rev 0)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/ClipPathReassigner.hpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 at 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;
+
+};
+

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.am	2022-02-28 22:04:29 UTC (rev 62296)
@@ -2,6 +2,7 @@
 
 liboptimizer_a_SOURCES = \
 	AttributeExtractor.hpp      AttributeExtractor.cpp \
+	ClipPathReassigner.hpp      ClipPathReassigner.cpp \
 	DependencyGraph.hpp \
 	GroupCollapser.hpp          GroupCollapser.cpp  \
 	OptimizerModule.hpp \
@@ -11,4 +12,7 @@
 	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)
+

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/Makefile.in	2022-02-28 22:04:29 UTC (rev 62296)
@@ -88,6 +88,10 @@
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+ at HAVE_BROTLI_FALSE@am__append_1 = -I$(dvisvgm_srcdir)/libs/brotli/include
+ at HAVE_BROTLI_FALSE@am__append_2 = ../libs/brotli/libbrotli.a
+ at HAVE_WOFF2_FALSE@am__append_3 = -I$(dvisvgm_srcdir)/libs/woff2/include
+ at 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 @@
 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_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
@@ -140,6 +145,7 @@
 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 @@
   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 @@
 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 @@
 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 @@
 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 @@
 	TransformSimplifier.hpp     TransformSimplifier.cpp \
   	WSNodeRemover.hpp           WSNodeRemover.cpp
 
-AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include
+ at HAVE_POTRACE_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
+ at HAVE_POTRACE_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
+ at HAVE_XXHASH_FALSE@XXHASH_CFLAGS = -I$(dvisvgm_srcdir)/libs/xxHash
+ at 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 @@
 	    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 @@
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AttributeExtractor.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ClipPathReassigner.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GroupCollapser.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/RedundantElementRemover.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SVGOptimizer.Po at am__quote@ # am--include-marker
@@ -595,6 +608,7 @@
 
 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 @@
 
 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

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp	2022-02-28 22:04:29 UTC (rev 62296)
@@ -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 @@
 	_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>()));
 }
 
 

Modified: trunk/Build/source/texk/dvisvgm/version.ac
===================================================================
--- trunk/Build/source/texk/dvisvgm/version.ac	2022-02-28 21:54:00 UTC (rev 62295)
+++ trunk/Build/source/texk/dvisvgm/version.ac	2022-02-28 22:04:29 UTC (rev 62296)
@@ -9,4 +9,4 @@
 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])



More information about the tex-live-commits mailing list.