From d50a41b6ab3d05fe5605a3a3b50ff68f61059296 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 16 Mar 2020 03:01:06 +0000 Subject: CTAN sync 202003160301 --- dviware/dvisvgm/src/AGLTable.hpp | 2 +- dviware/dvisvgm/src/BasicDVIReader.cpp | 2 +- dviware/dvisvgm/src/BasicDVIReader.hpp | 2 +- dviware/dvisvgm/src/Bezier.cpp | 6 +- dviware/dvisvgm/src/Bezier.hpp | 2 +- dviware/dvisvgm/src/BgColorSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/BgColorSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/Bitmap.cpp | 2 +- dviware/dvisvgm/src/Bitmap.hpp | 2 +- dviware/dvisvgm/src/BoundingBox.cpp | 4 +- dviware/dvisvgm/src/BoundingBox.hpp | 2 +- dviware/dvisvgm/src/CLCommandLine.cpp | 2 +- dviware/dvisvgm/src/CLCommandLine.hpp | 2 +- dviware/dvisvgm/src/CLOption.hpp | 2 +- dviware/dvisvgm/src/CMap.cpp | 2 +- dviware/dvisvgm/src/CMap.hpp | 2 +- dviware/dvisvgm/src/CMapManager.cpp | 2 +- dviware/dvisvgm/src/CMapManager.hpp | 2 +- dviware/dvisvgm/src/CMapReader.cpp | 2 +- dviware/dvisvgm/src/CMapReader.hpp | 2 +- dviware/dvisvgm/src/Calculator.cpp | 2 +- dviware/dvisvgm/src/Calculator.hpp | 2 +- dviware/dvisvgm/src/CharMapID.cpp | 2 +- dviware/dvisvgm/src/CharMapID.hpp | 2 +- dviware/dvisvgm/src/Character.hpp | 2 +- dviware/dvisvgm/src/Color.cpp | 2 +- dviware/dvisvgm/src/Color.hpp | 2 +- dviware/dvisvgm/src/ColorSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/ColorSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/CommandLine.hpp | 10 +- dviware/dvisvgm/src/DLLoader.cpp | 2 +- dviware/dvisvgm/src/DLLoader.hpp | 2 +- dviware/dvisvgm/src/DVIActions.hpp | 2 +- dviware/dvisvgm/src/DVIReader.cpp | 2 +- dviware/dvisvgm/src/DVIReader.hpp | 2 +- dviware/dvisvgm/src/DVIToSVG.cpp | 2 +- dviware/dvisvgm/src/DVIToSVG.hpp | 2 +- dviware/dvisvgm/src/DVIToSVGActions.cpp | 2 +- dviware/dvisvgm/src/DVIToSVGActions.hpp | 2 +- dviware/dvisvgm/src/Directory.cpp | 2 +- dviware/dvisvgm/src/Directory.hpp | 2 +- dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/EPSFile.cpp | 2 +- dviware/dvisvgm/src/EPSFile.hpp | 2 +- dviware/dvisvgm/src/EPSToSVG.hpp | 4 +- dviware/dvisvgm/src/EllipticalArc.cpp | 2 +- dviware/dvisvgm/src/EllipticalArc.hpp | 2 +- dviware/dvisvgm/src/EmSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/EmSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/EncFile.cpp | 2 +- dviware/dvisvgm/src/EncFile.hpp | 2 +- dviware/dvisvgm/src/FileFinder.cpp | 2 +- dviware/dvisvgm/src/FileFinder.hpp | 2 +- dviware/dvisvgm/src/FilePath.cpp | 12 +- dviware/dvisvgm/src/FilePath.hpp | 4 +- dviware/dvisvgm/src/FileSystem.cpp | 2 +- dviware/dvisvgm/src/FileSystem.hpp | 2 +- dviware/dvisvgm/src/FixWord.hpp | 2 +- dviware/dvisvgm/src/Font.cpp | 8 +- dviware/dvisvgm/src/Font.hpp | 2 +- dviware/dvisvgm/src/FontCache.cpp | 2 +- dviware/dvisvgm/src/FontCache.hpp | 2 +- dviware/dvisvgm/src/FontEncoding.cpp | 2 +- dviware/dvisvgm/src/FontEncoding.hpp | 2 +- dviware/dvisvgm/src/FontEngine.cpp | 2 +- dviware/dvisvgm/src/FontEngine.hpp | 2 +- dviware/dvisvgm/src/FontManager.cpp | 2 +- dviware/dvisvgm/src/FontManager.hpp | 2 +- dviware/dvisvgm/src/FontMap.cpp | 2 +- dviware/dvisvgm/src/FontMap.hpp | 2 +- dviware/dvisvgm/src/FontMetrics.cpp | 2 +- dviware/dvisvgm/src/FontMetrics.hpp | 2 +- dviware/dvisvgm/src/FontStyle.hpp | 2 +- dviware/dvisvgm/src/FontWriter.cpp | 6 +- dviware/dvisvgm/src/FontWriter.hpp | 2 +- dviware/dvisvgm/src/GFGlyphTracer.cpp | 2 +- dviware/dvisvgm/src/GFGlyphTracer.hpp | 2 +- dviware/dvisvgm/src/GFReader.cpp | 2 +- dviware/dvisvgm/src/GFReader.hpp | 2 +- dviware/dvisvgm/src/GFTracer.cpp | 2 +- dviware/dvisvgm/src/GFTracer.hpp | 2 +- dviware/dvisvgm/src/Ghostscript.cpp | 5 +- dviware/dvisvgm/src/Ghostscript.hpp | 2 +- dviware/dvisvgm/src/Glyph.hpp | 2 +- dviware/dvisvgm/src/GlyphTracerMessages.hpp | 23 ++- dviware/dvisvgm/src/GraphicsPath.hpp | 8 +- dviware/dvisvgm/src/HashFunction.cpp | 2 +- dviware/dvisvgm/src/HashFunction.hpp | 2 +- dviware/dvisvgm/src/HtmlSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/HtmlSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/HyperlinkManager.cpp | 2 +- dviware/dvisvgm/src/HyperlinkManager.hpp | 2 +- dviware/dvisvgm/src/ImageToSVG.cpp | 8 +- dviware/dvisvgm/src/ImageToSVG.hpp | 11 +- dviware/dvisvgm/src/InputBuffer.cpp | 2 +- dviware/dvisvgm/src/InputBuffer.hpp | 2 +- dviware/dvisvgm/src/InputReader.cpp | 2 +- dviware/dvisvgm/src/InputReader.hpp | 2 +- dviware/dvisvgm/src/JFM.cpp | 2 +- dviware/dvisvgm/src/JFM.hpp | 2 +- dviware/dvisvgm/src/Length.cpp | 2 +- dviware/dvisvgm/src/Length.hpp | 2 +- dviware/dvisvgm/src/MD5HashFunction.hpp | 2 +- dviware/dvisvgm/src/Makefile.am | 2 +- dviware/dvisvgm/src/MapLine.cpp | 2 +- dviware/dvisvgm/src/MapLine.hpp | 2 +- dviware/dvisvgm/src/Matrix.cpp | 30 +-- dviware/dvisvgm/src/Matrix.hpp | 2 +- dviware/dvisvgm/src/Message.cpp | 2 +- dviware/dvisvgm/src/Message.hpp | 2 +- dviware/dvisvgm/src/MessageException.hpp | 2 +- dviware/dvisvgm/src/MetafontWrapper.cpp | 62 ++++-- dviware/dvisvgm/src/MetafontWrapper.hpp | 8 +- dviware/dvisvgm/src/MiKTeXCom.cpp | 2 +- dviware/dvisvgm/src/MiKTeXCom.hpp | 2 +- dviware/dvisvgm/src/NoPsSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/NoPsSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/NumericRanges.hpp | 2 +- dviware/dvisvgm/src/PDFParser.cpp | 2 +- dviware/dvisvgm/src/PDFParser.hpp | 2 +- dviware/dvisvgm/src/PDFToSVG.hpp | 4 +- dviware/dvisvgm/src/PSFilter.hpp | 2 +- dviware/dvisvgm/src/PSInterpreter.cpp | 79 ++++++- dviware/dvisvgm/src/PSInterpreter.hpp | 13 +- dviware/dvisvgm/src/PSPattern.cpp | 11 +- dviware/dvisvgm/src/PSPattern.hpp | 2 +- dviware/dvisvgm/src/PSPreviewFilter.cpp | 2 +- dviware/dvisvgm/src/PSPreviewFilter.hpp | 2 +- dviware/dvisvgm/src/PageRanges.cpp | 2 +- dviware/dvisvgm/src/PageRanges.hpp | 2 +- dviware/dvisvgm/src/PageSize.cpp | 18 +- dviware/dvisvgm/src/PageSize.hpp | 2 +- dviware/dvisvgm/src/Pair.hpp | 2 +- dviware/dvisvgm/src/PapersizeSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/PapersizeSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/PathClipper.cpp | 2 +- dviware/dvisvgm/src/PathClipper.hpp | 2 +- dviware/dvisvgm/src/PdfSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/PdfSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/PreScanDVIReader.cpp | 2 +- dviware/dvisvgm/src/PreScanDVIReader.hpp | 2 +- dviware/dvisvgm/src/Process.cpp | 2 +- dviware/dvisvgm/src/Process.hpp | 2 +- dviware/dvisvgm/src/PsSpecialHandler.cpp | 125 ++++++++--- dviware/dvisvgm/src/PsSpecialHandler.hpp | 13 +- dviware/dvisvgm/src/RangeMap.cpp | 2 +- dviware/dvisvgm/src/RangeMap.hpp | 2 +- dviware/dvisvgm/src/SVGCharHandler.cpp | 2 +- dviware/dvisvgm/src/SVGCharHandler.hpp | 2 +- dviware/dvisvgm/src/SVGCharHandlerFactory.cpp | 2 +- dviware/dvisvgm/src/SVGCharHandlerFactory.hpp | 2 +- dviware/dvisvgm/src/SVGCharPathHandler.cpp | 2 +- dviware/dvisvgm/src/SVGCharPathHandler.hpp | 2 +- dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp | 2 +- dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp | 2 +- dviware/dvisvgm/src/SVGOutput.cpp | 2 +- dviware/dvisvgm/src/SVGOutput.hpp | 2 +- dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp | 2 +- dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp | 2 +- dviware/dvisvgm/src/SVGTree.cpp | 2 +- dviware/dvisvgm/src/SVGTree.hpp | 2 +- dviware/dvisvgm/src/ShadingPatch.cpp | 2 +- dviware/dvisvgm/src/ShadingPatch.hpp | 2 +- dviware/dvisvgm/src/SignalHandler.cpp | 2 +- dviware/dvisvgm/src/SignalHandler.hpp | 2 +- dviware/dvisvgm/src/SourceInput.cpp | 2 +- dviware/dvisvgm/src/SourceInput.hpp | 2 +- dviware/dvisvgm/src/SpecialActions.hpp | 2 +- dviware/dvisvgm/src/SpecialHandler.hpp | 2 +- dviware/dvisvgm/src/SpecialManager.cpp | 2 +- dviware/dvisvgm/src/SpecialManager.hpp | 2 +- dviware/dvisvgm/src/StreamReader.cpp | 2 +- dviware/dvisvgm/src/StreamReader.hpp | 2 +- dviware/dvisvgm/src/StreamWriter.cpp | 2 +- dviware/dvisvgm/src/StreamWriter.hpp | 2 +- dviware/dvisvgm/src/Subfont.cpp | 2 +- dviware/dvisvgm/src/Subfont.hpp | 2 +- dviware/dvisvgm/src/System.cpp | 2 +- dviware/dvisvgm/src/System.hpp | 2 +- dviware/dvisvgm/src/TFM.cpp | 2 +- dviware/dvisvgm/src/TFM.hpp | 2 +- dviware/dvisvgm/src/TTFAutohint.cpp | 2 +- dviware/dvisvgm/src/TTFAutohint.hpp | 2 +- dviware/dvisvgm/src/TensorProductPatch.cpp | 6 +- dviware/dvisvgm/src/TensorProductPatch.hpp | 2 +- dviware/dvisvgm/src/Terminal.cpp | 2 +- dviware/dvisvgm/src/Terminal.hpp | 2 +- dviware/dvisvgm/src/ToUnicodeMap.cpp | 2 +- dviware/dvisvgm/src/ToUnicodeMap.hpp | 2 +- dviware/dvisvgm/src/TpicSpecialHandler.cpp | 2 +- dviware/dvisvgm/src/TpicSpecialHandler.hpp | 2 +- dviware/dvisvgm/src/TriangularPatch.cpp | 6 +- dviware/dvisvgm/src/TriangularPatch.hpp | 2 +- dviware/dvisvgm/src/TrueTypeFont.cpp | 2 +- dviware/dvisvgm/src/TrueTypeFont.hpp | 2 +- dviware/dvisvgm/src/Unicode.cpp | 2 +- dviware/dvisvgm/src/Unicode.hpp | 2 +- dviware/dvisvgm/src/VFActions.hpp | 2 +- dviware/dvisvgm/src/VFReader.cpp | 2 +- dviware/dvisvgm/src/VFReader.hpp | 2 +- dviware/dvisvgm/src/VectorIterator.hpp | 2 +- dviware/dvisvgm/src/VectorStream.hpp | 2 +- dviware/dvisvgm/src/XMLDocument.cpp | 2 +- dviware/dvisvgm/src/XMLDocument.hpp | 2 +- dviware/dvisvgm/src/XMLNode.cpp | 49 ++++- dviware/dvisvgm/src/XMLNode.hpp | 5 +- dviware/dvisvgm/src/XMLString.cpp | 2 +- dviware/dvisvgm/src/XMLString.hpp | 2 +- dviware/dvisvgm/src/XXHashFunction.hpp | 2 +- dviware/dvisvgm/src/ZLibOutputStream.hpp | 2 +- dviware/dvisvgm/src/dvisvgm.cpp | 10 +- dviware/dvisvgm/src/ffwrapper.c | 2 +- dviware/dvisvgm/src/ffwrapper.h | 2 +- dviware/dvisvgm/src/macros.hpp | 2 +- .../dvisvgm/src/optimizer/AttributeExtractor.cpp | 2 +- .../dvisvgm/src/optimizer/AttributeExtractor.hpp | 2 +- dviware/dvisvgm/src/optimizer/DependencyGraph.hpp | 2 +- dviware/dvisvgm/src/optimizer/GroupCollapser.cpp | 2 +- dviware/dvisvgm/src/optimizer/GroupCollapser.hpp | 2 +- dviware/dvisvgm/src/optimizer/OptimizerModule.hpp | 2 +- .../src/optimizer/RedundantElementRemover.cpp | 3 +- .../src/optimizer/RedundantElementRemover.hpp | 2 +- dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp | 2 +- dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp | 2 +- dviware/dvisvgm/src/optimizer/TextSimplifier.cpp | 2 +- dviware/dvisvgm/src/optimizer/TextSimplifier.hpp | 2 +- .../dvisvgm/src/optimizer/TransformSimplifier.cpp | 35 +++- .../dvisvgm/src/optimizer/TransformSimplifier.hpp | 2 +- dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp | 2 +- dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp | 2 +- dviware/dvisvgm/src/options.dtd | 2 +- dviware/dvisvgm/src/options.xml | 10 +- dviware/dvisvgm/src/psdefs.cpp | 230 ++++++++++++--------- dviware/dvisvgm/src/utility.cpp | 2 +- dviware/dvisvgm/src/utility.hpp | 24 ++- dviware/dvisvgm/src/version.hpp.in | 2 +- dviware/dvisvgm/src/windows.hpp | 2 +- 238 files changed, 792 insertions(+), 468 deletions(-) (limited to 'dviware/dvisvgm/src') diff --git a/dviware/dvisvgm/src/AGLTable.hpp b/dviware/dvisvgm/src/AGLTable.hpp index d973d1186b..c1d460273a 100644 --- a/dviware/dvisvgm/src/AGLTable.hpp +++ b/dviware/dvisvgm/src/AGLTable.hpp @@ -2,7 +2,7 @@ ** AGLTable.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/BasicDVIReader.cpp b/dviware/dvisvgm/src/BasicDVIReader.cpp index 272c88c3ad..bb30154e7b 100644 --- a/dviware/dvisvgm/src/BasicDVIReader.cpp +++ b/dviware/dvisvgm/src/BasicDVIReader.cpp @@ -2,7 +2,7 @@ ** BasicDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/BasicDVIReader.hpp b/dviware/dvisvgm/src/BasicDVIReader.hpp index 14a1fb9858..7ce1f989e2 100644 --- a/dviware/dvisvgm/src/BasicDVIReader.hpp +++ b/dviware/dvisvgm/src/BasicDVIReader.hpp @@ -2,7 +2,7 @@ ** BasicDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Bezier.cpp b/dviware/dvisvgm/src/Bezier.cpp index d2077bcfeb..87a0070621 100644 --- a/dviware/dvisvgm/src/Bezier.cpp +++ b/dviware/dvisvgm/src/Bezier.cpp @@ -2,7 +2,7 @@ ** Bezier.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -168,7 +168,7 @@ static inline double dot_prod (const DPair &p1, const DPair &p2) { static bool between (const DPair &p1, const DPair &p2, const DPair &p3, double delta) { double sqr_dist = dot_prod(p2-p1, p2-p1); double factor = sqr_dist == 0.0 ? 1.0 : sqr_dist; - double area2 = fabs(signed_area(p1, p2, p3)); + double area2 = abs(signed_area(p1, p2, p3)); return area2*area2/factor < delta // does p3 lay almost on the line through p1 and p2... && min(p1.x(), p2.x()) <= p3.x() // ...and on or inside the rectangle spanned by p1 and p2? && max(p1.x(), p2.x()) >= p3.x() @@ -179,7 +179,7 @@ static bool between (const DPair &p1, const DPair &p2, const DPair &p3, double d static inline bool near (const DPair &p1, const DPair &p2, double delta) { DPair diff = p2-p1; - return fabs(diff.x()) < delta && fabs(diff.y()) < delta; + return abs(diff.x()) < delta && abs(diff.y()) < delta; } diff --git a/dviware/dvisvgm/src/Bezier.hpp b/dviware/dvisvgm/src/Bezier.hpp index 525ef23435..322dd4e72d 100644 --- a/dviware/dvisvgm/src/Bezier.hpp +++ b/dviware/dvisvgm/src/Bezier.hpp @@ -2,7 +2,7 @@ ** Bezier.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/BgColorSpecialHandler.cpp b/dviware/dvisvgm/src/BgColorSpecialHandler.cpp index 10c05fca05..3b315b50a3 100644 --- a/dviware/dvisvgm/src/BgColorSpecialHandler.cpp +++ b/dviware/dvisvgm/src/BgColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/BgColorSpecialHandler.hpp b/dviware/dvisvgm/src/BgColorSpecialHandler.hpp index e1061efc8c..9334a5c541 100644 --- a/dviware/dvisvgm/src/BgColorSpecialHandler.hpp +++ b/dviware/dvisvgm/src/BgColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** BgColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Bitmap.cpp b/dviware/dvisvgm/src/Bitmap.cpp index 3fa554eed4..64ebd6195e 100644 --- a/dviware/dvisvgm/src/Bitmap.cpp +++ b/dviware/dvisvgm/src/Bitmap.cpp @@ -2,7 +2,7 @@ ** Bitmap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Bitmap.hpp b/dviware/dvisvgm/src/Bitmap.hpp index 026edae9a2..0d04aa2a69 100644 --- a/dviware/dvisvgm/src/Bitmap.hpp +++ b/dviware/dvisvgm/src/Bitmap.hpp @@ -2,7 +2,7 @@ ** Bitmap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/BoundingBox.cpp b/dviware/dvisvgm/src/BoundingBox.cpp index a076b52363..2dbcc2ebcd 100644 --- a/dviware/dvisvgm/src/BoundingBox.cpp +++ b/dviware/dvisvgm/src/BoundingBox.cpp @@ -2,7 +2,7 @@ ** BoundingBox.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -207,7 +207,7 @@ void BoundingBox::operator += (const BoundingBox &bbox) { static inline bool almost_equal (double v1, double v2) { - return fabs(v1-v2) < 1e-10; + return abs(v1-v2) < 1e-10; } diff --git a/dviware/dvisvgm/src/BoundingBox.hpp b/dviware/dvisvgm/src/BoundingBox.hpp index 8848f60f28..c52312a24a 100644 --- a/dviware/dvisvgm/src/BoundingBox.hpp +++ b/dviware/dvisvgm/src/BoundingBox.hpp @@ -2,7 +2,7 @@ ** BoundingBox.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CLCommandLine.cpp b/dviware/dvisvgm/src/CLCommandLine.cpp index 2b0c1b5359..1f6bb4475e 100644 --- a/dviware/dvisvgm/src/CLCommandLine.cpp +++ b/dviware/dvisvgm/src/CLCommandLine.cpp @@ -2,7 +2,7 @@ ** CLCommandLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CLCommandLine.hpp b/dviware/dvisvgm/src/CLCommandLine.hpp index a80d9b87d7..257ff4160f 100644 --- a/dviware/dvisvgm/src/CLCommandLine.hpp +++ b/dviware/dvisvgm/src/CLCommandLine.hpp @@ -2,7 +2,7 @@ ** CLCommandLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CLOption.hpp b/dviware/dvisvgm/src/CLOption.hpp index 54dff67025..d9da7ae008 100644 --- a/dviware/dvisvgm/src/CLOption.hpp +++ b/dviware/dvisvgm/src/CLOption.hpp @@ -2,7 +2,7 @@ ** CLOption.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMap.cpp b/dviware/dvisvgm/src/CMap.cpp index fa92901eef..747fb5ad50 100644 --- a/dviware/dvisvgm/src/CMap.cpp +++ b/dviware/dvisvgm/src/CMap.cpp @@ -2,7 +2,7 @@ ** CMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMap.hpp b/dviware/dvisvgm/src/CMap.hpp index 0f0259e853..63761ff2ff 100644 --- a/dviware/dvisvgm/src/CMap.hpp +++ b/dviware/dvisvgm/src/CMap.hpp @@ -2,7 +2,7 @@ ** CMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMapManager.cpp b/dviware/dvisvgm/src/CMapManager.cpp index 779c6ee3a8..52b323ebc6 100644 --- a/dviware/dvisvgm/src/CMapManager.cpp +++ b/dviware/dvisvgm/src/CMapManager.cpp @@ -2,7 +2,7 @@ ** CMapManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMapManager.hpp b/dviware/dvisvgm/src/CMapManager.hpp index 0635f2ec3e..aeb9156e84 100644 --- a/dviware/dvisvgm/src/CMapManager.hpp +++ b/dviware/dvisvgm/src/CMapManager.hpp @@ -2,7 +2,7 @@ ** CMapManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMapReader.cpp b/dviware/dvisvgm/src/CMapReader.cpp index 6661afbbb1..51ba52b95d 100644 --- a/dviware/dvisvgm/src/CMapReader.cpp +++ b/dviware/dvisvgm/src/CMapReader.cpp @@ -2,7 +2,7 @@ ** CMapReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CMapReader.hpp b/dviware/dvisvgm/src/CMapReader.hpp index 3e5b841e0c..04ce5740c0 100644 --- a/dviware/dvisvgm/src/CMapReader.hpp +++ b/dviware/dvisvgm/src/CMapReader.hpp @@ -2,7 +2,7 @@ ** CMapReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Calculator.cpp b/dviware/dvisvgm/src/Calculator.cpp index 3091c9cf35..c5dc00df4d 100644 --- a/dviware/dvisvgm/src/Calculator.cpp +++ b/dviware/dvisvgm/src/Calculator.cpp @@ -2,7 +2,7 @@ ** Calculator.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Calculator.hpp b/dviware/dvisvgm/src/Calculator.hpp index cc3b2feb6b..92ec4e40b1 100644 --- a/dviware/dvisvgm/src/Calculator.hpp +++ b/dviware/dvisvgm/src/Calculator.hpp @@ -2,7 +2,7 @@ ** Calculator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CharMapID.cpp b/dviware/dvisvgm/src/CharMapID.cpp index c04ae2ceb9..9c56afc73a 100644 --- a/dviware/dvisvgm/src/CharMapID.cpp +++ b/dviware/dvisvgm/src/CharMapID.cpp @@ -2,7 +2,7 @@ ** CharMapID.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CharMapID.hpp b/dviware/dvisvgm/src/CharMapID.hpp index cdc39ca94d..ed044a9cf3 100644 --- a/dviware/dvisvgm/src/CharMapID.hpp +++ b/dviware/dvisvgm/src/CharMapID.hpp @@ -2,7 +2,7 @@ ** CharMapID.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Character.hpp b/dviware/dvisvgm/src/Character.hpp index e232401fb8..667a583100 100644 --- a/dviware/dvisvgm/src/Character.hpp +++ b/dviware/dvisvgm/src/Character.hpp @@ -2,7 +2,7 @@ ** Character.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Color.cpp b/dviware/dvisvgm/src/Color.cpp index de7e9074ab..bf9a05d7a3 100644 --- a/dviware/dvisvgm/src/Color.cpp +++ b/dviware/dvisvgm/src/Color.cpp @@ -2,7 +2,7 @@ ** Color.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Color.hpp b/dviware/dvisvgm/src/Color.hpp index c58a97f0bb..6f6f812207 100644 --- a/dviware/dvisvgm/src/Color.hpp +++ b/dviware/dvisvgm/src/Color.hpp @@ -2,7 +2,7 @@ ** Color.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ColorSpecialHandler.cpp b/dviware/dvisvgm/src/ColorSpecialHandler.cpp index 4bfd494003..2cacf82992 100644 --- a/dviware/dvisvgm/src/ColorSpecialHandler.cpp +++ b/dviware/dvisvgm/src/ColorSpecialHandler.cpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ColorSpecialHandler.hpp b/dviware/dvisvgm/src/ColorSpecialHandler.hpp index 176253407e..eeab300f47 100644 --- a/dviware/dvisvgm/src/ColorSpecialHandler.hpp +++ b/dviware/dvisvgm/src/ColorSpecialHandler.hpp @@ -2,7 +2,7 @@ ** ColorSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/CommandLine.hpp b/dviware/dvisvgm/src/CommandLine.hpp index b1f2636040..7ea6ddd76e 100644 --- a/dviware/dvisvgm/src/CommandLine.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking +// Copyright (C) 2016-2020 Martin Gieseking #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-2019 Martin Gieseking " + "Copyright (C) 2005-2020 Martin Gieseking " ) {} CommandLine (int argc, char **argv) : CommandLine() { @@ -29,6 +29,7 @@ class CommandLine : public CL::CommandLine { // option variables TypedOption bboxOpt {"bbox", 'b', "size", "min", "set size of bounding box"}; + TypedOption bitmapFormatOpt {"bitmap-format", 'B', "fmt", "jpeg", "set format used to embed PS/EPS bitmaps"}; TypedOption cacheOpt {"cache", 'C', "dir", "set/print path of cache directory"}; Option clipjoinOpt {"clipjoin", 'j', "compute intersection of clipping paths"}; Option colorOpt {"color", '\0', "colorize messages"}; @@ -36,7 +37,7 @@ class CommandLine : public CL::CommandLine { Option commentsOpt {"comments", '\0', "add comments with additional information"}; Option epsOpt {"eps", 'E', "convert EPS file to SVG"}; Option exactBboxOpt {"exact-bbox", 'e', "compute exact glyph bounding boxes"}; - TypedOption fontFormatOpt {"font-format", 'f', "format", "svg", "select file format of embedded fonts"}; + TypedOption fontFormatOpt {"font-format", 'f', "format", "svg", "set file format of embedded fonts"}; TypedOption fontmapOpt {"fontmap", 'm', "filenames", "evaluate (additional) font map files"}; Option gradOverlapOpt {"grad-overlap", '\0', "create overlapping color gradient segments"}; TypedOption gradSegmentsOpt {"grad-segments", '\0', "number", 20, "number of color gradient segments per row"}; @@ -97,6 +98,9 @@ class CommandLine : public CL::CommandLine { #endif {&stdinOpt, 0}, {&bboxOpt, 1}, +#if !defined(DISABLE_GS) + {&bitmapFormatOpt, 1}, +#endif #if !defined(DISABLE_GS) {&clipjoinOpt, 1}, #endif diff --git a/dviware/dvisvgm/src/DLLoader.cpp b/dviware/dvisvgm/src/DLLoader.cpp index b047203801..9a974e89d9 100644 --- a/dviware/dvisvgm/src/DLLoader.cpp +++ b/dviware/dvisvgm/src/DLLoader.cpp @@ -2,7 +2,7 @@ ** DLLoader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DLLoader.hpp b/dviware/dvisvgm/src/DLLoader.hpp index 6bfff573e2..469fd1c4aa 100644 --- a/dviware/dvisvgm/src/DLLoader.hpp +++ b/dviware/dvisvgm/src/DLLoader.hpp @@ -2,7 +2,7 @@ ** DLLoader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIActions.hpp b/dviware/dvisvgm/src/DVIActions.hpp index c42f446d9e..31ea693477 100644 --- a/dviware/dvisvgm/src/DVIActions.hpp +++ b/dviware/dvisvgm/src/DVIActions.hpp @@ -2,7 +2,7 @@ ** DVIActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIReader.cpp b/dviware/dvisvgm/src/DVIReader.cpp index b0bbabee94..417efe9304 100644 --- a/dviware/dvisvgm/src/DVIReader.cpp +++ b/dviware/dvisvgm/src/DVIReader.cpp @@ -2,7 +2,7 @@ ** DVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIReader.hpp b/dviware/dvisvgm/src/DVIReader.hpp index 972af2022a..fc1424aca3 100644 --- a/dviware/dvisvgm/src/DVIReader.hpp +++ b/dviware/dvisvgm/src/DVIReader.hpp @@ -2,7 +2,7 @@ ** DVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIToSVG.cpp b/dviware/dvisvgm/src/DVIToSVG.cpp index 4801bd80a0..7280495e83 100644 --- a/dviware/dvisvgm/src/DVIToSVG.cpp +++ b/dviware/dvisvgm/src/DVIToSVG.cpp @@ -2,7 +2,7 @@ ** DVIToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIToSVG.hpp b/dviware/dvisvgm/src/DVIToSVG.hpp index 40dbdc884f..1bafa7cb3d 100644 --- a/dviware/dvisvgm/src/DVIToSVG.hpp +++ b/dviware/dvisvgm/src/DVIToSVG.hpp @@ -2,7 +2,7 @@ ** DVIToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIToSVGActions.cpp b/dviware/dvisvgm/src/DVIToSVGActions.cpp index bb8e4d6f84..6239be3b01 100644 --- a/dviware/dvisvgm/src/DVIToSVGActions.cpp +++ b/dviware/dvisvgm/src/DVIToSVGActions.cpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DVIToSVGActions.hpp b/dviware/dvisvgm/src/DVIToSVGActions.hpp index e9adc63e38..2ae3fb9a2e 100644 --- a/dviware/dvisvgm/src/DVIToSVGActions.hpp +++ b/dviware/dvisvgm/src/DVIToSVGActions.hpp @@ -2,7 +2,7 @@ ** DVIToSVGActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Directory.cpp b/dviware/dvisvgm/src/Directory.cpp index 748d1bc070..e7200a0dc3 100644 --- a/dviware/dvisvgm/src/Directory.cpp +++ b/dviware/dvisvgm/src/Directory.cpp @@ -2,7 +2,7 @@ ** Directory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Directory.hpp b/dviware/dvisvgm/src/Directory.hpp index f6ec7a9602..d617b4fcbd 100644 --- a/dviware/dvisvgm/src/Directory.hpp +++ b/dviware/dvisvgm/src/Directory.hpp @@ -2,7 +2,7 @@ ** Directory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp b/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp index dadf196f77..b2af27d636 100644 --- a/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp +++ b/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp b/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp index a8bde952e6..0f73c73ecd 100644 --- a/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp +++ b/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** DvisvgmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EPSFile.cpp b/dviware/dvisvgm/src/EPSFile.cpp index 5a5fccc08f..1a19c07cc7 100644 --- a/dviware/dvisvgm/src/EPSFile.cpp +++ b/dviware/dvisvgm/src/EPSFile.cpp @@ -2,7 +2,7 @@ ** EPSFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EPSFile.hpp b/dviware/dvisvgm/src/EPSFile.hpp index 4fdd03ee1b..7b02db95b1 100644 --- a/dviware/dvisvgm/src/EPSFile.hpp +++ b/dviware/dvisvgm/src/EPSFile.hpp @@ -2,7 +2,7 @@ ** EPSFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EPSToSVG.hpp b/dviware/dvisvgm/src/EPSToSVG.hpp index 9b193dc9cb..64f5ac604d 100644 --- a/dviware/dvisvgm/src/EPSToSVG.hpp +++ b/dviware/dvisvgm/src/EPSToSVG.hpp @@ -2,7 +2,7 @@ ** EPSToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -30,7 +30,7 @@ class EPSToSVG : public ImageToSVG { public: EPSToSVG (const std::string &fname, SVGOutputBase &out) : ImageToSVG(fname, out) {} bool isSinglePageFormat() const override {return true;} - int totalPageCount() override {return 1;} + int totalPageCount() const override {return 1;} protected: std::string imageFormat () const override {return "EPS";} diff --git a/dviware/dvisvgm/src/EllipticalArc.cpp b/dviware/dvisvgm/src/EllipticalArc.cpp index b820af0052..a151c51307 100644 --- a/dviware/dvisvgm/src/EllipticalArc.cpp +++ b/dviware/dvisvgm/src/EllipticalArc.cpp @@ -2,7 +2,7 @@ ** EllipticalArc.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EllipticalArc.hpp b/dviware/dvisvgm/src/EllipticalArc.hpp index 5d20558196..422a40b207 100644 --- a/dviware/dvisvgm/src/EllipticalArc.hpp +++ b/dviware/dvisvgm/src/EllipticalArc.hpp @@ -2,7 +2,7 @@ ** EllipticalArc.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EmSpecialHandler.cpp b/dviware/dvisvgm/src/EmSpecialHandler.cpp index c93a798fd7..efbd7abef3 100644 --- a/dviware/dvisvgm/src/EmSpecialHandler.cpp +++ b/dviware/dvisvgm/src/EmSpecialHandler.cpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EmSpecialHandler.hpp b/dviware/dvisvgm/src/EmSpecialHandler.hpp index 242ef248ef..e20339e548 100644 --- a/dviware/dvisvgm/src/EmSpecialHandler.hpp +++ b/dviware/dvisvgm/src/EmSpecialHandler.hpp @@ -2,7 +2,7 @@ ** EmSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EncFile.cpp b/dviware/dvisvgm/src/EncFile.cpp index dba0a2544a..ce0f18d81e 100644 --- a/dviware/dvisvgm/src/EncFile.cpp +++ b/dviware/dvisvgm/src/EncFile.cpp @@ -2,7 +2,7 @@ ** EncFile.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/EncFile.hpp b/dviware/dvisvgm/src/EncFile.hpp index fac26fd201..8f2b14c430 100644 --- a/dviware/dvisvgm/src/EncFile.hpp +++ b/dviware/dvisvgm/src/EncFile.hpp @@ -2,7 +2,7 @@ ** EncFile.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FileFinder.cpp b/dviware/dvisvgm/src/FileFinder.cpp index e867f648a7..a52ccd37d3 100644 --- a/dviware/dvisvgm/src/FileFinder.cpp +++ b/dviware/dvisvgm/src/FileFinder.cpp @@ -2,7 +2,7 @@ ** FileFinder.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FileFinder.hpp b/dviware/dvisvgm/src/FileFinder.hpp index 08c59a3372..7218bf6c0b 100644 --- a/dviware/dvisvgm/src/FileFinder.hpp +++ b/dviware/dvisvgm/src/FileFinder.hpp @@ -2,7 +2,7 @@ ** FileFinder.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FilePath.cpp b/dviware/dvisvgm/src/FilePath.cpp index 6f162bfab9..2150cf31f7 100644 --- a/dviware/dvisvgm/src/FilePath.cpp +++ b/dviware/dvisvgm/src/FilePath.cpp @@ -2,7 +2,7 @@ ** FilePath.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -191,14 +191,16 @@ string FilePath::suffix () const { /** Changes the suffix of the filename. If FilePath represents the - * location of a directory (and not of a file) nothing happens. - * @param[in] s new suffix */ -void FilePath::suffix (const string &s) { + * location of a directory (and not of a file) nothing happens. An + * empty new suffix leads to the removal of the current one. + * @param[in] newSuffix the new suffix */ +void FilePath::suffix (const string &newSuffix) { if (!_fname.empty()) { string current_suffix = suffix(); if (!current_suffix.empty()) _fname.erase(_fname.length()-current_suffix.length()-1); - _fname += "."+s; + if (!newSuffix.empty()) + _fname += "."+newSuffix; } } diff --git a/dviware/dvisvgm/src/FilePath.hpp b/dviware/dvisvgm/src/FilePath.hpp index 32a9be6814..e9d55562c5 100644 --- a/dviware/dvisvgm/src/FilePath.hpp +++ b/dviware/dvisvgm/src/FilePath.hpp @@ -2,7 +2,7 @@ ** FilePath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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 FilePath { std::string shorterAbsoluteOrRelative (std::string reldir="", bool with_filename=true) const; std::string basename () const; std::string suffix () const; - void suffix (const std::string &s); + void suffix (const std::string &newSuffix); size_t depth () const {return _dirs.size();} bool isFile () const {return !_fname.empty();} bool empty () const {return _dirs.empty() && _fname.empty();} diff --git a/dviware/dvisvgm/src/FileSystem.cpp b/dviware/dvisvgm/src/FileSystem.cpp index 6a081ee24f..a1fafbdece 100644 --- a/dviware/dvisvgm/src/FileSystem.cpp +++ b/dviware/dvisvgm/src/FileSystem.cpp @@ -2,7 +2,7 @@ ** FileSystem.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FileSystem.hpp b/dviware/dvisvgm/src/FileSystem.hpp index b882caa9fa..f82ff1e870 100644 --- a/dviware/dvisvgm/src/FileSystem.hpp +++ b/dviware/dvisvgm/src/FileSystem.hpp @@ -2,7 +2,7 @@ ** FileSystem.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FixWord.hpp b/dviware/dvisvgm/src/FixWord.hpp index 94166b232c..3414e1ead4 100644 --- a/dviware/dvisvgm/src/FixWord.hpp +++ b/dviware/dvisvgm/src/FixWord.hpp @@ -2,7 +2,7 @@ ** FixWord.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Font.cpp b/dviware/dvisvgm/src/Font.cpp index 97520c5953..e40ad8a392 100644 --- a/dviware/dvisvgm/src/Font.cpp +++ b/dviware/dvisvgm/src/Font.cpp @@ -2,7 +2,7 @@ ** Font.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -425,10 +425,10 @@ int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *c * @param[out] bbox the computed bounding box * @param[in] cb optional calback object forwarded to the tracer * @return true if the box could be computed successfully */ -bool PhysicalFont::getExactGlyphBox(int c, BoundingBox& bbox, GFGlyphTracer::Callback* cb) const { +bool PhysicalFont::getExactGlyphBox (int c, BoundingBox& bbox, GFGlyphTracer::Callback* cb) const { Glyph glyph; if (getGlyph(c, glyph, cb)) { - glyph.computeBBox(bbox); + bbox = glyph.computeBBox(); double s = scaledSize()/unitsPerEm(); bbox.scale(s, s); return true; @@ -608,7 +608,7 @@ double NativeFont::charWidth (int c) const { FontEngine::instance().setFont(*this); int upem = FontEngine::instance().getUnitsPerEM(); double w = upem ? (scaledSize()*FontEngine::instance().getAdvance(c)/upem*_style.extend) : 0; - w += fabs(_style.slant*charHeight(c)); + w += abs(_style.slant*charHeight(c)); return w; } diff --git a/dviware/dvisvgm/src/Font.hpp b/dviware/dvisvgm/src/Font.hpp index 3273a0c14b..59556e7a81 100644 --- a/dviware/dvisvgm/src/Font.hpp +++ b/dviware/dvisvgm/src/Font.hpp @@ -2,7 +2,7 @@ ** Font.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontCache.cpp b/dviware/dvisvgm/src/FontCache.cpp index 34478542df..e024558913 100644 --- a/dviware/dvisvgm/src/FontCache.cpp +++ b/dviware/dvisvgm/src/FontCache.cpp @@ -2,7 +2,7 @@ ** FontCache.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontCache.hpp b/dviware/dvisvgm/src/FontCache.hpp index 0068b6c78b..8a6025a3d2 100644 --- a/dviware/dvisvgm/src/FontCache.hpp +++ b/dviware/dvisvgm/src/FontCache.hpp @@ -2,7 +2,7 @@ ** FontCache.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontEncoding.cpp b/dviware/dvisvgm/src/FontEncoding.cpp index 3b038b63c6..8f2673f123 100644 --- a/dviware/dvisvgm/src/FontEncoding.cpp +++ b/dviware/dvisvgm/src/FontEncoding.cpp @@ -2,7 +2,7 @@ ** FontEncoding.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontEncoding.hpp b/dviware/dvisvgm/src/FontEncoding.hpp index fffccd4224..1c4a979aa9 100644 --- a/dviware/dvisvgm/src/FontEncoding.hpp +++ b/dviware/dvisvgm/src/FontEncoding.hpp @@ -2,7 +2,7 @@ ** FontEncoding.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontEngine.cpp b/dviware/dvisvgm/src/FontEngine.cpp index 61efd68916..bee1ca886d 100644 --- a/dviware/dvisvgm/src/FontEngine.cpp +++ b/dviware/dvisvgm/src/FontEngine.cpp @@ -2,7 +2,7 @@ ** FontEngine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontEngine.hpp b/dviware/dvisvgm/src/FontEngine.hpp index 33c9b96da2..5796c2b1b3 100644 --- a/dviware/dvisvgm/src/FontEngine.hpp +++ b/dviware/dvisvgm/src/FontEngine.hpp @@ -2,7 +2,7 @@ ** FontEngine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontManager.cpp b/dviware/dvisvgm/src/FontManager.cpp index 4f236b3866..58d2dfc261 100644 --- a/dviware/dvisvgm/src/FontManager.cpp +++ b/dviware/dvisvgm/src/FontManager.cpp @@ -2,7 +2,7 @@ ** FontManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontManager.hpp b/dviware/dvisvgm/src/FontManager.hpp index 4405f67ecd..2fe88bee38 100644 --- a/dviware/dvisvgm/src/FontManager.hpp +++ b/dviware/dvisvgm/src/FontManager.hpp @@ -2,7 +2,7 @@ ** FontManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontMap.cpp b/dviware/dvisvgm/src/FontMap.cpp index cc48aef0e6..727fdd83ba 100644 --- a/dviware/dvisvgm/src/FontMap.cpp +++ b/dviware/dvisvgm/src/FontMap.cpp @@ -2,7 +2,7 @@ ** FontMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontMap.hpp b/dviware/dvisvgm/src/FontMap.hpp index cd109c1809..f4824aa7f1 100644 --- a/dviware/dvisvgm/src/FontMap.hpp +++ b/dviware/dvisvgm/src/FontMap.hpp @@ -2,7 +2,7 @@ ** FontMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontMetrics.cpp b/dviware/dvisvgm/src/FontMetrics.cpp index 003b80acad..7d858fea90 100644 --- a/dviware/dvisvgm/src/FontMetrics.cpp +++ b/dviware/dvisvgm/src/FontMetrics.cpp @@ -2,7 +2,7 @@ ** FontMetrics.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontMetrics.hpp b/dviware/dvisvgm/src/FontMetrics.hpp index ccba26b727..66637e3044 100644 --- a/dviware/dvisvgm/src/FontMetrics.hpp +++ b/dviware/dvisvgm/src/FontMetrics.hpp @@ -2,7 +2,7 @@ ** FontMetrics.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontStyle.hpp b/dviware/dvisvgm/src/FontStyle.hpp index 1088df3c4e..79a03dac36 100644 --- a/dviware/dvisvgm/src/FontStyle.hpp +++ b/dviware/dvisvgm/src/FontStyle.hpp @@ -2,7 +2,7 @@ ** FontStyle.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/FontWriter.cpp b/dviware/dvisvgm/src/FontWriter.cpp index d93402baf5..4dd4c5c0d8 100644 --- a/dviware/dvisvgm/src/FontWriter.cpp +++ b/dviware/dvisvgm/src/FontWriter.cpp @@ -2,7 +2,7 @@ ** FontWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -145,7 +145,7 @@ static void writeSFD (const string &sfdname, const PhysicalFont &font, const set // ensure that the sum of the SFD's Ascent and Descent values equals the font's units per EM double yext = font.ascent()+font.descent(); - double scale = double(font.unitsPerEm())/(yext != 0 ? yext : fabs(font.ascent())); + double scale = double(font.unitsPerEm())/(yext != 0 ? yext : abs(font.ascent())); sfd << "Ascent: " << font.ascent()*scale << "\n" "Descent: " << font.descent()*scale << "\n" @@ -260,7 +260,7 @@ bool FontWriter::writeCSSFontFace (FontFormat format, const set &charcodes, os << "@font-face{" << "font-family:" << _font.name() << ';' << "src:url(data:" << info->mimetype << ";base64,"; - util::base64_copy(istreambuf_iterator(ifs), istreambuf_iterator(), ostreambuf_iterator(os)); + util::base64_copy(ifs, os); os << ") format('" << info->formatstr_long << "');}\n"; ifs.close(); if (!PhysicalFont::KEEP_TEMP_FILES) diff --git a/dviware/dvisvgm/src/FontWriter.hpp b/dviware/dvisvgm/src/FontWriter.hpp index 458952cad9..e6cad37e88 100644 --- a/dviware/dvisvgm/src/FontWriter.hpp +++ b/dviware/dvisvgm/src/FontWriter.hpp @@ -2,7 +2,7 @@ ** FontWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFGlyphTracer.cpp b/dviware/dvisvgm/src/GFGlyphTracer.cpp index 1b55afc593..db77ae1dc8 100644 --- a/dviware/dvisvgm/src/GFGlyphTracer.cpp +++ b/dviware/dvisvgm/src/GFGlyphTracer.cpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFGlyphTracer.hpp b/dviware/dvisvgm/src/GFGlyphTracer.hpp index afe1b95253..d0d45ffd61 100644 --- a/dviware/dvisvgm/src/GFGlyphTracer.hpp +++ b/dviware/dvisvgm/src/GFGlyphTracer.hpp @@ -2,7 +2,7 @@ ** GFGlyphTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFReader.cpp b/dviware/dvisvgm/src/GFReader.cpp index a7d314d3de..4712de41d3 100644 --- a/dviware/dvisvgm/src/GFReader.cpp +++ b/dviware/dvisvgm/src/GFReader.cpp @@ -2,7 +2,7 @@ ** GFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFReader.hpp b/dviware/dvisvgm/src/GFReader.hpp index ad1e8b2220..e829bf8ffa 100644 --- a/dviware/dvisvgm/src/GFReader.hpp +++ b/dviware/dvisvgm/src/GFReader.hpp @@ -2,7 +2,7 @@ ** GFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFTracer.cpp b/dviware/dvisvgm/src/GFTracer.cpp index e73aab12fd..4a3fa5e776 100644 --- a/dviware/dvisvgm/src/GFTracer.cpp +++ b/dviware/dvisvgm/src/GFTracer.cpp @@ -2,7 +2,7 @@ ** GFTracer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GFTracer.hpp b/dviware/dvisvgm/src/GFTracer.hpp index efe9476a8f..e72848896d 100644 --- a/dviware/dvisvgm/src/GFTracer.hpp +++ b/dviware/dvisvgm/src/GFTracer.hpp @@ -2,7 +2,7 @@ ** GFTracer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Ghostscript.cpp b/dviware/dvisvgm/src/Ghostscript.cpp index c097ace667..1ff82314ec 100644 --- a/dviware/dvisvgm/src/Ghostscript.cpp +++ b/dviware/dvisvgm/src/Ghostscript.cpp @@ -2,7 +2,7 @@ ** Ghostscript.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -144,6 +144,9 @@ static string get_libgs (const string &fname) { dlname = "libgs." + to_string(i) + ".dylib"; if (loader.loadLibrary(dlname)) return dlname; + dlname = "libgs.dylib." + to_string(i); + if (loader.loadLibrary(dlname)) + return dlname; #endif } #endif diff --git a/dviware/dvisvgm/src/Ghostscript.hpp b/dviware/dvisvgm/src/Ghostscript.hpp index 4ea62f775f..8c9a429798 100644 --- a/dviware/dvisvgm/src/Ghostscript.hpp +++ b/dviware/dvisvgm/src/Ghostscript.hpp @@ -2,7 +2,7 @@ ** Ghostscript.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Glyph.hpp b/dviware/dvisvgm/src/Glyph.hpp index 6f457a778f..dfa8cb366a 100644 --- a/dviware/dvisvgm/src/Glyph.hpp +++ b/dviware/dvisvgm/src/Glyph.hpp @@ -2,7 +2,7 @@ ** Glyph.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/GlyphTracerMessages.hpp b/dviware/dvisvgm/src/GlyphTracerMessages.hpp index d48fe6f1b4..f291d05ccc 100644 --- a/dviware/dvisvgm/src/GlyphTracerMessages.hpp +++ b/dviware/dvisvgm/src/GlyphTracerMessages.hpp @@ -2,7 +2,7 @@ ** GlyphTracerMessages.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -37,17 +37,18 @@ class GlyphTracerMessages : public GFGlyphTracer::Callback { void beginChar (uint8_t c) override { if (!_traced) { - if (!_fname.empty()) + if (!_fname.empty()) { Message::mstream() << '\n'; - // extract font name from file path - std::string fontname = _fname; - size_t pos; - if ((pos = fontname.rfind('/')) != std::string::npos) - fontname = fontname.substr(pos+1); - if ((pos = fontname.rfind('.')) != std::string::npos) - fontname = fontname.substr(0, pos); - Message::mstream(false, Message::MC_STATE) - << "tracing glyphs of " << fontname << '\n'; + // extract font name from file path + std::string fontname = _fname; + size_t pos; + if ((pos = fontname.rfind('/')) != std::string::npos) + fontname = fontname.substr(pos+1); + if ((pos = fontname.rfind('.')) != std::string::npos) + fontname = fontname.substr(0, pos); + Message::mstream(false, Message::MC_STATE) + << "tracing glyphs of " << fontname << '\n'; + } _traced = true; } } diff --git a/dviware/dvisvgm/src/GraphicsPath.hpp b/dviware/dvisvgm/src/GraphicsPath.hpp index bf09a37d09..565251c0d0 100644 --- a/dviware/dvisvgm/src/GraphicsPath.hpp +++ b/dviware/dvisvgm/src/GraphicsPath.hpp @@ -2,7 +2,7 @@ ** GraphicsPath.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -540,7 +540,7 @@ class GraphicsPath { } } - void arcto (double rx, double ry, double angle, bool laf, bool sweep, const Point &p) { + void arcto (T rx, T ry, double angle, bool laf, bool sweep, const Point &p) { _commands.emplace_back(ArcTo{rx, ry, angle, laf, sweep, p}); _finalPoint = p; } @@ -597,7 +597,8 @@ class GraphicsPath { /** Computes the bounding box of the current path. * @param[out] bbox the computed bounding box */ - void computeBBox (BoundingBox &bbox) const { + BoundingBox computeBBox () const { + BoundingBox bbox; struct BBoxActions : IterationActions { explicit BBoxActions (BoundingBox &bb) : bbox(bb) {} void moveto (const Point &p) override {bbox.embed(p);} @@ -610,6 +611,7 @@ class GraphicsPath { BoundingBox &bbox; } actions(bbox); iterate(actions, false); + return bbox; } /** Checks whether the current path describes a dot/point only (with no extent). diff --git a/dviware/dvisvgm/src/HashFunction.cpp b/dviware/dvisvgm/src/HashFunction.cpp index 517cc8f3cc..7f99dacaf0 100644 --- a/dviware/dvisvgm/src/HashFunction.cpp +++ b/dviware/dvisvgm/src/HashFunction.cpp @@ -2,7 +2,7 @@ ** HashFunction.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/HashFunction.hpp b/dviware/dvisvgm/src/HashFunction.hpp index bba61918ed..b13ee39a50 100644 --- a/dviware/dvisvgm/src/HashFunction.hpp +++ b/dviware/dvisvgm/src/HashFunction.hpp @@ -2,7 +2,7 @@ ** HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/HtmlSpecialHandler.cpp b/dviware/dvisvgm/src/HtmlSpecialHandler.cpp index 43d3dbc224..01051f9d64 100644 --- a/dviware/dvisvgm/src/HtmlSpecialHandler.cpp +++ b/dviware/dvisvgm/src/HtmlSpecialHandler.cpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/HtmlSpecialHandler.hpp b/dviware/dvisvgm/src/HtmlSpecialHandler.hpp index bb85b2ad2c..e09a6d7b51 100644 --- a/dviware/dvisvgm/src/HtmlSpecialHandler.hpp +++ b/dviware/dvisvgm/src/HtmlSpecialHandler.hpp @@ -2,7 +2,7 @@ ** HtmlSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/HyperlinkManager.cpp b/dviware/dvisvgm/src/HyperlinkManager.cpp index de412afcdc..ef636c5aac 100644 --- a/dviware/dvisvgm/src/HyperlinkManager.cpp +++ b/dviware/dvisvgm/src/HyperlinkManager.cpp @@ -2,7 +2,7 @@ ** HyperlinkManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/HyperlinkManager.hpp b/dviware/dvisvgm/src/HyperlinkManager.hpp index 762b4a4cca..ca8d4fd0ef 100644 --- a/dviware/dvisvgm/src/HyperlinkManager.hpp +++ b/dviware/dvisvgm/src/HyperlinkManager.hpp @@ -2,7 +2,7 @@ ** HyperlinkManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ImageToSVG.cpp b/dviware/dvisvgm/src/ImageToSVG.cpp index 26edb3c753..dfb7943a06 100644 --- a/dviware/dvisvgm/src/ImageToSVG.cpp +++ b/dviware/dvisvgm/src/ImageToSVG.cpp @@ -2,7 +2,7 @@ ** ImageToSVG.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -67,6 +67,7 @@ void ImageToSVG::convert (int pageno) { "lly=" << bbox.minY() << " " "urx=" << bbox.maxX() << " " "ury=" << bbox.maxY(); + _currentPageNumber = pageno; if (!isSinglePageFormat()) ss << " page=" << pageno; try { @@ -147,8 +148,9 @@ void ImageToSVG::convert (const std::string &rangestr, pair *pageinfo) FilePath ImageToSVG::getSVGFilePath (unsigned pageno) const { FilePath path; - if (pageno == 1) - path = _out.filepath(1, 1); + unsigned numPages = totalPageCount(); + if (pageno >= 1 && pageno <= numPages) + path = _out.filepath(pageno, numPages); return path; } diff --git a/dviware/dvisvgm/src/ImageToSVG.hpp b/dviware/dvisvgm/src/ImageToSVG.hpp index a4e4de223f..92a860949c 100644 --- a/dviware/dvisvgm/src/ImageToSVG.hpp +++ b/dviware/dvisvgm/src/ImageToSVG.hpp @@ -2,7 +2,7 @@ ** ImageToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -39,9 +39,9 @@ class ImageToSVG : protected SpecialActions { void setPageTransformation (const std::string &transCmds) {_transCmds = transCmds;} // void setPageSize (const std::string &name); std::string filename () const {return _fname;} - PSInterpreter& psInterpreter () {return _psHandler.psInterpreter();} + PSInterpreter& psInterpreter () const {return _psHandler.psInterpreter();} virtual bool isSinglePageFormat () const =0; - virtual int totalPageCount () =0; + virtual int totalPageCount () const =0; protected: void checkGSAndFileFormat (); @@ -65,7 +65,7 @@ class ImageToSVG : protected SpecialActions { void embed (const BoundingBox &bbox) override {_bbox.embed(bbox);} void embed (const DPair &p, double r=0) override {if (r==0) _bbox.embed(p); else _bbox.embed(p, r);} void progress (const char *id) override; - unsigned getCurrentPageNumber() const override {return 0;} + unsigned getCurrentPageNumber() const override {return _currentPageNumber;} BoundingBox& bbox () override {return _bbox;} BoundingBox& bbox (const std::string &name, bool reset=false) override {return _bbox;} FilePath getSVGFilePath (unsigned pageno) const override; @@ -76,8 +76,9 @@ class ImageToSVG : protected SpecialActions { SVGTree _svg; SVGOutputBase &_out; double _x=0, _y=0; + unsigned _currentPageNumber=0; BoundingBox _bbox; - PsSpecialHandler _psHandler; + mutable PsSpecialHandler _psHandler; bool _haveGS=false; ///< true if Ghostscript is available std::string _transCmds; ///< transformation commands }; diff --git a/dviware/dvisvgm/src/InputBuffer.cpp b/dviware/dvisvgm/src/InputBuffer.cpp index a952369afc..b6e85f27e1 100644 --- a/dviware/dvisvgm/src/InputBuffer.cpp +++ b/dviware/dvisvgm/src/InputBuffer.cpp @@ -2,7 +2,7 @@ ** InputBuffer.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/InputBuffer.hpp b/dviware/dvisvgm/src/InputBuffer.hpp index 8a62b6b011..1474ce0a52 100644 --- a/dviware/dvisvgm/src/InputBuffer.hpp +++ b/dviware/dvisvgm/src/InputBuffer.hpp @@ -2,7 +2,7 @@ ** InputBuffer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/InputReader.cpp b/dviware/dvisvgm/src/InputReader.cpp index 5c9b9f5c62..074c184822 100644 --- a/dviware/dvisvgm/src/InputReader.cpp +++ b/dviware/dvisvgm/src/InputReader.cpp @@ -2,7 +2,7 @@ ** InputReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/InputReader.hpp b/dviware/dvisvgm/src/InputReader.hpp index 0ca4f10772..9825156c09 100644 --- a/dviware/dvisvgm/src/InputReader.hpp +++ b/dviware/dvisvgm/src/InputReader.hpp @@ -2,7 +2,7 @@ ** InputReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/JFM.cpp b/dviware/dvisvgm/src/JFM.cpp index a79fdf0c03..7c749fd34e 100644 --- a/dviware/dvisvgm/src/JFM.cpp +++ b/dviware/dvisvgm/src/JFM.cpp @@ -2,7 +2,7 @@ ** JFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/JFM.hpp b/dviware/dvisvgm/src/JFM.hpp index c51f371a5e..8d4a1daf21 100644 --- a/dviware/dvisvgm/src/JFM.hpp +++ b/dviware/dvisvgm/src/JFM.hpp @@ -2,7 +2,7 @@ ** JFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Length.cpp b/dviware/dvisvgm/src/Length.cpp index cbee103d49..d20af5056c 100644 --- a/dviware/dvisvgm/src/Length.cpp +++ b/dviware/dvisvgm/src/Length.cpp @@ -2,7 +2,7 @@ ** Length.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Length.hpp b/dviware/dvisvgm/src/Length.hpp index 3c4de91fae..1b0d35d35f 100644 --- a/dviware/dvisvgm/src/Length.hpp +++ b/dviware/dvisvgm/src/Length.hpp @@ -2,7 +2,7 @@ ** Length.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/MD5HashFunction.hpp b/dviware/dvisvgm/src/MD5HashFunction.hpp index e233673d36..f0eda874f2 100644 --- a/dviware/dvisvgm/src/MD5HashFunction.hpp +++ b/dviware/dvisvgm/src/MD5HashFunction.hpp @@ -2,7 +2,7 @@ ** MD5HashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Makefile.am b/dviware/dvisvgm/src/Makefile.am index fcab2ba5cc..e7c7c27522 100644 --- a/dviware/dvisvgm/src/Makefile.am +++ b/dviware/dvisvgm/src/Makefile.am @@ -1,5 +1,5 @@ ## This file is part of dvisvgm -## Copyright (C) 2005-2019 Martin Gieseking +## Copyright (C) 2005-2020 Martin Gieseking ## ## Process this file with automake. diff --git a/dviware/dvisvgm/src/MapLine.cpp b/dviware/dvisvgm/src/MapLine.cpp index 57aa116f02..cd3d8ae7ea 100644 --- a/dviware/dvisvgm/src/MapLine.cpp +++ b/dviware/dvisvgm/src/MapLine.cpp @@ -2,7 +2,7 @@ ** MapLine.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/MapLine.hpp b/dviware/dvisvgm/src/MapLine.hpp index ea41fae0d0..9a6fa17648 100644 --- a/dviware/dvisvgm/src/MapLine.hpp +++ b/dviware/dvisvgm/src/MapLine.hpp @@ -2,7 +2,7 @@ ** MapLine.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Matrix.cpp b/dviware/dvisvgm/src/Matrix.cpp index f94e84809c..75d571877a 100644 --- a/dviware/dvisvgm/src/Matrix.cpp +++ b/dviware/dvisvgm/src/Matrix.cpp @@ -2,7 +2,7 @@ ** Matrix.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -169,7 +169,7 @@ Matrix& Matrix::rotate (double deg) { Matrix& Matrix::xskewByAngle (double deg) { - if (fmod(fabs(deg)-90, 180) != 0) + if (fmod(abs(deg)-90, 180) != 0) return xskewByRatio(tan(deg2rad(deg))); return *this; } @@ -186,7 +186,7 @@ Matrix& Matrix::xskewByRatio (double xyratio) { Matrix& Matrix::yskewByAngle (double deg) { - if (fmod(fabs(deg)-90, 180) != 0) + if (fmod(abs(deg)-90, 180) != 0) return yskewByRatio(tan(deg2rad(deg))); return *this; } @@ -246,17 +246,17 @@ Matrix& Matrix::lmultiply (const Matrix &tm) { Matrix& Matrix::invert () { Matrix ret; - if (double denom = det(*this)) { - for (int i=0; i < 3; ++i) { - for (int j=0; j < 3; ++j) { - ret._values[i][j] = det(*this, i, j)/denom; - if ((i+j)%2 != 0) - ret._values[i][j] *= -1; - } + double denom = det(*this); + if (abs(denom) < 1e-12) + throw exception(); + for (int i=0; i < 3; ++i) { + for (int j=0; j < 3; ++j) { + ret._values[j][i] = det(*this, i, j)/denom; + if ((i+j)%2 != 0) + ret._values[j][i] *= -1; } - return *this = ret; } - throw exception(); + return *this = ret; } @@ -469,7 +469,7 @@ static const char* ord_suffix (int n) { static void skip_comma_wsp (istream &is) { is >> ws; - if (is.peek() == ',') is.ignore(1); + if (is.peek() == ',') is.get(); is >> ws; } @@ -494,13 +494,13 @@ static size_t parse_transform_cmd (istream &is, string cmd, size_t minparams, si params.push_back(val); is >> ws; if (i == minparams && is.peek() == ')') { - is.ignore(1); + is.get(); return i; } if (i == maxparams) { if (is.peek() != ')') throw ParserException("missing ')' at end of command '"+cmd+"'"); - is.ignore(1); + is.get(); } skip_comma_wsp(is); } diff --git a/dviware/dvisvgm/src/Matrix.hpp b/dviware/dvisvgm/src/Matrix.hpp index 733ff71fad..154ac8a37b 100644 --- a/dviware/dvisvgm/src/Matrix.hpp +++ b/dviware/dvisvgm/src/Matrix.hpp @@ -2,7 +2,7 @@ ** Matrix.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Message.cpp b/dviware/dvisvgm/src/Message.cpp index 85ed204cb4..caf8051f88 100644 --- a/dviware/dvisvgm/src/Message.cpp +++ b/dviware/dvisvgm/src/Message.cpp @@ -2,7 +2,7 @@ ** Message.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Message.hpp b/dviware/dvisvgm/src/Message.hpp index a7e6034021..fd6f048622 100644 --- a/dviware/dvisvgm/src/Message.hpp +++ b/dviware/dvisvgm/src/Message.hpp @@ -2,7 +2,7 @@ ** Message.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/MessageException.hpp b/dviware/dvisvgm/src/MessageException.hpp index c7aa342860..325e83e403 100644 --- a/dviware/dvisvgm/src/MessageException.hpp +++ b/dviware/dvisvgm/src/MessageException.hpp @@ -2,7 +2,7 @@ ** MessageException.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/MetafontWrapper.cpp b/dviware/dvisvgm/src/MetafontWrapper.cpp index 202b65d6ec..11667fb5e7 100644 --- a/dviware/dvisvgm/src/MetafontWrapper.cpp +++ b/dviware/dvisvgm/src/MetafontWrapper.cpp @@ -2,7 +2,7 @@ ** MetafontWrapper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -79,18 +79,8 @@ bool MetafontWrapper::call (const string &mode, double mag) { string mf_messages; mf_process.run(_dir, &mf_messages); - // get resolution value from stdout created by above MF command - char buf[256]; - istringstream iss(mf_messages); - int resolution = 0; - while (iss) { - iss.getline(buf, sizeof(buf)); - string line = buf; - if (line.substr(0, 3) == ">> ") { - resolution = stoi(line.substr(3)); - break; - } - } + int resolution = getResolution(mf_messages); + // compose expected name of GF file (see Metafont Book, p. 324) string gfname = _dir + _fontname + "."; if (resolution > 0) @@ -101,6 +91,52 @@ bool MetafontWrapper::call (const string &mode, double mag) { } +/** Returns the resolution applied to a GF file generated by Metafont. Since the resolution + * is part of the filename suffix, we need this value in order to address the file. + * @param[in] mfMessage output written to stdout by Metafont + * @return the resolution (>0 on success, 0 otherwise) */ +int MetafontWrapper::getResolution (const string &mfMessage) const { + int res = 0; + char buf[256]; + if (!mfMessage.empty()) { + // try get resolution value written to stdout by above MF command + istringstream iss(mfMessage); + while (iss) { + iss.getline(buf, sizeof(buf)); + string line = buf; + if (line.substr(0, 3) == ">> ") { + res = stoi(line.substr(3)); + break; + } + } + } + // couldn't read resolution from stdout, try to get it from log file + if (res == 0) { + ifstream ifs(_dir+_fontname+".log"); + while (ifs) { + ifs.getline(buf, sizeof(buf)); + string line = buf; + if (line.substr(0, 18) == "Output written on ") { + line = line.substr(18); + size_t pos = line.find(' '); + line = line.substr(0, pos); + pos = line.rfind('.'); + if (pos != string::npos && line.substr(line.length()-2) == "gf") { + line.pop_back(); + line.pop_back(); + try { + res = stoi(line.substr(pos+1)); + } + catch (...) { + } + } + } + } + } + return res; +} + + /** Calls Metafont if output files (tfm and gf) don't already exist. * @param[in] mode Metafont mode to be used (e.g. 'ljfour') * @param[in] mag magnification factor diff --git a/dviware/dvisvgm/src/MetafontWrapper.hpp b/dviware/dvisvgm/src/MetafontWrapper.hpp index 031eb01ebd..582a146aee 100644 --- a/dviware/dvisvgm/src/MetafontWrapper.hpp +++ b/dviware/dvisvgm/src/MetafontWrapper.hpp @@ -2,7 +2,7 @@ ** MetafontWrapper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -26,14 +26,16 @@ class FileFinder; -class MetafontWrapper -{ +class MetafontWrapper { public: MetafontWrapper (std::string fname, std::string dir); bool call (const std::string &mode, double mag); bool make (const std::string &mode, double mag); bool success () const; + protected: + int getResolution (const std::string &mfMessage) const; + private: std::string _fontname; std::string _dir; diff --git a/dviware/dvisvgm/src/MiKTeXCom.cpp b/dviware/dvisvgm/src/MiKTeXCom.cpp index 957173f126..9cd02edf41 100644 --- a/dviware/dvisvgm/src/MiKTeXCom.cpp +++ b/dviware/dvisvgm/src/MiKTeXCom.cpp @@ -2,7 +2,7 @@ ** MiKTeXCom.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/MiKTeXCom.hpp b/dviware/dvisvgm/src/MiKTeXCom.hpp index 5bf1981167..3da270cea1 100644 --- a/dviware/dvisvgm/src/MiKTeXCom.hpp +++ b/dviware/dvisvgm/src/MiKTeXCom.hpp @@ -2,7 +2,7 @@ ** MiKTeXCom.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/NoPsSpecialHandler.cpp b/dviware/dvisvgm/src/NoPsSpecialHandler.cpp index 533e5390be..f5b3d7244e 100644 --- a/dviware/dvisvgm/src/NoPsSpecialHandler.cpp +++ b/dviware/dvisvgm/src/NoPsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/NoPsSpecialHandler.hpp b/dviware/dvisvgm/src/NoPsSpecialHandler.hpp index 027ea3fb62..9af3d47df5 100644 --- a/dviware/dvisvgm/src/NoPsSpecialHandler.hpp +++ b/dviware/dvisvgm/src/NoPsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** NoPsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/NumericRanges.hpp b/dviware/dvisvgm/src/NumericRanges.hpp index c51f1eba73..a6ee109568 100644 --- a/dviware/dvisvgm/src/NumericRanges.hpp +++ b/dviware/dvisvgm/src/NumericRanges.hpp @@ -2,7 +2,7 @@ ** NumericRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PDFParser.cpp b/dviware/dvisvgm/src/PDFParser.cpp index 1ecd40cba8..e511d4dc39 100644 --- a/dviware/dvisvgm/src/PDFParser.cpp +++ b/dviware/dvisvgm/src/PDFParser.cpp @@ -2,7 +2,7 @@ ** PDFParser.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PDFParser.hpp b/dviware/dvisvgm/src/PDFParser.hpp index 6471668307..b261ee9cf7 100644 --- a/dviware/dvisvgm/src/PDFParser.hpp +++ b/dviware/dvisvgm/src/PDFParser.hpp @@ -2,7 +2,7 @@ ** PDFParser.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PDFToSVG.hpp b/dviware/dvisvgm/src/PDFToSVG.hpp index d1871d0bb1..a6c71f964b 100644 --- a/dviware/dvisvgm/src/PDFToSVG.hpp +++ b/dviware/dvisvgm/src/PDFToSVG.hpp @@ -2,7 +2,7 @@ ** PDFToSVG.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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 @@ class PDFToSVG : public ImageToSVG { bool isSinglePageFormat() const override {return false;} /** Returns the total number of pages in the PDF file. */ - int totalPageCount() override { + int totalPageCount() const override { if (_totalPageCount < 0) { _totalPageCount = psInterpreter().pdfPageCount(filename()); if (_totalPageCount < 1) diff --git a/dviware/dvisvgm/src/PSFilter.hpp b/dviware/dvisvgm/src/PSFilter.hpp index 2e1cac5c77..87aff89a7c 100644 --- a/dviware/dvisvgm/src/PSFilter.hpp +++ b/dviware/dvisvgm/src/PSFilter.hpp @@ -2,7 +2,7 @@ ** PSFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PSInterpreter.cpp b/dviware/dvisvgm/src/PSInterpreter.cpp index 4b1d1fbc15..038e1326f2 100644 --- a/dviware/dvisvgm/src/PSInterpreter.cpp +++ b/dviware/dvisvgm/src/PSInterpreter.cpp @@ -2,7 +2,7 @@ ** PSInterpreter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -30,6 +30,7 @@ #include "PSFilter.hpp" #include "PSInterpreter.hpp" #include "SignalHandler.hpp" +#include "utility.hpp" using namespace std; @@ -266,6 +267,7 @@ void PSInterpreter::callActions (InputReader &in) { {"grestore", { 0, &PSActions::grestore}}, {"grestoreall", { 0, &PSActions::grestoreall}}, {"gsave", { 0, &PSActions::gsave}}, + {"image", { 3, &PSActions::image}}, {"initclip", { 0, &PSActions::initclip}}, {"lineto", { 2, &PSActions::lineto}}, {"makepattern", {-1, &PSActions::makepattern}}, @@ -278,6 +280,7 @@ void PSInterpreter::callActions (InputReader &in) { {"save", { 1, &PSActions::save}}, {"scale", { 2, &PSActions::scale}}, {"setblendmode", { 1, &PSActions::setblendmode}}, + {"setcolorspace", { 1, &PSActions::setcolorspace}}, {"setcmykcolor", { 4, &PSActions::setcmykcolor}}, {"setdash", {-1, &PSActions::setdash}}, {"setgray", { 1, &PSActions::setgray}}, @@ -378,3 +381,77 @@ BoundingBox PSInterpreter::pdfPageBox (const string &fname, int pageno) { pagebox = BoundingBox(stod(_rawData[0]), stod(_rawData[1]), stod(_rawData[2]), stod(_rawData[3])); return pagebox; } + + +vector PSInterpreter::getImageDeviceInfos () { + vector infos { + {"none", "no processing of bitmap images"}, + {"jpeg", "color JPEG format"}, + {"jpeggray", "grayscale JPEG format"}, + {"png", "grayscale or 24-bit color PNG format"}, + {"pnggray", "grayscale PNG format"}, + {"pngmono", "black-and-white PNG format"}, + {"pngmonod", "dithered black-and-white PNG format"}, + {"png16", "4-bit color PNG format"}, + {"png256", "8-bit color PNG format"}, + {"png16m", "24-bit color PNG format"}, + }; + return infos; +} + + +void PSInterpreter::listImageDeviceInfos (ostream &os) { + for (const PSDeviceInfo &info : getImageDeviceInfos()) + os << setw(8) << left << info.name << " | " << info.description << '\n'; +} + + +/** Returns true if a given PS device name is known. The function deosn't + * check whether the device is actually available. + * @param[in] deviceStr device specifier of the form [:] */ +bool PSInterpreter::imageDeviceKnown (string deviceStr) { + if (deviceStr.empty() || !isalpha(deviceStr[0])) + return false; + deviceStr = deviceStr.substr(0, deviceStr.find(':')); // strip optional argument + auto infos = getImageDeviceInfos(); + auto it = find_if(infos.begin(), infos.end(), [&](PSDeviceInfo &info) { + return info.name == deviceStr; + }); + return it != infos.end(); +} + + +/** Sets the output device used to create bitmap images. + * @param[in] deviceStr device specifier of the form [:] + * @return true on success, false if device is not supported */ +bool PSInterpreter::setImageDevice (const string &deviceStr) { + auto params = util::split(deviceStr, ":"); + string name = util::tolower(params[0]); + if (!imageDeviceKnown(name)) + return false; + if (name != "jpeg" && name != "png" && name != "none") { + // check if image device is supported by Ghostscript + executeRaw("devicedict/"+name+" known{1}{0}ifelse\n", 1); + if (_rawData.empty() || _rawData[0] != "1") + throw PSException("output device '"+name+"' is not available"); + } + string ps = "/@imgdevice("+name+")store "; + try { + if (params.size() > 1) { + // set JPEG quality level if given + if (name.substr(0, 4) == "jpeg") { + int quality = max(0, min(stoi(params[1]), 100)); + ps += "/JPEGQ "+to_string(quality)+" def "; + } + else if (name == "pngmonod") { + int minFeatureSize = max(0, min(stoi(params[1]), 4)); + ps += "/MinFeatureSize "+to_string(minFeatureSize)+" def "; + } + } + } + catch (...) { + throw PSException("invalid device option '"+params[1]+"' (integer expected)"); + } + execute(ps); + return true; +} diff --git a/dviware/dvisvgm/src/PSInterpreter.hpp b/dviware/dvisvgm/src/PSInterpreter.hpp index 8e75e3c5f1..138242abb7 100644 --- a/dviware/dvisvgm/src/PSInterpreter.hpp +++ b/dviware/dvisvgm/src/PSInterpreter.hpp @@ -2,7 +2,7 @@ ** PSInterpreter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -51,6 +51,7 @@ struct PSActions { virtual void gsave (std::vector &p) =0; virtual void grestore (std::vector &p) =0; virtual void grestoreall (std::vector &p) =0; + virtual void image (std::vector &p) =0; virtual void initclip (std::vector &p) =0; virtual void lineto (std::vector &p) =0; virtual void makepattern (std::vector &p) =0; @@ -62,6 +63,7 @@ struct PSActions { virtual void save (std::vector &p) =0; virtual void scale (std::vector &p) =0; virtual void setblendmode (std::vector &p) =0; + virtual void setcolorspace (std::vector &p) =0; virtual void setcmykcolor (std::vector &cmyk) =0; virtual void setdash (std::vector &p) =0; virtual void setgray (std::vector &p) =0; @@ -85,6 +87,11 @@ struct PSActions { class PSFilter; +struct PSDeviceInfo { + std::string name; + std::string description; +}; + /** This class provides methods to execute chunks of PostScript code and calls * several template methods on invocation of selected PS operators (see PSActions). */ class PSInterpreter { @@ -105,6 +112,10 @@ class PSInterpreter { int pdfPageCount (const std::string &fname); BoundingBox pdfPageBox (const std::string &fname, int pageno); const std::vector& rawData () const {return _rawData;} + bool setImageDevice (const std::string &deviceStr); + static std::vector getImageDeviceInfos (); + static void listImageDeviceInfos (std::ostream &os); + static bool imageDeviceKnown (std::string deviceStr); protected: void init (); diff --git a/dviware/dvisvgm/src/PSPattern.cpp b/dviware/dvisvgm/src/PSPattern.cpp index 90ff6a5685..4659dc7a84 100644 --- a/dviware/dvisvgm/src/PSPattern.cpp +++ b/dviware/dvisvgm/src/PSPattern.cpp @@ -2,7 +2,7 @@ ** PSPattern.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -151,12 +151,11 @@ void PSUncoloredTilingPattern::apply (SpecialActions &actions) { setGroupNode(util::static_unique_ptr_cast(getGroupNode()->clone())); // assign current color to the pattern graphic vector colored_elems; - const array attribs = {{"fill", "stroke"}}; - for (const char *attrib : attribs) { - getGroupNode()->getDescendants(nullptr, attrib, colored_elems); + for (const char *attrName : {"fill", "stroke"}) { + getGroupNode()->getDescendants(nullptr, attrName, colored_elems); for (XMLElement *elem : colored_elems) { - if (string(elem->getAttributeValue(attrib)) != "none") - elem->addAttribute(attrib, _currentColor.svgColorString()); + if (string(elem->getAttributeValue(attrName)) != "none") + elem->addAttribute(attrName, _currentColor.svgColorString()); } colored_elems.clear(); } diff --git a/dviware/dvisvgm/src/PSPattern.hpp b/dviware/dvisvgm/src/PSPattern.hpp index 7dde27827d..2c53dd2b3e 100644 --- a/dviware/dvisvgm/src/PSPattern.hpp +++ b/dviware/dvisvgm/src/PSPattern.hpp @@ -2,7 +2,7 @@ ** PSPattern.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PSPreviewFilter.cpp b/dviware/dvisvgm/src/PSPreviewFilter.cpp index 6dac4945a8..20e8b53643 100644 --- a/dviware/dvisvgm/src/PSPreviewFilter.cpp +++ b/dviware/dvisvgm/src/PSPreviewFilter.cpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PSPreviewFilter.hpp b/dviware/dvisvgm/src/PSPreviewFilter.hpp index 630a277b16..acadf9f39e 100644 --- a/dviware/dvisvgm/src/PSPreviewFilter.hpp +++ b/dviware/dvisvgm/src/PSPreviewFilter.hpp @@ -2,7 +2,7 @@ ** PSPreviewFilter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PageRanges.cpp b/dviware/dvisvgm/src/PageRanges.cpp index e6c1a8287b..a08ad4aa54 100644 --- a/dviware/dvisvgm/src/PageRanges.cpp +++ b/dviware/dvisvgm/src/PageRanges.cpp @@ -2,7 +2,7 @@ ** PageRanges.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PageRanges.hpp b/dviware/dvisvgm/src/PageRanges.hpp index 5ecc7a998c..e6909b9cd1 100644 --- a/dviware/dvisvgm/src/PageRanges.hpp +++ b/dviware/dvisvgm/src/PageRanges.hpp @@ -2,7 +2,7 @@ ** PageRanges.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PageSize.cpp b/dviware/dvisvgm/src/PageSize.cpp index 2f0a48aeb9..ac8e1c5275 100644 --- a/dviware/dvisvgm/src/PageSize.cpp +++ b/dviware/dvisvgm/src/PageSize.cpp @@ -2,7 +2,7 @@ ** PageSize.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -33,8 +33,8 @@ using namespace std; * @param[out] width contains the page width when function returns * @param[out] height contains the page height when function returns */ static void computeASize (int n, Length &width, Length &height) { - height.set(floor(1189.0/pow(math::SQRT2, n)+0.5), Length::Unit::MM); - width.set(floor(height.mm()/math::SQRT2+0.5), Length::Unit::MM); + height.set(round(1189.0/pow(math::SQRT2, n)), Length::Unit::MM); + width.set(round(height.mm()/math::SQRT2), Length::Unit::MM); } @@ -46,8 +46,8 @@ static void computeBSize (int n, Length &width, Length &height) { Length w, h; computeASize(n, width, height); computeASize(n-1, w, h); - width.set(floor(sqrt(width.mm() * w.mm())+0.5), Length::Unit::MM); - height.set(floor(sqrt(height.mm() * h.mm())+0.5), Length::Unit::MM); + width.set(round(sqrt(width.mm() * w.mm())), Length::Unit::MM); + height.set(round(sqrt(height.mm() * h.mm())), Length::Unit::MM); } @@ -59,8 +59,8 @@ static void computeCSize (int n, Length &width, Length &height) { Length w, h; computeASize(n, width, height); computeBSize(n, w, h); - width.set(floor(sqrt(width.mm() * w.mm())+0.5), Length::Unit::MM); - height.set(floor(sqrt(height.mm() * h.mm())+0.5), Length::Unit::MM); + width.set(round(sqrt(width.mm() * w.mm())), Length::Unit::MM); + height.set(round(sqrt(height.mm() * h.mm())), Length::Unit::MM); } @@ -72,8 +72,8 @@ static void computeDSize (int n, Length &width, Length &height) { Length w, h; computeASize(n, width, height); computeBSize(n+1, w, h); - width.set(floor(sqrt(width.mm() * w.mm())+0.5), Length::Unit::MM); - height.set(floor(sqrt(height.mm() * h.mm())+0.5), Length::Unit::MM); + width.set(round(sqrt(width.mm() * w.mm())), Length::Unit::MM); + height.set(round(sqrt(height.mm() * h.mm())), Length::Unit::MM); } diff --git a/dviware/dvisvgm/src/PageSize.hpp b/dviware/dvisvgm/src/PageSize.hpp index c785a89564..43c555b9dd 100644 --- a/dviware/dvisvgm/src/PageSize.hpp +++ b/dviware/dvisvgm/src/PageSize.hpp @@ -2,7 +2,7 @@ ** PageSize.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Pair.hpp b/dviware/dvisvgm/src/Pair.hpp index 5dd7c68a93..63806c5b6a 100644 --- a/dviware/dvisvgm/src/Pair.hpp +++ b/dviware/dvisvgm/src/Pair.hpp @@ -2,7 +2,7 @@ ** Pair.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp b/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp index 0907afc8f0..c2ab96a8a8 100644 --- a/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp +++ b/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp b/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp index c7f8f26d60..ed836f37d7 100644 --- a/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp +++ b/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PapersizeSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PathClipper.cpp b/dviware/dvisvgm/src/PathClipper.cpp index f646289d25..4aa4373f46 100644 --- a/dviware/dvisvgm/src/PathClipper.cpp +++ b/dviware/dvisvgm/src/PathClipper.cpp @@ -2,7 +2,7 @@ ** PathClipper.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PathClipper.hpp b/dviware/dvisvgm/src/PathClipper.hpp index fb375db35f..e3e6bd1681 100644 --- a/dviware/dvisvgm/src/PathClipper.hpp +++ b/dviware/dvisvgm/src/PathClipper.hpp @@ -2,7 +2,7 @@ ** PathClipper.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PdfSpecialHandler.cpp b/dviware/dvisvgm/src/PdfSpecialHandler.cpp index 70174b0fe1..3466e44f8e 100644 --- a/dviware/dvisvgm/src/PdfSpecialHandler.cpp +++ b/dviware/dvisvgm/src/PdfSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PdfSpecialHandler.hpp b/dviware/dvisvgm/src/PdfSpecialHandler.hpp index 389ee96b86..67512dd403 100644 --- a/dviware/dvisvgm/src/PdfSpecialHandler.hpp +++ b/dviware/dvisvgm/src/PdfSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PdfSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PreScanDVIReader.cpp b/dviware/dvisvgm/src/PreScanDVIReader.cpp index 7c964fae86..8e255ef088 100644 --- a/dviware/dvisvgm/src/PreScanDVIReader.cpp +++ b/dviware/dvisvgm/src/PreScanDVIReader.cpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PreScanDVIReader.hpp b/dviware/dvisvgm/src/PreScanDVIReader.hpp index 5176f5a1f3..900fd1fc01 100644 --- a/dviware/dvisvgm/src/PreScanDVIReader.hpp +++ b/dviware/dvisvgm/src/PreScanDVIReader.hpp @@ -2,7 +2,7 @@ ** PreScanDVIReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Process.cpp b/dviware/dvisvgm/src/Process.cpp index de5394f1fd..2e15153b9e 100644 --- a/dviware/dvisvgm/src/Process.cpp +++ b/dviware/dvisvgm/src/Process.cpp @@ -2,7 +2,7 @@ ** Process.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Process.hpp b/dviware/dvisvgm/src/Process.hpp index 70eeafb9d8..53311921c9 100644 --- a/dviware/dvisvgm/src/Process.hpp +++ b/dviware/dvisvgm/src/Process.hpp @@ -2,7 +2,7 @@ ** Process.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/PsSpecialHandler.cpp b/dviware/dvisvgm/src/PsSpecialHandler.cpp index 31f8aa55e7..2301eeb571 100644 --- a/dviware/dvisvgm/src/PsSpecialHandler.cpp +++ b/dviware/dvisvgm/src/PsSpecialHandler.cpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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,6 @@ #include #include #include -#include "EPSFile.hpp" #include "FileFinder.hpp" #include "FilePath.hpp" #include "FileSystem.hpp" @@ -36,6 +35,7 @@ #include "SVGTree.hpp" #include "TensorProductPatch.hpp" #include "TriangularPatch.hpp" +#include "utility.hpp" using namespace std; @@ -44,10 +44,12 @@ bool PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = false; bool PsSpecialHandler::SHADING_SEGMENT_OVERLAP = false; int PsSpecialHandler::SHADING_SEGMENT_SIZE = 20; double PsSpecialHandler::SHADING_SIMPLIFY_DELTA = 0.01; +string PsSpecialHandler::BITMAP_FORMAT; -PsSpecialHandler::PsSpecialHandler () : _psi(this), _actions(), _previewFilter(_psi), _xmlnode(), _savenode() +PsSpecialHandler::PsSpecialHandler () : _psi(this), _previewFilter(_psi) { + _psi.setImageDevice(BITMAP_FORMAT); } @@ -83,6 +85,7 @@ void PsSpecialHandler::initgraphics () { _blendmode = 0; // "normal" mode (no blending) _sx = _sy = _cos = 1.0; _pattern = nullptr; + _patternEnabled = false; _currentcolor = Color::BLACK; _dashoffset = 0; _dashpattern.clear(); @@ -381,6 +384,13 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const ma } +/** Returns path + basename of temporary bitmap images. */ +static string image_base_path (SpecialActions &actions) { + FilePath imgpath = actions.getSVGFilePath(actions.getCurrentPageNumber()); + return FileSystem::tmpdir() + "/" + imgpath.basename() + "-tmp-"; +} + + /** Creates an XML element containing the image data depending on the file type. * @param[in] type file type of the image * @param[in] fname file name/path of image file @@ -421,14 +431,15 @@ unique_ptr PsSpecialHandler::createImageNode (FileType type, const s node = util::make_unique("g"); // put SVG nodes created from the EPS/PDF file in this group _xmlnode = node.get(); _psi.execute( - "\n@beginspecial @setspecial" // enter special environment - "/setpagedevice{@setpagedevice}def " // activate processing of operator "setpagedevice" - "matrix setmatrix" // don't apply outer PS transformations - "/FirstPage "+to_string(pageno)+" def" // set number of first page to convert (PDF only) - "/LastPage "+to_string(pageno)+" def " // set number of last page to convert (PDF only) - +rectclip+ // clip to bounding box (if requexted by attribute 'clip') - "(" + pathstr + ")run " // execute file content - "@endspecial " // leave special environment + "\n@beginspecial @setspecial" // enter special environment + "/setpagedevice{@setpagedevice}def " // activate processing of operator "setpagedevice" + "/@imgbase("+image_base_path(*_actions)+")store " // path and basename of image files + "matrix setmatrix" // don't apply outer PS transformations + "/FirstPage "+to_string(pageno)+" def" // set number of first page to convert (PDF only) + "/LastPage "+to_string(pageno)+" def " // set number of last page to convert (PDF only) + +rectclip+ // clip to bounding box (if requexted by attribute 'clip') + "(" + pathstr + ")run " // execute file content + "@endspecial\n" // leave special environment ); if (node->empty()) node.reset(nullptr); @@ -468,6 +479,11 @@ static bool transform_box_extents (const Matrix &matrix, double &w, double &h, d } +void PsSpecialHandler::dviBeginPage (unsigned int pageno, SpecialActions &actions) { + _psi.execute("/@imgbase("+image_base_path(actions)+")store\n"); // path and basename of image files +} + + void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) { BoundingBox bbox; if (_previewFilter.getBoundingBox(bbox)) { // is there any data written by preview package? @@ -638,7 +654,7 @@ void PsSpecialHandler::stroke (vector &p) { } else { // compute bounding box - _path.computeBBox(bbox); + bbox = _path.computeBBox(); bbox.expand(_linewidth/2); ostringstream oss; @@ -669,12 +685,10 @@ void PsSpecialHandler::stroke (vector &p) { path->addAttribute("stroke-dashoffset", _dashoffset); } } - if (path && _clipStack.path()) { + if (path && _clipStack.path() && !_savenode) { // assign clipping path and clip bounding box path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); - BoundingBox clipbox; - _clipStack.path()->computeBBox(clipbox); - bbox.intersect(clipbox); + bbox.intersect(_clipStack.path()->computeBBox()); _clipStack.removePrependedPath(); } if (_xmlnode) @@ -696,8 +710,7 @@ void PsSpecialHandler::fill (vector &p, bool evenodd) { return; // compute bounding box - BoundingBox bbox; - _path.computeBBox(bbox); + BoundingBox bbox = _path.computeBBox(); if (!_actions->getMatrix().isIdentity()) { _path.transform(_actions->getMatrix()); if (!_xmlnode) @@ -714,12 +727,10 @@ void PsSpecialHandler::fill (vector &p, bool evenodd) { path->addAttribute("fill", XMLString("url(#")+_pattern->svgID()+")"); else if (_actions->getColor() != Color::BLACK || _savenode) path->addAttribute("fill", _actions->getColor().svgColorString()); - if (_clipStack.path()) { + if (_clipStack.path() && !_savenode) { // 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())+")"); - BoundingBox clipbox; - _clipStack.path()->computeBBox(clipbox); - bbox.intersect(clipbox); + bbox.intersect(_clipStack.path()->computeBBox()); _clipStack.removePrependedPath(); } if (evenodd) // SVG default fill rule is "nonzero" algorithm @@ -738,6 +749,62 @@ void PsSpecialHandler::fill (vector &p, bool evenodd) { } +/** Postprocesses the 'image' operation performed by the PS interpreter. If + * the PS image operator succeeded, there's now a PNG file that must be embedded + * into the SVG file. */ +void PsSpecialHandler::image (std::vector &p) { + int imgID = static_cast(p[0]); // ID of PNG file written + if (imgID < 0) // no bitmap file written? + return; + + double width = p[1]; + double height = p[2]; + string suffix = (BITMAP_FORMAT.substr(0, 3) == "png" ? ".png" : ".jpg"); + string fname = image_base_path(*_actions)+to_string(imgID)+suffix; + ifstream ifs(fname, ios::binary); + if (ifs) { + ifs.close(); + auto image = util::make_unique("image"); + double x = _actions->getX(); + double y = _actions->getY(); + image->addAttribute("x", x); + image->addAttribute("y", y); + image->addAttribute("width", util::to_string(width)); + image->addAttribute("height", util::to_string(height)); + + // The current transformation matrix (CTM) maps the unit square to the rectangular region + // of the target canvas showing the bitmap (see PS Reference Manual, 4.10.3). Therefore, + // the local pixel coordinates of the original bitmap must be transformed by CTM*inv(M) to + // get the target coordinates. M is the matrix that maps the unit square to the bitmap rectangle. + Matrix matrix{width, 0, 0, 0, -height, height}; // maps unit square to bitmap rectangle + matrix = matrix.invert().lmultiply(_actions->getMatrix()); + image->addAttribute("transform", matrix.toSVG()); + + // To prevent memory issues, only add the filename to the href attribute and tag it by '@' + // for later base64 encoding. + image->addAttribute("@xlink:href", string("data:image/")+(suffix == ".png" ? "png" : "jpeg")+";base64,"+fname); + + // if set, assign clipping path to image + if (_clipStack.path()) { + auto group = util::make_unique("g"); + group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + group->append(std::move(image)); + image = std::move(group); // handle the entire group as image to add + } + if (_xmlnode) + _xmlnode->append(std::move(image)); + else { + _actions->svgTree().appendToPage(std::move(image)); + BoundingBox bbox(x, y, x+width, y+height); + bbox.transform(matrix); + if (_clipStack.path()) + bbox.intersect(_clipStack.path()->computeBBox()); + _actions->embed(bbox); + } + } +} + + /** Creates a Matrix object from a given sequence of 6 double values. * The given values must be arranged in PostScript matrix order. * @param[in] v vector containing the matrix values @@ -774,7 +841,6 @@ static void create_matrix (vector &v, int startindex, Matrix &matrix) { * 9-14: pattern matrix */ void PsSpecialHandler::makepattern (vector &p) { int pattern_type = static_cast(p[0]); - int id = static_cast(p[1]); switch (pattern_type) { case 0: // pattern definition completed @@ -784,6 +850,7 @@ void PsSpecialHandler::makepattern (vector &p) { } break; case 1: { // tiling pattern + int id = static_cast(p[1]); BoundingBox bbox(p[2], p[3], p[4], p[5]); const double &xstep=p[6], &ystep=p[7]; // horizontal and vertical distance of adjacent tiles int paint_type = static_cast(p[8]); @@ -1184,7 +1251,8 @@ void PsSpecialHandler::rotate (vector &p) { void PsSpecialHandler::setgray (vector &p) { - _pattern = nullptr; + if (!_patternEnabled) + _pattern = nullptr; _currentcolor.setGray(p[0]); if (_actions) _actions->setColor(_currentcolor); @@ -1192,7 +1260,8 @@ void PsSpecialHandler::setgray (vector &p) { void PsSpecialHandler::setrgbcolor (vector &p) { - _pattern= nullptr; + if (!_patternEnabled) + _pattern= nullptr; _currentcolor.setRGB(p[0], p[1], p[2]); if (_actions) _actions->setColor(_currentcolor); @@ -1200,7 +1269,8 @@ void PsSpecialHandler::setrgbcolor (vector &p) { void PsSpecialHandler::setcmykcolor (vector &p) { - _pattern = nullptr; + if (!_patternEnabled) + _pattern = nullptr; _currentcolor.setCMYK(p[0], p[1], p[2], p[3]); if (_actions) _actions->setColor(_currentcolor); @@ -1208,7 +1278,8 @@ void PsSpecialHandler::setcmykcolor (vector &p) { void PsSpecialHandler::sethsbcolor (vector &p) { - _pattern = nullptr; + if (!_patternEnabled) + _pattern = nullptr; _currentcolor.setHSB(p[0], p[1], p[2]); if (_actions) _actions->setColor(_currentcolor); diff --git a/dviware/dvisvgm/src/PsSpecialHandler.hpp b/dviware/dvisvgm/src/PsSpecialHandler.hpp index 6251e20a47..9dcbc2d4ce 100644 --- a/dviware/dvisvgm/src/PsSpecialHandler.hpp +++ b/dviware/dvisvgm/src/PsSpecialHandler.hpp @@ -2,7 +2,7 @@ ** PsSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -95,6 +95,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { static bool SHADING_SEGMENT_OVERLAP; static int SHADING_SEGMENT_SIZE; static double SHADING_SIMPLIFY_DELTA; + static std::string BITMAP_FORMAT; protected: void initialize (); @@ -104,6 +105,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void processHeaderFile (const char *fname); void imgfile (FileType type, const std::string &fname, const std::map &attr); std::unique_ptr 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); void processSequentialPatchMesh (int shadingTypeID, ColorSpace cspace, VectorIterator &it); @@ -125,6 +127,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void grestore (std::vector &p) override; void grestoreall (std::vector &p) override; void gsave (std::vector &p) override; + void image (std::vector &p) override; void initclip (std::vector &p) override; void lineto (std::vector &p) override; void makepattern (std::vector &p) override; @@ -136,6 +139,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void save (std::vector &p) override; void scale (std::vector &p) override; void setblendmode (std::vector &p) override {_blendmode = int(p[0]);} + void setcolorspace (std::vector &p) override {_patternEnabled = bool(p[0]);} void setcmykcolor (std::vector &cmyk) override; void setdash (std::vector &p) override; void setgray (std::vector &p) override; @@ -158,11 +162,11 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { private: PSInterpreter _psi; - SpecialActions *_actions; + SpecialActions *_actions=nullptr; PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package PsSection _psSection=PS_NONE; ///< current section processed (nothing yet, headers, or body specials) - XMLElement *_xmlnode; ///< if != 0, created SVG elements are appended to this node - XMLElement *_savenode; ///< pointer to temporaryly store _xmlnode + XMLElement *_xmlnode=nullptr; ///< if != 0, created SVG elements are appended to this node + XMLElement *_savenode=nullptr; ///< pointer to temporaryly store _xmlnode std::string _headerCode; ///< collected literal PS header code Path _path; DPair _currentpoint; ///< current PS position in bp units @@ -181,6 +185,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { ClippingStack _clipStack; std::map> _patterns; PSTilingPattern *_pattern; ///< current pattern + bool _patternEnabled; ///< true if active color space is a pattern }; #endif diff --git a/dviware/dvisvgm/src/RangeMap.cpp b/dviware/dvisvgm/src/RangeMap.cpp index 5fa2bb10ab..86190cacf9 100644 --- a/dviware/dvisvgm/src/RangeMap.cpp +++ b/dviware/dvisvgm/src/RangeMap.cpp @@ -2,7 +2,7 @@ ** RangeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/RangeMap.hpp b/dviware/dvisvgm/src/RangeMap.hpp index 9d3f2c2d95..3e3bff9d4b 100644 --- a/dviware/dvisvgm/src/RangeMap.hpp +++ b/dviware/dvisvgm/src/RangeMap.hpp @@ -2,7 +2,7 @@ ** RangeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharHandler.cpp b/dviware/dvisvgm/src/SVGCharHandler.cpp index 3733053e4d..f8d75a28d3 100644 --- a/dviware/dvisvgm/src/SVGCharHandler.cpp +++ b/dviware/dvisvgm/src/SVGCharHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharHandler.hpp b/dviware/dvisvgm/src/SVGCharHandler.hpp index 48d24496fa..f75df47215 100644 --- a/dviware/dvisvgm/src/SVGCharHandler.hpp +++ b/dviware/dvisvgm/src/SVGCharHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp b/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp index 613f7e7d8b..397943ace0 100644 --- a/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp +++ b/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp b/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp index 92a08dc196..f37b9977c2 100644 --- a/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp +++ b/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp @@ -2,7 +2,7 @@ ** SVGCharHandlerFactory.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharPathHandler.cpp b/dviware/dvisvgm/src/SVGCharPathHandler.cpp index 3962168ae2..7a766bae49 100644 --- a/dviware/dvisvgm/src/SVGCharPathHandler.cpp +++ b/dviware/dvisvgm/src/SVGCharPathHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharPathHandler.hpp b/dviware/dvisvgm/src/SVGCharPathHandler.hpp index ba172de340..c404cbcd5a 100644 --- a/dviware/dvisvgm/src/SVGCharPathHandler.hpp +++ b/dviware/dvisvgm/src/SVGCharPathHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharPathHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp b/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp index a48f5f9a93..6b89348dc1 100644 --- a/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp +++ b/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp b/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp index 01567997b6..b847965a1a 100644 --- a/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp +++ b/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGCharTspanTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGOutput.cpp b/dviware/dvisvgm/src/SVGOutput.cpp index 1f9e244883..18702be776 100644 --- a/dviware/dvisvgm/src/SVGOutput.cpp +++ b/dviware/dvisvgm/src/SVGOutput.cpp @@ -2,7 +2,7 @@ ** SVGOutput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGOutput.hpp b/dviware/dvisvgm/src/SVGOutput.hpp index 1f4da20ee8..f29a032674 100644 --- a/dviware/dvisvgm/src/SVGOutput.hpp +++ b/dviware/dvisvgm/src/SVGOutput.hpp @@ -2,7 +2,7 @@ ** SVGOutput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp b/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp index 0d36b5a8b8..89d1c548b0 100644 --- a/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp +++ b/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp b/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp index 7fd2174f12..67fcabd44c 100644 --- a/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp +++ b/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp @@ -2,7 +2,7 @@ ** SVGSingleCharTextHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGTree.cpp b/dviware/dvisvgm/src/SVGTree.cpp index 57b5fd5a4f..e35a14d9b3 100644 --- a/dviware/dvisvgm/src/SVGTree.cpp +++ b/dviware/dvisvgm/src/SVGTree.cpp @@ -2,7 +2,7 @@ ** SVGTree.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SVGTree.hpp b/dviware/dvisvgm/src/SVGTree.hpp index d351ec9799..a441a314a5 100644 --- a/dviware/dvisvgm/src/SVGTree.hpp +++ b/dviware/dvisvgm/src/SVGTree.hpp @@ -2,7 +2,7 @@ ** SVGTree.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ShadingPatch.cpp b/dviware/dvisvgm/src/ShadingPatch.cpp index 1ad0011daf..847dc3aa0c 100644 --- a/dviware/dvisvgm/src/ShadingPatch.cpp +++ b/dviware/dvisvgm/src/ShadingPatch.cpp @@ -2,7 +2,7 @@ ** ShadingPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ShadingPatch.hpp b/dviware/dvisvgm/src/ShadingPatch.hpp index 4346301e7b..573188b77b 100644 --- a/dviware/dvisvgm/src/ShadingPatch.hpp +++ b/dviware/dvisvgm/src/ShadingPatch.hpp @@ -2,7 +2,7 @@ ** ShadingPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SignalHandler.cpp b/dviware/dvisvgm/src/SignalHandler.cpp index 5af70be2e4..14badba085 100644 --- a/dviware/dvisvgm/src/SignalHandler.cpp +++ b/dviware/dvisvgm/src/SignalHandler.cpp @@ -2,7 +2,7 @@ ** SignalHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SignalHandler.hpp b/dviware/dvisvgm/src/SignalHandler.hpp index b97449399e..647a3650fc 100644 --- a/dviware/dvisvgm/src/SignalHandler.hpp +++ b/dviware/dvisvgm/src/SignalHandler.hpp @@ -2,7 +2,7 @@ ** SignalHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SourceInput.cpp b/dviware/dvisvgm/src/SourceInput.cpp index 35cdd24af9..5cd2e22749 100644 --- a/dviware/dvisvgm/src/SourceInput.cpp +++ b/dviware/dvisvgm/src/SourceInput.cpp @@ -2,7 +2,7 @@ ** SourceInput.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SourceInput.hpp b/dviware/dvisvgm/src/SourceInput.hpp index 3b0f7b3c62..63f4af9b7a 100644 --- a/dviware/dvisvgm/src/SourceInput.hpp +++ b/dviware/dvisvgm/src/SourceInput.hpp @@ -2,7 +2,7 @@ ** SourceInput.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SpecialActions.hpp b/dviware/dvisvgm/src/SpecialActions.hpp index 7e53303792..f8eba3fd12 100644 --- a/dviware/dvisvgm/src/SpecialActions.hpp +++ b/dviware/dvisvgm/src/SpecialActions.hpp @@ -2,7 +2,7 @@ ** SpecialActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SpecialHandler.hpp b/dviware/dvisvgm/src/SpecialHandler.hpp index 4a3439bb24..6c676a6ba0 100644 --- a/dviware/dvisvgm/src/SpecialHandler.hpp +++ b/dviware/dvisvgm/src/SpecialHandler.hpp @@ -2,7 +2,7 @@ ** SpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SpecialManager.cpp b/dviware/dvisvgm/src/SpecialManager.cpp index 4838cbdf47..f3b2f3aa50 100644 --- a/dviware/dvisvgm/src/SpecialManager.cpp +++ b/dviware/dvisvgm/src/SpecialManager.cpp @@ -2,7 +2,7 @@ ** SpecialManager.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/SpecialManager.hpp b/dviware/dvisvgm/src/SpecialManager.hpp index fe88eaf58e..4c4ccae281 100644 --- a/dviware/dvisvgm/src/SpecialManager.hpp +++ b/dviware/dvisvgm/src/SpecialManager.hpp @@ -2,7 +2,7 @@ ** SpecialManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/StreamReader.cpp b/dviware/dvisvgm/src/StreamReader.cpp index ccfb176abe..200b6592d9 100644 --- a/dviware/dvisvgm/src/StreamReader.cpp +++ b/dviware/dvisvgm/src/StreamReader.cpp @@ -2,7 +2,7 @@ ** StreamReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/StreamReader.hpp b/dviware/dvisvgm/src/StreamReader.hpp index 05c4e1e701..653b451b69 100644 --- a/dviware/dvisvgm/src/StreamReader.hpp +++ b/dviware/dvisvgm/src/StreamReader.hpp @@ -2,7 +2,7 @@ ** StreamReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/StreamWriter.cpp b/dviware/dvisvgm/src/StreamWriter.cpp index 6216468695..c0885c31b1 100644 --- a/dviware/dvisvgm/src/StreamWriter.cpp +++ b/dviware/dvisvgm/src/StreamWriter.cpp @@ -2,7 +2,7 @@ ** StreamWriter.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/StreamWriter.hpp b/dviware/dvisvgm/src/StreamWriter.hpp index 441a9a7e7f..16a54b1050 100644 --- a/dviware/dvisvgm/src/StreamWriter.hpp +++ b/dviware/dvisvgm/src/StreamWriter.hpp @@ -2,7 +2,7 @@ ** StreamWriter.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Subfont.cpp b/dviware/dvisvgm/src/Subfont.cpp index e0b2570d8c..eb7f244cdb 100644 --- a/dviware/dvisvgm/src/Subfont.cpp +++ b/dviware/dvisvgm/src/Subfont.cpp @@ -2,7 +2,7 @@ ** Subfont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Subfont.hpp b/dviware/dvisvgm/src/Subfont.hpp index ca88520ea2..5125194e9d 100644 --- a/dviware/dvisvgm/src/Subfont.hpp +++ b/dviware/dvisvgm/src/Subfont.hpp @@ -2,7 +2,7 @@ ** Subfont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/System.cpp b/dviware/dvisvgm/src/System.cpp index b2724bdcab..ed14df6821 100644 --- a/dviware/dvisvgm/src/System.cpp +++ b/dviware/dvisvgm/src/System.cpp @@ -2,7 +2,7 @@ ** System.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/System.hpp b/dviware/dvisvgm/src/System.hpp index fa29325252..72a0cb3da8 100644 --- a/dviware/dvisvgm/src/System.hpp +++ b/dviware/dvisvgm/src/System.hpp @@ -2,7 +2,7 @@ ** System.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TFM.cpp b/dviware/dvisvgm/src/TFM.cpp index 005081533e..ea6f2ecbe4 100644 --- a/dviware/dvisvgm/src/TFM.cpp +++ b/dviware/dvisvgm/src/TFM.cpp @@ -2,7 +2,7 @@ ** TFM.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TFM.hpp b/dviware/dvisvgm/src/TFM.hpp index f2fd3027eb..261a5ce736 100644 --- a/dviware/dvisvgm/src/TFM.hpp +++ b/dviware/dvisvgm/src/TFM.hpp @@ -2,7 +2,7 @@ ** TFM.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TTFAutohint.cpp b/dviware/dvisvgm/src/TTFAutohint.cpp index a7aef2a5ec..ad1b03f21a 100644 --- a/dviware/dvisvgm/src/TTFAutohint.cpp +++ b/dviware/dvisvgm/src/TTFAutohint.cpp @@ -2,7 +2,7 @@ ** TTFAutohint.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TTFAutohint.hpp b/dviware/dvisvgm/src/TTFAutohint.hpp index 417661d3bb..d23ceb2be0 100644 --- a/dviware/dvisvgm/src/TTFAutohint.hpp +++ b/dviware/dvisvgm/src/TTFAutohint.hpp @@ -2,7 +2,7 @@ ** TTFAutohint.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TensorProductPatch.cpp b/dviware/dvisvgm/src/TensorProductPatch.cpp index 52acd63179..dcd31e275d 100644 --- a/dviware/dvisvgm/src/TensorProductPatch.cpp +++ b/dviware/dvisvgm/src/TensorProductPatch.cpp @@ -2,7 +2,7 @@ ** TensorProductPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -300,9 +300,9 @@ DPair TensorProductPatch::blossomValue (double u1, double u2, double u3, double /** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values * greater than or near 1 are mapped to 1. */ static inline double snap (double x) { - if (fabs(x) < 0.001) + if (abs(x) < 0.001) return 0; - if (fabs(1-x) < 0.001) + if (abs(1-x) < 0.001) return 1; return x; } diff --git a/dviware/dvisvgm/src/TensorProductPatch.hpp b/dviware/dvisvgm/src/TensorProductPatch.hpp index 711feefc2d..e53604cf52 100644 --- a/dviware/dvisvgm/src/TensorProductPatch.hpp +++ b/dviware/dvisvgm/src/TensorProductPatch.hpp @@ -2,7 +2,7 @@ ** TensorProductPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Terminal.cpp b/dviware/dvisvgm/src/Terminal.cpp index 0e46874895..3b2ff2b871 100644 --- a/dviware/dvisvgm/src/Terminal.cpp +++ b/dviware/dvisvgm/src/Terminal.cpp @@ -2,7 +2,7 @@ ** Terminal.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Terminal.hpp b/dviware/dvisvgm/src/Terminal.hpp index e452aa042f..fd7a920c16 100644 --- a/dviware/dvisvgm/src/Terminal.hpp +++ b/dviware/dvisvgm/src/Terminal.hpp @@ -2,7 +2,7 @@ ** Terminal.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ToUnicodeMap.cpp b/dviware/dvisvgm/src/ToUnicodeMap.cpp index f002038aec..6ab99a248e 100644 --- a/dviware/dvisvgm/src/ToUnicodeMap.cpp +++ b/dviware/dvisvgm/src/ToUnicodeMap.cpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ToUnicodeMap.hpp b/dviware/dvisvgm/src/ToUnicodeMap.hpp index 8ab3474e65..74d6dcb648 100644 --- a/dviware/dvisvgm/src/ToUnicodeMap.hpp +++ b/dviware/dvisvgm/src/ToUnicodeMap.hpp @@ -2,7 +2,7 @@ ** ToUnicodeMap.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TpicSpecialHandler.cpp b/dviware/dvisvgm/src/TpicSpecialHandler.cpp index b97fa439af..47d3e46988 100644 --- a/dviware/dvisvgm/src/TpicSpecialHandler.cpp +++ b/dviware/dvisvgm/src/TpicSpecialHandler.cpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TpicSpecialHandler.hpp b/dviware/dvisvgm/src/TpicSpecialHandler.hpp index fa8ba706fd..f6ec271994 100644 --- a/dviware/dvisvgm/src/TpicSpecialHandler.hpp +++ b/dviware/dvisvgm/src/TpicSpecialHandler.hpp @@ -2,7 +2,7 @@ ** TpicSpecialHandler.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TriangularPatch.cpp b/dviware/dvisvgm/src/TriangularPatch.cpp index 01efe2e8f0..fadeb725ff 100644 --- a/dviware/dvisvgm/src/TriangularPatch.cpp +++ b/dviware/dvisvgm/src/TriangularPatch.cpp @@ -2,7 +2,7 @@ ** TriangularPatch.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -142,9 +142,9 @@ Color TriangularPatch::averageColor (const Color &c1, const Color &c2, const Col /** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values * greater than or near 1 are mapped to 1. */ static inline double snap (double x) { - if (fabs(x) < 0.001) + if (abs(x) < 0.001) return 0; - if (fabs(1-x) < 0.001) + if (abs(1-x) < 0.001) return 1; return x; } diff --git a/dviware/dvisvgm/src/TriangularPatch.hpp b/dviware/dvisvgm/src/TriangularPatch.hpp index d329e43fa1..797068bacd 100644 --- a/dviware/dvisvgm/src/TriangularPatch.hpp +++ b/dviware/dvisvgm/src/TriangularPatch.hpp @@ -2,7 +2,7 @@ ** TriangularPatch.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TrueTypeFont.cpp b/dviware/dvisvgm/src/TrueTypeFont.cpp index 408a00eede..2921af59ea 100644 --- a/dviware/dvisvgm/src/TrueTypeFont.cpp +++ b/dviware/dvisvgm/src/TrueTypeFont.cpp @@ -2,7 +2,7 @@ ** TrueTypeFont.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/TrueTypeFont.hpp b/dviware/dvisvgm/src/TrueTypeFont.hpp index d2e5b6e98d..0ae155c52c 100644 --- a/dviware/dvisvgm/src/TrueTypeFont.hpp +++ b/dviware/dvisvgm/src/TrueTypeFont.hpp @@ -2,7 +2,7 @@ ** TrueTypeFont.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Unicode.cpp b/dviware/dvisvgm/src/Unicode.cpp index d4a18a7bb9..950209bda0 100644 --- a/dviware/dvisvgm/src/Unicode.cpp +++ b/dviware/dvisvgm/src/Unicode.cpp @@ -2,7 +2,7 @@ ** Unicode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/Unicode.hpp b/dviware/dvisvgm/src/Unicode.hpp index e281edc791..bc9db7e731 100644 --- a/dviware/dvisvgm/src/Unicode.hpp +++ b/dviware/dvisvgm/src/Unicode.hpp @@ -2,7 +2,7 @@ ** Unicode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/VFActions.hpp b/dviware/dvisvgm/src/VFActions.hpp index 73567109f7..2d4a2a2c5f 100644 --- a/dviware/dvisvgm/src/VFActions.hpp +++ b/dviware/dvisvgm/src/VFActions.hpp @@ -2,7 +2,7 @@ ** VFActions.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/VFReader.cpp b/dviware/dvisvgm/src/VFReader.cpp index 47f5e3f7b6..eb1193ddaa 100644 --- a/dviware/dvisvgm/src/VFReader.cpp +++ b/dviware/dvisvgm/src/VFReader.cpp @@ -2,7 +2,7 @@ ** VFReader.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/VFReader.hpp b/dviware/dvisvgm/src/VFReader.hpp index bd42289039..bbf4986d7f 100644 --- a/dviware/dvisvgm/src/VFReader.hpp +++ b/dviware/dvisvgm/src/VFReader.hpp @@ -2,7 +2,7 @@ ** VFReader.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/VectorIterator.hpp b/dviware/dvisvgm/src/VectorIterator.hpp index 17707fbc96..0fb53d78e4 100644 --- a/dviware/dvisvgm/src/VectorIterator.hpp +++ b/dviware/dvisvgm/src/VectorIterator.hpp @@ -2,7 +2,7 @@ ** VectorIterator.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/VectorStream.hpp b/dviware/dvisvgm/src/VectorStream.hpp index 9672e67435..0372d368d0 100644 --- a/dviware/dvisvgm/src/VectorStream.hpp +++ b/dviware/dvisvgm/src/VectorStream.hpp @@ -2,7 +2,7 @@ ** VectorStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/XMLDocument.cpp b/dviware/dvisvgm/src/XMLDocument.cpp index be14eaf678..ffe23b1f80 100644 --- a/dviware/dvisvgm/src/XMLDocument.cpp +++ b/dviware/dvisvgm/src/XMLDocument.cpp @@ -2,7 +2,7 @@ ** XMLDocument.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/XMLDocument.hpp b/dviware/dvisvgm/src/XMLDocument.hpp index e9132c44d8..2eaaee4a28 100644 --- a/dviware/dvisvgm/src/XMLDocument.hpp +++ b/dviware/dvisvgm/src/XMLDocument.hpp @@ -2,7 +2,7 @@ ** XMLDocument.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/XMLNode.cpp b/dviware/dvisvgm/src/XMLNode.cpp index 128be5b9e5..db07d95dd2 100644 --- a/dviware/dvisvgm/src/XMLNode.cpp +++ b/dviware/dvisvgm/src/XMLNode.cpp @@ -2,7 +2,7 @@ ** XMLNode.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -19,15 +19,18 @@ *************************************************************************/ #include -#include +#include #include +#include #include +#include "FileSystem.hpp" #include "utility.hpp" #include "XMLNode.hpp" #include "XMLString.hpp" using namespace std; +bool XMLNode::KEEP_ENCODED_FILES=false; bool XMLElement::WRITE_NEWLINES=true; @@ -69,7 +72,7 @@ XMLElement::XMLElement (string name) : _name(std::move(name)) { XMLElement::XMLElement (const XMLElement &node) : XMLNode(node), _name(node._name), _attributes(node._attributes) { - for (XMLNode *child=_firstChild.get(); child; child = child->next()) + for (XMLNode *child=node._firstChild.get(); child; child = child->next()) insertLast(child->clone()); } @@ -84,6 +87,14 @@ XMLElement::XMLElement (XMLElement &&node) noexcept } +XMLElement::~XMLElement () { + // explicitly remove child nodes by iteration to prevent deep recursion + unique_ptr child = std::move(_firstChild); + while (child && child->next()) + child->removeNext(); +} + + /** Removes all attributes and children. */ void XMLElement::clear () { _attributes.clear(); @@ -315,8 +326,10 @@ unique_ptr XMLElement::remove (XMLNode *child) { bool XMLElement::getDescendants (const char *name, const char *attrName, vector &descendants) const { for (XMLNode *child = _firstChild.get(); child; child = child->next()) { if (XMLElement *elem = child->toElement()) { - if ((!name || elem->name() == name) && (!attrName || elem->hasAttribute(attrName))) - descendants.push_back(elem); + if (!name || !name[0] || (name[0] != '!' && elem->name() == name) || (name[0] == '!' && elem->name() != name+1)) { + if (!attrName || elem->hasAttribute(attrName)) + descendants.push_back(elem); + } elem->getDescendants(name, attrName, descendants); } } @@ -347,8 +360,30 @@ XMLElement* XMLElement::getFirstDescendant (const char *name, const char *attrNa ostream& XMLElement::write (ostream &os) const { os << '<' << _name; - for (const auto &attrib : _attributes) - os << ' ' << attrib.name << "='" << attrib.value << '\''; + for (const auto &attrib : _attributes) { + os << ' '; + if (attrib.name.front() != '@') + os << attrib.name << "='" << attrib.value << '\''; + else { + os << attrib.name.substr(1) << "='"; + size_t pos = attrib.value.find("base64,"); + if (pos == string::npos) + os << attrib.value; + else { + os << attrib.value.substr(0, pos+7); + string fname = attrib.value.substr(pos+7); + ifstream ifs(fname, ios::binary); + if (ifs) { + os << '\n'; + util::base64_copy(ifs, os, 200); + ifs.close(); + if (!KEEP_ENCODED_FILES) + FileSystem::remove(fname); + } + } + os << "'"; + } + } if (empty()) os << "/>"; else { diff --git a/dviware/dvisvgm/src/XMLNode.hpp b/dviware/dvisvgm/src/XMLNode.hpp index b4e5ed6f2b..534ae87bd7 100644 --- a/dviware/dvisvgm/src/XMLNode.hpp +++ b/dviware/dvisvgm/src/XMLNode.hpp @@ -2,7 +2,7 @@ ** XMLNode.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -63,6 +63,8 @@ class XMLNode { XMLNode* prev () const {return _prev;} XMLNode* next () const {return _next.get();} + static bool KEEP_ENCODED_FILES; + protected: XMLNode* insertNext (std::unique_ptr node); std::unique_ptr removeNext (); @@ -126,6 +128,7 @@ class XMLElement : public XMLNode { explicit XMLElement (std::string name); XMLElement (const XMLElement &node); XMLElement (XMLElement &&node) noexcept; + ~XMLElement (); std::unique_ptr clone () const override {return util::make_unique(*this);} void clear () override; void addAttribute (const std::string &name, const std::string &value); diff --git a/dviware/dvisvgm/src/XMLString.cpp b/dviware/dvisvgm/src/XMLString.cpp index fcafb8d1ee..31de6a7b33 100644 --- a/dviware/dvisvgm/src/XMLString.cpp +++ b/dviware/dvisvgm/src/XMLString.cpp @@ -2,7 +2,7 @@ ** XMLString.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/XMLString.hpp b/dviware/dvisvgm/src/XMLString.hpp index fa9cf15f9e..52c227ae8a 100644 --- a/dviware/dvisvgm/src/XMLString.hpp +++ b/dviware/dvisvgm/src/XMLString.hpp @@ -2,7 +2,7 @@ ** XMLString.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/XXHashFunction.hpp b/dviware/dvisvgm/src/XXHashFunction.hpp index f81deddbd4..e44083f182 100644 --- a/dviware/dvisvgm/src/XXHashFunction.hpp +++ b/dviware/dvisvgm/src/XXHashFunction.hpp @@ -2,7 +2,7 @@ ** XXHashFunction.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ZLibOutputStream.hpp b/dviware/dvisvgm/src/ZLibOutputStream.hpp index 8331cb9eed..c1c065e357 100644 --- a/dviware/dvisvgm/src/ZLibOutputStream.hpp +++ b/dviware/dvisvgm/src/ZLibOutputStream.hpp @@ -2,7 +2,7 @@ ** ZLibOutputStream.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/dvisvgm.cpp b/dviware/dvisvgm/src/dvisvgm.cpp index 5828299fce..74a8e83abc 100644 --- a/dviware/dvisvgm/src/dvisvgm.cpp +++ b/dviware/dvisvgm/src/dvisvgm.cpp @@ -2,7 +2,7 @@ ** dvisvgm.cpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -363,10 +363,18 @@ static void set_variables (const CommandLine &cmdline) { PhysicalFont::KEEP_TEMP_FILES = cmdline.keepOpt.given(); PhysicalFont::METAFONT_MAG = max(1.0, cmdline.magOpt.value()); XMLString::DECIMAL_PLACES = max(0, min(6, cmdline.precisionOpt.value())); + XMLNode::KEEP_ENCODED_FILES = cmdline.keepOpt.given(); PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = cmdline.clipjoinOpt.given(); PsSpecialHandler::SHADING_SEGMENT_OVERLAP = cmdline.gradOverlapOpt.given(); PsSpecialHandler::SHADING_SEGMENT_SIZE = max(1, cmdline.gradSegmentsOpt.value()); PsSpecialHandler::SHADING_SIMPLIFY_DELTA = cmdline.gradSimplifyOpt.value(); + PsSpecialHandler::BITMAP_FORMAT = util::tolower(cmdline.bitmapFormatOpt.value()); + if (!PSInterpreter::imageDeviceKnown(PsSpecialHandler::BITMAP_FORMAT)) { + ostringstream oss; + oss << "unknown image format '" << PsSpecialHandler::BITMAP_FORMAT << "'\nknown formats:\n"; + PSInterpreter::listImageDeviceInfos(oss); + throw CL::CommandLineException(oss.str()); + } if (cmdline.optimizeOpt.given()) { SVGOptimizer::MODULE_SEQUENCE = cmdline.optimizeOpt.value(); vector modnames; diff --git a/dviware/dvisvgm/src/ffwrapper.c b/dviware/dvisvgm/src/ffwrapper.c index 68377f0762..61f17fdc6d 100644 --- a/dviware/dvisvgm/src/ffwrapper.c +++ b/dviware/dvisvgm/src/ffwrapper.c @@ -2,7 +2,7 @@ ** ffwrapper.c ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/ffwrapper.h b/dviware/dvisvgm/src/ffwrapper.h index f652a97f9a..e3e2f98832 100644 --- a/dviware/dvisvgm/src/ffwrapper.h +++ b/dviware/dvisvgm/src/ffwrapper.h @@ -2,7 +2,7 @@ ** ffwrapper.h ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/macros.hpp b/dviware/dvisvgm/src/macros.hpp index beeb54f04b..0a03776057 100644 --- a/dviware/dvisvgm/src/macros.hpp +++ b/dviware/dvisvgm/src/macros.hpp @@ -2,7 +2,7 @@ ** macros.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp b/dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp index e26018253d..28046e45a2 100644 --- a/dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp b/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp index c882e8b4c8..b4c6f2775c 100644 --- a/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/DependencyGraph.hpp b/dviware/dvisvgm/src/optimizer/DependencyGraph.hpp index c9111b43d5..98d2a8d699 100644 --- a/dviware/dvisvgm/src/optimizer/DependencyGraph.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/GroupCollapser.cpp b/dviware/dvisvgm/src/optimizer/GroupCollapser.cpp index 36bf3a8cd5..b8a32786c1 100644 --- a/dviware/dvisvgm/src/optimizer/GroupCollapser.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/GroupCollapser.hpp b/dviware/dvisvgm/src/optimizer/GroupCollapser.hpp index 9b5eb01829..08db518a90 100644 --- a/dviware/dvisvgm/src/optimizer/GroupCollapser.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/OptimizerModule.hpp b/dviware/dvisvgm/src/optimizer/OptimizerModule.hpp index ff4fec1b4d..276cfa5578 100644 --- a/dviware/dvisvgm/src/optimizer/OptimizerModule.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp b/dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp index 85d8e5b1fa..906ccc2d14 100644 --- a/dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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,7 @@ void RedundantElementRemover::execute (XMLElement *defs, XMLElement *context) { } // collect elements that reference a clipPath, i.e. have a clip-path attribute vector descendants; + defs->getDescendants("!clipPath", "clip-path", descendants); context->getDescendants(nullptr, "clip-path", descendants); // remove referenced IDs and their dependencies from the dependency graph for (const XMLElement *elem : descendants) { diff --git a/dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp b/dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp index dd46cfeba5..8d5a6b689f 100644 --- a/dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp b/dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp index 0320f8b565..b2d45176e7 100644 --- a/dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp b/dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp index 809f1f497c..0da157fbbb 100644 --- a/dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/TextSimplifier.cpp b/dviware/dvisvgm/src/optimizer/TextSimplifier.cpp index 23e0e386df..b94ab9458e 100644 --- a/dviware/dvisvgm/src/optimizer/TextSimplifier.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/TextSimplifier.hpp b/dviware/dvisvgm/src/optimizer/TextSimplifier.hpp index 86f44e5051..cfdd548e87 100644 --- a/dviware/dvisvgm/src/optimizer/TextSimplifier.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp b/dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp index b9d4c3db59..461698b62a 100644 --- a/dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -61,7 +61,7 @@ void TransformSimplifier::execute (XMLElement *context) { /** Tries to incorporate the translation and scaling components of the 'transform' attribute * of a given element into the positional and/or size attributes of that element. If successful, - * the 'transform' attribute is removed. + * the 'transform' attribute is either removed or simplified to a scale() matrix. * Currently, only 'image' and 'rect' elements are considered. * @param[in] elem element to check * @param[in] matrix matrix representing the 'transform' attribute of the element @@ -72,17 +72,30 @@ bool TransformSimplifier::incorporateTransform (XMLElement *elem, const Matrix & double ty = matrix.get(1, 2); double sx = matrix.get(0, 0); double sy = matrix.get(1, 1); + double x=0, y=0; + if (const char *xstr = elem->getAttributeValue("x")) - tx += sx*strtod(xstr, nullptr); + x = strtod(xstr, nullptr); if (const char *ystr = elem->getAttributeValue("y")) - ty += sy*strtod(ystr, nullptr); - if (const char *wstr = elem->getAttributeValue("width")) - elem->addAttribute("width", sx*strtod(wstr, nullptr)); - if (const char *hstr = elem->getAttributeValue("height")) - elem->addAttribute("height", sy*strtod(hstr, nullptr)); - elem->addAttribute("x", tx); // update x attribute - elem->addAttribute("y", ty); // update x attribute - elem->removeAttribute("transform"); + y = strtod(ystr, nullptr); + // width and height attributes must not become negative. Hence, only apply the scaling + // values if they are non-negative. Otherwise, keep a scaling matrix + if (sx < 0 || sy < 0) { + x += (sx == 0 ? 0 : tx/sx); + y += (sy == 0 ? 0 : ty/sy); + elem->addAttribute("transform", "scale("+XMLString(sx)+","+XMLString(sy)+")"); + } + else { + x = x*sx + tx; + y = y*sy + ty; + if (const char *wstr = elem->getAttributeValue("width")) + elem->addAttribute("width", sx*strtod(wstr, nullptr)); + if (const char *hstr = elem->getAttributeValue("height")) + elem->addAttribute("height", sy*strtod(hstr, nullptr)); + elem->removeAttribute("transform"); + } + elem->addAttribute("x", x); // update x attribute + elem->addAttribute("y", y); // update y attribute return true; } return false; diff --git a/dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp b/dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp index c4b6d9ee16..5d503635ba 100644 --- a/dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp b/dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp index 2135e285bb..be58bf70fd 100644 --- a/dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp b/dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp index c4fe7f989e..8c21ce2b6e 100644 --- a/dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp +++ b/dviware/dvisvgm/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-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/options.dtd b/dviware/dvisvgm/src/options.dtd index 7e29babc43..d2806badce 100644 --- a/dviware/dvisvgm/src/options.dtd +++ b/dviware/dvisvgm/src/options.dtd @@ -3,7 +3,7 @@ ** options.dtd ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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/dviware/dvisvgm/src/options.xml b/dviware/dvisvgm/src/options.xml index 27975f1591..b1911694dd 100644 --- a/dviware/dvisvgm/src/options.xml +++ b/dviware/dvisvgm/src/options.xml @@ -3,7 +3,7 @@ ** options.xml ** ** ** ** This file is part of dvisvgm - a fast DVI to SVG converter ** -** Copyright (C) 2005-2019 Martin Gieseking ** +** Copyright (C) 2005-2020 Martin Gieseking ** ** ** ** 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 @@ --eps [options] epsfile --pdf [options] pdffile 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. - Copyright (C) 2005-2019 Martin Gieseking <martin.gieseking@uos.de> + Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
@@ -53,6 +53,10 @@ set size of bounding box + @@ -64,7 +68,7 @@