diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-21 17:25:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-21 17:25:16 +0000 |
commit | d4696bc762d79099bd38898faea19cd7af41c1f5 (patch) | |
tree | 7da6d0bf4f49c5592296f0f903c94d152ad0d857 /Build/source/texk/dvisvgm/dvisvgm-src/src | |
parent | 4dcaee1b127fff1f88f720d6c18c8e96989b98ef (diff) |
dvisvgm 2.13
git-svn-id: svn://tug.org/texlive/trunk@61679 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
243 files changed, 1389 insertions, 870 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp index 67c6dbcea16..c1f682ca851 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/AGLTable.hpp @@ -2,7 +2,7 @@ ** AGLTable.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp index d37a89c20cc..bb7f72a8448 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp @@ -2,7 +2,7 @@ ** BasicDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp index a71c547fa55..111283f619b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.hpp @@ -2,7 +2,7 @@ ** BasicDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp index b26ed711494..3a3ec317697 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp @@ -2,7 +2,7 @@ ** Bezier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp index 18050ca8578..2749797e59d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.hpp @@ -2,7 +2,7 @@ ** Bezier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp index acf2c40a80f..2fcf74f6e1c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -36,7 +36,7 @@ void BgColorSpecialHandler::preprocess (const string&, std::istream &is, Special if (!_pageColors.empty() && _pageColors.back().first == pageno) _pageColors.back().second = color; else - _pageColors.emplace_back(PageColor(pageno, color)); + _pageColors.emplace_back(pageno, color); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp index 07c13437e57..1194f4b793f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp index c59e4446086..9bdc8813323 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp @@ -2,7 +2,7 @@ ** Bitmap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp index f0bba3b41ea..dcd6a1f19f0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.hpp @@ -2,7 +2,7 @@ ** Bitmap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp index 78f3a19ee58..7276d717dad 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp @@ -2,7 +2,7 @@ ** BoundingBox.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -76,7 +76,7 @@ vector<Length> BoundingBox::extractLengths (string boxstr) { vector<string> lengthStrings = util::split(boxstr, " "); for (const string &lenstr : lengthStrings) { if (!lenstr.empty()) - lengths.emplace_back(Length(lenstr)); + lengths.emplace_back(lenstr); } return lengths; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp index e3b59ebf5de..339bc7eb41f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.hpp @@ -2,7 +2,7 @@ ** BoundingBox.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp index ae245699c57..17ba2c2d1f3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.cpp @@ -2,7 +2,7 @@ ** CLCommandLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp index 9f9814368bc..58001c607f4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLCommandLine.hpp @@ -2,7 +2,7 @@ ** CLCommandLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp index 594610b896f..daaaa3a6373 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CLOption.hpp @@ -2,7 +2,7 @@ ** CLOption.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp index 6c9b10ed10c..5979745e4c3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp @@ -2,7 +2,7 @@ ** CMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp index 606a401ff72..7a6b24e8333 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp @@ -2,7 +2,7 @@ ** CMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp index dfc564f7f2b..ddf3a8fdb16 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp @@ -2,7 +2,7 @@ ** CMapManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -119,7 +119,7 @@ const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, co // try to find a compatible encoding CMap - const bool is_unicode_map = bool(dynamic_cast<const UnicodeCMap*>(cmap)); + const bool is_unicode_map = cmap->mapsToUnicode(); const string ro = cmap->getROString(); for (const CharMapIDToEncName &enc : encodings) { for (const CharMapID &id : charmapIDs) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp index eab32e76466..8b5ff3cf8ce 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.hpp @@ -2,7 +2,7 @@ ** CMapManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp index c56d3bd463a..ff9a76f33ce 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp @@ -2,7 +2,7 @@ ** CMapReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp index 6e9a03ce980..de87c4e4c00 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.hpp @@ -2,7 +2,7 @@ ** CMapReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp index 00490efa045..7a655dcec13 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp @@ -2,7 +2,7 @@ ** Calculator.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp index 50f8fb959cc..9e4002ce72e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.hpp @@ -2,7 +2,7 @@ ** Calculator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp index 0020b38d047..0132e61af23 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp @@ -2,7 +2,7 @@ ** CharMapID.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp index 8b8890bc3ab..2b97a8e58b9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.hpp @@ -2,7 +2,7 @@ ** CharMapID.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp index 1e381f93111..6a0e836ccc4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.hpp @@ -2,7 +2,7 @@ ** Character.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp index 60107be9de4..54d7eb21789 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp @@ -2,7 +2,7 @@ ** Color.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp index 061e3e1236a..19ab9e6d440 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.hpp @@ -2,7 +2,7 @@ ** Color.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp index fed3a985f47..9ea45f4cd4d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp index 0d90283503d..1e62c8c14bd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp index c4a215b301d..fafd9f5ad3a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.hpp @@ -2,7 +2,7 @@ // It is part of the dvisvgm package and published under the terms // of the GNU General Public License version 3, or (at your option) any later version. // See file COPYING for further details. -// Copyright (C) 2016-2021 Martin Gieseking <martin.gieseking@uos.de> +// Copyright (C) 2016-2022 Martin Gieseking <martin.gieseking@uos.de> #ifndef COMMANDLINE_HPP #define COMMANDLINE_HPP @@ -20,7 +20,7 @@ class CommandLine : public CL::CommandLine { CommandLine () : CL::CommandLine( "This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.", "[options] dvifile\n--eps [options] epsfile\n--pdf [options] pdffile", - "Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>" + "Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de>" ) {} CommandLine (int argc, char **argv) : CommandLine() { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp index 064368c24a7..d5d749cc4a9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp @@ -2,7 +2,7 @@ ** DLLoader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp index 558c27d0c3f..6cb35723ee8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.hpp @@ -2,7 +2,7 @@ ** DLLoader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp index f51120ab772..228b8976868 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp @@ -2,7 +2,7 @@ ** DVIActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp index 05d87b89086..094dd6e499b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp @@ -2,7 +2,7 @@ ** DVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -26,7 +26,6 @@ #include "Font.hpp" #include "FontManager.hpp" #include "HashFunction.hpp" -#include "JFM.hpp" #include "utility.hpp" #include "VectorStream.hpp" @@ -203,11 +202,11 @@ void DVIReader::cmdPop (int) { * @param[in] font current font (corresponding to _currFontNum) * @param[in] c character to typeset */ void DVIReader::putVFChar (Font *font, uint32_t c) { - if (auto vf = dynamic_cast<VirtualFont*>(font)) { // is current font a virtual font? + if (auto vf = font_cast<VirtualFont*>(font)) { // is current font a virtual font? FontManager &fm = FontManager::instance(); const vector<uint8_t> *dvi = vf->getDVI(c); // try to get DVI snippet that represents character c Font *firstFont = fm.vfFirstFont(vf); - if (!dvi && (!firstFont || !dynamic_cast<const JFM*>(firstFont->getMetrics()))) + if (!dvi && (!firstFont || !firstFont->getMetrics()->isJFM())) return; fm.enterVF(vf); // enter VF font number context int savedFontNum = _currFontNum; // save current font number @@ -485,7 +484,7 @@ const Font* DVIReader::defineFont (uint32_t fontnum, const string &name, uint32_ else { // TFM-based font specified by name int id = fm.registerFont(fontnum, name, cs, dsize, ssize); font = fm.getFontById(id); - if (auto vf = dynamic_cast<VirtualFont*>(font)) { + if (auto vf = font_cast<VirtualFont*>(font)) { // read vf file, register its font and character definitions fm.enterVF(vf); ifstream ifs(vf->path(), ios::binary); @@ -592,7 +591,7 @@ void DVIReader::cmdXFontDef (int) { FontManager::instance().registerFont(fontnum, fontname, fontIndex, ptsize, style, color); font = FontManager::instance().getFont(fontnum); } - dviXFontDef(fontnum, dynamic_cast<const NativeFont*>(font)); + dviXFontDef(fontnum, font_cast<const NativeFont*>(font)); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp index ff8390f5150..f2daf5da8ae 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp @@ -2,7 +2,7 @@ ** DVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp index c2defd06fe9..45261b99c06 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -2,7 +2,7 @@ ** DVIToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -74,13 +74,10 @@ bool DVIToSVG::COMPUTE_PROGRESS = false; DVIToSVG::HashSettings DVIToSVG::PAGE_HASH_SETTINGS; -DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) : DVIReader(is), _out(out) +DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) + : DVIReader(is), _out(out), _prevWritingMode(WritingMode::LR) { - _pageHeight = _pageWidth = 0; - _tx = _ty = 0; // no cursor translation - _pageByte = 0; _prevXPos = _prevYPos = numeric_limits<double>::min(); - _prevWritingMode = WritingMode::LR; _actions = util::make_unique<DVIToSVGActions>(*this, _svg); } @@ -362,7 +359,7 @@ void DVIToSVG::embedFonts (XMLElement *svgElement) { unordered_set<const Font*> tracedFonts; // collect unique fonts already traced for (const auto &fontchar : usedCharsMap) { const Font *font = fontchar.first; - if (auto ph_font = dynamic_cast<const PhysicalFont*>(font)) { + if (auto ph_font = font_cast<const PhysicalFont*>(font)) { // Check if glyphs should be traced. Only trace the glyphs of unique fonts, i.e. // avoid retracing the same glyphs again if they are referenced in various sizes. if (TRACE_MODE != 0 && tracedFonts.find(ph_font->uniqueFont()) == tracedFonts.end()) { @@ -481,7 +478,7 @@ void DVIToSVG::dviEop () { void DVIToSVG::dviSetChar0 (uint32_t c, const Font *font) { - if (_actions && !dynamic_cast<const VirtualFont*>(font)) + if (_actions && !font_cast<const VirtualFont*>(font)) _actions->setChar(dviState().h+_tx, dviState().v+_ty, c, dviState().d != WritingMode::LR, *font); } @@ -520,7 +517,7 @@ void DVIToSVG::dviPop () { void DVIToSVG::dviFontNum (uint32_t fontnum, SetFontMode, const Font *font) { - if (_actions && font && !dynamic_cast<const VirtualFont*>(font)) + if (_actions && font && !font_cast<const VirtualFont*>(font)) _actions->setFont(FontManager::instance().fontID(fontnum), *font); // all fonts get a recomputed ID } @@ -572,16 +569,18 @@ void DVIToSVG::HashSettings::setParameters (const string ¶mstr) { auto it = paramMap.find(name); if (it != paramMap.end()) _params.insert(it->second); - else if (_algo.empty() && HashFunction::isSupportedAlgorithm(name)) - _algo = name; - else if (!name.empty()) { - string msg = "invalid hash parameter '"+name+"' (supported algorithms: "; - for (string str : HashFunction::supportedAlgorithms()) - msg += str + ", "; - msg.pop_back(); - msg.pop_back(); - msg += ')'; - throw MessageException(msg); + else if (_algo.empty()) { + if (HashFunction::isSupportedAlgorithm(name)) + _algo = name; + else if (!name.empty()) { + string msg = "invalid hash parameter '" + name + "' (supported algorithms: "; + for (string str: HashFunction::supportedAlgorithms()) + msg += str + ", "; + msg.pop_back(); + msg.pop_back(); + msg += ')'; + throw MessageException(msg); + } } } // set default hash algorithm if none is given diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp index 45c957e0868..0ac723019cd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp @@ -2,7 +2,7 @@ ** DVIToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -101,13 +101,13 @@ class DVIToSVG : public DVIReader { SVGTree _svg; SVGOutputBase &_out; std::unique_ptr<DVIActions> _actions; - std::string _bboxFormatString; ///< bounding box size/format set by the user - std::string _transCmds; ///< page transformation commands set by the user - double _pageHeight, _pageWidth; ///< global page height and width stored in the postamble - double _tx, _ty; ///< translation of cursor position - double _prevXPos, _prevYPos; ///< previous cursor position - WritingMode _prevWritingMode; ///< previous writing mode - std::streampos _pageByte; ///< position of the stream pointer relative to the preceding bop (in bytes) + std::string _bboxFormatString; ///< bounding box size/format set by the user + std::string _transCmds; ///< page transformation commands set by the user + double _pageHeight=0, _pageWidth=0; ///< global page height and width stored in the postamble + double _tx=0, _ty=0; ///< translation of cursor position + double _prevXPos, _prevYPos; ///< previous cursor position + WritingMode _prevWritingMode; ///< previous writing mode + std::streampos _pageByte=0; ///< position of the stream pointer relative to the preceding bop (in bytes) }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp index b44843c6bf3..74e0f97aa5b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -105,7 +105,7 @@ void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, co GlyphMetrics metrics; font.getGlyphMetrics(c, vertical, metrics); - auto pf = dynamic_cast<const PhysicalFont*>(&font); + auto pf = font_cast<const PhysicalFont*>(&font); if (PhysicalFont::EXACT_BBOX && pf) { GlyphMetrics exact_metrics; pf->getExactGlyphBox(c, exact_metrics, vertical, &callback); @@ -166,15 +166,13 @@ void DVIToSVGActions::setRule (double x, double y, double height, double width) return; // (x,y) is the lower left corner of the rectangle - auto rect = util::make_unique<XMLElement>("rect"); + auto rect = util::make_unique<SVGElement>("rect"); rect->addAttribute("x", x); rect->addAttribute("y", y-height); rect->addAttribute("height", height); rect->addAttribute("width", width); - if (!getMatrix().isIdentity()) - rect->addAttribute("transform", getMatrix().toSVG()); - if (getColor() != Color::BLACK) - rect->addAttribute("fill", _svg.getColor().svgColorString()); + rect->setTransform(getMatrix()); + rect->setFillColor(_svg.getColor()); _svg.appendToPage(std::move(rect)); // update bounding box @@ -237,12 +235,12 @@ void DVIToSVGActions::endPage (unsigned pageno) { _svg.transformPage(matrix); if (_bgcolor != Color::TRANSPARENT) { // create a rectangle filled with the background color - auto rect = util::make_unique<XMLElement>("rect"); + auto rect = util::make_unique<SVGElement>("rect"); rect->addAttribute("x", _bbox.minX()); rect->addAttribute("y", _bbox.minY()); rect->addAttribute("width", _bbox.width()); rect->addAttribute("height", _bbox.height()); - rect->addAttribute("fill", _bgcolor.svgColorString()); + rect->setFillColor(_bgcolor); _svg.prependToPage(std::move(rect)); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp index ed8a5f9c9b5..651e71f5d39 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -49,6 +49,8 @@ class DVIToSVGActions : public DVIActions, public SpecialActions { void setBgColor (const Color &color) override; void setColor (const Color &color) override {_svg.setColor(color);} void setMatrix (const Matrix &m) override {_svg.setMatrix(m);} + void setOpacity (const Opacity &opacity) override {_svg.setOpacity(opacity);} + const Opacity& getOpacity () const override {return _svg.getOpacity();} const Matrix& getMatrix () const override {return _svg.getMatrix();} Matrix getPageTransformation () const override {return _dvireader->getPageTransformation();} Color getColor () const override {return _svg.getColor();} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp index 224165e2556..87c31dbf089 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp @@ -2,7 +2,7 @@ ** Directory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp index 14360a9f670..7a90c87618e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.hpp @@ -2,7 +2,7 @@ ** Directory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp index 67463a4c597..8fba6d8974b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -81,8 +81,7 @@ void DvisvgmSpecialHandler::preprocessRawSet (InputReader &ir) { _currentMacro = _macros.end(); throw SpecialException("redefinition of SVG fragment '" + id + "'"); } - pair<string, StringVector> entry(id, StringVector()); - pair<MacroMap::iterator, bool> state = _macros.emplace(move(entry)); + pair<MacroMap::iterator, bool> state = _macros.emplace(id, StringVector()); _currentMacro = state.first; } @@ -194,7 +193,7 @@ static void expand_constants (string &str, SpecialActions &actions) { /** Evaluates substrings of the form {?(expr)} where 'expr' is a math expression, * and replaces the substring by the computed value. * @param[in,out] str string to scan for expressions */ -static void evaluate_expressions (string &str, SpecialActions &actions) { +static void evaluate_expressions (string &str, const SpecialActions &actions) { size_t left = str.find("{?("); // start position of expression macro while (left != string::npos) { size_t right = str.find(")}", left+2); // end position of expression macro @@ -386,14 +385,13 @@ void DvisvgmSpecialHandler::processImg (InputReader &ir, SpecialActions &actions Length h = read_length(ir); string f = ir.getString(); update_bbox(w, h, Length(0), false, actions); - auto img = util::make_unique<XMLElement>("image"); + auto img = util::make_unique<SVGElement>("image"); img->addAttribute("x", actions.getX()); img->addAttribute("y", actions.getY()); img->addAttribute("width", w.bp()); img->addAttribute("height", h.bp()); img->addAttribute("xlink:href", f); - if (!actions.getMatrix().isIdentity()) - img->addAttribute("transform", actions.getMatrix().toSVG()); + img->setTransform(actions.getMatrix()); actions.svgTree().appendToPage(std::move(img)); } catch (const UnitException &e) { @@ -448,10 +446,10 @@ void DvisvgmSpecialHandler::XMLParser::parse (const string &xml, SpecialActions // collect/extract an XML fragment that only contains complete tags // incomplete tags are held back _xmlbuf += xml; - size_t left=0, right; + size_t left=0; try { while (left != string::npos) { - right = _xmlbuf.find('<', left); + size_t right = _xmlbuf.find('<', left); if (left < right && left < _xmlbuf.length()) // plain text found? (actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left))); if (right != string::npos) { @@ -523,7 +521,7 @@ void DvisvgmSpecialHandler::XMLParser::openElement (const string &tag, SpecialAc BufferInputReader ir(ib); string name = ir.getString("/ \t\n\r"); ir.skipSpace(); - auto elemNode = util::make_unique<XMLElement>(name); + auto elemNode = util::make_unique<SVGElement>(name); map<string, string> attribs; if (ir.parseAttributes(attribs, true, "\"'")) { for (const auto &attrpair : attribs) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp index f90c283429c..f5ae43f4118 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -29,6 +29,7 @@ class InputReader; class SpecialActions; +class SVGElement; class SVGTree; class XMLElement; class XMLNode; @@ -44,7 +45,7 @@ class XMLNode; class DvisvgmSpecialHandler : public SpecialHandler { class XMLParser { using AppendFunc = void (SVGTree::*)(std::unique_ptr<XMLNode>); - using PushFunc = void (SVGTree::*)(std::unique_ptr<XMLElement>); + using PushFunc = void (SVGTree::*)(std::unique_ptr<SVGElement>); using PopFunc = void (SVGTree::*)(); using NameStack = std::vector<std::string>; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp index 2f61f9f07dc..021598b35d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp @@ -2,7 +2,7 @@ ** EPSFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp index 384af7225ee..6523889df0a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.hpp @@ -2,7 +2,7 @@ ** EPSFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp index 75a574cf38b..df2b635874f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.hpp @@ -2,7 +2,7 @@ ** EPSToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp index bfb3dffd7ed..6de120b0e64 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.cpp @@ -2,7 +2,7 @@ ** EllipticalArc.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -177,7 +177,7 @@ vector<Bezier> EllipticalArc::approximate () const { if (isStraightLine()) { DPair dir = (_endPoint - _startPoint); dir /= dir.length()/3.0; - beziers.emplace_back(Bezier(_startPoint, _startPoint+dir, _endPoint-dir, _endPoint)); + beziers.emplace_back(_startPoint, _startPoint+dir, _endPoint-dir, _endPoint); } else { CenterParams cparams = getCenterParams(); @@ -190,11 +190,11 @@ vector<Bezier> EllipticalArc::approximate () const { if (numCurves > 0) { double c = cos(_rotationAngle); double s = sin(_rotationAngle); - Matrix ellipse = {_rx*c, -_ry*s, cparams.center.x(), _rx*s, _ry*c, cparams.center.y()}; + Matrix ellipse{_rx*c, -_ry*s, cparams.center.x(), _rx*s, _ry*c, cparams.center.y()}; double angle = cparams.startAngle; double diff = cparams.deltaAngle/numCurves; while (numCurves-- > 0) { - beziers.emplace_back(approx_unit_arc(angle, diff).transform(ellipse)); + beziers.push_back(approx_unit_arc(angle, diff).transform(ellipse)); angle += diff; } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp index 78785c4ff12..0c32e583165 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EllipticalArc.hpp @@ -2,7 +2,7 @@ ** EllipticalArc.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp index 95dc58a4ec4..0627e283ecc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -24,9 +24,8 @@ #include "InputReader.hpp" #include "Length.hpp" #include "SpecialActions.hpp" +#include "SVGElement.hpp" #include "SVGTree.hpp" -#include "XMLNode.hpp" -#include "XMLString.hpp" using namespace std; @@ -77,17 +76,19 @@ static DPair cut_vector (char cuttype, const DPair &linedir, double linewidth) { static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, double lw, SpecialActions &actions) { if (actions.outputLocked()) return; - unique_ptr<XMLElement> node; + unique_ptr<SVGElement> node; DPair dir = p2-p1; if (dir.x() == 0 || dir.y() == 0 || (c1 == 'p' && c2 == 'p')) { // draw regular line - node = util::make_unique<XMLElement>("line"); + node = util::make_unique<SVGElement>("line"); node->addAttribute("x1", p1.x()); node->addAttribute("y1", p1.y()); node->addAttribute("x2", p2.x()); node->addAttribute("y2", p2.y()); - node->addAttribute("stroke-width", lw); - node->addAttribute("stroke", actions.getColor().svgColorString()); + node->setStrokeWidth(lw); + node->setStrokeColor(actions.getColor()); + node->setStrokeOpacity(actions.getOpacity()); + // update bounding box DPair cv = cut_vector('p', dir, lw); actions.embed(p1+cv); @@ -97,24 +98,24 @@ static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, dou } else { // draw polygon + vector<DPair> points; DPair cv1 = cut_vector(c1, dir, lw); DPair cv2 = cut_vector(c2, dir, lw); - DPair q11 = p1+cv1, q12 = p1-cv1; - DPair q21 = p2+cv2, q22 = p2-cv2; - ostringstream oss; - oss << XMLString(q11.x()) << ',' << XMLString(q11.y()) << ' ' - << XMLString(q12.x()) << ',' << XMLString(q12.y()) << ' ' - << XMLString(q22.x()) << ',' << XMLString(q22.y()) << ' ' - << XMLString(q21.x()) << ',' << XMLString(q21.y()); - node = util::make_unique<XMLElement>("polygon"); - node->addAttribute("points", oss.str()); - if (actions.getColor() != Color::BLACK) - node->addAttribute("fill", actions.getColor().svgColorString()); + points.push_back(p1+cv1); + points.push_back(p1-cv1); + points.push_back(p2-cv2); + points.push_back(p2+cv2); + + node = util::make_unique<SVGElement>("polygon"); + node->setPoints(points); + node->setFillColor(actions.getColor()); + node->setFillOpacity(actions.getOpacity()); + // update bounding box - actions.embed(q11); - actions.embed(q12); - actions.embed(q21); - actions.embed(q22); + actions.embed(points[0]); + actions.embed(points[1]); + actions.embed(points[2]); + actions.embed(points[3]); } actions.svgTree().appendToPage(std::move(node)); } @@ -236,7 +237,7 @@ void EmSpecialHandler::line (InputReader &ir, SpecialActions& actions) { // Line endpoints don't necessarily have to be defined before // a line definition. If a point isn't defined yet, we put the line // in a wait list and process the lines at the end of the page. - _lines.emplace_back(Line(pointnum1, pointnum2, char(cut1), char(cut2), linewidth)); + _lines.emplace_back(pointnum1, pointnum2, char(cut1), char(cut2), linewidth); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp index fc9f14a4689..704fa0a19a7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp index d08791c03ea..4d39f0886bf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp @@ -2,7 +2,7 @@ ** EncFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp index 0e5f90bcb34..f844dfa34e8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.hpp @@ -2,7 +2,7 @@ ** EncFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp index 3358d5c273c..e7efe2786f3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp @@ -2,7 +2,7 @@ ** FileFinder.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp index 5774f8165ce..904c31c861a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.hpp @@ -2,7 +2,7 @@ ** FileFinder.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp index a8e6a258a1e..998204b6840 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp @@ -2,7 +2,7 @@ ** FilePath.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -37,34 +37,24 @@ static string& single_slashes (string &str) { #ifdef _WIN32 +/** Returns the drive letter of a given path string or 0 if there's none. */ +static char drive_letter (const string &path) { + if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) + return tolower(path[0]); + return '\0'; +} + +/** Removes the drive letter and following colon from a given path string if present. + * @param[in] path path to strip drive letter from + * @return drive letter or 0 if there was none */ static char strip_drive_letter (string &path) { - char letter = 0; + char letter = '\0'; if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) { letter = path[0]; path.erase(0, 2); } - return letter; -} - - -static char adapt_current_path (string &path, char target_drive) { - if (char current_drive = strip_drive_letter(path)) { - if (target_drive != current_drive) { - if (target_drive == 0) - target_drive = current_drive; - if (path.empty() || path[0] != '/') { - if (FileSystem::chdir(string(1, target_drive) + ":")) { - path.insert(0, FileSystem::getcwd()+"/"); - strip_drive_letter(path); - } - else - throw MessageException("drive " + string(1, target_drive) + ": not accessible"); - } - } - } - return target_drive; + return tolower(letter); } - #endif @@ -99,7 +89,7 @@ void FilePath::set (const string &path) { * @param[in] path absolute or relative path to a file or directory * @param[in] isfile true if 'path' references a file, false if a directory is referenced */ void FilePath::set (const string &path, bool isfile) { - init(path, isfile, FileSystem::getcwd()); + init(path, isfile, ""); } @@ -121,47 +111,42 @@ void FilePath::init (string path, bool isfile, string current_dir) { _fname.clear(); single_slashes(path); single_slashes(current_dir); -#ifdef _WIN32 - path = FileSystem::ensureForwardSlashes(path); +#ifndef _WIN32 + if (current_dir.empty()) + current_dir = FileSystem::getcwd(); +#else _drive = strip_drive_letter(path); + if (current_dir.empty() || drive_letter(current_dir) != _drive) + current_dir = FileSystem::getcwd(_drive); + if (!_drive) + _drive = drive_letter(current_dir); + strip_drive_letter(current_dir); + path = FileSystem::ensureForwardSlashes(path); #endif if (isfile) { size_t pos = path.rfind('/'); _fname = path.substr((pos == string::npos) ? 0 : pos+1); - if (pos != string::npos) + // remove filename from path + if (pos == 0 && _fname.length() > 1) // file in root directory? + path.erase(1); + else if (pos != string::npos) path.erase(pos); else path.clear(); } - if (current_dir.empty()) - current_dir = FileSystem::getcwd(); -#ifdef _WIN32 - _drive = adapt_current_path(current_dir, _drive); -#endif - if (!path.empty()) { - if (path[0] == '/') - current_dir.clear(); - else if (current_dir[0] != '/') - current_dir = "/"; - else { - FilePath curr(current_dir, false, "/"); - current_dir = curr.absolute(); -#ifdef _WIN32 - adapt_current_path(current_dir, _drive); -#endif - } - } - path.insert(0, current_dir + "/"); + if ((path.empty() || path[0] != '/') && !current_dir.empty()) + path.insert(0, current_dir + "/"); string elem; for (char c : path) { if (c != '/') elem += c; - else { + else if (!elem.empty()){ add(elem); elem.clear(); } } - add(elem); + if (!elem.empty()) + add(elem); } @@ -169,7 +154,7 @@ void FilePath::init (string path, bool isfile, string current_dir) { void FilePath::add (const string &dir) { if (dir == ".." && !_dirs.empty()) _dirs.pop_back(); - else if (dir.length() > 0 && dir != ".") + else if (!dir.empty() && dir != ".") _dirs.emplace_back(dir); } @@ -223,16 +208,16 @@ string FilePath::basename () const { * @return the absolute path string */ string FilePath::absolute (bool with_filename) const { string path; +#ifdef _WIN32 + if (_drive) + path = string(1, _drive) + ":"; +#endif for (const Directory &dir : _dirs) path += "/" + string(dir); if (path.empty()) path = "/"; if (with_filename && !_fname.empty()) path += "/"+_fname; -#ifdef _WIN32 - if (_drive) - path.insert(0, string(1, _drive) + ":"); -#endif return single_slashes(path); } @@ -245,28 +230,32 @@ string FilePath::absolute (bool with_filename) const { * @param[in] with_filename if false, the filename is omitted * @return the relative path string */ string FilePath::relative (string reldir, bool with_filename) const { +#ifdef _WIN32 + char reldrive = drive_letter(reldir); + if (reldir.empty()) { + reldir = FileSystem::getcwd(_drive); + reldrive = drive_letter(FileSystem::getcwd()); + } + bool isAbsolute = (reldir[0] == '/') + || (reldir.length() >= 3 && isalpha(reldir[0]) && reldir[1] == ':' && reldir[2] == '/'); +#else if (reldir.empty()) reldir = FileSystem::getcwd(); -#ifdef _WIN32 - adapt_current_path(reldir, _drive); + bool isAbsolute = (reldir[0] == '/'); #endif - if (reldir[0] != '/') + if (!isAbsolute) return absolute(); - FilePath rel(reldir, false); + FilePath relpath(reldir, false); string path; -#ifdef _WIN32 - if (rel._drive && _drive && tolower(rel._drive) != tolower(_drive)) - path += string(1, _drive) + ":"; -#endif auto it1 = _dirs.begin(); - auto it2 = rel._dirs.begin(); - while (it1 != _dirs.end() && it2 != rel._dirs.end() && *it1 == *it2) + auto it2 = relpath._dirs.begin(); + while (it1 != _dirs.end() && it2 != relpath._dirs.end() && *it1 == *it2) ++it1, ++it2; - for (; it2 != rel._dirs.end(); ++it2) + for (; it2 != relpath._dirs.end(); ++it2) path += "../"; for (; it1 != _dirs.end(); ++it1) path += string(*it1) + "/"; - if (!path.empty()) + if (!path.empty() && path.back() == '/') path.erase(path.length()-1, 1); // remove trailing slash if (with_filename && !_fname.empty()) { if (!path.empty() && path != "/") @@ -275,6 +264,10 @@ string FilePath::relative (string reldir, bool with_filename) const { } if (path.empty()) path = "."; +#ifdef _WIN32 + if (relpath._drive && _drive && _drive != reldrive) + path.insert(0, string(1, _drive) + ":"); +#endif return single_slashes(path); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp index af81db66f45..31f03e92428 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp @@ -2,7 +2,7 @@ ** FilePath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp index 92960138e71..4e8e43ddd77 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp @@ -2,7 +2,7 @@ ** FileSystem.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp index 0c13f178e96..86f6dbf2017 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp @@ -2,7 +2,7 @@ ** FileSystem.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp index b6166b15dca..fcef7437486 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FixWord.hpp @@ -2,7 +2,7 @@ ** FixWord.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp index ff93c81cd0b..9627c421e21 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp @@ -2,7 +2,7 @@ ** Font.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -621,14 +621,14 @@ double NativeFont::italicCorr(int c) const { double NativeFont::charHeight (int c) const { FontEngine::instance().setFont(*this); int upem = FontEngine::instance().getUnitsPerEM(); - return upem ? (scaledSize()*FontEngine::instance().getAscender()/upem) : 0; + return upem ? (scaledSize()*FontEngine::instance().getHeight(Character(Character::INDEX, c))/upem) : 0; } double NativeFont::charDepth (int c) const { FontEngine::instance().setFont(*this); int upem = FontEngine::instance().getUnitsPerEM(); - return upem ? (scaledSize()*FontEngine::instance().getDescender()/upem) : 0; + return upem ? (scaledSize()*FontEngine::instance().getDepth(Character(Character::INDEX, c))/upem) : 0; } @@ -679,3 +679,11 @@ const vector<uint8_t>* VirtualFontImpl::getDVI (int c) const { return (it == _charDefs.end() ? nullptr : &it->second); } +////////////////////////////////////////////////////////////////////////////// + +void PhysicalFont::visit (FontVisitor &visitor) {visitor.visited(this);} +void VirtualFont::visit (FontVisitor &visitor) {visitor.visited(this);} +void NativeFont::visit (FontVisitor &visitor) {visitor.visited(this);} +void PhysicalFont::visit (FontVisitor &visitor) const {visitor.visited(this);} +void VirtualFont::visit (FontVisitor &visitor) const {visitor.visited(this);} +void NativeFont::visit (FontVisitor &visitor) const {visitor.visited(this);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp index 0c341b8e69d..23c99e3bc57 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp @@ -2,7 +2,7 @@ ** Font.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -50,6 +50,7 @@ struct GlyphMetrics { double wl, wr, h, d; }; +class FontVisitor; /** Abstract base for all font classes. */ class Font { @@ -69,17 +70,19 @@ class Font { virtual const char* path () const =0; virtual const char* filename () const; virtual const FontEncoding* encoding () const; - virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *callback=nullptr) const =0; + virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *callback) const =0; virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const; virtual uint32_t unicode (uint32_t c) const; virtual void tidy () const {} virtual bool findAndAssignBaseFontMap () {return true;} - virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;} + virtual bool verticalLayout () const {return getMetrics() != nullptr && getMetrics()->verticalLayout();} virtual bool verifyChecksums () const {return true;} virtual int fontIndex () const {return 0;} virtual const FontStyle* style () const {return nullptr;} virtual Color color () const {return Color::BLACK;} virtual const FontMap::Entry* fontMapEntry () const; + virtual void visit (FontVisitor &visitor) =0; + virtual void visit (FontVisitor &visitor) const =0; }; @@ -100,7 +103,9 @@ class EmptyFont : public Font { double italicCorr (int c) const override {return 0;} const FontMetrics* getMetrics () const override {return nullptr;} const char* path () const override {return nullptr;} - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override {return false;} + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback*) const override {return false;} + void visit (FontVisitor &visitor) override {} + void visit (FontVisitor &visitor) const override {} private: std::string _fontname; @@ -115,9 +120,9 @@ class PhysicalFont : public virtual Font { static std::unique_ptr<Font> create (const std::string &name, uint32_t checksum, double dsize, double ssize, PhysicalFont::Type type); static std::unique_ptr<Font> create (const std::string &name, int fontindex, uint32_t checksum, double dsize, double ssize); virtual Type type () const =0; - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override; - virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=nullptr) const; - virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=nullptr) const; + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb) const override; + virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb) const; + virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb) const; virtual bool isCIDFont () const; virtual int hAdvance () const; virtual std::string familyName () const; @@ -129,12 +134,14 @@ class PhysicalFont : public virtual Font { virtual double scaledAscent () const; virtual int ascent () const; virtual int descent () const; - virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=nullptr) const; + virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const; virtual int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const; virtual CharMapID getCharMapID () const =0; virtual void setCharMapID (const CharMapID &id) {} virtual Character decodeChar (uint32_t c) const; const char* path () const override; + void visit (FontVisitor &visitor) override; + void visit (FontVisitor &visitor) const override; protected: bool createGF (std::string &gfname) const; @@ -159,7 +166,9 @@ class VirtualFont : public virtual Font { public: static std::unique_ptr<Font> create (const std::string &name, uint32_t checksum, double dsize, double ssize); virtual const DVIVector* getDVI (int c) const =0; - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override {return false;} + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback*) const override {return false;} + void visit (FontVisitor &visitor) override; + void visit (FontVisitor &visitor) const override; protected: virtual void assignChar (uint32_t c, DVIVector &&dvi) =0; @@ -272,6 +281,8 @@ class NativeFont : public PhysicalFont { Color color () const override {return _color;} const FontMap::Entry* fontMapEntry () const override {return nullptr;} static std::string uniqueName (const std::string &path, const FontStyle &style); + void visit (FontVisitor &visitor) override; + void visit (FontVisitor &visitor) const override; protected: NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {} @@ -390,6 +401,33 @@ class VirtualFontImpl : public VirtualFont, public TFMFont { }; +struct FontVisitor { + virtual ~FontVisitor () =default; + virtual void visited (const PhysicalFont *font) {} + virtual void visited (const VirtualFont *font) {} + virtual void visited (const NativeFont *font) {visited(static_cast<const PhysicalFont*>(font));} + virtual void visited (PhysicalFont *font) {} + virtual void visited (VirtualFont *font) {} + virtual void visited (NativeFont *font) {visited(static_cast<PhysicalFont*>(font));} +}; + + +/** This function works similar to dynamic_cast but only on pointers to Font classes. + * It uses double dispatch instead of RTTI and should therefore be faster. + * @param[in] font font pointer to be cast + * @return cast pointer on success, nullptr otherwise */ +template <typename C> +C font_cast (typename util::set_const_of<Font>::by<typename std::remove_pointer<C>::type>::type *font) { + struct : FontVisitor { + void visited (C font) override {result = font;} + C result = nullptr; + } visitor; + if (font) + font->visit(visitor); + return visitor.result; +} + + struct FontException : public MessageException { explicit FontException (const std::string &msg) : MessageException(msg) {} }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp index 09a88a2d2a8..44b4de521ef 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp @@ -2,7 +2,7 @@ ** FontCache.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -281,9 +281,9 @@ bool FontCache::fontinfo (const string &dirname, vector<FontInfo> &infos, vector string path = dirname+"/"+(fname.substr(1)); ifstream ifs(path, ios::binary); if (fontinfo(ifs, info)) - infos.emplace_back(move(info)); + infos.push_back(move(info)); else - invalid.emplace_back(fname.substr(1)); + invalid.push_back(fname.substr(1)); } } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp index e7bbf36126f..01333d05d65 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.hpp @@ -2,7 +2,7 @@ ** FontCache.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp index afc221063e5..9ba9dcd488e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp @@ -2,7 +2,7 @@ ** FontEncoding.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp index 141f4486fe5..b0425f47a6b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.hpp @@ -2,7 +2,7 @@ ** FontEncoding.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp index 56ae0a9f78c..630570046f9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp @@ -2,7 +2,7 @@ ** FontEngine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -103,7 +103,7 @@ bool FontEngine::setFont (const Font &font) { return true; if (const char *path=font.path()) { - auto pf = dynamic_cast<const PhysicalFont*>(&font); + auto pf = font_cast<const PhysicalFont*>(&font); if (setFont(path, font.fontIndex(), pf ? pf->getCharMapID() : CharMapID())) { _currentFont = &font; return true; @@ -239,6 +239,33 @@ int FontEngine::getVAdvance (const Character &c) const { } +int FontEngine::getWidth (const Character &c) const { + if (_currentFace) { + FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); + return _currentFace->glyph->metrics.width; + } + return 0; +} + + +int FontEngine::getHeight (const Character &c) const { + if (_currentFace) { + FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); + return _currentFace->glyph->metrics.horiBearingY; + } + return 0; +} + + +int FontEngine::getDepth (const Character &c) const { + if (_currentFace) { + FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); + return _currentFace->glyph->metrics.height - _currentFace->glyph->metrics.horiBearingY; + } + return 0; +} + + int FontEngine::charIndex (const Character &c) const { if (!_currentFace || !_currentFace->charmap) return c.type() == Character::NAME ? 0 : c.number(); @@ -308,7 +335,7 @@ int FontEngine::getCharMapIDs (vector<CharMapID> &charmapIDs) const { if (_currentFace) { for (int i=0; i < _currentFace->num_charmaps; i++) { FT_CharMap charmap = _currentFace->charmaps[i]; - charmapIDs.emplace_back(CharMapID(charmap->platform_id, charmap->encoding_id)); + charmapIDs.emplace_back(charmap->platform_id, charmap->encoding_id); } } return charmapIDs.size(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp index 45d9c6d3b63..d7c1496c2bc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.hpp @@ -2,7 +2,7 @@ ** FontEngine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -54,6 +54,9 @@ class FontEngine { int getHAdvance () const; int getHAdvance (const Character &c) const; int getVAdvance (const Character &c) const; + int getWidth (const Character &c) const; + int getHeight (const Character &c) const; + int getDepth (const Character &c) const; int getFirstChar () const; int getNextChar () const; int getCharMapIDs (std::vector<CharMapID> &charmapIDs) const; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp index 33135135c1b..2262346c60d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp @@ -2,7 +2,7 @@ ** FontManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -221,16 +221,14 @@ int FontManager::registerFont (uint32_t fontnum, const string &name, uint32_t ch } _name2id[name] = newid; } - _fonts.emplace_back(std::move(newfont)); + _fonts.push_back(std::move(newfont)); if (_vfStack.empty()) // register font referenced in dvi file? _num2id[fontnum] = newid; else { // register font referenced in vf file const VirtualFont *vf = _vfStack.top(); _vfnum2id[vf][fontnum] = newid; - if (_vfFirstFontNumMap.find(vf) == _vfFirstFontNumMap.end()) { // first fontdef of VF? - _vfFirstFontNumMap.emplace(vf, fontnum); - _vfFirstFontMap.emplace(vf, _fonts.back().get()); - } + _vfFirstFontNumMap.emplace(vf, fontnum); + _vfFirstFontMap.emplace(vf, _fonts.back().get()); } return newid; } @@ -269,7 +267,7 @@ int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex, const int newid = _fonts.size(); // the new font gets this ID auto it = _name2id.find(fontname); if (it != _name2id.end()) { // font with same name already registered? - if (auto font = dynamic_cast<NativeFont*>(_fonts[it->second].get())) + if (auto font = font_cast<NativeFont*>(_fonts[it->second].get())) newfont = font->clone(ptsize, style, color); } else { @@ -291,7 +289,7 @@ int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex, } _name2id[fontname] = newid; } - _fonts.emplace_back(std::move(newfont)); + _fonts.push_back(std::move(newfont)); _num2id[fontnum] = newid; return newid; } @@ -330,7 +328,7 @@ ostream& FontManager::write (ostream &os, Font *font, int level) { if (_fonts[i] == font) id = i; - VirtualFont *vf = dynamic_cast<VirtualFont*>(font); + VirtualFont *vf = font_cast<VirtualFont*>(font); for (int j=0; j < level+1; j++) os << " "; os << "id " << id diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp index 413b649169f..e371e6bac6f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.hpp @@ -2,7 +2,7 @@ ** FontManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp index a16d38aa2f0..e5c0caef5de 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp @@ -2,7 +2,7 @@ ** FontMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp index 8ed65199220..c681e24dba2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.hpp @@ -2,7 +2,7 @@ ** FontMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp index b2cba248181..1391f9e630a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp @@ -2,7 +2,7 @@ ** FontMetrics.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp index 53cafbb827d..b9f5b260d8f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.hpp @@ -2,7 +2,7 @@ ** FontMetrics.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -43,6 +43,7 @@ struct FontMetrics { virtual uint32_t getChecksum () const =0; virtual uint16_t firstChar () const =0; virtual uint16_t lastChar () const =0; + virtual bool isJFM () const {return false;} static std::unique_ptr<FontMetrics> read (const std::string &fontname); }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp index 094ba2da1f8..125099f9e7e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.hpp @@ -2,7 +2,7 @@ ** FontStyle.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp index ad1a6dd77c0..b05f63c3dff 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.cpp @@ -2,7 +2,7 @@ ** FontWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -59,7 +59,7 @@ const FontWriter::FontFormatInfo* FontWriter::fontFormatInfo (FontFormat format) vector<string> FontWriter::supportedFormats () { vector<string> formats; for (const FontFormatInfo &info : _formatInfos) - formats.emplace_back(info.formatstr_short); + formats.push_back(info.formatstr_short); return formats; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp index 1fa5dab4db6..2bf1b90edd4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontWriter.hpp @@ -2,7 +2,7 @@ ** FontWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp index fc900dc6a92..7c2e19f3c4f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -25,7 +25,7 @@ using namespace std; /** Constructs a new glyph tracer. * @param[in] is GF input stream * @param[in] upp target units per PS point */ -GFGlyphTracer::GFGlyphTracer (string &fname, double upp, Callback *cb) +GFGlyphTracer::GFGlyphTracer (const string &fname, double upp, Callback *cb) : GFTracer(_ifs, upp), _callback(cb) { if (_callback) @@ -34,7 +34,7 @@ GFGlyphTracer::GFGlyphTracer (string &fname, double upp, Callback *cb) } -void GFGlyphTracer::reset (string &fname, double upp) { +void GFGlyphTracer::reset (const string &fname, double upp) { if (_callback) _callback->setFont(fname); if (_ifs.is_open()) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp index 2f3ed818143..030cb27ac59 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.hpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -38,8 +38,8 @@ class GFGlyphTracer : public GFTracer { public: GFGlyphTracer () : GFTracer(_ifs, 0) {} - GFGlyphTracer (std::string &fname, double upp, Callback *cb=nullptr); - void reset (std::string &fname, double upp); + GFGlyphTracer (const std::string &fname, double upp, Callback *cb=nullptr); + void reset (const std::string &fname, double upp); void setCallback (Callback *cb) {_callback = cb;} bool executeChar (uint8_t c) override; void moveTo (double x, double y) override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp index 3fdba80d9c2..6c0fd1e5eb2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp @@ -2,7 +2,7 @@ ** GFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -92,7 +92,7 @@ int GFReader::executeCommand () { if (opcode < 0) // at end of file? throw GFException("unexpected end of file"); - if (opcode >= 0 && opcode <= 63) + if (opcode <= 63) cmdPaint0(opcode); else if (opcode >= 74 && opcode <= 238) cmdNewRow(opcode-74); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp index 401f89babbb..efbb130475b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.hpp @@ -2,7 +2,7 @@ ** GFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp index 408fb49d0bb..dd761ecaf24 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp @@ -2,7 +2,7 @@ ** GFTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp index f52ffd6cc82..083395e9c3e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.hpp @@ -2,7 +2,7 @@ ** GFTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp index bef8a68b92a..f4aa6e00aa7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp @@ -2,7 +2,7 @@ ** Ghostscript.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -215,7 +215,7 @@ bool Ghostscript::available () { /** Retrieves version information about Ghostscript. * @param[out] r takes the revision information (see GS API documentation for further details) * @return true on success */ -bool Ghostscript::revision (gsapi_revision_t *r) { +bool Ghostscript::revision (gsapi_revision_t *r) const { #if defined(HAVE_LIBGS) return (gsapi_revision(r, sizeof(gsapi_revision_t)) == 0); #else @@ -227,7 +227,7 @@ bool Ghostscript::revision (gsapi_revision_t *r) { /** Returns the revision number of the GS library. */ -int Ghostscript::revision () { +int Ghostscript::revision () const { gsapi_revision_t r; if (revision(&r)) return static_cast<int>(r.revision); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp index 883b42d1762..9faa63e360b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.hpp @@ -2,7 +2,7 @@ ** Ghostscript.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -78,8 +78,8 @@ class Ghostscript ~Ghostscript (); bool init (int argc, const char **argv, void *caller=nullptr); bool available (); - bool revision (gsapi_revision_t *r); - int revision (); + bool revision (gsapi_revision_t *r) const; + int revision () const; std::string revisionstr (); int set_stdio (Stdin in, Stdout out, Stderr err); int run_string_begin (int user_errors, int *pexit_code); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp index 37de9bd58cb..fb6a4855200 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.hpp @@ -2,7 +2,7 @@ ** Glyph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp index 32f4f08955d..15c607faea6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.hpp @@ -2,7 +2,7 @@ ** GlyphTracerMessages.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp index 27d45472524..9d270871cf0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.hpp @@ -2,7 +2,7 @@ ** GraphicsPath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -20,6 +20,7 @@ #pragma once +#include <algorithm> #include <array> #include <cctype> #include <cmath> @@ -662,24 +663,14 @@ class GraphicsPath { bool operator == (const GraphicsPath &path) const { if (size() != path.size()) return false; - auto it = _commands.begin(); - for (const auto &cmd : path._commands) { - if (*it++ != cmd) - return false; - } - return true; + return std::equal(_commands.begin(), _commands.end(), path._commands.begin()); } /** Returns true if this path differs from another one (command-wise). */ bool operator != (const GraphicsPath &path) const { if (size() != path.size()) return true; - auto it = _commands.begin(); - for (const auto &cmd : path._commands) { - if (*it++ != cmd) - return true; - } - return false; + return !std::equal(_commands.begin(), _commands.end(), path._commands.begin()); } /** Iterates over all commands defining this path and calls the corresponding template methods. diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp index bada148b6c7..b97084f3287 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.cpp @@ -2,7 +2,7 @@ ** HashFunction.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp index 5efbdf84684..15f7725543a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HashFunction.hpp @@ -2,7 +2,7 @@ ** HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp index dca8111405d..33d980fa723 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp index 2122ed749d5..4bdabfda773 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.hpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp index 09b48156307..2371234499b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp @@ -2,7 +2,7 @@ ** HyperlinkManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -106,7 +106,7 @@ void HyperlinkManager::createLink (string uri, SpecialActions &actions) { uri = "/" + uri; uri = _base + uri; } - auto anchorNode = util::make_unique<XMLElement>("a"); + auto anchorNode = util::make_unique<SVGElement>("a"); anchorNode->addAttribute("xlink:href", uri); anchorNode->addAttribute("xlink:title", XMLString(name.empty() ? uri : name, false)); actions.svgTree().pushPageContext(std::move(anchorNode)); @@ -148,14 +148,14 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) { if (bbox.width() > 0 && bbox.height() > 0) { // does the bounding box extend in both dimensions? if (MARKER_TYPE != MarkerType::NONE) { const double linewidth = _linewidth >= 0 ? _linewidth : min(0.5, bbox.height()/15); - auto rect = util::make_unique<XMLElement>("rect"); + auto rect = util::make_unique<SVGElement>("rect"); double x = bbox.minX(); double y = bbox.maxY()+linewidth; double w = bbox.width(); double h = linewidth; const Color linecolor = COLORSOURCE == ColorSource::DEFAULT ? actions.getColor() : LINK_LINECOLOR; if (MARKER_TYPE == MarkerType::LINE) - rect->addAttribute("fill", linecolor.svgColorString()); + rect->setFillColor(linecolor); else { const double offset = _linewidth < 0 ? linewidth : 0 ; x -= offset; @@ -163,16 +163,16 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) { w += 2*offset; h += bbox.height()+offset; if (MARKER_TYPE == MarkerType::BGCOLOR) { - rect->addAttribute("fill", LINK_BGCOLOR.svgColorString()); + rect->setFillColor(LINK_BGCOLOR); if (COLORSOURCE != ColorSource::DEFAULT) { - rect->addAttribute("stroke", linecolor.svgColorString()); - rect->addAttribute("stroke-width", linewidth); + rect->setStrokeColor(linecolor); + rect->setStrokeWidth(linewidth); } } else { // LM_BOX - rect->addAttribute("fill", "none"); - rect->addAttribute("stroke", linecolor.svgColorString()); - rect->addAttribute("stroke-width", linewidth); + rect->setNoFillColor(); + rect->setStrokeColor(linecolor); + rect->setStrokeWidth(linewidth); } } rect->addAttribute("x", x); @@ -192,13 +192,13 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) { // Create an invisible rectangle around the linked area so that it's easier to access. // This is only necessary when using paths rather than real text elements together with fonts. if (!SVGTree::USE_FONTS) { - auto rect = util::make_unique<XMLElement>("rect"); + auto rect = util::make_unique<SVGElement>("rect"); rect->addAttribute("x", bbox.minX()); rect->addAttribute("y", bbox.minY()); rect->addAttribute("width", bbox.width()); rect->addAttribute("height", bbox.height()); - rect->addAttribute("fill", "white"); - rect->addAttribute("fill-opacity", 0); + rect->setFillColor(Color::WHITE); + rect->setFillOpacity(OpacityAlpha(0, 0)); actions.svgTree().appendToPage(std::move(rect)); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp index 4859e0784e7..3e7ba17373e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.hpp @@ -2,7 +2,7 @@ ** HyperlinkManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -52,7 +52,7 @@ class HyperlinkManager { void checkNewLine (SpecialActions &actions); void createLink (std::string uri, SpecialActions &actions); void createViews (unsigned pageno, SpecialActions &actions); - void setBaseUrl (std::string &base) {_base = base;} + void setBaseUrl (const std::string &base) {_base = base;} void setLineWidth (double w) {_linewidth = w;} static HyperlinkManager& instance (); static bool setLinkMarker (const std::string &marker); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp index 6c52a0b8268..e810f32e664 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.cpp @@ -2,7 +2,7 @@ ** ImageToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp index d3da961c0eb..2c2c701d47b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ImageToSVG.hpp @@ -2,7 +2,7 @@ ** ImageToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -57,9 +57,11 @@ class ImageToSVG : protected SpecialActions { void setY (double y) override {_y = y; _svg.setY(y);} void finishLine () override {} void setColor (const Color &color) override {_svg.setColor(color);} + void setOpacity (const Opacity &opacity) override {_svg.setOpacity(opacity);} Color getColor () const override {return _svg.getColor();} void setMatrix (const Matrix &m) override {_svg.setMatrix(m);} const Matrix& getMatrix () const override {return _svg.getMatrix();} + const Opacity& getOpacity () const override {return _svg.getOpacity();} const SVGTree& svgTree () const override {return _svg;} void setBgColor (const Color &color) override {} void embed (const BoundingBox &bbox) override {_bbox.embed(bbox);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp index 6ee562da7d0..e9387cfb116 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp @@ -2,7 +2,7 @@ ** InputBuffer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp index cc3c593e8f1..adf5898cec7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp @@ -2,7 +2,7 @@ ** InputBuffer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -40,12 +40,14 @@ struct InputBuffer { class StreamInputBuffer : public InputBuffer { public: explicit StreamInputBuffer (std::istream &is, size_t bufsize=1024); + StreamInputBuffer (const StreamInputBuffer &ib) =delete; ~StreamInputBuffer () override; int get () override; int peek () const override; int peek (size_t n) const override; bool eof () const override {return pos() == _size1 && _size2 == 0;} void invalidate () override {_bufptr = _buf1+_size1; _size2 = 0;} + void operator = (const StreamInputBuffer &ib) =delete; protected: int fillBuffer (uint8_t *buf); @@ -65,6 +67,7 @@ class StreamInputBuffer : public InputBuffer { class StringInputBuffer : public InputBuffer { public: explicit StringInputBuffer (const std::string &str) : _str(&str) {} + StringInputBuffer (const StreamInputBuffer &ib) =delete; void assign (const std::string &str) {_str = &str; _pos=0;} int get () override {return _pos < _str->length() ? _str->at(_pos++) : -1;} int peek () const override {return _pos < _str->length() ? _str->at(_pos) : -1;} @@ -81,6 +84,7 @@ class StringInputBuffer : public InputBuffer { class CharInputBuffer : public InputBuffer { public: CharInputBuffer (const char *buf, size_t size) : _pos(buf), _size(buf ? size : 0) {} + CharInputBuffer (const CharInputBuffer &ib) =delete; int get () override { if (_size == 0) @@ -112,6 +116,7 @@ class CharInputBuffer : public InputBuffer { class SplittedCharInputBuffer : public InputBuffer { public: SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2); + SplittedCharInputBuffer (const SplittedCharInputBuffer &ib) =delete; int get () override; int peek () const override; int peek (size_t n) const override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp index 6b5a7b70f09..ed97e3f44d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp @@ -2,7 +2,7 @@ ** InputReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -365,8 +365,7 @@ string InputReader::getLine () { while (!eof() && peek() > 0 && peek() != '\n') ret += char(get()); // trim trailing whitespace - ret.erase(std::find_if(ret.rbegin(), ret.rend(), not1(ptr_fun<int, int>(isspace))).base(), ret.end()); - return ret; + return ret.erase(ret.find_last_not_of(" \t\n\r\f\v")+1); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp index d9b697963bf..ac1dfdf9558 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.hpp @@ -2,7 +2,7 @@ ** InputReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp index d0dd13c9b96..4b5c63cb7e4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -2,7 +2,7 @@ ** JFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp index 9080212b798..dc9798cda2a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp @@ -2,7 +2,7 @@ ** JFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -29,6 +29,7 @@ class JFM : public TFM { public: explicit JFM (std::istream &is); bool verticalLayout () const override {return _vertical;} + bool isJFM () const override {return true;} uint32_t minChar () const {return _minchar;} uint32_t maxChar () const {return static_cast<uint32_t>(_minchar+_charTypeTable.size()-1);} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp index d4992c77efe..463f571a590 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp @@ -2,7 +2,7 @@ ** Length.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp index f03711ecd28..14a2fd4c743 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.hpp @@ -2,7 +2,7 @@ ** Length.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp index e34db106022..5149d5945e6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MD5HashFunction.hpp @@ -2,7 +2,7 @@ ** MD5HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am index 2a1706b15b1..d329e35f4a0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -1,5 +1,5 @@ ## This file is part of dvisvgm -## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> +## Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de> ## ## Process this file with automake. @@ -110,6 +110,7 @@ libdvisvgm_a_SOURCES = \ MetafontWrapper.hpp MetafontWrapper.cpp \ NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \ NumericRanges.hpp \ + Opacity.hpp Opacity.cpp \ PageRanges.hpp PageRanges.cpp \ PageSize.hpp PageSize.cpp \ Pair.hpp \ @@ -140,6 +141,7 @@ libdvisvgm_a_SOURCES = \ SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \ SVGCharPathHandler.hpp SVGCharPathHandler.cpp \ SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \ + SVGElement.hpp SVGElement.cpp \ SVGOutput.hpp SVGOutput.cpp \ SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \ SVGTree.hpp SVGTree.cpp \ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in index 5f0f5599912..88b75b779d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in @@ -178,29 +178,30 @@ am__libdvisvgm_a_SOURCES_DIST = AGLTable.hpp BasicDVIReader.hpp \ MD5HashFunction.hpp Message.hpp Message.cpp \ MessageException.hpp MetafontWrapper.hpp MetafontWrapper.cpp \ NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \ - NumericRanges.hpp PageRanges.hpp PageRanges.cpp PageSize.hpp \ - PageSize.cpp Pair.hpp PapersizeSpecialHandler.hpp \ - PapersizeSpecialHandler.cpp PathClipper.hpp PathClipper.cpp \ - PDFParser.hpp PDFParser.cpp PdfSpecialHandler.hpp \ - PdfSpecialHandler.cpp PDFToSVG.hpp PreScanDVIReader.hpp \ - PreScanDVIReader.cpp Process.hpp Process.cpp psdefs.cpp \ - PSFilter.hpp PSInterpreter.hpp PSInterpreter.cpp PSPattern.hpp \ - PSPattern.cpp PSPreviewFilter.hpp PSPreviewFilter.cpp \ - PsSpecialHandler.hpp PsSpecialHandler.cpp RangeMap.hpp \ - RangeMap.cpp ShadingPatch.hpp ShadingPatch.cpp \ - SignalHandler.hpp SignalHandler.cpp SourceInput.hpp \ - SourceInput.cpp SpecialActions.hpp SpecialHandler.hpp \ - SpecialManager.hpp SpecialManager.cpp StreamReader.hpp \ - StreamReader.cpp StreamWriter.hpp StreamWriter.cpp Subfont.hpp \ - Subfont.cpp SVGCharHandler.hpp SVGCharHandler.cpp \ + NumericRanges.hpp Opacity.hpp Opacity.cpp PageRanges.hpp \ + PageRanges.cpp PageSize.hpp PageSize.cpp Pair.hpp \ + PapersizeSpecialHandler.hpp PapersizeSpecialHandler.cpp \ + PathClipper.hpp PathClipper.cpp PDFParser.hpp PDFParser.cpp \ + PdfSpecialHandler.hpp PdfSpecialHandler.cpp PDFToSVG.hpp \ + PreScanDVIReader.hpp PreScanDVIReader.cpp Process.hpp \ + Process.cpp psdefs.cpp PSFilter.hpp PSInterpreter.hpp \ + PSInterpreter.cpp PSPattern.hpp PSPattern.cpp \ + PSPreviewFilter.hpp PSPreviewFilter.cpp PsSpecialHandler.hpp \ + PsSpecialHandler.cpp RangeMap.hpp RangeMap.cpp \ + ShadingPatch.hpp ShadingPatch.cpp SignalHandler.hpp \ + SignalHandler.cpp SourceInput.hpp SourceInput.cpp \ + SpecialActions.hpp SpecialHandler.hpp SpecialManager.hpp \ + SpecialManager.cpp StreamReader.hpp StreamReader.cpp \ + StreamWriter.hpp StreamWriter.cpp Subfont.hpp Subfont.cpp \ + SVGCharHandler.hpp SVGCharHandler.cpp \ SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \ SVGCharPathHandler.hpp SVGCharPathHandler.cpp \ SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \ - SVGOutput.hpp SVGOutput.cpp SVGSingleCharTextHandler.hpp \ - SVGSingleCharTextHandler.cpp SVGTree.hpp SVGTree.cpp \ - System.hpp System.cpp TensorProductPatch.hpp \ - TensorProductPatch.cpp Terminal.hpp Terminal.cpp TFM.hpp \ - TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \ + SVGElement.hpp SVGElement.cpp SVGOutput.hpp SVGOutput.cpp \ + SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \ + SVGTree.hpp SVGTree.cpp System.hpp System.cpp \ + TensorProductPatch.hpp TensorProductPatch.cpp Terminal.hpp \ + Terminal.cpp TFM.hpp TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \ TpicSpecialHandler.hpp TpicSpecialHandler.cpp \ TriangularPatch.hpp TriangularPatch.cpp TrueTypeFont.hpp \ TrueTypeFont.cpp TTFAutohint.hpp TTFAutohint.cpp Unicode.hpp \ @@ -231,7 +232,7 @@ am_libdvisvgm_a_OBJECTS = BasicDVIReader.$(OBJEXT) Bezier.$(OBJEXT) \ InputReader.$(OBJEXT) JFM.$(OBJEXT) Length.$(OBJEXT) \ MapLine.$(OBJEXT) Matrix.$(OBJEXT) Message.$(OBJEXT) \ MetafontWrapper.$(OBJEXT) NoPsSpecialHandler.$(OBJEXT) \ - PageRanges.$(OBJEXT) PageSize.$(OBJEXT) \ + Opacity.$(OBJEXT) PageRanges.$(OBJEXT) PageSize.$(OBJEXT) \ PapersizeSpecialHandler.$(OBJEXT) PathClipper.$(OBJEXT) \ PDFParser.$(OBJEXT) PdfSpecialHandler.$(OBJEXT) \ PreScanDVIReader.$(OBJEXT) Process.$(OBJEXT) psdefs.$(OBJEXT) \ @@ -243,14 +244,14 @@ am_libdvisvgm_a_OBJECTS = BasicDVIReader.$(OBJEXT) Bezier.$(OBJEXT) \ StreamWriter.$(OBJEXT) Subfont.$(OBJEXT) \ SVGCharHandler.$(OBJEXT) SVGCharHandlerFactory.$(OBJEXT) \ SVGCharPathHandler.$(OBJEXT) SVGCharTspanTextHandler.$(OBJEXT) \ - SVGOutput.$(OBJEXT) SVGSingleCharTextHandler.$(OBJEXT) \ - SVGTree.$(OBJEXT) System.$(OBJEXT) \ - TensorProductPatch.$(OBJEXT) Terminal.$(OBJEXT) TFM.$(OBJEXT) \ - ToUnicodeMap.$(OBJEXT) TpicSpecialHandler.$(OBJEXT) \ - TriangularPatch.$(OBJEXT) TrueTypeFont.$(OBJEXT) \ - TTFAutohint.$(OBJEXT) Unicode.$(OBJEXT) utility.$(OBJEXT) \ - VFReader.$(OBJEXT) XMLDocument.$(OBJEXT) XMLNode.$(OBJEXT) \ - XMLString.$(OBJEXT) $(am__objects_1) + SVGElement.$(OBJEXT) SVGOutput.$(OBJEXT) \ + SVGSingleCharTextHandler.$(OBJEXT) SVGTree.$(OBJEXT) \ + System.$(OBJEXT) TensorProductPatch.$(OBJEXT) \ + Terminal.$(OBJEXT) TFM.$(OBJEXT) ToUnicodeMap.$(OBJEXT) \ + TpicSpecialHandler.$(OBJEXT) TriangularPatch.$(OBJEXT) \ + TrueTypeFont.$(OBJEXT) TTFAutohint.$(OBJEXT) Unicode.$(OBJEXT) \ + utility.$(OBJEXT) VFReader.$(OBJEXT) XMLDocument.$(OBJEXT) \ + XMLNode.$(OBJEXT) XMLString.$(OBJEXT) $(am__objects_1) libdvisvgm_a_OBJECTS = $(am_libdvisvgm_a_OBJECTS) am_dvisvgm_OBJECTS = dvisvgm.$(OBJEXT) dvisvgm_OBJECTS = $(am_dvisvgm_OBJECTS) @@ -304,10 +305,11 @@ am__depfiles_remade = ./$(DEPDIR)/BasicDVIReader.Po \ ./$(DEPDIR)/JFM.Po ./$(DEPDIR)/Length.Po \ ./$(DEPDIR)/MapLine.Po ./$(DEPDIR)/Matrix.Po \ ./$(DEPDIR)/Message.Po ./$(DEPDIR)/MetafontWrapper.Po \ - ./$(DEPDIR)/NoPsSpecialHandler.Po ./$(DEPDIR)/PDFParser.Po \ - ./$(DEPDIR)/PSInterpreter.Po ./$(DEPDIR)/PSPattern.Po \ - ./$(DEPDIR)/PSPreviewFilter.Po ./$(DEPDIR)/PageRanges.Po \ - ./$(DEPDIR)/PageSize.Po ./$(DEPDIR)/PapersizeSpecialHandler.Po \ + ./$(DEPDIR)/NoPsSpecialHandler.Po ./$(DEPDIR)/Opacity.Po \ + ./$(DEPDIR)/PDFParser.Po ./$(DEPDIR)/PSInterpreter.Po \ + ./$(DEPDIR)/PSPattern.Po ./$(DEPDIR)/PSPreviewFilter.Po \ + ./$(DEPDIR)/PageRanges.Po ./$(DEPDIR)/PageSize.Po \ + ./$(DEPDIR)/PapersizeSpecialHandler.Po \ ./$(DEPDIR)/PathClipper.Po ./$(DEPDIR)/PdfSpecialHandler.Po \ ./$(DEPDIR)/PreScanDVIReader.Po ./$(DEPDIR)/Process.Po \ ./$(DEPDIR)/PsSpecialHandler.Po ./$(DEPDIR)/RangeMap.Po \ @@ -315,7 +317,7 @@ am__depfiles_remade = ./$(DEPDIR)/BasicDVIReader.Po \ ./$(DEPDIR)/SVGCharHandlerFactory.Po \ ./$(DEPDIR)/SVGCharPathHandler.Po \ ./$(DEPDIR)/SVGCharTspanTextHandler.Po \ - ./$(DEPDIR)/SVGOutput.Po \ + ./$(DEPDIR)/SVGElement.Po ./$(DEPDIR)/SVGOutput.Po \ ./$(DEPDIR)/SVGSingleCharTextHandler.Po ./$(DEPDIR)/SVGTree.Po \ ./$(DEPDIR)/ShadingPatch.Po ./$(DEPDIR)/SignalHandler.Po \ ./$(DEPDIR)/SourceInput.Po ./$(DEPDIR)/SpecialManager.Po \ @@ -640,29 +642,30 @@ libdvisvgm_a_SOURCES = AGLTable.hpp BasicDVIReader.hpp \ MD5HashFunction.hpp Message.hpp Message.cpp \ MessageException.hpp MetafontWrapper.hpp MetafontWrapper.cpp \ NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \ - NumericRanges.hpp PageRanges.hpp PageRanges.cpp PageSize.hpp \ - PageSize.cpp Pair.hpp PapersizeSpecialHandler.hpp \ - PapersizeSpecialHandler.cpp PathClipper.hpp PathClipper.cpp \ - PDFParser.hpp PDFParser.cpp PdfSpecialHandler.hpp \ - PdfSpecialHandler.cpp PDFToSVG.hpp PreScanDVIReader.hpp \ - PreScanDVIReader.cpp Process.hpp Process.cpp psdefs.cpp \ - PSFilter.hpp PSInterpreter.hpp PSInterpreter.cpp PSPattern.hpp \ - PSPattern.cpp PSPreviewFilter.hpp PSPreviewFilter.cpp \ - PsSpecialHandler.hpp PsSpecialHandler.cpp RangeMap.hpp \ - RangeMap.cpp ShadingPatch.hpp ShadingPatch.cpp \ - SignalHandler.hpp SignalHandler.cpp SourceInput.hpp \ - SourceInput.cpp SpecialActions.hpp SpecialHandler.hpp \ - SpecialManager.hpp SpecialManager.cpp StreamReader.hpp \ - StreamReader.cpp StreamWriter.hpp StreamWriter.cpp Subfont.hpp \ - Subfont.cpp SVGCharHandler.hpp SVGCharHandler.cpp \ + NumericRanges.hpp Opacity.hpp Opacity.cpp PageRanges.hpp \ + PageRanges.cpp PageSize.hpp PageSize.cpp Pair.hpp \ + PapersizeSpecialHandler.hpp PapersizeSpecialHandler.cpp \ + PathClipper.hpp PathClipper.cpp PDFParser.hpp PDFParser.cpp \ + PdfSpecialHandler.hpp PdfSpecialHandler.cpp PDFToSVG.hpp \ + PreScanDVIReader.hpp PreScanDVIReader.cpp Process.hpp \ + Process.cpp psdefs.cpp PSFilter.hpp PSInterpreter.hpp \ + PSInterpreter.cpp PSPattern.hpp PSPattern.cpp \ + PSPreviewFilter.hpp PSPreviewFilter.cpp PsSpecialHandler.hpp \ + PsSpecialHandler.cpp RangeMap.hpp RangeMap.cpp \ + ShadingPatch.hpp ShadingPatch.cpp SignalHandler.hpp \ + SignalHandler.cpp SourceInput.hpp SourceInput.cpp \ + SpecialActions.hpp SpecialHandler.hpp SpecialManager.hpp \ + SpecialManager.cpp StreamReader.hpp StreamReader.cpp \ + StreamWriter.hpp StreamWriter.cpp Subfont.hpp Subfont.cpp \ + SVGCharHandler.hpp SVGCharHandler.cpp \ SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \ SVGCharPathHandler.hpp SVGCharPathHandler.cpp \ SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \ - SVGOutput.hpp SVGOutput.cpp SVGSingleCharTextHandler.hpp \ - SVGSingleCharTextHandler.cpp SVGTree.hpp SVGTree.cpp \ - System.hpp System.cpp TensorProductPatch.hpp \ - TensorProductPatch.cpp Terminal.hpp Terminal.cpp TFM.hpp \ - TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \ + SVGElement.hpp SVGElement.cpp SVGOutput.hpp SVGOutput.cpp \ + SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \ + SVGTree.hpp SVGTree.cpp System.hpp System.cpp \ + TensorProductPatch.hpp TensorProductPatch.cpp Terminal.hpp \ + Terminal.cpp TFM.hpp TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \ TpicSpecialHandler.hpp TpicSpecialHandler.cpp \ TriangularPatch.hpp TriangularPatch.cpp TrueTypeFont.hpp \ TrueTypeFont.cpp TTFAutohint.hpp TTFAutohint.cpp Unicode.hpp \ @@ -837,6 +840,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Message.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetafontWrapper.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NoPsSpecialHandler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Opacity.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDFParser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSInterpreter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSPattern.Po@am__quote@ # am--include-marker @@ -854,6 +858,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandlerFactory.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharPathHandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharTspanTextHandler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGElement.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGOutput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGSingleCharTextHandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGTree.Po@am__quote@ # am--include-marker @@ -1195,6 +1200,7 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/Message.Po -rm -f ./$(DEPDIR)/MetafontWrapper.Po -rm -f ./$(DEPDIR)/NoPsSpecialHandler.Po + -rm -f ./$(DEPDIR)/Opacity.Po -rm -f ./$(DEPDIR)/PDFParser.Po -rm -f ./$(DEPDIR)/PSInterpreter.Po -rm -f ./$(DEPDIR)/PSPattern.Po @@ -1212,6 +1218,7 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Po -rm -f ./$(DEPDIR)/SVGCharPathHandler.Po -rm -f ./$(DEPDIR)/SVGCharTspanTextHandler.Po + -rm -f ./$(DEPDIR)/SVGElement.Po -rm -f ./$(DEPDIR)/SVGOutput.Po -rm -f ./$(DEPDIR)/SVGSingleCharTextHandler.Po -rm -f ./$(DEPDIR)/SVGTree.Po @@ -1336,6 +1343,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/Message.Po -rm -f ./$(DEPDIR)/MetafontWrapper.Po -rm -f ./$(DEPDIR)/NoPsSpecialHandler.Po + -rm -f ./$(DEPDIR)/Opacity.Po -rm -f ./$(DEPDIR)/PDFParser.Po -rm -f ./$(DEPDIR)/PSInterpreter.Po -rm -f ./$(DEPDIR)/PSPattern.Po @@ -1353,6 +1361,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Po -rm -f ./$(DEPDIR)/SVGCharPathHandler.Po -rm -f ./$(DEPDIR)/SVGCharTspanTextHandler.Po + -rm -f ./$(DEPDIR)/SVGElement.Po -rm -f ./$(DEPDIR)/SVGOutput.Po -rm -f ./$(DEPDIR)/SVGSingleCharTextHandler.Po -rm -f ./$(DEPDIR)/SVGTree.Po diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp index 5b43cd448a1..531550788d4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp @@ -2,7 +2,7 @@ ** MapLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp index 2d756653536..569472d14ce 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp @@ -2,7 +2,7 @@ ** MapLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp index f1f2b47721f..7e335cef2cd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -2,7 +2,7 @@ ** Matrix.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -520,7 +520,7 @@ Matrix Matrix::parseSVGTransform (const string &transform) { vector<double> params; if (parse_transform_cmd(iss, "matrix", 6, 6, params)) { if (ne(params[0], 1) || ne(params[1], 0) || ne(params[2], 0) || ne(params[3], 1) || ne(params[4], 0) || ne(params[5], 0)) - matrix.rmultiply({params[0], params[2], params[4], params[1], params[3], params[5]}); + matrix.rmultiply(Matrix{params[0], params[2], params[4], params[1], params[3], params[5]}); } else if (parse_transform_cmd(iss, "rotate", 1, 3, params)) { if (params.size() == 1) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp index 76c6e075148..f9b6552dd37 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.hpp @@ -2,7 +2,7 @@ ** Matrix.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -40,11 +40,12 @@ class Matrix { friend double det (const Matrix &m, int row, int col); public: + Matrix () {set(0);} + Matrix (double d); Matrix (const std::string &cmds, Calculator &calc); - Matrix (double d=0); explicit Matrix (const double *v, unsigned size=9); explicit Matrix (const std::vector<double> &v, int start=0); - Matrix (std::initializer_list<double> initlist); + explicit Matrix (std::initializer_list<double> initlist); Matrix& set (double d); Matrix& set (const double *v, unsigned size); Matrix& set (const std::vector<double> &v, int start=0); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp index ca465adcc5b..dc8a8a78710 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp @@ -2,7 +2,7 @@ ** Message.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -74,7 +74,7 @@ void MessageStream::putChar (char c, ostream &os) { _col++; } _nl = false; - if (!_nl || c != '\n') + if (c != '\n') os << c; } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp index afb93d94326..e552458d70e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.hpp @@ -2,7 +2,7 @@ ** Message.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp index 1cfcb49e7dc..2baa4d98fe1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.hpp @@ -2,7 +2,7 @@ ** MessageException.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp index 7788bef3d9c..bf1bbf1ba49 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp @@ -2,7 +2,7 @@ ** MetafontWrapper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp index 4ec5afd304c..cb54bba6a7f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.hpp @@ -2,7 +2,7 @@ ** MetafontWrapper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp index 1bbd40cae61..7da0342f9f6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp @@ -2,7 +2,7 @@ ** MiKTeXCom.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp index b05b26a1322..b4d56b0365f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.hpp @@ -2,7 +2,7 @@ ** MiKTeXCom.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp index 77af3d9d0c7..769dcabb910 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp index b4af33ab6c9..099320fb9f5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp index 5102b715b07..6c0015609d6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.hpp @@ -2,7 +2,7 @@ ** NumericRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.cpp new file mode 100644 index 00000000000..058f794a863 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.cpp @@ -0,0 +1,59 @@ +/************************************************************************* +** Opacity.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 "Opacity.hpp" + +using namespace std; + +string Opacity::cssBlendMode (BlendMode bm) { + switch (bm) { + case BM_NORMAL : return "normal"; + case BM_MULTIPLY : return "multiply"; + case BM_SCREEN : return "screen"; + case BM_OVERLAY : return "overlay"; + case BM_SOFTLIGHT : return "soft-light"; + case BM_HARDLIGHT : return "hard-light"; + case BM_COLORDODGE: return "color-dodge"; + case BM_COLORBURN : return "color-burn"; + case BM_DARKEN : return "darken"; + case BM_LIGHTEN : return "lighten"; + case BM_DIFFERENCE: return "difference"; + case BM_EXCLUSION : return "exclusion"; + case BM_HUE : return "hue"; + case BM_SATURATION: return "saturation"; + case BM_COLOR : return "color"; + case BM_LUMINOSITY: return "luminosity"; + } + return ""; +} + + +bool Opacity::operator == (const Opacity &opacity) const { + return opacity._fillalpha == _fillalpha + && opacity._strokealpha == _strokealpha + && opacity._blendMode == _blendMode; +} + + +bool Opacity::operator != (const Opacity &opacity) const { + return opacity._fillalpha != _fillalpha + || opacity._strokealpha != _strokealpha + || opacity._blendMode != _blendMode; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.hpp new file mode 100644 index 00000000000..3d211b82bc3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Opacity.hpp @@ -0,0 +1,75 @@ +/************************************************************************* +** Opacity.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/>. ** +*************************************************************************/ + +#ifndef OPACITY_HPP +#define OPACITY_HPP + +#include <string> + +class OpacityAlpha { + public: + OpacityAlpha () =default; + OpacityAlpha (double constalpha, double shapealpha) : _constalpha(constalpha), _shapealpha(shapealpha) {} + void setConstAlpha (double alpha) { _constalpha = alpha;} + void setShapeAlpha (double shapealpha) {_shapealpha = shapealpha;} + double value () const {return _constalpha * _shapealpha;} + bool operator == (const OpacityAlpha &alpha) const {return alpha._constalpha == _constalpha && alpha._shapealpha == _shapealpha;} + bool operator != (const OpacityAlpha &alpha) const {return alpha._constalpha != _constalpha || alpha._shapealpha != _shapealpha;} + bool isOpaque () const {return _constalpha == 1.0 && _shapealpha == 1.0;} + + private: + double _constalpha=1.0; + double _shapealpha=1.0; +}; + +class Opacity { + public: + enum BlendMode { + BM_NORMAL, BM_MULTIPLY, BM_SCREEN, BM_OVERLAY, + BM_SOFTLIGHT, BM_HARDLIGHT, BM_COLORDODGE, BM_COLORBURN, + BM_DARKEN, BM_LIGHTEN, BM_DIFFERENCE, BM_EXCLUSION, + BM_HUE, BM_SATURATION, BM_COLOR, BM_LUMINOSITY + }; + + public: + Opacity () =default; + Opacity (OpacityAlpha fillalpha, OpacityAlpha strokealpha, BlendMode bm) : _fillalpha(fillalpha), _strokealpha(strokealpha), _blendMode(bm) {} + Opacity (OpacityAlpha fillalpha, OpacityAlpha strokealpha) : Opacity(fillalpha, strokealpha, BM_NORMAL) {} + explicit Opacity (BlendMode bm) : _blendMode(bm) {} + OpacityAlpha& fillalpha () {return _fillalpha;} + OpacityAlpha& strokealpha () {return _strokealpha;} + const OpacityAlpha& fillalpha () const {return _fillalpha;} + const OpacityAlpha& strokealpha () const {return _strokealpha;} + BlendMode blendMode () const {return _blendMode;} + void setBlendMode (BlendMode mode) {_blendMode = mode;} + std::string cssBlendMode () const {return cssBlendMode(_blendMode);} + static std::string cssBlendMode (BlendMode bm); + bool isFillDefault () const {return _fillalpha.isOpaque() && _blendMode == BM_NORMAL;} + bool isStrokeDefault () const {return _strokealpha.isOpaque() && _blendMode == BM_NORMAL;} + bool operator == (const Opacity &opacity) const; + bool operator != (const Opacity &opacity) const; + + private: + OpacityAlpha _fillalpha; + OpacityAlpha _strokealpha; + BlendMode _blendMode=BM_NORMAL; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp index aaf50886ec1..04b9fe661ca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.cpp @@ -2,7 +2,7 @@ ** PDFParser.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp index a342e740cdb..02cd7078e7d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFParser.hpp @@ -2,7 +2,7 @@ ** PDFParser.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp index 91792689a20..4385612b69d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PDFToSVG.hpp @@ -2,7 +2,7 @@ ** PDFToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp index 59a4565d1de..30ca0108096 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.hpp @@ -2,7 +2,7 @@ ** PSFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp index b82cec9b962..e796c760e33 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp @@ -2,7 +2,7 @@ ** PSInterpreter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -59,8 +59,10 @@ void PSInterpreter::init () { // in conjunction with -dDELAYBIND and -dWRITESYSTEMDICT. // Thus, -dDELAYSAFER (or -dNOSAFER) must be added. // https://www.ghostscript.com/doc/9.50/Use.htm#Safer - if (gsrev >= 950) + if (gsrev >= 950) { gsargs.emplace_back("-dDELAYSAFER"); + gsargs.emplace_back("-dALLOWPSTRANSPARENCY"); + } } _gs.init(gsargs.size(), gsargs.data(), this); _gs.set_stdio(input, output, error); @@ -130,7 +132,7 @@ bool PSInterpreter::execute (const char *str, size_t len, bool flush) { // feed Ghostscript with code chunks that are not larger than 64KB // => see documentation of gsapi_run_string_foo() const char *p=str; - while (PS_RUNNING && len > 0) { + while (_mode == PS_RUNNING && len > 0) { SignalHandler::instance().check(); size_t chunksize = min(len, (size_t)0xffff); _gs.run_string_continue(p, chunksize, 0, &status); @@ -279,6 +281,7 @@ void PSInterpreter::callActions (InputReader &in) { {"rotate", { 1, &PSActions::rotate}}, {"save", { 1, &PSActions::save}}, {"scale", { 2, &PSActions::scale}}, + {"setalphaisshape", { 1, &PSActions::setalphaisshape}}, {"setblendmode", { 1, &PSActions::setblendmode}}, {"setcolorspace", { 1, &PSActions::setcolorspace}}, {"setcmykcolor", { 4, &PSActions::setcmykcolor}}, @@ -286,7 +289,6 @@ void PSInterpreter::callActions (InputReader &in) { {"setfillconstantalpha", { 1, &PSActions::setfillconstantalpha}}, {"setgray", { 1, &PSActions::setgray}}, {"sethsbcolor", { 3, &PSActions::sethsbcolor}}, - {"setisshapealpha", { 1, &PSActions::setisshapealpha}}, {"setlinecap", { 1, &PSActions::setlinecap}}, {"setlinejoin", { 1, &PSActions::setlinejoin}}, {"setlinewidth", { 1, &PSActions::setlinewidth}}, @@ -309,7 +311,7 @@ void PSInterpreter::callActions (InputReader &in) { _rawData.clear(); in.skipSpace(); while (!in.eof()) { - _rawData.emplace_back(in.getString()); + _rawData.push_back(in.getString()); in.skipSpace(); } } @@ -320,14 +322,14 @@ void PSInterpreter::callActions (InputReader &in) { if (pcount < 0) { // variable number of parameters? in.skipSpace(); while (!in.eof()) { // read all available parameters - params.emplace_back(in.getString()); + params.push_back(in.getString()); in.skipSpace(); } } else { // fix number of parameters for (int i=0; i < pcount; i++) { in.skipSpace(); - params.emplace_back(in.getString()); + params.push_back(in.getString()); } } // convert parameter strings to doubles @@ -415,7 +417,7 @@ bool PSInterpreter::imageDeviceKnown (string deviceStr) { return false; deviceStr = deviceStr.substr(0, deviceStr.find(':')); // strip optional argument auto infos = getImageDeviceInfos(); - auto it = find_if(infos.begin(), infos.end(), [&](PSDeviceInfo &info) { + auto it = find_if(infos.begin(), infos.end(), [&](const PSDeviceInfo &info) { return info.name == deviceStr; }); return it != infos.end(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp index 71454f696e1..b2e2616d5e1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.hpp @@ -2,7 +2,7 @@ ** PSInterpreter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -62,6 +62,7 @@ struct PSActions { virtual void rotate (std::vector<double> &p) =0; virtual void save (std::vector<double> &p) =0; virtual void scale (std::vector<double> &p) =0; + virtual void setalphaisshape (std::vector<double> &p) =0; virtual void setblendmode (std::vector<double> &p) =0; virtual void setcolorspace (std::vector<double> &p) =0; virtual void setcmykcolor (std::vector<double> &cmyk) =0; @@ -69,7 +70,6 @@ struct PSActions { virtual void setfillconstantalpha (std::vector<double> &p) =0; virtual void setgray (std::vector<double> &p) =0; virtual void sethsbcolor (std::vector<double> &hsb) =0; - virtual void setisshapealpha (std::vector<double> &p) =0; virtual void setlinecap (std::vector<double> &p) =0; virtual void setlinejoin (std::vector<double> &p) =0; virtual void setlinewidth (std::vector<double> &p) =0; @@ -114,6 +114,7 @@ class PSInterpreter { BoundingBox pdfPageBox (const std::string &fname, int pageno); const std::vector<std::string>& rawData () const {return _rawData;} bool setImageDevice (const std::string &deviceStr); + bool hasFullOpacitySupport () const {return _gs.revision() >= 952;} static std::vector<PSDeviceInfo> getImageDeviceInfos (); static void listImageDeviceInfos (std::ostream &os); static bool imageDeviceKnown (std::string deviceStr); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp index 135965299e6..6cebe7844d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp @@ -2,7 +2,7 @@ ** PSPattern.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -106,8 +106,8 @@ unique_ptr<XMLElement> PSTilingPattern::createClipNode() const { * define the pattern graphic. */ unique_ptr<XMLElement> PSTilingPattern::createGroupNode () const { // add all succeeding path elements to this group - auto group = util::make_unique<XMLElement>("g"); - group->addAttribute("clip-path", XMLString("url(#pc")+XMLString(psID())+")"); + auto group = util::make_unique<SVGElement>("g"); + group->setClipPathUrl("pc"+XMLString(psID())); return group; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp index 62794317c21..ca152f8e2a3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.hpp @@ -2,7 +2,7 @@ ** PSPattern.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -40,6 +40,8 @@ class PSPattern { virtual int psID () const {return _id;} virtual std::string svgID () const; virtual void apply (SpecialActions &actions); + virtual void setColor (Color color) {} + virtual bool tiled () const =0; protected: explicit PSPattern (int id) : _id(id) {} @@ -54,6 +56,8 @@ class PSTilingPattern : public PSPattern { public: virtual XMLElement* getContainerNode () {return _groupNode.get();} void apply (SpecialActions &actions) override; + bool tiled () const override {return true;} + protected: PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); @@ -82,7 +86,7 @@ class PSUncoloredTilingPattern final : public PSTilingPattern { public: PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); std::string svgID () const override; - void setColor (Color color) {_currentColor = color;} + void setColor (Color color) override {_currentColor = color;} void apply (SpecialActions &actions) override; protected: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp index 312b3eb6def..fb55435a95b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp index 62860b6932e..3ffe6ffdb14 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp index 46f27078214..4af8ff2bc41 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp @@ -2,7 +2,7 @@ ** PageRanges.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp index f03dfc51622..1a2de678a14 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.hpp @@ -2,7 +2,7 @@ ** PageRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp index 8b5c29445ba..2fcdd917fb6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp @@ -2,7 +2,7 @@ ** PageSize.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp index 4eb4e5e201f..735b526bed9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.hpp @@ -2,7 +2,7 @@ ** PageSize.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp index 466e6fd8f29..44236717efe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.hpp @@ -2,7 +2,7 @@ ** Pair.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp index 864ccbaa123..42a9fcbc1a0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -58,7 +58,7 @@ void PapersizeSpecialHandler::storePaperSize (unsigned pageno, Length width, Len if (!_pageSizes.empty() && _pageSizes.back().first == pageno) _pageSizes.back().second = whpair; else - _pageSizes.emplace_back(PageSize(pageno, whpair)); + _pageSizes.emplace_back(pageno, whpair); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp index 02599d8c32d..ab20a220919 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PapersizeSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp index a36dc5d3dfc..b6a26c418e6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp @@ -2,7 +2,7 @@ ** PathClipper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp index 8ab9b48c4f0..93b3f6a3daa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.hpp @@ -2,7 +2,7 @@ ** PathClipper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp index 6368d979756..f54b18de2d7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -95,7 +95,7 @@ static char prepare_mode (InputReader &ir) { void PdfSpecialHandler::preprocessPagesize (StreamInputReader &ir, SpecialActions &actions) { // add page sizes to collection of paper sizes in order to handle them equally SpecialHandler *handler = SpecialManager::instance().findHandlerByName("papersize"); - if (auto papersizeHandler = dynamic_cast<PapersizeSpecialHandler*>(handler)) { + if (auto papersizeHandler = static_cast<PapersizeSpecialHandler*>(handler)) { try { Length width, height; // parse parameter sequence of the form (name length)+ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp index e7a18bacce2..53f9d945486 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp index ef862f02cc3..bdd3ff19016 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp index a0e5a5fc644..6d22f1bf246 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.hpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp index 2010b05db93..f89d5024181 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp @@ -2,7 +2,7 @@ ** Process.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp index 3e9417d7bb6..a0668c354fc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.hpp @@ -2,7 +2,7 @@ ** Process.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index fbb43f38fbe..aa6c7461dc9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -32,7 +32,7 @@ #include "PSPreviewFilter.hpp" #include "PsSpecialHandler.hpp" #include "SpecialActions.hpp" -#include "SVGTree.hpp" +#include "SVGElement.hpp" #include "TensorProductPatch.hpp" #include "TriangularPatch.hpp" #include "utility.hpp" @@ -81,11 +81,11 @@ void PsSpecialHandler::initgraphics () { _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; _xmlnode = _savenode = nullptr; - _isshapealpha = false; // opacity operators change constant component by default - _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _opacity = Opacity(); _sx = _sy = _cos = 1.0; _pattern = nullptr; + _makingPattern = false; _patternEnabled = false; _currentcolor = Color::BLACK; _dashoffset = 0; @@ -287,7 +287,6 @@ bool PsSpecialHandler::process (const string &prefix, istream &is, SpecialAction return true; } - /** Handles a psfile/pdffile special which places an external EPS/PDF graphic * at the current DVI position. The lower left corner (llx,lly) of the * given bounding box is placed at the DVI position. @@ -366,16 +365,15 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const ma matrix.scale(sx, sy).rotate(-angle).scale(hscale/100, vscale/100); // apply transformation attributes matrix.translate(x+hoffset, y-voffset); // move image to current DVI position matrix.lmultiply(_actions->getMatrix()); - // update bounding box BoundingBox bbox(0, 0, urx-llx, ury-lly); bbox.transform(matrix); _actions->embed(bbox); // insert element containing the image data - matrix.rmultiply(TranslationMatrix(-llx, -lly)); // move lower left corner of image to origin - if (!matrix.isIdentity()) - imgNode->addAttribute("transform", matrix.toSVG()); + if (filetype != FileType::PDF) + matrix.rmultiply(TranslationMatrix(-llx, -lly)); // move lower left corner of image to origin + imgNode->setTransform(matrix); _actions->svgTree().appendToPage(std::move(imgNode)); } // restore DVI position @@ -386,7 +384,7 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const ma /** Returns path + basename of temporary bitmap images. */ -static string image_base_path (SpecialActions &actions) { +static string image_base_path (const SpecialActions &actions) { FilePath imgpath = actions.getSVGFilePath(actions.getCurrentPageNumber()); return FileSystem::tmpdir() + "/" + imgpath.basename() + "-tmp-"; } @@ -399,8 +397,8 @@ static string image_base_path (SpecialActions &actions) { * @param[in] bbox bounding box of the image * @param[in] clip if true, the image is clipped to its bounding box * @return pointer to the element or nullptr if there's no image data */ -unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const string &fname, int pageno, BoundingBox bbox, bool clip) { - unique_ptr<XMLElement> node; +unique_ptr<SVGElement> PsSpecialHandler::createImageNode (FileType type, const string &fname, int pageno, BoundingBox bbox, bool clip) { + unique_ptr<SVGElement> node; string pathstr; if (const char *path = FileFinder::instance().lookup(fname, false)) pathstr = FileSystem::ensureForwardSlashes(path); @@ -409,7 +407,7 @@ unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const s if (pathstr.empty()) Message::wstream(true) << "file '" << fname << "' not found\n"; else if (type == FileType::BITMAP || type == FileType::SVG) { - node = util::make_unique<XMLElement>("image"); + node = util::make_unique<SVGElement>("image"); node->addAttribute("x", 0); node->addAttribute("y", 0); node->addAttribute("width", bbox.width()); @@ -429,7 +427,7 @@ unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const s if (clip) rectclip = to_string(bbox.minX())+" "+to_string(bbox.minY())+" "+to_string(bbox.width())+" "+to_string(bbox.height())+" rectclip"; - node = util::make_unique<XMLElement>("g"); // put SVG nodes created from the EPS/PDF file in this group + 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 @@ -556,9 +554,8 @@ void PsSpecialHandler::setpagedevice (std::vector<double> &p) { _linewidth = 1; _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; - _isshapealpha = false; // opacity operators change constant component by default - _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _opacity = Opacity(); _sx = _sy = _cos = 1.0; _pattern = nullptr; _currentcolor = Color::BLACK; @@ -613,14 +610,37 @@ void PsSpecialHandler::closepath (vector<double>&) { } -static string css_blendmode_name (int mode) { - static const array<const char*,16> modenames = {{ - "normal", "multiply", "screen", "overlay", "soft-light", "hard-light", "color-dodge", "color-burn", - "darken", "lighten", "difference", "exclusion", "hue", "saturation", "color", "luminosity" - }}; +void PsSpecialHandler::setblendmode (vector<double> &p) { + int mode = static_cast<int>(p[0]); + static const Opacity::BlendMode blendmodes[] = { + Opacity::BM_NORMAL, Opacity::BM_MULTIPLY, Opacity::BM_SCREEN, Opacity::BM_OVERLAY, + Opacity::BM_SOFTLIGHT, Opacity::BM_HARDLIGHT, Opacity::BM_COLORDODGE, Opacity::BM_COLORBURN, + Opacity::BM_DARKEN, Opacity::BM_LIGHTEN, Opacity::BM_DIFFERENCE, Opacity::BM_EXCLUSION, + Opacity::BM_HUE, Opacity::BM_SATURATION, Opacity::BM_COLOR, Opacity::BM_LUMINOSITY + }; if (mode < 0 || mode > 15) - return ""; - return modenames[mode]; + mode = Opacity::BM_NORMAL; + _opacity.setBlendMode(blendmodes[mode]); +} + + +void PsSpecialHandler::setfillconstantalpha (vector<double> &p) { + if (_isshapealpha) + _opacity.fillalpha().setShapeAlpha(p[0]); + else + _opacity.fillalpha().setConstAlpha(p[0]); + if (_actions) + _actions->setOpacity(_opacity); +} + + +void PsSpecialHandler::setstrokeconstantalpha (vector<double> &p) { + if (_isshapealpha) + _opacity.strokealpha().setShapeAlpha(p[0]); + else + _opacity.strokealpha().setConstAlpha(p[0]); + if (_actions) + _actions->setOpacity(_opacity); } @@ -639,18 +659,18 @@ void PsSpecialHandler::stroke (vector<double> &p) { } if (_clipStack.prependedPath()) _path.prepend(*_clipStack.prependedPath()); - unique_ptr<XMLElement> path; + unique_ptr<SVGElement> path; Pair<double> point; if (_path.isDot(point)) { // zero-length path? if (_linecap == 1) { // round line ends? => draw dot double x = point.x(); double y = point.y(); double r = _linewidth/2.0; - path = util::make_unique<XMLElement>("circle"); + path = util::make_unique<SVGElement>("circle"); path->addAttribute("cx", x); path->addAttribute("cy", y); path->addAttribute("r", r); - path->addAttribute("fill", _actions->getColor().svgColorString()); + path->setFillColor(_actions->getColor()); bbox = BoundingBox(x-r, y-r, x+r, y+r); } } @@ -661,35 +681,20 @@ void PsSpecialHandler::stroke (vector<double> &p) { ostringstream oss; _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - path = util::make_unique<XMLElement>("path"); + path = util::make_unique<SVGElement>("path"); path->addAttribute("d", oss.str()); - path->addAttribute("stroke", _actions->getColor().svgColorString()); - path->addAttribute("fill", "none"); - if (_linewidth != 1) - path->addAttribute("stroke-width", _linewidth); - if (_miterlimit != 4) - path->addAttribute("stroke-miterlimit", _miterlimit); - if (_linecap > 0) // default value is "butt", no need to set it explicitly - path->addAttribute("stroke-linecap", _linecap == 1 ? "round" : "square"); - if (_linejoin > 0) // default value is "miter", no need to set it explicitly - path->addAttribute("stroke-linejoin", _linecap == 1 ? "round" : "bevel"); - if (_strokealpha[0] < 1 || _strokealpha[1] < 1) - path->addAttribute("stroke-opacity", _strokealpha[0] * _strokealpha[1]); - if (_blendmode > 0 && _blendmode < 16) - path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); - if (!_dashpattern.empty()) { - string patternStr; - for (double dashValue : _dashpattern) - patternStr += XMLString(dashValue)+","; - patternStr.pop_back(); - path->addAttribute("stroke-dasharray", patternStr); - if (_dashoffset != 0) - path->addAttribute("stroke-dashoffset", _dashoffset); - } + path->setStrokeColor(_actions->getColor()); + path->setNoFillColor(); + path->setStrokeWidth(_linewidth); + path->setStrokeMiterLimit(_miterlimit); + path->setStrokeLineCap(_linecap == 0 ? SVGElement::LC_BUTT : _linecap == 1 ? SVGElement::LC_ROUND : SVGElement::LC_SQUARE); + path->setStrokeLineJoin(_linejoin == 0 ? SVGElement::LJ_MITER : _linecap == 1 ? SVGElement::LJ_ROUND : SVGElement::LJ_BEVEL); + path->setStrokeOpacity(_opacity); + path->setStrokeDash(_dashpattern, _dashoffset); } - if (path && _clipStack.path() && !_savenode) { + if (path && _clipStack.path() && !_makingPattern) { // assign clipping path and clip bounding box - path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + path->setClipPathUrl("clip"+XMLString(_clipStack.topID())); bbox.intersect(_clipStack.path()->computeBBox()); _clipStack.removePrependedPath(); } @@ -708,7 +713,7 @@ void PsSpecialHandler::stroke (vector<double> &p) { * @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.prependedPath()) || !_actions) + if ((_path.empty() && !_clipStack.prependedPath()) || (_patternEnabled && !_pattern) || !_actions) return; // compute bounding box @@ -723,24 +728,20 @@ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) { ostringstream oss; _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - unique_ptr<XMLElement> path = util::make_unique<XMLElement>("path"); + auto path = util::make_unique<SVGElement>("path"); path->addAttribute("d", oss.str()); if (_pattern) - path->addAttribute("fill", XMLString("url(#")+_pattern->svgID()+")"); - else if (_actions->getColor() != Color::BLACK || _savenode) - path->addAttribute("fill", _actions->getColor().svgColorString()); - if (_clipStack.path() && !_savenode) { // clip path active and not inside pattern definition? + path->setFillPatternUrl(XMLString(_pattern->svgID())); + else if (_actions->getColor() != Color::BLACK || _makingPattern) + path->setFillColor(_actions->getColor(), false); + if (_clipStack.path() && !_makingPattern) { // clip path active and not inside pattern definition? // assign clipping path and clip bounding box - path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + path->setClipPathUrl("clip"+XMLString(_clipStack.topID())); bbox.intersect(_clipStack.path()->computeBBox()); _clipStack.removePrependedPath(); } - if (evenodd) // SVG default fill rule is "nonzero" algorithm - path->addAttribute("fill-rule", "evenodd"); - if (_fillalpha[0] < 1 || _fillalpha[1] < 1) - path->addAttribute("fill-opacity", _fillalpha[0] * _fillalpha[1]); - if (_blendmode > 0 && _blendmode < 16) - path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); + path->setFillRule(evenodd ? SVGElement::FR_EVENODD : SVGElement::FR_NONZERO); + path->setFillOpacity(_opacity); if (_xmlnode) _xmlnode->append(std::move(path)); else { @@ -788,8 +789,8 @@ void PsSpecialHandler::image (std::vector<double> &p) { // if set, assign clipping path to image if (_clipStack.path()) { - auto group = util::make_unique<XMLElement>("g"); - group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + auto group = util::make_unique<SVGElement>("g"); + group->setClipPathUrl("clip"+XMLString(_clipStack.topID())); group->append(std::move(image)); image = std::move(group); // handle the entire group as image to add } @@ -846,10 +847,9 @@ void PsSpecialHandler::makepattern (vector<double> &p) { switch (pattern_type) { case 0: // pattern definition completed - if (_savenode) { - _xmlnode = _savenode; - _savenode = nullptr; - } + _xmlnode = _savenode; + _savenode = nullptr; + _makingPattern = false; break; case 1: { // tiling pattern int id = static_cast<int>(p[1]); @@ -869,6 +869,7 @@ void PsSpecialHandler::makepattern (vector<double> &p) { _savenode = _xmlnode; _xmlnode = pattern->getContainerNode(); // insert the following SVG elements into this node _patterns[id] = std::move(pattern); + _makingPattern = true; break; } case 2: { @@ -891,13 +892,9 @@ void PsSpecialHandler::setpattern (vector<double> &p) { if (it == _patterns.end()) _pattern = nullptr; else { - if (auto pattern = dynamic_cast<PSUncoloredTilingPattern*>(it->second.get())) - pattern->setColor(color); + it->second->setColor(color); it->second->apply(*_actions); - if (auto pattern = dynamic_cast<PSTilingPattern*>(it->second.get())) - _pattern = pattern; - else - _pattern = nullptr; + _pattern = it->second->tiled() ? static_cast<PSTilingPattern*>(it->second.get()) : nullptr; } } @@ -961,16 +958,15 @@ void PsSpecialHandler::clip (Path path, bool evenodd) { intersectedPath.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); } if (pathReplaced) { - auto pathElem = util::make_unique<XMLElement>("path"); + auto pathElem = util::make_unique<SVGElement>("path"); pathElem->addAttribute("d", oss.str()); - if (evenodd) - pathElem->addAttribute("clip-rule", "evenodd"); + pathElem->setClipRule(evenodd ? SVGElement::FR_EVENODD : SVGElement::FR_NONZERO); int newID = _clipStack.topID(); - auto clipElem = util::make_unique<XMLElement>("clipPath"); + auto clipElem = util::make_unique<SVGElement>("clipPath"); clipElem->addAttribute("id", XMLString("clip")+XMLString(newID)); if (!COMPUTE_CLIPPATHS_INTERSECTIONS && oldID) - clipElem->addAttribute("clip-path", XMLString("url(#clip")+XMLString(oldID)+")"); + clipElem->setClipPathUrl("clip"+XMLString(oldID)); clipElem->append(std::move(pathElem)); _actions->svgTree().appendToDefs(std::move(clipElem)); @@ -1046,7 +1042,7 @@ void PsSpecialHandler::shfill (vector<double> ¶ms) { * @param[in,out] it iterator used to sequentially access the patch data * @param[out] points the points defining the geometry of the patch * @param[out] colors the colors assigned to the vertices of the patch */ -static void read_patch_data (ShadingPatch &patch, int edgeflag, +static void read_patch_data (const ShadingPatch &patch, int edgeflag, VectorIterator<double> &it, vector<DPair> &points, vector<Color> &colors) { // number of control points and colors required to define a single patch @@ -1087,14 +1083,14 @@ class ShadingCallback : public ShadingPatch::Callback { ShadingCallback (SpecialActions &actions, XMLElement *parent, int clippathID) : _actions(actions) { - auto group = util::make_unique<XMLElement>("g"); + auto group = util::make_unique<SVGElement>("g"); _group = group.get(); if (parent) parent->append(std::move(group)); else actions.svgTree().appendToPage(std::move(group)); if (clippathID > 0) - _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")"); + _group->setClipPathUrl("clip"+XMLString(clippathID)); } void patchSegment (GraphicsPath<double> &path, const Color &color) override { @@ -1104,15 +1100,15 @@ class ShadingCallback : public ShadingPatch::Callback { // draw a single patch segment ostringstream oss; path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - auto pathElem = util::make_unique<XMLElement>("path"); + auto pathElem = util::make_unique<SVGElement>("path"); pathElem->addAttribute("d", oss.str()); - pathElem->addAttribute("fill", color.svgColorString()); + pathElem->setFillColor(color); _group->append(std::move(pathElem)); } private: SpecialActions &_actions; - XMLElement *_group; + SVGElement *_group; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp index efdd5dd238f..f4a9b333f4f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -28,12 +28,13 @@ #include <vector> #include "GraphicsPath.hpp" #include "PSInterpreter.hpp" -#include "SpecialHandler.hpp" +#include "Opacity.hpp" #include "PSPattern.hpp" #include "PSPreviewFilter.hpp" - +#include "SpecialHandler.hpp" class PSPattern; +class SVGElement; class XMLElement; class PsSpecialHandler : public SpecialHandler, protected PSActions { @@ -104,7 +105,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void executeAndSync (std::istream &is, bool updatePos); void processHeaderFile (const char *fname); void imgfile (FileType type, const std::string &fname, const std::map<std::string,std::string> &attr); - std::unique_ptr<XMLElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip); + std::unique_ptr<SVGElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip); void dviBeginPage (unsigned int pageno, SpecialActions &actions) override; void dviEndPage (unsigned pageno, SpecialActions &actions) override; void clip (Path path, bool evenodd); @@ -138,14 +139,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void rotate (std::vector<double> &p) override; void save (std::vector<double> &p) override; void scale (std::vector<double> &p) override; - void setblendmode (std::vector<double> &p) override {_blendmode = int(p[0]);} + void setalphaisshape (std::vector<double> &p) override { _isshapealpha = bool(p[0]);} + void setblendmode (std::vector<double> &p) override; void setcolorspace (std::vector<double> &p) override {_patternEnabled = bool(p[0]);} void setcmykcolor (std::vector<double> &cmyk) override; void setdash (std::vector<double> &p) override; - void setfillconstantalpha (std::vector<double> &p) override {_fillalpha[_isshapealpha ? 1 : 0] = p[0];} + void setfillconstantalpha (std::vector<double> &p) override; void setgray (std::vector<double> &p) override; void sethsbcolor (std::vector<double> &hsb) override; - void setisshapealpha (std::vector<double> &p) override {_isshapealpha = bool(p[0]);} void setlinecap (std::vector<double> &p) override {_linecap = uint8_t(p[0]);} void setlinejoin (std::vector<double> &p) override {_linejoin = uint8_t(p[0]);} void setlinewidth (std::vector<double> &p) override {_linewidth = scale(p[0] ? p[0] : 0.5);} @@ -155,7 +156,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void setpagedevice (std::vector<double> &p) override; void setpattern (std::vector<double> &p) override; void setrgbcolor (std::vector<double> &rgb) override; - void setstrokeconstantalpha (std::vector<double> &p) override {_strokealpha[_isshapealpha ? 1 : 0] = p[0];} + void setstrokeconstantalpha (std::vector<double> &p) override; void shfill (std::vector<double> &p) override; void stroke (std::vector<double> &p) override; void translate (std::vector<double> &p) override; @@ -176,15 +177,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { double _cos; ///< cosine of angle between (1,0) and transform(1,0) double _linewidth; ///< current line width in bp units double _miterlimit; ///< current miter limit in bp units - bool _isshapealpha; ///< if true, opacity operators act on index 1 (shape component), otherwise on index 0 (constant component) - std::array<double,2> _fillalpha; ///< constant and shape opacity used for fill operations (0=fully transparent, ..., 1=opaque) - std::array<double,2> _strokealpha; ///< constant and shape opacity used for stroke operations (0=fully transparent, ..., 1=opaque) - int _blendmode; ///< blend mode used when overlaying colored areas + bool _isshapealpha; ///< if true, opacity operators act on shape component, otherwise on constant component + Opacity _opacity; uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) double _dashoffset; ///< current dash offset std::vector<double> _dashpattern; ClippingStack _clipStack; + bool _makingPattern=false; ///< true if executing makepattern operator std::map<int, std::unique_ptr<PSPattern>> _patterns; PSTilingPattern *_pattern; ///< current pattern bool _patternEnabled; ///< true if active color space is a pattern diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp index 3d208c8a8f9..8de4ff42bf8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp @@ -2,7 +2,7 @@ ** RangeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -82,14 +82,14 @@ void RangeMap::addRange (uint32_t cmin, uint32_t cmax, uint32_t vmin) { Range range(cmin, cmax, vmin); if (_ranges.empty()) - _ranges.emplace_back(std::move(range)); + _ranges.push_back(std::move(range)); else { // check for simple cases that can be handled pretty fast Range &lrange = *_ranges.begin(); Range &rrange = *_ranges.rbegin(); if (cmin > rrange.max()) { // non-overlapping range at end of vector? if (!rrange.join(range)) - _ranges.emplace_back(std::move(range)); + _ranges.push_back(std::move(range)); } else if (cmax < lrange.min()) { // non-overlapping range at begin of vector? if (!lrange.join(range)) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp index 3f5cb7a6e5f..c1413464466 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp @@ -2,7 +2,7 @@ ** RangeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp index 4ba6c88a7d3..567a2ceda58 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -20,12 +20,12 @@ #include "SVGCharHandler.hpp" #include "utility.hpp" -#include "XMLNode.hpp" +#include "SVGElement.hpp" using namespace std; -void SVGCharHandler::setInitialContextNode (XMLElement *node) { +void SVGCharHandler::setInitialContextNode (SVGElement *node) { resetContextNode(); _initialContextNode = node; } @@ -34,9 +34,9 @@ void SVGCharHandler::setInitialContextNode (XMLElement *node) { /** Changes the context element. All following nodes will be appended to this node. * @param[in] node the new context node * @return bare pointer to the new context node or 0 if context hasn't changed */ -XMLElement* SVGCharHandler::pushContextNode (unique_ptr<XMLElement> node) { +SVGElement* SVGCharHandler::pushContextNode (unique_ptr<SVGElement> node) { if (node && (_contextNodeStack.empty() || node.get() != _contextNodeStack.top())) { - XMLElement *nodeptr = node.get(); + SVGElement *nodeptr = node.get(); contextNode()->append(std::move(node)); _contextNodeStack.push(nodeptr); return nodeptr; @@ -61,23 +61,22 @@ void SVGCharHandler::resetContextNode () { /** Creates and returns a new SVG text element. * @param[in] x current x coordinate * @param[in] y current y coordinate */ -unique_ptr<XMLElement> SVGCharTextHandler::createTextNode (double x, double y) const { +unique_ptr<SVGElement> SVGCharTextHandler::createTextNode (double x, double y) const { const Font *font = _font.get(); if (!font) return nullptr; - auto textNode = util::make_unique<XMLElement>("text"); + auto textNode = util::make_unique<SVGElement>("text"); if (_selectFontByClass) textNode->addAttribute("class", string("f")+XMLString(_fontnum)); else { textNode->addAttribute("font-family", font->name()); - textNode->addAttribute("font-size", XMLString(font->scaledSize())); - if (font->color() != Color::BLACK) - textNode->addAttribute("fill", font->color().svgColorString()); + textNode->addAttribute("font-size", font->scaledSize()); + textNode->setFillColor(font->color()); } if (_vertical) { textNode->addAttribute("writing-mode", "tb"); // align glyphs designed for horizontal layout properly - if (auto pf = dynamic_cast<const PhysicalFont*>(font)) { + if (auto pf = font_cast<const PhysicalFont*>(font)) { if (!pf->getMetrics()->verticalLayout()) { // alphabetic text designed for horizontal layout? x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset textNode->addAttribute("glyph-orientation-vertical", 90); // ensure rotation @@ -86,7 +85,7 @@ unique_ptr<XMLElement> SVGCharTextHandler::createTextNode (double x, double y) c } textNode->addAttribute("x", x); textNode->addAttribute("y", y); - if (!_matrix.get().isIdentity()) - textNode->addAttribute("transform", _matrix.get().toSVG()); + if (!_matrix->isIdentity()) + textNode->addAttribute("transform", _matrix->toSVG()); return textNode; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp index 241b28b7ef8..157c1b6a64e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -26,12 +26,15 @@ #include "Color.hpp" #include "Font.hpp" #include "Matrix.hpp" +#include "Opacity.hpp" template <typename T> class CharProperty { public: + CharProperty () =default; CharProperty (const T &v) : _value(v) {} + CharProperty (T &&v) : _value(std::move(v)) {} void set (const T &v) { if (v != _value) { @@ -40,10 +43,11 @@ class CharProperty { } } - const T& get () const {return _value;} - operator const T& () const {return _value;} - bool changed () const {return _changed;} - void changed (bool c) {_changed = c;} + const T& get () const {return _value;} + const T* operator -> () const {return &_value;} + operator const T& () const {return _value;} + bool changed () const {return _changed;} + void changed (bool c) {_changed = c;} private: T _value; @@ -51,7 +55,7 @@ class CharProperty { }; -class XMLElement; +class SVGElement; /** Base class for all character handlers. These handlers create SVG representations @@ -60,36 +64,39 @@ class SVGCharHandler { public: SVGCharHandler () : _matrix(1) {} virtual ~SVGCharHandler() =default; - virtual void setInitialContextNode (XMLElement *node); + virtual void setInitialContextNode (SVGElement *node); virtual void appendChar (uint32_t c, double x, double y) =0; virtual void notifyXAdjusted () {} virtual void notifyYAdjusted () {} - void setColor (const Color &color) {_color.set(color);} - void setFont (const Font &font, int id) {_font.set(&font); _fontnum = id;} - void setMatrix (const Matrix &matrix) {_matrix.set(matrix);} - void setVertical (bool vertical) {_vertical.set(vertical);} - Color getColor () const {return _color.get();} - const Font* getFont () const {return _font.get();} - const Matrix& getMatrix () const {return _matrix.get();} + void setColor (const Color &color) {_color.set(color);} + void setOpacity (const Opacity &opacity) {_opacity.set(opacity);} + void setFont (const Font &font, int id) {_font.set(&font); _fontnum = id;} + void setMatrix (const Matrix &matrix) {_matrix.set(matrix);} + void setVertical (bool vertical) {_vertical.set(vertical);} + Color getColor () const {return _color.get();} + const Opacity& getOpacity () const {return _opacity.get();} + const Font* getFont () const {return _font.get();} + const Matrix& getMatrix () const {return _matrix.get();} protected: virtual void resetContextNode (); - XMLElement* pushContextNode (std::unique_ptr<XMLElement> node); + SVGElement* pushContextNode (std::unique_ptr<SVGElement> node); void popContextNode (); - XMLElement* contextNode () const { + SVGElement* contextNode () const { return _contextNodeStack.empty() ? _initialContextNode : _contextNodeStack.top(); } CharProperty<Color> _color=Color::BLACK; ///< current color + CharProperty<Opacity> _opacity; ///< current opacity values CharProperty<const Font*> _font=0; ///< current font int _fontnum=0; ///< current font ID CharProperty<Matrix> _matrix; ///< current transformation CharProperty<bool> _vertical=false; ///< current writing mode private: - XMLElement *_initialContextNode= nullptr; ///< SVG element the generated character nodes are attached to - std::stack<XMLElement*> _contextNodeStack; + SVGElement *_initialContextNode= nullptr; ///< SVG element the generated character nodes are attached to + std::stack<SVGElement*> _contextNodeStack; }; @@ -99,7 +106,7 @@ class SVGCharTextHandler : public SVGCharHandler { explicit SVGCharTextHandler (bool selectFontByClass) : _selectFontByClass(selectFontByClass) {} protected: - std::unique_ptr<XMLElement> createTextNode (double x, double y) const; + std::unique_ptr<SVGElement> createTextNode (double x, double y) const; private: bool _selectFontByClass; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp index 0a4666f5ae7..342571a1548 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.cpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp index a43257bc158..bbb431c8cd3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharHandlerFactory.hpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp index 02f83e8c999..8f973be293e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -23,7 +23,7 @@ #include "FontManager.hpp" #include "SVGCharPathHandler.hpp" #include "utility.hpp" -#include "XMLNode.hpp" +#include "SVGElement.hpp" using namespace std; @@ -61,22 +61,23 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { // Glyphs of non-black fonts (e.g. defined in a XeTeX document) can't change their color. CharProperty<Color> &color = (_fontColor.get() != Color::BLACK) ? _fontColor : _color; bool applyColor = color.get() != Color::BLACK; - bool applyMatrix = !_matrix.get().isIdentity(); + bool applyMatrix = !_matrix->isIdentity(); + bool applyOpacity = !_opacity->isFillDefault(); if (!_groupNode) { color.changed(applyColor); _matrix.changed(applyMatrix); } - if (color.changed() || _matrix.changed()) { + if (color.changed() || _matrix.changed() || _opacity.changed()) { resetContextNode(); - if (applyColor || applyMatrix) { - _groupNode = pushContextNode(util::make_unique<XMLElement>("g")); - if (applyColor) - contextNode()->addAttribute("fill", color.get().svgColorString()); - if (applyMatrix) - contextNode()->addAttribute("transform", _matrix.get().toSVG()); + if (applyColor || applyMatrix || applyOpacity) { + _groupNode = pushContextNode(util::make_unique<SVGElement>("g")); + contextNode()->setFillColor(color); + contextNode()->setFillOpacity(_opacity->fillalpha()); + contextNode()->setTransform(_matrix); } color.changed(false); _matrix.changed(false); + _opacity.changed(false); } const Font *font = _font.get(); if (font->verticalLayout()) { @@ -84,12 +85,12 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { GlyphMetrics metrics; font->getGlyphMetrics(c, _vertical, metrics); x -= metrics.wl; - if (auto pf = dynamic_cast<const PhysicalFont*>(font)) { + if (auto pf = font_cast<const PhysicalFont*>(font)) { // Center glyph between top and bottom border of the TFM box. // This is just an approximation used until I find a way to compute // the exact location in vertical mode. GlyphMetrics exact_metrics; - pf->getExactGlyphBox(c, exact_metrics, false); + pf->getExactGlyphBox(c, exact_metrics, false, nullptr); y += exact_metrics.h+(metrics.d-exact_metrics.h-exact_metrics.d)/2; } else @@ -109,28 +110,27 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { void SVGCharPathHandler::appendUseElement (uint32_t c, double x, double y, const Matrix &matrix) { string id = "#g" + to_string(FontManager::instance().fontID(_font)) + "-" + to_string(c); - auto useNode = util::make_unique<XMLElement>("use"); - useNode->addAttribute("x", XMLString(x)); - useNode->addAttribute("y", XMLString(y)); + auto useNode = util::make_unique<SVGElement>("use"); + useNode->addAttribute("x", x); + useNode->addAttribute("y", y); useNode->addAttribute("xlink:href", id); - if (!matrix.isIdentity()) - useNode->addAttribute("transform", matrix.toSVG()); + useNode->setFillOpacity(_opacity->blendMode()); // add blend mode style here because it's not inheritable + useNode->setTransform(matrix); contextNode()->append(std::move(useNode)); } void SVGCharPathHandler::appendPathElement (uint32_t c, double x, double y, const Matrix &matrix) { Glyph glyph; - auto pf = dynamic_cast<const PhysicalFont*>(_font.get()); - if (pf && pf->getGlyph(c, glyph)) { + auto pf = font_cast<const PhysicalFont*>(_font.get()); + if (pf && pf->getGlyph(c, glyph, nullptr)) { double sx = pf->scaledSize()/pf->unitsPerEm(); double sy = -sx; ostringstream oss; glyph.writeSVG(oss, _relativePathCommands, sx, sy, x, y); - auto glyphNode = util::make_unique<XMLElement>("path"); + auto glyphNode = util::make_unique<SVGElement>("path"); glyphNode->addAttribute("d", oss.str()); - if (!matrix.isIdentity()) - glyphNode->addAttribute("transform", matrix.toSVG()); + glyphNode->setTransform(matrix); contextNode()->append(std::move(glyphNode)); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp index a70bf293465..01b2ac5ae0d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharPathHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -39,7 +39,7 @@ class SVGCharPathHandler : public SVGCharHandler { private: AppendMethod _appendChar; ///< method called to append a single character bool _relativePathCommands; ///< if true, create relative rather than absolute SVG path commands - XMLElement *_groupNode=nullptr; ///< current group node taking the path elements + SVGElement *_groupNode=nullptr; ///< current group node taking the path elements CharProperty<Color> _fontColor=Color::BLACK; ///< color of current font }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp index 772dee12954..c17b8bd1809 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -20,7 +20,7 @@ #include "SVGCharTspanTextHandler.hpp" #include "utility.hpp" -#include "XMLNode.hpp" +#include "SVGElement.hpp" using namespace std; @@ -36,9 +36,10 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) { if (!_textNode || _font.changed() || _matrix.changed() || _vertical.changed()) { resetContextNode(); _textNode = pushContextNode(createTextNode(x, y)); - _color.changed(true); // force creating tspan with color attribute if current color differs from font color + _color.changed(true); // force creating tspan with color attribute if current color differs from font color + _opacity.changed(true); // dito for opacity properties } - if (_tspanNode && (_xchanged || _ychanged || _color.changed())) { + if (_tspanNode && (_xchanged || _ychanged || _color.changed() || _opacity.changed())) { // if drawing position or color was explicitly changed, finish current tspan element popContextNode(); _tspanNode = nullptr; @@ -46,15 +47,18 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) { // Apply text color changes only if the color of the entire font is black. // Glyphs of non-black fonts (e.g. defined in a XeTeX document) can't change their color. bool applyColor = _color.get() != Color::BLACK && _font.get()->color() == Color::BLACK; - if (_xchanged || _ychanged || (_color.changed() && applyColor)) { - _tspanNode = pushContextNode(util::make_unique<XMLElement>("tspan")); + bool applyOpacity = !_opacity->isFillDefault(); + if (_xchanged || _ychanged || (_color.changed() && applyColor) || (_opacity.changed() && applyOpacity)) { + _tspanNode = pushContextNode(util::make_unique<SVGElement>("tspan")); if (applyColor) - _tspanNode->addAttribute("fill", _color.get().svgColorString()); + _tspanNode->setFillColor(_color); _color.changed(false); + _tspanNode->setFillOpacity(_opacity); + _opacity.changed(false); if (_xchanged) { if (_vertical) { // align glyphs designed for horizontal layout properly - if (auto pf = dynamic_cast<const PhysicalFont*>(_font.get())) + if (auto pf = font_cast<const PhysicalFont*>(_font.get())) if (!pf->getMetrics()->verticalLayout()) x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset } @@ -70,7 +74,7 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) { } -void SVGCharTspanTextHandler::setInitialContextNode (XMLElement *node) { +void SVGCharTspanTextHandler::setInitialContextNode (SVGElement *node) { SVGCharHandler::setInitialContextNode(node); _textNode = _tspanNode = nullptr; _xchanged = _ychanged = false; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp index 0357387d6c9..34443961c16 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGCharTspanTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -29,15 +29,15 @@ class SVGCharTspanTextHandler : public SVGCharTextHandler { void notifyXAdjusted () override {_xchanged = true;} void notifyYAdjusted() override {_ychanged = true;} void appendChar (uint32_t c, double x, double y) override; - void setInitialContextNode (XMLElement *node) override; + void setInitialContextNode (SVGElement *node) override; protected: void resetContextNode () override; private: bool _xchanged, _ychanged; - XMLElement *_textNode; - XMLElement *_tspanNode; + SVGElement *_textNode; + SVGElement *_tspanNode; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.cpp new file mode 100644 index 00000000000..78ffd36b505 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.cpp @@ -0,0 +1,153 @@ +/************************************************************************* +** SVGElement.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 <sstream> +#include "Color.hpp" +#include "Matrix.hpp" +#include "Opacity.hpp" +#include "SVGElement.hpp" +#include "XMLString.hpp" + +using namespace std; + + +void SVGElement::setClipPathUrl (const string &url) { + if (!url.empty()) + addAttribute("clip-path", "url(#"+url+")"); +} + + +void SVGElement::setClipRule (FillRule rule) { + if (rule != FR_NONZERO) + addAttribute("clip-rule", "evenodd"); +} + + +void SVGElement::setFillColor (Color color, bool skipBlack) { + if (color != Color::BLACK || !skipBlack) + addAttribute("fill", color.svgColorString()); +} + + +void SVGElement::setFillOpacity (const Opacity &opacity) { + if (!opacity.isFillDefault()) { + setFillOpacity(opacity.fillalpha()); + setFillOpacity(opacity.blendMode()); + } +} + + +void SVGElement::setFillOpacity (const OpacityAlpha &alpha) { + if (!alpha.isOpaque()) + addAttribute("fill-opacity", alpha.value()); +} + + +void SVGElement::setFillOpacity (Opacity::BlendMode blendMode) { + if (blendMode != Opacity::BM_NORMAL) + addAttribute("style", "mix-blend-mode:"+Opacity::cssBlendMode(blendMode)); +} + + +void SVGElement::setFillRule (FillRule rule) { + if (rule != FR_NONZERO) + addAttribute("fill-rule", "evenodd"); +} + + +void SVGElement::setFillPatternUrl (const std::string &url) { + if (!url.empty()) + addAttribute("fill", "url(#" + url + ")"); +} + + +void SVGElement::setNoFillColor () { + addAttribute("fill", "none"); +} + + +void SVGElement::setPoints (const vector<DPair> &points) { + if (!points.empty()) { + ostringstream oss; + for (const DPair &p : points) + oss << XMLString(p.x()) << ' ' << XMLString(p.y()) << ' '; + string str = oss.str(); + str.pop_back(); + addAttribute("points", str); + } +} + + +void SVGElement::setStrokeColor (Color color) { + addAttribute("stroke", color.svgColorString()); +} + + +void SVGElement::setStrokeDash (const vector<double> &pattern, double offset) { + if (!pattern.empty()) { + string patternStr; + for (double dashValue : pattern) + patternStr += XMLString(dashValue)+" "; + patternStr.pop_back(); + addAttribute("stroke-dasharray", patternStr); + if (offset != 0) + addAttribute("stroke-dashoffset", offset); + } +} + + +void SVGElement::setStrokeLineCap (LineCap cap) { + if (cap != LC_BUTT) + addAttribute("stroke-linecap", cap == LC_ROUND ? "round" : "square"); +} + + +void SVGElement::setStrokeLineJoin (LineJoin join) { + if (join != LJ_MITER) + addAttribute("stroke-linejoin", join == LJ_BEVEL ? "bevel" : "round"); +} + + +void SVGElement::setStrokeMiterLimit (double limit) { + if (limit != 4) + addAttribute("stroke-miterlimit", limit); +} + + +void SVGElement::setStrokeOpacity (const Opacity &opacity) { + if (!opacity.isStrokeDefault()) { + if (!opacity.strokealpha().isOpaque()) + addAttribute("stroke-opacity", opacity.strokealpha().value()); + if (opacity.blendMode() != Opacity::BM_NORMAL) + addAttribute("style", "mix-blend-mode:"+opacity.cssBlendMode()); + } +} + + +void SVGElement::setStrokeWidth (double width) { + if (width != 1) + addAttribute("stroke-width", width); +} + + +void SVGElement::setTransform (const Matrix &matrix) { + if (!matrix.isIdentity()) + addAttribute("transform", matrix.toSVG()); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.hpp new file mode 100644 index 00000000000..c326b79f879 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGElement.hpp @@ -0,0 +1,60 @@ +/************************************************************************* +** SVGElement.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/>. ** +*************************************************************************/ + +#ifndef SVGELEMENT_HPP +#define SVGELEMENT_HPP + +#include "XMLNode.hpp" + +class Color; +class Matrix; +class Opacity; + +class SVGElement : public XMLElement { + public: + enum FillRule {FR_EVENODD, FR_NONZERO}; + enum LineCap {LC_BUTT, LC_ROUND, LC_SQUARE}; + enum LineJoin {LJ_BEVEL, LJ_MITER, LJ_ROUND}; + + public: + explicit SVGElement (std::string name) : XMLElement(std::move(name)) {} + explicit SVGElement (const XMLElement &node) : XMLElement(node) {} + explicit SVGElement (XMLElement &&node) noexcept : XMLElement(std::move(node)) {} + void setClipPathUrl (const std::string &url); + void setClipRule (FillRule rule); + void setFillColor (Color color, bool skipBlack=true); + void setFillOpacity (const Opacity &opacity); + void setFillOpacity (const OpacityAlpha &alpha); + void setFillOpacity (Opacity::BlendMode blendMode); + void setFillPatternUrl (const std::string &url); + void setFillRule (FillRule rule); + void setNoFillColor (); + void setPoints (const std::vector<DPair> &points); + void setStrokeColor (Color color); + void setStrokeDash (const std::vector<double> &pattern, double offset=0); + void setStrokeLineCap (LineCap cap); + void setStrokeLineJoin (LineJoin join); + void setStrokeOpacity (const Opacity &opacity); + void setStrokeWidth (double width); + void setStrokeMiterLimit (double limit); + void setTransform (const Matrix &matrix); +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp index 59a26764a7b..6ba41f1c7d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp @@ -2,7 +2,7 @@ ** SVGOutput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -139,6 +139,11 @@ string SVGOutput::expandFormatString (string str, int page, int numPages, const } break; } + case 'n': + case 'N': + oss << (str[pos] == 'n' ? _fileNumber : _fileCount); + result += oss.str(); + break; case 'p': case 'P': oss << (str[pos] == 'p' ? page : numPages); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp index 96acf807e3e..a0ae43c68b1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.hpp @@ -2,7 +2,7 @@ ** SVGOutput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -60,6 +60,7 @@ class SVGOutput : public SVGOutputBase { std::ostream& getPageStream (int page, int numPages, const HashTriple &hash=HashTriple()) const override; FilePath filepath (int page, int numPages, const HashTriple &hash=HashTriple()) const override; bool ignoresHashes () const override; + void setFileNumbers (int fileNumber, int fileCount) {_fileNumber = fileNumber; _fileCount = fileCount;} protected: std::string expandFormatString (std::string str, int page, int numPages, const HashTriple &hashes) const; @@ -69,6 +70,8 @@ class SVGOutput : public SVGOutputBase { std::string _pattern; bool _stdout=true; ///< write to STDOUT? int _zipLevel=0; ///< compression level + int _fileNumber=1; ///< current number of file in sequence of files + int _fileCount=1; ///< number of files in sequence mutable int _page=-1; ///< number of current page being written mutable std::unique_ptr<std::ostream> _osptr; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp index d61e298a017..84ba8591c11 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -19,7 +19,7 @@ *************************************************************************/ #include "SVGSingleCharTextHandler.hpp" -#include "XMLNode.hpp" +#include "SVGElement.hpp" using namespace std; @@ -29,9 +29,11 @@ void SVGSingleCharTextHandler::appendChar (uint32_t c, double x, double y) { textNode->append(XMLString(font->unicode(c), false)); // Apply color changes only if the color differs from black and if the font color itself is black. // Glyphs from non-black fonts (e.g. defined in a XeTeX document) can't change their color. - if (_color.get() != Color::BLACK && font->color() == Color::BLACK) { - textNode->addAttribute("fill", _color.get().svgColorString()); - _color.changed(false); - } + if (_color.get() != Color::BLACK && font->color() == Color::BLACK) + textNode->setFillColor(_color); + _color.changed(false); + if (!_opacity->isFillDefault()) + textNode->setFillOpacity(_opacity); + _opacity.changed(false); contextNode()->append(std::move(textNode)); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp index 57f05a4b07d..c1cd48bc247 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGSingleCharTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp index 372dd28bf22..8463ef08f15 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp @@ -2,7 +2,7 @@ ** SVGTree.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -31,7 +31,6 @@ #include "SVGCharHandlerFactory.hpp" #include "SVGTree.hpp" #include "XMLDocument.hpp" -#include "XMLNode.hpp" #include "XMLString.hpp" using namespace std; @@ -55,7 +54,7 @@ SVGTree::SVGTree () : _charHandler(SVGCharHandlerFactory::createHandler()) { /** Clears the SVG tree and initializes the root element. */ void SVGTree::reset () { _doc.clear(); - auto rootNode = util::make_unique<XMLElement>("svg"); + auto rootNode = util::make_unique<SVGElement>("svg"); rootNode->addAttribute("version", "1.1"); rootNode->addAttribute("xmlns", "http://www.w3.org/2000/svg"); rootNode->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); @@ -111,20 +110,20 @@ bool SVGTree::setFontFormat (string formatstr) { /** Starts a new page. * @param[in] pageno number of new page */ void SVGTree::newPage (int pageno) { - auto pageNode = util::make_unique<XMLElement>("g"); + auto pageNode = util::make_unique<SVGElement>("g"); if (pageno >= 0) pageNode->addAttribute("id", string("page")+XMLString(pageno)); _charHandler->setInitialContextNode(pageNode.get()); _page = pageNode.get(); _root->append(std::move(pageNode)); - _defsContextStack = stack<XMLElement*>(); - _pageContextStack = stack<XMLElement*>(); + _defsContextStack = stack<SVGElement*>(); + _pageContextStack = stack<SVGElement*>(); } void SVGTree::appendToDefs (unique_ptr<XMLNode> node) { if (!_defs) { - auto defsNode = util::make_unique<XMLElement>("defs"); + auto defsNode = util::make_unique<SVGElement>("defs"); _defs = defsNode.get(); _root->prepend(std::move(defsNode)); } @@ -134,7 +133,7 @@ void SVGTree::appendToDefs (unique_ptr<XMLNode> node) { void SVGTree::appendToPage (unique_ptr<XMLNode> node) { - XMLElement *parent = _pageContextStack.empty() ? _page : _pageContextStack.top(); + SVGElement *parent = _pageContextStack.empty() ? _page : _pageContextStack.top(); parent->append(std::move(node)); _charHandler->setInitialContextNode(parent); } @@ -149,8 +148,7 @@ void SVGTree::prependToPage (unique_ptr<XMLNode> node) { void SVGTree::transformPage (const Matrix &usermatrix) { - if (!usermatrix.isIdentity()) - _page->addAttribute("transform", usermatrix.toSVG()); + _page->setTransform(usermatrix); } @@ -171,8 +169,8 @@ static unique_ptr<XMLElement> createGlyphNode (int c, const PhysicalFont &font, double extend = font.style() ? font.style()->extend : 1; glyphNode = util::make_unique<XMLElement>("glyph"); glyphNode->addAttribute("unicode", XMLString(font.unicode(c), false)); - glyphNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance(c)*extend)); - glyphNode->addAttribute("vert-adv-y", XMLString(font.vAdvance(c))); + glyphNode->addAttribute("horiz-adv-x", font.hAdvance(c)*extend); + glyphNode->addAttribute("vert-adv-y", font.vAdvance(c)); string name = font.glyphName(c); if (!name.empty()) glyphNode->addAttribute("glyph-name", name); @@ -192,7 +190,7 @@ static unique_ptr<XMLElement> createGlyphNode (int c, const PhysicalFont &font, static string font_info (const Font &font) { ostringstream oss; - if (auto nf = dynamic_cast<const NativeFont*>(&font)) { + if (auto nf = font_cast<const NativeFont*>(&font)) { oss << nf->familyName() << ' ' << nf->styleName() << "; " << nf->filename(); if (nf->style()) { if (nf->style()->bold != 0) @@ -211,7 +209,7 @@ void SVGTree::appendFontStyles (const unordered_set<const Font*> &fonts) { if (CREATE_CSS && USE_FONTS && !fonts.empty() && _page) { map<int, const Font*> sortmap; for (const Font *font : fonts) - if (!dynamic_cast<const VirtualFont*>(font)) // skip virtual fonts + if (!font_cast<const VirtualFont*>(font)) // skip virtual fonts sortmap[FontManager::instance().fontID(font)] = font; ostringstream style; // add font style definitions in ascending order @@ -260,14 +258,14 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr auto fontNode = util::make_unique<XMLElement>("font"); string fontname = font.name(); fontNode->addAttribute("id", fontname); - fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance())); + fontNode->addAttribute("horiz-adv-x", font.hAdvance()); auto faceNode = util::make_unique<XMLElement>("font-face"); faceNode->addAttribute("font-family", fontname); - faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm())); + faceNode->addAttribute("units-per-em", font.unitsPerEm()); if (!font.verticalLayout()) { - faceNode->addAttribute("ascent", XMLString(font.ascent())); - faceNode->addAttribute("descent", XMLString(font.descent())); + faceNode->addAttribute("ascent", font.ascent()); + faceNode->addAttribute("descent", font.descent()); } fontNode->append(std::move(faceNode)); for (int c : chars) @@ -297,8 +295,8 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr } -void SVGTree::pushDefsContext (unique_ptr<XMLElement> node) { - XMLElement *nodePtr = node.get(); +void SVGTree::pushDefsContext (unique_ptr<SVGElement> node) { + SVGElement *nodePtr = node.get(); if (_defsContextStack.empty()) appendToDefs(std::move(node)); else @@ -314,8 +312,8 @@ void SVGTree::popDefsContext () { /** Pushes a new context element that will take all following nodes added to the page. */ -void SVGTree::pushPageContext (unique_ptr<XMLElement> node) { - XMLElement *nodePtr = node.get(); +void SVGTree::pushPageContext (unique_ptr<SVGElement> node) { + SVGElement *nodePtr = node.get(); if (_pageContextStack.empty()) _page->append(std::move(node)); else diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp index 84c9e111580..0669d47cef3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.hpp @@ -2,7 +2,7 @@ ** SVGTree.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -31,13 +31,14 @@ #include "GFGlyphTracer.hpp" #include "Matrix.hpp" #include "SVGCharHandler.hpp" +#include "SVGElement.hpp" #include "XMLDocument.hpp" -#include "XMLNode.hpp" class BoundingBox; class Color; class Font; class Matrix; +class Opacity; class PhysicalFont; class SVGTree { @@ -54,24 +55,26 @@ class SVGTree { void appendChar (int c, double x, double y) {_charHandler->appendChar(c, x, y);} void appendFontStyles (const std::unordered_set<const Font*> &fonts); void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *callback=nullptr); - void pushDefsContext (std::unique_ptr<XMLElement> node); + void pushDefsContext (std::unique_ptr<SVGElement> node); void popDefsContext (); - void pushPageContext (std::unique_ptr<XMLElement> node); + void pushPageContext (std::unique_ptr<SVGElement> node); void popPageContext (); void setBBox (const BoundingBox &bbox); void setFont (int id, const Font &font); static bool setFontFormat (std::string formatstr); - void setX (double x) {_charHandler->notifyXAdjusted();} - void setY (double y) {_charHandler->notifyYAdjusted();} - void setMatrix (const Matrix &m) {_charHandler->setMatrix(m);} + void setX (double x) {_charHandler->notifyXAdjusted();} + void setY (double y) {_charHandler->notifyYAdjusted();} + void setMatrix (const Matrix &m) {_charHandler->setMatrix(m);} void setColor (const Color &c); - void setVertical (bool state) {_charHandler->setVertical(state);} + void setOpacity (const Opacity &op) {_charHandler->setOpacity(op);} + void setVertical (bool state) {_charHandler->setVertical(state);} void transformPage (const Matrix &m); - Color getColor () const {return _charHandler->getColor();} - const Matrix& getMatrix () const {return _charHandler->getMatrix();} - XMLElement* rootNode () const {return _root;} - XMLElement* defsNode () const {return _defs;} - XMLElement* pageNode () const {return _page;} + Color getColor () const {return _charHandler->getColor();} + const Opacity& getOpacity () const {return _charHandler->getOpacity();} + const Matrix& getMatrix () const {return _charHandler->getMatrix();} + XMLElement* rootNode () const {return _root;} + XMLElement* defsNode () const {return _defs;} + XMLElement* pageNode () const {return _page;} protected: XMLCData* styleCDataNode (); @@ -88,11 +91,11 @@ class SVGTree { private: XMLDocument _doc; - XMLElement *_root, *_page, *_defs; + SVGElement *_root, *_page, *_defs; XMLCData *_styleCDataNode; std::unique_ptr<SVGCharHandler> _charHandler; - std::stack<XMLElement*> _defsContextStack; - std::stack<XMLElement*> _pageContextStack; + std::stack<SVGElement*> _defsContextStack; + std::stack<SVGElement*> _pageContextStack; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp index a734c4c48b3..3a99b98e7cc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp @@ -2,7 +2,7 @@ ** ShadingPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp index 2a8103d0443..6999a817a33 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.hpp @@ -2,7 +2,7 @@ ** ShadingPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp index 129b010d729..230410e0778 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp @@ -2,7 +2,7 @@ ** SignalHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp index ef6a0a4e556..2ecef0960e5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.hpp @@ -2,7 +2,7 @@ ** SignalHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp index 55196c76ce8..478532de034 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.cpp @@ -2,7 +2,7 @@ ** SourceInput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp index 7d7a08c88fc..3d201c31d7f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SourceInput.hpp @@ -2,7 +2,7 @@ ** SourceInput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp index 12e9c90ec12..df80ac434b7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.hpp @@ -2,7 +2,7 @@ ** SpecialActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -27,6 +27,7 @@ #include "Color.hpp" #include "FilePath.hpp" #include "Matrix.hpp" +#include "Opacity.hpp" #include "SVGTree.hpp" class XMLElement; @@ -46,6 +47,8 @@ class SpecialActions { virtual const Matrix& getMatrix () const =0; virtual Matrix getPageTransformation () const {return Matrix(1);} virtual void setBgColor (const Color &color) =0; + virtual void setOpacity (const Opacity &opacity) =0; + virtual const Opacity& getOpacity () const =0; virtual const SVGTree& svgTree () const =0; SVGTree& svgTree () {return const_cast<SVGTree&>(const_cast<const SpecialActions*>(this)->svgTree());} virtual BoundingBox& bbox () =0; @@ -75,6 +78,8 @@ class EmptySpecialActions : public SpecialActions { void finishLine () override {} void setColor (const Color &color) override {} void setBgColor (const Color &color) override {} + void setOpacity (const Opacity &opacity) override {} + const Opacity& getOpacity () const override {return _svg.getOpacity();} Color getColor () const override {return Color::BLACK;} void setMatrix (const Matrix &m) override {} const Matrix& getMatrix () const override {return _matrix;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp index 382f0e53d12..2beda4e7bb5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.hpp @@ -2,7 +2,7 @@ ** SpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp index 68e1c68b515..fb78ffd57b1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp @@ -2,7 +2,7 @@ ** SpecialManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp index 76cdb3e2e66..c124994d2b4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp @@ -2,7 +2,7 @@ ** SpecialManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp index 8924d885b52..f0e9bf8e5d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp @@ -2,7 +2,7 @@ ** StreamReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp index 08a4fd36361..1a9d76abe15 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.hpp @@ -2,7 +2,7 @@ ** StreamReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp index 21eefd1b9e1..59ee7ffe8be 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp @@ -2,7 +2,7 @@ ** StreamWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp index 5128bbf7365..3e2dbda5103 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.hpp @@ -2,7 +2,7 @@ ** StreamWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp index 44f3bcaeb24..09a26076885 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp @@ -2,7 +2,7 @@ ** Subfont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -53,7 +53,7 @@ SubfontDefinition::SubfontDefinition (string name, const char *fpath) : _sfname( while (is && !isspace(is.peek())) id += char(is.get()); if (!id.empty()) { - auto state = _subfonts.emplace(pair<string,unique_ptr<Subfont>>(id, unique_ptr<Subfont>())); + auto state = _subfonts.emplace(id, unique_ptr<Subfont>()); if (state.second) // id was not present in map already state.first->second = unique_ptr<Subfont>(new Subfont(*this, state.first->first)); skip_mapping_data(is); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp index 961720a99cb..ac5359a84a2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.hpp @@ -2,7 +2,7 @@ ** Subfont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp index 4f8b0a139cb..6baf5a40edf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp @@ -2,7 +2,7 @@ ** System.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp index fb698d303bd..686c24af82d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.hpp @@ -2,7 +2,7 @@ ** System.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp index 011e659dc93..37da112757a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp @@ -2,7 +2,7 @@ ** TFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp index 0bb881df8f2..ad242ad258d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.hpp @@ -2,7 +2,7 @@ ** TFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp index 6e8fbefd48d..d04cbf77b9c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.cpp @@ -2,7 +2,7 @@ ** TTFAutohint.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp index 3d774984c70..7739895c382 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TTFAutohint.hpp @@ -2,7 +2,7 @@ ** TTFAutohint.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp index 8c5d7448966..6a334b17119 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp @@ -2,7 +2,7 @@ ** TensorProductPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -63,7 +63,9 @@ void TensorProductPatch::setFirstMatrixColumn (DPair source[4][4], int col, bool * @param[in] edgeflag defines how to connect this patch with another one * @param[in] patch reference patch required if edgeflag > 0 */ void TensorProductPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) { - auto tpPatch = dynamic_cast<TensorProductPatch*>(patch); + TensorProductPatch *tpPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + tpPatch = static_cast<TensorProductPatch*>(patch); if (edgeflag > 0 && !tpPatch) throw ShadingException("missing preceding data in definition of tensor-product patch"); if ((edgeflag == 0 && points.size() != 16) || (edgeflag > 0 && points.size() != 12)) @@ -107,7 +109,9 @@ void TensorProductPatch::setPoints (const PointVec &points, int edgeflag, Shadin * @param[in] edgeflag defines how to connect this patch with another one * @param[in] patch reference patch required if edgeflag > 0 */ void TensorProductPatch::setColors(const ColorVec &colors, int edgeflag, ShadingPatch* patch) { - auto tpPatch = dynamic_cast<TensorProductPatch*>(patch); + TensorProductPatch *tpPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + tpPatch = static_cast<TensorProductPatch*>(patch); if (edgeflag > 0 && !tpPatch) throw ShadingException("missing preceding data in definition of tensor-product patch"); if ((edgeflag == 0 && colors.size() != 4) || (edgeflag > 0 && colors.size() != 2)) @@ -492,7 +496,9 @@ DPair CoonsPatch::valueAt (double u, double v) const { * @param[in] edgeflag defines how to connect this patch to another one * @param[in] patch reference patch required if edgeflag > 0 */ void CoonsPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) { - auto coonsPatch = dynamic_cast<CoonsPatch*>(patch); + CoonsPatch *coonsPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + coonsPatch = static_cast<CoonsPatch*>(patch); if (edgeflag > 0 && !coonsPatch) throw ShadingException("missing preceding data in definition of relative Coons patch"); if ((edgeflag == 0 && points.size() != 12) || (edgeflag > 0 && points.size() != 8)) @@ -529,7 +535,9 @@ void CoonsPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch * void CoonsPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { - auto coonsPatch = dynamic_cast<CoonsPatch*>(patch); + CoonsPatch *coonsPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + coonsPatch = static_cast<CoonsPatch*>(patch); if (edgeflag > 0 && !coonsPatch) throw ShadingException("missing preceding data in definition of relative Coons patch"); if ((edgeflag == 0 && colors.size() != 4) || (edgeflag > 0 && colors.size() != 2)) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp index 654271b90df..47a7d840a59 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.hpp @@ -2,7 +2,7 @@ ** TensorProductPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp index 274426443a1..1b5405a3421 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp @@ -2,7 +2,7 @@ ** Terminal.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp index f84d47b707a..e1a0ce38adc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.hpp @@ -2,7 +2,7 @@ ** Terminal.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp index 0a0b069e965..a29911c1731 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp index 806233e12f8..5db95e1f381 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.hpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 54034126db0..220accdcb40 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -28,6 +28,7 @@ #include "InputReader.hpp" #include "GraphicsPath.hpp" #include "SpecialActions.hpp" +#include "SVGElement.hpp" #include "SVGTree.hpp" #include "TpicSpecialHandler.hpp" #include "utility.hpp" @@ -70,28 +71,32 @@ Color TpicSpecialHandler::fillColor (bool grayOnly) const { * @param[in] penwidth pen with used to compute the stroke parameters * @param[in] pencolor the drawing color * @param[in] ddist dash/dot distance of line in PS point units (0:solid line, >0:dashed line, <0:dotted line) */ -static void add_stroke_attribs (XMLElement *elem, double penwidth, Color pencolor, double ddist) { +static void add_stroke_attribs (SVGElement *elem, double penwidth, Color pencolor, double ddist) { if (penwidth > 0) { // attributes actually required? - elem->addAttribute("stroke", pencolor.svgColorString()); - elem->addAttribute("stroke-width", XMLString(penwidth)); + elem->setStrokeColor(pencolor); + elem->setStrokeWidth(penwidth); + vector<double> dasharray; if (ddist > 0) - elem->addAttribute("stroke-dasharray", XMLString(ddist)); - else if (ddist < 0) - elem->addAttribute("stroke-dasharray", XMLString(penwidth) + ' ' + XMLString(-ddist)); + dasharray.push_back(ddist); + else if (ddist < 0) { + dasharray.push_back(penwidth); + dasharray.push_back(-ddist); + } + elem->setStrokeDash(dasharray); } } -static unique_ptr<XMLElement> create_ellipse_element (double cx, double cy, double rx, double ry) { +static unique_ptr<SVGElement> create_ellipse_element (double cx, double cy, double rx, double ry) { bool is_circle = (rx == ry); - auto elem = util::make_unique<XMLElement>(is_circle ? "circle" : "ellipse"); - elem->addAttribute("cx", XMLString(cx)); - elem->addAttribute("cy", XMLString(cy)); + auto elem = util::make_unique<SVGElement>(is_circle ? "circle" : "ellipse"); + elem->addAttribute("cx", cx); + elem->addAttribute("cy", cy); if (is_circle) - elem->addAttribute("r", XMLString(rx)); + elem->addAttribute("r", rx); else { - elem->addAttribute("rx", XMLString(rx)); - elem->addAttribute("ry", XMLString(ry)); + elem->addAttribute("rx", rx); + elem->addAttribute("ry", ry); } return elem; } @@ -102,7 +107,7 @@ static unique_ptr<XMLElement> create_ellipse_element (double cx, double cy, doub * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ void TpicSpecialHandler::drawLines (double ddist, SpecialActions &actions) { if (!_points.empty() && (_penwidth > 0 || _grayLevel >= 0) && !actions.outputLocked()) { - unique_ptr<XMLElement> elem; + unique_ptr<SVGElement> elem; if (_points.size() == 1) { const DPair &p = _points.back(); elem = create_ellipse_element(p.x()+actions.getX(), p.y()+actions.getY(), _penwidth/2.0, _penwidth/2.0); @@ -110,26 +115,27 @@ void TpicSpecialHandler::drawLines (double ddist, SpecialActions &actions) { } else { if (_points.size() == 2 || (_grayLevel < 0 && _points.front() != _points.back())) { - elem = util::make_unique<XMLElement>("polyline"); - elem->addAttribute("fill", "none"); - elem->addAttribute("stroke-linecap", "round"); + elem = util::make_unique<SVGElement>("polyline"); + elem->setNoFillColor(); + elem->setStrokeLineCap(SVGElement::LC_ROUND); } else { while (_points.front() == _points.back()) _points.pop_back(); - elem = util::make_unique<XMLElement>("polygon"); - elem->addAttribute("fill", _grayLevel < 0 ? "none" : fillColor(false).svgColorString()); + elem = util::make_unique<SVGElement>("polygon"); + if (_grayLevel < 0) + elem->setNoFillColor(); + else + elem->setFillColor(fillColor(false)); } - ostringstream oss; - for (auto it=_points.begin(); it != _points.end(); ++it) { - if (it != _points.begin()) - oss << ' '; - double x = it->x()+actions.getX(); - double y = it->y()+actions.getY(); - oss << XMLString(x) << ',' << XMLString(y); + vector<DPair> points; + for (const DPair &p : _points) { + double x = p.x()+actions.getX(); + double y = p.y()+actions.getY(); + points.emplace_back(x, y); actions.embed(DPair(x, y)); } - elem->addAttribute("points", oss.str()); + elem->setPoints(points); add_stroke_attribs(elem.get(), _penwidth, Color::BLACK, ddist); } actions.svgTree().appendToPage(std::move(elem)); @@ -175,8 +181,8 @@ void TpicSpecialHandler::drawSplines (double ddist, SpecialActions &actions) { path.lineto(p+_points[numPoints-1]); actions.embed(p+_points[numPoints-1]); } - auto pathElem = util::make_unique<XMLElement>("path"); - pathElem->addAttribute("fill", "none"); + auto pathElem = util::make_unique<SVGElement>("path"); + pathElem->setNoFillColor(); ostringstream oss; path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); pathElem->addAttribute("d", oss.str()); @@ -200,7 +206,7 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do if ((_penwidth > 0 || _grayLevel >= 0) && !actions.outputLocked()) { cx += actions.getX(); cy += actions.getY(); - unique_ptr<XMLElement> elem; + unique_ptr<SVGElement> elem; bool closed=true; if (abs(angle2-angle1) >= math::TWO_PI) // closed ellipse? elem = create_ellipse_element(cx, cy, rx, ry); @@ -213,18 +219,21 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do path.closepath(); else closed = false; - elem = util::make_unique<XMLElement>("path"); + elem = util::make_unique<SVGElement>("path"); ostringstream oss; path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); elem->addAttribute("d", oss.str()); } if (_penwidth > 0) { - elem->addAttribute("stroke-width", _penwidth); - elem->addAttribute("stroke", actions.getColor().svgColorString()); + elem->setStrokeWidth(_penwidth); + elem->setStrokeColor(actions.getColor()); if (!closed) - elem->addAttribute("stroke-linecap", "round"); + elem->setStrokeLineCap(SVGElement::LC_ROUND); } - elem->addAttribute("fill", _grayLevel < 0 ? "none" : fillColor(true).svgColorString()); + if (_grayLevel < 0) + elem->setNoFillColor(); + else + elem->setFillColor(fillColor(true)); actions.svgTree().appendToPage(std::move(elem)); double pw = _penwidth/2.0; actions.embed(BoundingBox(cx-rx-pw, cy-ry-pw, cx+rx+pw, cy+ry+pw)); @@ -296,7 +305,7 @@ bool TpicSpecialHandler::process (const string &prefix, istream &is, SpecialActi case cmd_id("pa"): { // add point to path double x = ir.getDouble()*mi2bp; double y = ir.getDouble()*mi2bp; - _points.emplace_back(DPair(x,y)); + _points.emplace_back(x, y); break; } case cmd_id("fp"): // draw solid lines through recorded points; close and fill path if fill color was defined diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp index 8a9b458056f..a13613087db 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.hpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp index 76f58618396..41444b8b307 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -2,7 +2,7 @@ ** TriangularPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -31,7 +31,9 @@ TriangularPatch::TriangularPatch (const PointVec &points, const ColorVec &colors void TriangularPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) { - auto triangularPatch = dynamic_cast<TriangularPatch*>(patch); + TriangularPatch *triangularPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + triangularPatch = static_cast<TriangularPatch*>(patch); if (edgeflag > 0 && !triangularPatch) throw ShadingException("missing preceding data in definition of triangular patch"); if ((edgeflag == 0 && points.size() != 3) || (edgeflag > 0 && points.size() != 1)) @@ -62,7 +64,9 @@ void TriangularPatch::setPoints (const DPair &p1, const DPair &p2, const DPair & void TriangularPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { - auto triangularPatch = dynamic_cast<TriangularPatch*>(patch); + TriangularPatch *triangularPatch = nullptr; + if (patch && patch->psShadingType() == psShadingType()) + triangularPatch = static_cast<TriangularPatch*>(patch); if (edgeflag > 0 && !triangularPatch) throw ShadingException("missing preceding data in definition of triangular patch"); if ((edgeflag == 0 && colors.size() != 3) || (edgeflag > 0 && colors.size() != 1)) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp index 8d4453e5dbe..fc9c15e7fdf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.hpp @@ -2,7 +2,7 @@ ** TriangularPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp index 945c20bd403..b642c169f41 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.cpp @@ -2,7 +2,7 @@ ** TrueTypeFont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -56,7 +56,7 @@ bool TrueTypeFont::read (const string &fname) { if ((offset | length) > _buffer.size() || offset+length > _buffer.size()) return false; TTFTableRecord record = {tag, checksum, length, reinterpret_cast<const uint8_t*>(_buffer.data())+offset}; - _tableRecords.emplace_back(std::move(record)); + _tableRecords.push_back(std::move(record)); } return true; } @@ -94,7 +94,7 @@ void TrueTypeFont::writeWOFF (ostream &os) const { woffRecord.compressTableData(); woffSize += woffRecord.paddedSize(); ttfSize += ttfRecord.paddedSize(); - woffRecords.emplace_back(std::move(woffRecord)); + woffRecords.push_back(std::move(woffRecord)); } // write WOFF header StreamWriter writer(os); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp index a287f305faa..cc00001147f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TrueTypeFont.hpp @@ -2,7 +2,7 @@ ** TrueTypeFont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp index 5b7fb3d2388..af35bdf9bd5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp @@ -2,7 +2,7 @@ ** Unicode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp index 1547e3f7d40..75d0d0e2db4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.hpp @@ -2,7 +2,7 @@ ** Unicode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp index 6939d8e710e..150a5510210 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.hpp @@ -2,7 +2,7 @@ ** VFActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp index 6533333b5ea..7467b78d6b4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp @@ -2,7 +2,7 @@ ** VFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp index dabad674608..9d81745f7e3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.hpp @@ -2,7 +2,7 @@ ** VFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp index 9663490a196..49390c945a8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.hpp @@ -2,7 +2,7 @@ ** VectorIterator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -93,7 +93,7 @@ class VectorIterator { bool operator >= (const VectorIterator &it) const {return _pos >= it._pos;} bool operator < (const VectorIterator &it) const {return _pos < it._pos;} bool operator > (const VectorIterator &it) const {return _pos > it._pos;} - bool valid () const {return _pos >= 0 && _pos < _vector.size();} + bool valid () const {return _pos < _vector.size();} void invalidate () {_pos = _vector.size();} void reset () {_pos = 0;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp index 22709803ca5..a8f2df5b191 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.hpp @@ -2,7 +2,7 @@ ** VectorStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp index 992b01f3cf0..fc4651012c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp @@ -2,7 +2,7 @@ ** XMLDocument.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -39,7 +39,7 @@ void XMLDocument::append (unique_ptr<XMLNode> node) { if (node->toElement()) _rootElement = util::static_unique_ptr_cast<XMLElement>(std::move(node)); else - _nodes.emplace_back(std::move(node)); + _nodes.push_back(std::move(node)); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp index c6b56452264..e766580bc49 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.hpp @@ -2,7 +2,7 @@ ** XMLDocument.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp index b71ac7e8074..743da58b93d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp @@ -2,7 +2,7 @@ ** XMLNode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -107,7 +107,7 @@ void XMLElement::addAttribute (const string &name, const string &value) { if (Attribute *attr = getAttribute(name)) attr->value = value; else - _attributes.emplace_back(Attribute(name, value)); + _attributes.emplace_back(name, value); } @@ -387,12 +387,12 @@ ostream& XMLElement::write (ostream &os) const { os << '>'; // Insert newlines around children except text nodes. According to the // SVG specification, pure whitespace nodes are ignored by the SVG renderer. - if (WRITE_NEWLINES && !_firstChild->toText()) + if (WRITE_NEWLINES && name() != "text" && !_firstChild->toText()) os << '\n'; for (XMLNode *child = _firstChild.get(); child; child = child->next()) { child->write(os); if (!child->toText()) { - if (WRITE_NEWLINES && (!child->next() || !child->next()->toText())) + if (WRITE_NEWLINES && name() != "text" && (!child->next() || !child->next()->toText())) os << '\n'; } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp index ba9f68ad549..f1880352f20 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.hpp @@ -2,7 +2,7 @@ ** XMLNode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -128,7 +128,7 @@ class XMLElement : public XMLNode { explicit XMLElement (std::string name); XMLElement (const XMLElement &node); XMLElement (XMLElement &&node) noexcept; - ~XMLElement (); + ~XMLElement () override; std::unique_ptr<XMLNode> clone () const override {return util::make_unique<XMLElement>(*this);} void clear () override; void addAttribute (const std::string &name, const std::string &value); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp index 72026bdd767..6ce89b3d869 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp @@ -2,7 +2,7 @@ ** XMLString.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp index 36ef2bee55c..832ac434681 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.hpp @@ -2,7 +2,7 @@ ** XMLString.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp index 4478a2204cf..ecc2fd5f2bd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XXHashFunction.hpp @@ -2,7 +2,7 @@ ** XXHashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp index a995dbf01e9..7537dcf41ed 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ZLibOutputStream.hpp @@ -2,7 +2,7 @@ ** ZLibOutputStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp index 15f15958353..089064a1b98 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -2,7 +2,7 @@ ** dvisvgm.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -244,7 +244,7 @@ class VersionInfo { protected: void append (const string &name, const string &version) { - _versionPairs.emplace_back(pair<string,string>(name, version)); + _versionPairs.emplace_back(name, version); } private: @@ -349,7 +349,8 @@ static void set_variables (const CommandLine &cmdline) { string msg = "unknown font format '"+cmdline.fontFormatOpt.value()+"' (supported formats: "; for (const string &format : FontWriter::supportedFormats()) msg += format + ", "; - msg.erase(msg.end()-2); + msg.erase(msg.end()-2, msg.end()); + msg += ")"; throw CL::CommandLineException(msg); } SVGTree::CREATE_USE_ELEMENTS = cmdline.noFontsOpt.value() < 1; @@ -404,6 +405,46 @@ static void timer_message (double start_time, const pair<int,int> *pageinfo) { } +static void convert_file (size_t fnameIndex, const CommandLine &cmdline) { + const char *suffix = cmdline.epsOpt.given() ? "eps" : cmdline.pdfOpt.given() ? "pdf" : "dvi"; + string inputfile = ensure_suffix(cmdline.filenames()[fnameIndex], suffix); + SourceInput srcin(inputfile); + if (!srcin.getInputStream(true)) + throw MessageException("can't open file '" + srcin.getMessageFileName() + "' for reading"); + + double start_time = System::time(); + set_variables(cmdline); + SVGOutput out(cmdline.stdoutOpt.given() ? "" : srcin.getFileName(), + cmdline.outputOpt.value(), + cmdline.zipOpt.given() ? cmdline.zipOpt.value() : 0); + out.setFileNumbers(fnameIndex+1, cmdline.filenames().size()); + pair<int,int> pageinfo; + if (cmdline.epsOpt.given() || cmdline.pdfOpt.given()) { + auto img2svg = unique_ptr<ImageToSVG>( + cmdline.epsOpt.given() + ? static_cast<ImageToSVG*>(new EPSToSVG(srcin.getFilePath(), out)) + : static_cast<ImageToSVG*>(new PDFToSVG(srcin.getFilePath(), out))); + img2svg->setPageTransformation(get_transformation_string(cmdline)); + img2svg->convert(cmdline.pageOpt.value(), &pageinfo); + timer_message(start_time, img2svg->isSinglePageFormat() ? nullptr : &pageinfo); + } + else { + init_fontmap(cmdline); + DVIToSVG dvi2svg(srcin.getInputStream(), out); + if (!list_page_hashes(cmdline, dvi2svg)) { + const char *ignore_specials = nullptr; + if (cmdline.noSpecialsOpt.given()) + ignore_specials = cmdline.noSpecialsOpt.value().empty() ? "*" : cmdline.noSpecialsOpt.value().c_str(); + dvi2svg.setProcessSpecials(ignore_specials, true); + dvi2svg.setPageTransformation(get_transformation_string(cmdline)); + dvi2svg.setPageSize(cmdline.bboxOpt.value()); + dvi2svg.convert(cmdline.pageOpt.value(), &pageinfo); + timer_message(start_time, &pageinfo); + } + } +} + + int main (int argc, char *argv[]) { try { CommandLine cmdline; @@ -441,42 +482,9 @@ int main (int argc, char *argv[]) { throw MessageException("no input file given"); SignalHandler::instance().start(); - string inputfile = ensure_suffix(cmdline.filenames()[0], - cmdline.epsOpt.given() ? "eps" : cmdline.pdfOpt.given() ? "pdf" : "dvi"); - SourceInput srcin(inputfile); - if (!srcin.getInputStream(true)) - throw MessageException("can't open file '" + srcin.getMessageFileName() + "' for reading"); - - double start_time = System::time(); - set_variables(cmdline); - SVGOutput out(cmdline.stdoutOpt.given() ? "" : srcin.getFileName(), - cmdline.outputOpt.value(), - cmdline.zipOpt.given() ? cmdline.zipOpt.value() : 0); - pair<int,int> pageinfo; - if (cmdline.epsOpt.given() || cmdline.pdfOpt.given()) { - auto img2svg = unique_ptr<ImageToSVG>( - cmdline.epsOpt.given() - ? static_cast<ImageToSVG*>(new EPSToSVG(srcin.getFilePath(), out)) - : static_cast<ImageToSVG*>(new PDFToSVG(srcin.getFilePath(), out))); - img2svg->setPageTransformation(get_transformation_string(cmdline)); - img2svg->convert(cmdline.pageOpt.value(), &pageinfo); - timer_message(start_time, img2svg->isSinglePageFormat() ? nullptr : &pageinfo); - } - else { - init_fontmap(cmdline); - DVIToSVG dvi2svg(srcin.getInputStream(), out); - if (list_page_hashes(cmdline, dvi2svg)) - return 0; - const char *ignore_specials=nullptr; - if (cmdline.noSpecialsOpt.given()) - ignore_specials = cmdline.noSpecialsOpt.value().empty() ? "*" : cmdline.noSpecialsOpt.value().c_str(); - dvi2svg.setProcessSpecials(ignore_specials, true); - dvi2svg.setPageTransformation(get_transformation_string(cmdline)); - dvi2svg.setPageSize(cmdline.bboxOpt.value()); - - dvi2svg.convert(cmdline.pageOpt.value(), &pageinfo); - timer_message(start_time, &pageinfo); - } + size_t numFiles = cmdline.epsOpt.given() ? cmdline.filenames().size() : 1; + for (size_t i=0; i < numFiles; i++) + convert_file(i, cmdline); } catch (DVIException &e) { Message::estream() << "\nDVI error: " << e.what() << '\n'; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c index 4f89c2b6d19..7b6247366a2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.c @@ -2,7 +2,7 @@ ** ffwrapper.c ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h index 6474d854a2c..2732a9f1d72 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ffwrapper.h @@ -2,7 +2,7 @@ ** ffwrapper.h ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp index 907e402c8c9..489c4de0028 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.hpp @@ -2,7 +2,7 @@ ** macros.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp index e5f3b955367..d36314aae41 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.cpp @@ -2,7 +2,7 @@ ** AttributeExtractor.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp index c8ab6bd61a1..19cd4f0fed3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/AttributeExtractor.hpp @@ -2,7 +2,7 @@ ** AttributeExtractor.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp index 912d4a91107..bf1c1cc9737 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/DependencyGraph.hpp @@ -2,7 +2,7 @@ ** DependencyGraph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp index 47c0ac44ee5..03fc3ac1855 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.cpp @@ -2,7 +2,7 @@ ** GroupCollapser.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -24,10 +24,12 @@ #include <vector> #include "AttributeExtractor.hpp" #include "GroupCollapser.hpp" +#include "TransformSimplifier.hpp" #include "../XMLNode.hpp" using namespace std; +bool GroupCollapser::COMBINE_TRANSFORMS = true; const char* GroupCollapser::info () const { return "join nested group elements"; @@ -70,8 +72,9 @@ static void remove_ws_nodes (XMLElement *elem) { /** Recursively removes all redundant group elements from the given context element * and moves their attributes to the corresponding parent elements. - * @param[in] context root of the subtree to process */ -void GroupCollapser::execute (XMLElement *context) { + * @param[in] context root of the subtree to process + * @param[in] depth depth of tree node being processed (0 = root of local tree) */ +void GroupCollapser::execute (XMLElement *context, int depth) { if (!context) return; @@ -79,7 +82,7 @@ void GroupCollapser::execute (XMLElement *context) { while (child) { XMLNode *next=child->next(); if (XMLElement *childElement = child->toElement()) { - execute(childElement); + execute(childElement, depth+1); // check for groups without attributes and remove them if (childElement->name() == "g" && childElement->attributes().empty()) { remove_ws_nodes(childElement); @@ -97,6 +100,10 @@ void GroupCollapser::execute (XMLElement *context) { } } } + if (depth == 0 && COMBINE_TRANSFORMS && _transformCombined) { + TransformSimplifier().execute(context); + _transformCombined = false; + } } @@ -107,13 +114,16 @@ void GroupCollapser::execute (XMLElement *context) { * @return true if all attributes have been moved */ bool GroupCollapser::moveAttributes (XMLElement &source, XMLElement &dest) { vector<string> movedAttributes; - for (const XMLElement::Attribute &attr : source.attributes()) { + for (const auto &attr : source.attributes()) { if (attr.name == "transform") { string transform; - if (const char *destvalue = dest.getAttributeValue("transform")) + if (const char *destvalue = dest.getAttributeValue("transform")) { transform = destvalue+attr.value; - else + _transformCombined = true; + } + else { transform = attr.value; + } dest.addAttribute("transform", transform); movedAttributes.emplace_back("transform"); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp index 2694c4f3558..addf65b4aca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/GroupCollapser.hpp @@ -2,7 +2,7 @@ ** GroupCollapser.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -26,11 +26,17 @@ class GroupCollapser : public OptimizerModule { public: void execute (XMLElement*, XMLElement *context) override {execute(context);}; - void execute (XMLElement *context); + void execute (XMLElement *context) {execute(context, 0);} const char* info () const override; + static bool COMBINE_TRANSFORMS; + protected: - static bool moveAttributes (XMLElement &source, XMLElement &dest); + void execute (XMLElement *context, int depth); + bool moveAttributes (XMLElement &source, XMLElement &dest); static bool collapsible (const XMLElement &elem); static bool unwrappable (const XMLElement &source, const XMLElement &dest); + + private: + bool _transformCombined=false; ///< true if transform attributes have been combined }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp index 91f0263bb86..94e4c743815 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/OptimizerModule.hpp @@ -2,7 +2,7 @@ ** OptimizerModule.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp index f8d040a3299..7d34bbcd11d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.cpp @@ -2,7 +2,7 @@ ** RedundantElementRemover.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp index 52ce905c8eb..ce87bf4751f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/RedundantElementRemover.hpp @@ -2,7 +2,7 @@ ** RedundantElementRemover.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** 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 8f9635a8365..9ff1b8163f3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.cpp @@ -2,7 +2,7 @@ ** SVGOptimizer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -51,15 +51,21 @@ void SVGOptimizer::execute () { return; if (MODULE_SEQUENCE.empty()) MODULE_SEQUENCE = "remove-clippath"; // default behaviour of previous dvisvgm releases - if (MODULE_SEQUENCE == "all") { - for (const auto &entry : _moduleEntries) - entry.module->execute(_svg->defsNode(), _svg->pageNode()); - } else { - vector<string> names = util::split(MODULE_SEQUENCE, ","); - for (const string &name : names) { - if (OptimizerModule *module = getModule(name)) - module->execute(_svg->defsNode(), _svg->pageNode()); + if (MODULE_SEQUENCE == "all") { + for (const auto &entry: _moduleEntries) + entry.module->execute(_svg->defsNode(), _svg->pageNode()); + } + else { + vector<string> names = util::split(MODULE_SEQUENCE, ","); + auto it = find_if(names.begin(), names.end(), [](const string &name) { + return name == "simplify-transform"; + }); + GroupCollapser::COMBINE_TRANSFORMS = (it != names.end()); + for (const string &name: names) { + if (OptimizerModule *module = getModule(name)) + module->execute(_svg->defsNode(), _svg->pageNode()); + } } } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp index b15723d9ea4..9cd9e64da3c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/SVGOptimizer.hpp @@ -2,7 +2,7 @@ ** SVGOptimizer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp index 72cb0c5bb5e..b07db7701b6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.cpp @@ -2,7 +2,7 @@ ** TextSimplifier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -39,7 +39,7 @@ static XMLElement::Attributes common_inheritable_attributes (const vector<XMLEle if (commonAttribs.empty()) { if (intersected) break; - for (const auto attrib : elem->attributes()) { + for (const auto &attrib : elem->attributes()) { if (AttributeExtractor::inheritable(attrib)) commonAttribs.push_back(attrib); } @@ -94,11 +94,11 @@ void TextSimplifier::execute (XMLElement *context) { vector<XMLElement::Attribute> attribs = common_inheritable_attributes(tspans); if (!tspans.empty() && !attribs.empty()) { // move all common tspan attributes to the parent text element - for (const XMLElement::Attribute &attr : attribs) + for (const auto &attr : attribs) context->addAttribute(attr.name, attr.value); // remove all common attributes from the tspan elements for (XMLElement *tspan : tspans) { - for (const XMLElement::Attribute &attr : attribs) + for (const auto &attr : attribs) tspan->removeAttribute(attr.name); // unwrap the tspan if there are no remaining attributes if (tspan->attributes().empty()) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp index 9ad3e0edb04..8908861366c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TextSimplifier.hpp @@ -2,7 +2,7 @@ ** TextSimplifier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp index ce0a6d8d7ae..3eca47fc3d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.cpp @@ -2,7 +2,7 @@ ** TransformSimplifier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp index 10591dc271f..023c9655ea8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/TransformSimplifier.hpp @@ -2,7 +2,7 @@ ** TransformSimplifier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp index 09de2f19bbf..864c13905be 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.cpp @@ -2,7 +2,7 @@ ** WSNodeRemover.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp index 438c21c8fdd..b050b523905 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/optimizer/WSNodeRemover.hpp @@ -2,7 +2,7 @@ ** WSNodeRemover.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd index 21c33a168a2..1b454e38502 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd @@ -3,7 +3,7 @@ ** options.dtd ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml index 1d0d09e3d6d..d39dc17b9bd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml @@ -3,7 +3,7 @@ ** options.xml ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -26,7 +26,7 @@ <usage>--eps [options] epsfile</usage> <usage>--pdf [options] pdffile</usage> <description>This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.</description> - <copyright>Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de></copyright> + <copyright>Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de></copyright> </program> <options> <section title="Input options"> diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp index 40de4677d14..8feade148e2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -2,7 +2,7 @@ ** psdefs.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -115,47 +115,51 @@ const char *PSInterpreter::PSDEFS = "rgbcolor 3(setrgbcolor)prcmd}def/printgstate{@dodraw @GD/@nulldev get not and{" "matrix currentmatrix aload pop 6(setmatrix)prcmd applyscalevals currentlinewid" "th 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoin 1(se" -"tlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd prcolor currentdash ma" -"rk 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}if}d" -"ef/strconcat{exch dup length 2 index length add string dup dup 4 2 roll copy l" -"ength 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgstate}def/s" -"ave{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prcmd}def/" -"restore{:restore @checknulldev printgstate @UD/@saveID known{@UD begin @saveID" -" end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore @checknull" -"dev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @checknulldev se" -"tstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup 1(" -"rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype ne " -"@dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate" -"{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/translate sysex" -"ec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd app" -"lyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{matrix curr" -"entmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1 roll>>" -"begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin PatternTy" -"pe 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload pop " -"15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(makepattern)p" -"rcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpattern{begin Pa" -"tternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorsp" -"ace aload length -1 roll pop]/setcolorspace sysexec/setcolor sysexec XUID aloa" -"d pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd currentcolo" -"rspace 0 get/Pattern ne{[/Pattern currentcolorspace]/setcolorspace sysexec}if " -"currentcolorspace @setcolorspace}{/setpattern sysexec}ifelse end}def/setcolor{" -"dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor sysexec set" -"rgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sysexec @setcolorspace}def" -"/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern eq{1}{0}ifelse 1(setcol" -"orspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/set" -"rgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape known{dup/.setalphaissh" -"ape sysexec}if{1}{0}ifelse 1(setisshapealpha)prcmd}bind def/.setfillconstantal" -"pha{@SD/.setfillconstantalpha known{dup/.setfillconstantalpha sysexec}if 1(set" -"fillconstantalpha)prcmd}bind def/.setstrokeconstantalpha{@SD/.setstrokeconstan" -"talpha known{dup/.setstrokeconstantalpha sysexec}if 1(setstrokeconstantalpha)p" -"rcmd}bind def/.setopacityalpha{false .setalphaisshape dup .setfillconstantalph" -"a .setstrokeconstantalpha}bind def/.setshapealpha{true .setalphaisshape dup .s" -"etfillconstantalpha .setstrokeconstantalpha}bind def/.setblendmode{dup/.setble" -"ndmode sysexec<</Normal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3/SoftLight" -" 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Lighten 9/Difference 10/Exclu" -"sion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverprint 16>>ex" -"ch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file runpdfbegin pdfpagecount" -" runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup 1 lt exch pdfpagecount " -"gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse runpdfend}def DELAYBI" -"ND{.bindnow}if "; +"tlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd revision dup 952 lt{po" +"p}{.currentblendmode .setblendmode 952 eq{.currentopacityalpha .setopacityalph" +"a .currentshapealpha .setshapealpha}{.currentalphaisshape{1}{0}ifelse 1(setalp" +"haisshape)prcmd .currentstrokeconstantalpha 1(setstrokeconstantalpha)prcmd .cu" +"rrentfillconstantalpha 1(setfillconstantalpha)prcmd}ifelse}ifelse prcolor curr" +"entdash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcm" +"d pop}if}def/strconcat{exch dup length 2 index length add string dup dup 4 2 r" +"oll copy length 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgs" +"tate}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)" +"prcmd}def/restore{:restore @checknulldev printgstate @UD/@saveID known{@UD beg" +"in @saveID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore " +"@checknulldev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @check" +"nulldev setstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw " +"and{dup 1(rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arr" +"aytype ne @dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def" +"/translate{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/trans" +"late sysexec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix" +")prcmd applyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{m" +"atrix currentmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3" +" -1 roll>>begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin" +" PatternType 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx " +"aload pop 15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(mak" +"epattern)prcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpatter" +"n{dup begin PatternType end 1 eq{begin PaintType 1 eq{XUID aload pop exch pop " +"1}{:gsave[currentcolorspace aload length -1 roll pop]/setcolorspace sysexec/se" +"tcolor sysexec XUID aload pop exch pop currentrgbcolor :grestore 4}ifelse(setp" +"attern)prcmd currentcolorspace 0 get/Pattern ne{[/Pattern currentcolorspace]/s" +"etcolorspace sysexec}if currentcolorspace @setcolorspace end}{/setpattern syse" +"xec}ifelse}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysexec/cur" +"rentrgbcolor sysexec setrgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sy" +"sexec @setcolorspace}def/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern" +" eq{1}{0}ifelse 1(setcolorspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr" +"/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape" +" known{dup/.setalphaisshape sysexec}if{1}{0}ifelse 1(setalphaisshape)prcmd}bin" +"d def/.setfillconstantalpha{@SD/.setfillconstantalpha known{dup/.setfillconsta" +"ntalpha sysexec}if 1(setfillconstantalpha)prcmd}bind def/.setstrokeconstantalp" +"ha{@SD/.setstrokeconstantalpha known{dup/.setstrokeconstantalpha sysexec}if 1(" +"setstrokeconstantalpha)prcmd}bind def/.setopacityalpha{false .setalphaisshape " +"dup .setfillconstantalpha .setstrokeconstantalpha}bind def/.setshapealpha{true" +" .setalphaisshape dup .setfillconstantalpha .setstrokeconstantalpha}bind def/." +"setblendmode{dup/.setblendmode sysexec<</Normal 0/Compatible 0/Multiply 1/Scre" +"en 2/Overlay 3/SoftLight 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Light" +"en 9/Difference 10/Exclusion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/Co" +"mpatibleOverprint 16>>exch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file " +"runpdfbegin pdfpagecount runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup" +" 1 lt exch pdfpagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifel" +"se runpdfend}def DELAYBIND{.bindnow}if "; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp index f702d67ce54..56f2c17ae7c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.cpp @@ -2,7 +2,7 @@ ** utility.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -134,17 +134,17 @@ string util::replace (string str, const string &find, const string &repl) { vector<string> util::split (const string &str, const string &sep) { vector<string> parts; if (str.empty() || sep.empty()) - parts.emplace_back(str); + parts.push_back(str); else { size_t left=0; while (left <= str.length()) { size_t right = str.find(sep, left); if (right == string::npos) { - parts.emplace_back(str.substr(left)); + parts.push_back(str.substr(left)); left = string::npos; } else { - parts.emplace_back(str.substr(left, right-left)); + parts.push_back(str.substr(left, right-left)); left = right+sep.length(); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp index ff8387a4190..9ab0d605420 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp @@ -2,7 +2,7 @@ ** utility.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** @@ -25,6 +25,7 @@ #include <memory> #include <sstream> #include <string> +#include <type_traits> #include <vector> namespace math { @@ -145,6 +146,17 @@ std::unique_ptr<T> static_unique_ptr_cast (std::unique_ptr<U> &&old){ return std::unique_ptr<T>{static_cast<T*>(old.release())}; } +template <typename T> +struct set_const_of { + template <typename U> + struct by { + using type = typename std::conditional< + std::is_const<U>::value, + typename std::add_const<T>::type, + typename std::remove_const<T>::type + >::type; + }; +}; } // namespace util #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in index 70d27f6e48d..7f673d167a4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp.in @@ -2,7 +2,7 @@ ** version.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp index 5f71bbed1e4..2316f1a1cdf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/windows.hpp @@ -2,7 +2,7 @@ ** windows.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> ** +** 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 ** |