summaryrefslogtreecommitdiff
path: root/dviware
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-08-26 03:02:29 +0000
committerNorbert Preining <norbert@preining.info>2021-08-26 03:02:29 +0000
commit059cab71c68a3fbee36f60e8208d4a47d11c6b60 (patch)
treec982bcbf00c931a1474d68bf51dfeba5918cf76c /dviware
parent960421b0bcd1af561be3f2eb9468224969a7bd34 (diff)
CTAN sync 202108260302
Diffstat (limited to 'dviware')
-rw-r--r--dviware/dvisvgm/ChangeLog437
-rw-r--r--dviware/dvisvgm/Makefile.am2
-rw-r--r--dviware/dvisvgm/Makefile.in1
-rw-r--r--dviware/dvisvgm/NEWS16
-rw-r--r--dviware/dvisvgm/README2
-rwxr-xr-xdviware/dvisvgm/configure345
-rw-r--r--dviware/dvisvgm/configure.ac6
-rw-r--r--dviware/dvisvgm/doc/Makefile.am2
-rw-r--r--dviware/dvisvgm/doc/Makefile.in1
-rw-r--r--dviware/dvisvgm/doc/conf-dblatex-man.xsl2
-rw-r--r--dviware/dvisvgm/doc/conf-dblatex-pdf.xsl2
-rw-r--r--dviware/dvisvgm/doc/dvisvgm.121
-rw-r--r--dviware/dvisvgm/doc/dvisvgm.txt.in31
-rw-r--r--dviware/dvisvgm/doc/tweak-db-refentry.xsl2
-rw-r--r--dviware/dvisvgm/doc/tweak-dblatex-pdf.xsl2
-rw-r--r--dviware/dvisvgm/doc/tweak-dblatex-tex.py4
-rw-r--r--dviware/dvisvgm/libs/Makefile.am2
-rw-r--r--dviware/dvisvgm/libs/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/brotli/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/clipper/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/ff-woff/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/ff-woff/fontforge/tmpfile2.cpp2
-rw-r--r--dviware/dvisvgm/libs/md5/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/potrace/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/variant/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/woff2/Makefile.in1
-rw-r--r--dviware/dvisvgm/libs/xxHash/Makefile.in1
-rw-r--r--dviware/dvisvgm/m4/Makefile.in1
-rw-r--r--dviware/dvisvgm/m4/ax_cxx_compile_stdcxx.m415
-rw-r--r--dviware/dvisvgm/src/AGLTable.hpp2
-rw-r--r--dviware/dvisvgm/src/BasicDVIReader.cpp2
-rw-r--r--dviware/dvisvgm/src/BasicDVIReader.hpp2
-rw-r--r--dviware/dvisvgm/src/Bezier.cpp2
-rw-r--r--dviware/dvisvgm/src/Bezier.hpp2
-rw-r--r--dviware/dvisvgm/src/BgColorSpecialHandler.cpp4
-rw-r--r--dviware/dvisvgm/src/BgColorSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/Bitmap.cpp2
-rw-r--r--dviware/dvisvgm/src/Bitmap.hpp2
-rw-r--r--dviware/dvisvgm/src/BoundingBox.cpp4
-rw-r--r--dviware/dvisvgm/src/BoundingBox.hpp2
-rw-r--r--dviware/dvisvgm/src/CLCommandLine.cpp2
-rw-r--r--dviware/dvisvgm/src/CLCommandLine.hpp2
-rw-r--r--dviware/dvisvgm/src/CLOption.hpp2
-rw-r--r--dviware/dvisvgm/src/CMap.cpp2
-rw-r--r--dviware/dvisvgm/src/CMap.hpp2
-rw-r--r--dviware/dvisvgm/src/CMapManager.cpp4
-rw-r--r--dviware/dvisvgm/src/CMapManager.hpp2
-rw-r--r--dviware/dvisvgm/src/CMapReader.cpp2
-rw-r--r--dviware/dvisvgm/src/CMapReader.hpp2
-rw-r--r--dviware/dvisvgm/src/Calculator.cpp228
-rw-r--r--dviware/dvisvgm/src/Calculator.hpp22
-rw-r--r--dviware/dvisvgm/src/CharMapID.cpp2
-rw-r--r--dviware/dvisvgm/src/CharMapID.hpp2
-rw-r--r--dviware/dvisvgm/src/Character.hpp2
-rw-r--r--dviware/dvisvgm/src/Color.cpp2
-rw-r--r--dviware/dvisvgm/src/Color.hpp2
-rw-r--r--dviware/dvisvgm/src/ColorSpecialHandler.cpp2
-rw-r--r--dviware/dvisvgm/src/ColorSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/CommandLine.hpp4
-rw-r--r--dviware/dvisvgm/src/DLLoader.cpp2
-rw-r--r--dviware/dvisvgm/src/DLLoader.hpp2
-rw-r--r--dviware/dvisvgm/src/DVIActions.hpp2
-rw-r--r--dviware/dvisvgm/src/DVIReader.cpp11
-rw-r--r--dviware/dvisvgm/src/DVIReader.hpp2
-rw-r--r--dviware/dvisvgm/src/DVIToSVG.cpp15
-rw-r--r--dviware/dvisvgm/src/DVIToSVG.hpp16
-rw-r--r--dviware/dvisvgm/src/DVIToSVGActions.cpp16
-rw-r--r--dviware/dvisvgm/src/DVIToSVGActions.hpp4
-rw-r--r--dviware/dvisvgm/src/Directory.cpp2
-rw-r--r--dviware/dvisvgm/src/Directory.hpp2
-rw-r--r--dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp18
-rw-r--r--dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp5
-rw-r--r--dviware/dvisvgm/src/EPSFile.cpp2
-rw-r--r--dviware/dvisvgm/src/EPSFile.hpp2
-rw-r--r--dviware/dvisvgm/src/EPSToSVG.hpp2
-rw-r--r--dviware/dvisvgm/src/EllipticalArc.cpp8
-rw-r--r--dviware/dvisvgm/src/EllipticalArc.hpp2
-rw-r--r--dviware/dvisvgm/src/EmSpecialHandler.cpp47
-rw-r--r--dviware/dvisvgm/src/EmSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/EncFile.cpp2
-rw-r--r--dviware/dvisvgm/src/EncFile.hpp2
-rw-r--r--dviware/dvisvgm/src/FileFinder.cpp2
-rw-r--r--dviware/dvisvgm/src/FileFinder.hpp2
-rw-r--r--dviware/dvisvgm/src/FilePath.cpp123
-rw-r--r--dviware/dvisvgm/src/FilePath.hpp2
-rw-r--r--dviware/dvisvgm/src/FileSystem.cpp26
-rw-r--r--dviware/dvisvgm/src/FileSystem.hpp5
-rw-r--r--dviware/dvisvgm/src/FixWord.hpp2
-rw-r--r--dviware/dvisvgm/src/Font.cpp12
-rw-r--r--dviware/dvisvgm/src/Font.hpp56
-rw-r--r--dviware/dvisvgm/src/FontCache.cpp6
-rw-r--r--dviware/dvisvgm/src/FontCache.hpp2
-rw-r--r--dviware/dvisvgm/src/FontEncoding.cpp2
-rw-r--r--dviware/dvisvgm/src/FontEncoding.hpp2
-rw-r--r--dviware/dvisvgm/src/FontEngine.cpp39
-rw-r--r--dviware/dvisvgm/src/FontEngine.hpp4
-rw-r--r--dviware/dvisvgm/src/FontManager.cpp16
-rw-r--r--dviware/dvisvgm/src/FontManager.hpp2
-rw-r--r--dviware/dvisvgm/src/FontMap.cpp2
-rw-r--r--dviware/dvisvgm/src/FontMap.hpp2
-rw-r--r--dviware/dvisvgm/src/FontMetrics.cpp2
-rw-r--r--dviware/dvisvgm/src/FontMetrics.hpp3
-rw-r--r--dviware/dvisvgm/src/FontStyle.hpp2
-rw-r--r--dviware/dvisvgm/src/FontWriter.cpp4
-rw-r--r--dviware/dvisvgm/src/FontWriter.hpp2
-rw-r--r--dviware/dvisvgm/src/GFGlyphTracer.cpp6
-rw-r--r--dviware/dvisvgm/src/GFGlyphTracer.hpp6
-rw-r--r--dviware/dvisvgm/src/GFReader.cpp4
-rw-r--r--dviware/dvisvgm/src/GFReader.hpp2
-rw-r--r--dviware/dvisvgm/src/GFTracer.cpp2
-rw-r--r--dviware/dvisvgm/src/GFTracer.hpp2
-rw-r--r--dviware/dvisvgm/src/Ghostscript.cpp6
-rw-r--r--dviware/dvisvgm/src/Ghostscript.hpp6
-rw-r--r--dviware/dvisvgm/src/Glyph.hpp2
-rw-r--r--dviware/dvisvgm/src/GlyphTracerMessages.hpp2
-rw-r--r--dviware/dvisvgm/src/GraphicsPath.hpp17
-rw-r--r--dviware/dvisvgm/src/HashFunction.cpp2
-rw-r--r--dviware/dvisvgm/src/HashFunction.hpp2
-rw-r--r--dviware/dvisvgm/src/HtmlSpecialHandler.cpp2
-rw-r--r--dviware/dvisvgm/src/HtmlSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/HyperlinkManager.cpp26
-rw-r--r--dviware/dvisvgm/src/HyperlinkManager.hpp4
-rw-r--r--dviware/dvisvgm/src/ImageToSVG.cpp2
-rw-r--r--dviware/dvisvgm/src/ImageToSVG.hpp4
-rw-r--r--dviware/dvisvgm/src/InputBuffer.cpp2
-rw-r--r--dviware/dvisvgm/src/InputBuffer.hpp7
-rw-r--r--dviware/dvisvgm/src/InputReader.cpp2
-rw-r--r--dviware/dvisvgm/src/InputReader.hpp2
-rw-r--r--dviware/dvisvgm/src/JFM.cpp2
-rw-r--r--dviware/dvisvgm/src/JFM.hpp3
-rw-r--r--dviware/dvisvgm/src/Length.cpp2
-rw-r--r--dviware/dvisvgm/src/Length.hpp2
-rw-r--r--dviware/dvisvgm/src/MD5HashFunction.hpp2
-rw-r--r--dviware/dvisvgm/src/Makefile.am4
-rw-r--r--dviware/dvisvgm/src/Makefile.in105
-rw-r--r--dviware/dvisvgm/src/MapLine.cpp2
-rw-r--r--dviware/dvisvgm/src/MapLine.hpp2
-rw-r--r--dviware/dvisvgm/src/Matrix.cpp4
-rw-r--r--dviware/dvisvgm/src/Matrix.hpp7
-rw-r--r--dviware/dvisvgm/src/Message.cpp4
-rw-r--r--dviware/dvisvgm/src/Message.hpp2
-rw-r--r--dviware/dvisvgm/src/MessageException.hpp2
-rw-r--r--dviware/dvisvgm/src/MetafontWrapper.cpp2
-rw-r--r--dviware/dvisvgm/src/MetafontWrapper.hpp2
-rw-r--r--dviware/dvisvgm/src/MiKTeXCom.cpp2
-rw-r--r--dviware/dvisvgm/src/MiKTeXCom.hpp2
-rw-r--r--dviware/dvisvgm/src/NoPsSpecialHandler.cpp2
-rw-r--r--dviware/dvisvgm/src/NoPsSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/NumericRanges.hpp2
-rw-r--r--dviware/dvisvgm/src/Opacity.cpp59
-rw-r--r--dviware/dvisvgm/src/Opacity.hpp75
-rw-r--r--dviware/dvisvgm/src/PDFParser.cpp2
-rw-r--r--dviware/dvisvgm/src/PDFParser.hpp2
-rw-r--r--dviware/dvisvgm/src/PDFToSVG.hpp2
-rw-r--r--dviware/dvisvgm/src/PSFilter.hpp2
-rw-r--r--dviware/dvisvgm/src/PSInterpreter.cpp18
-rw-r--r--dviware/dvisvgm/src/PSInterpreter.hpp5
-rw-r--r--dviware/dvisvgm/src/PSPattern.cpp6
-rw-r--r--dviware/dvisvgm/src/PSPattern.hpp8
-rw-r--r--dviware/dvisvgm/src/PSPreviewFilter.cpp2
-rw-r--r--dviware/dvisvgm/src/PSPreviewFilter.hpp2
-rw-r--r--dviware/dvisvgm/src/PageRanges.cpp2
-rw-r--r--dviware/dvisvgm/src/PageRanges.hpp2
-rw-r--r--dviware/dvisvgm/src/PageSize.cpp2
-rw-r--r--dviware/dvisvgm/src/PageSize.hpp2
-rw-r--r--dviware/dvisvgm/src/Pair.hpp2
-rw-r--r--dviware/dvisvgm/src/PapersizeSpecialHandler.cpp4
-rw-r--r--dviware/dvisvgm/src/PapersizeSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/PathClipper.cpp2
-rw-r--r--dviware/dvisvgm/src/PathClipper.hpp2
-rw-r--r--dviware/dvisvgm/src/PdfSpecialHandler.cpp4
-rw-r--r--dviware/dvisvgm/src/PdfSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/PreScanDVIReader.cpp2
-rw-r--r--dviware/dvisvgm/src/PreScanDVIReader.hpp2
-rw-r--r--dviware/dvisvgm/src/Process.cpp2
-rw-r--r--dviware/dvisvgm/src/Process.hpp2
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandler.cpp176
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandler.hpp24
-rw-r--r--dviware/dvisvgm/src/RangeMap.cpp6
-rw-r--r--dviware/dvisvgm/src/RangeMap.hpp2
-rw-r--r--dviware/dvisvgm/src/SVGCharHandler.cpp25
-rw-r--r--dviware/dvisvgm/src/SVGCharHandler.hpp45
-rw-r--r--dviware/dvisvgm/src/SVGCharHandlerFactory.cpp2
-rw-r--r--dviware/dvisvgm/src/SVGCharHandlerFactory.hpp2
-rw-r--r--dviware/dvisvgm/src/SVGCharPathHandler.cpp44
-rw-r--r--dviware/dvisvgm/src/SVGCharPathHandler.hpp4
-rw-r--r--dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp22
-rw-r--r--dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp8
-rw-r--r--dviware/dvisvgm/src/SVGElement.cpp153
-rw-r--r--dviware/dvisvgm/src/SVGElement.hpp60
-rw-r--r--dviware/dvisvgm/src/SVGOutput.cpp2
-rw-r--r--dviware/dvisvgm/src/SVGOutput.hpp2
-rw-r--r--dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp14
-rw-r--r--dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/SVGTree.cpp42
-rw-r--r--dviware/dvisvgm/src/SVGTree.hpp35
-rw-r--r--dviware/dvisvgm/src/ShadingPatch.cpp2
-rw-r--r--dviware/dvisvgm/src/ShadingPatch.hpp2
-rw-r--r--dviware/dvisvgm/src/SignalHandler.cpp2
-rw-r--r--dviware/dvisvgm/src/SignalHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/SourceInput.cpp2
-rw-r--r--dviware/dvisvgm/src/SourceInput.hpp2
-rw-r--r--dviware/dvisvgm/src/SpecialActions.hpp7
-rw-r--r--dviware/dvisvgm/src/SpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/SpecialManager.cpp2
-rw-r--r--dviware/dvisvgm/src/SpecialManager.hpp2
-rw-r--r--dviware/dvisvgm/src/StreamReader.cpp2
-rw-r--r--dviware/dvisvgm/src/StreamReader.hpp2
-rw-r--r--dviware/dvisvgm/src/StreamWriter.cpp2
-rw-r--r--dviware/dvisvgm/src/StreamWriter.hpp2
-rw-r--r--dviware/dvisvgm/src/Subfont.cpp4
-rw-r--r--dviware/dvisvgm/src/Subfont.hpp2
-rw-r--r--dviware/dvisvgm/src/System.cpp2
-rw-r--r--dviware/dvisvgm/src/System.hpp2
-rw-r--r--dviware/dvisvgm/src/TFM.cpp2
-rw-r--r--dviware/dvisvgm/src/TFM.hpp2
-rw-r--r--dviware/dvisvgm/src/TTFAutohint.cpp2
-rw-r--r--dviware/dvisvgm/src/TTFAutohint.hpp2
-rw-r--r--dviware/dvisvgm/src/TensorProductPatch.cpp18
-rw-r--r--dviware/dvisvgm/src/TensorProductPatch.hpp2
-rw-r--r--dviware/dvisvgm/src/Terminal.cpp2
-rw-r--r--dviware/dvisvgm/src/Terminal.hpp2
-rw-r--r--dviware/dvisvgm/src/ToUnicodeMap.cpp2
-rw-r--r--dviware/dvisvgm/src/ToUnicodeMap.hpp2
-rw-r--r--dviware/dvisvgm/src/TpicSpecialHandler.cpp83
-rw-r--r--dviware/dvisvgm/src/TpicSpecialHandler.hpp2
-rw-r--r--dviware/dvisvgm/src/TriangularPatch.cpp10
-rw-r--r--dviware/dvisvgm/src/TriangularPatch.hpp2
-rw-r--r--dviware/dvisvgm/src/TrueTypeFont.cpp6
-rw-r--r--dviware/dvisvgm/src/TrueTypeFont.hpp2
-rw-r--r--dviware/dvisvgm/src/Unicode.cpp2
-rw-r--r--dviware/dvisvgm/src/Unicode.hpp2
-rw-r--r--dviware/dvisvgm/src/VFActions.hpp2
-rw-r--r--dviware/dvisvgm/src/VFReader.cpp2
-rw-r--r--dviware/dvisvgm/src/VFReader.hpp2
-rw-r--r--dviware/dvisvgm/src/VectorIterator.hpp4
-rw-r--r--dviware/dvisvgm/src/VectorStream.hpp2
-rw-r--r--dviware/dvisvgm/src/XMLDocument.cpp4
-rw-r--r--dviware/dvisvgm/src/XMLDocument.hpp2
-rw-r--r--dviware/dvisvgm/src/XMLNode.cpp8
-rw-r--r--dviware/dvisvgm/src/XMLNode.hpp4
-rw-r--r--dviware/dvisvgm/src/XMLString.cpp2
-rw-r--r--dviware/dvisvgm/src/XMLString.hpp2
-rw-r--r--dviware/dvisvgm/src/XXHashFunction.hpp2
-rw-r--r--dviware/dvisvgm/src/ZLibOutputStream.hpp2
-rw-r--r--dviware/dvisvgm/src/dvisvgm.cpp7
-rw-r--r--dviware/dvisvgm/src/ffwrapper.c2
-rw-r--r--dviware/dvisvgm/src/ffwrapper.h2
-rw-r--r--dviware/dvisvgm/src/macros.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/DependencyGraph.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/GroupCollapser.cpp4
-rw-r--r--dviware/dvisvgm/src/optimizer/GroupCollapser.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/Makefile.in1
-rw-r--r--dviware/dvisvgm/src/optimizer/OptimizerModule.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/TextSimplifier.cpp8
-rw-r--r--dviware/dvisvgm/src/optimizer/TextSimplifier.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp2
-rw-r--r--dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp2
-rw-r--r--dviware/dvisvgm/src/options.dtd2
-rw-r--r--dviware/dvisvgm/src/options.xml4
-rw-r--r--dviware/dvisvgm/src/psdefs.cpp92
-rw-r--r--dviware/dvisvgm/src/utility.cpp8
-rw-r--r--dviware/dvisvgm/src/utility.hpp14
-rw-r--r--dviware/dvisvgm/src/version.hpp.in2
-rw-r--r--dviware/dvisvgm/src/windows.hpp2
-rw-r--r--dviware/dvisvgm/tests/BezierTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/BitmapTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/BoundingBoxTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/CMapManagerTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/CMapReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/CMapTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/CalculatorTest.cpp13
-rw-r--r--dviware/dvisvgm/tests/ColorSpecialTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/ColorTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/CommandLineTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/DVIReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/DependencyGraphTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/DirectoryTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/DvisvgmSpecialTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/EllipticalArcTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/EmSpecialTest.cpp10
-rw-r--r--dviware/dvisvgm/tests/FileFinderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/FilePathTest.cpp15
-rw-r--r--dviware/dvisvgm/tests/FileSystemTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/FontCacheTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/FontManagerTest.cpp46
-rw-r--r--dviware/dvisvgm/tests/FontMapTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/GFGlyphTracerTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/GFReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/GhostscriptTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/GraphicsPathTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/HashFunctionTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/JFMReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/LengthTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/Makefile.am2
-rw-r--r--dviware/dvisvgm/tests/Makefile.in1
-rw-r--r--dviware/dvisvgm/tests/MapLineTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/MatrixTest.cpp6
-rw-r--r--dviware/dvisvgm/tests/MessageExceptionTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/PDFParserTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/PSInterpreterTest.cpp14
-rw-r--r--dviware/dvisvgm/tests/PageRagesTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/PageSizeTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/PairTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/PapersizeSpecialTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/RangeMapTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/SVGOutputTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/ShadingPatchTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/SpecialManagerTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/SplittedCharInputBufferTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/StreamInputBufferTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/StreamReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/StreamWriterTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/StringMatcherTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/SubfontTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/TFMReaderTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/TensorProductPatchTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/ToUnicodeMapTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/TpicSpecialTest.cpp44
-rw-r--r--dviware/dvisvgm/tests/TriangularPatchTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/UnicodeTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/UtilityTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/VectorIteratorTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/VectorStreamTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/XMLNodeTest.cpp2
-rw-r--r--dviware/dvisvgm/tests/XMLStringTest.cpp2
-rwxr-xr-xdviware/dvisvgm/tests/check-conv2
-rw-r--r--dviware/dvisvgm/tests/data/Makefile.am3
-rw-r--r--dviware/dvisvgm/tests/data/Makefile.in2
-rw-r--r--dviware/dvisvgm/tests/data/lmmono12-regular.otfbin0 -> 63012 bytes
-rwxr-xr-xdviware/dvisvgm/tests/genhashcheck.py2
-rw-r--r--dviware/dvisvgm/tests/normalize.xsl2
-rw-r--r--dviware/dvisvgm/tests/testmain.cpp2
341 files changed, 2451 insertions, 1082 deletions
diff --git a/dviware/dvisvgm/ChangeLog b/dviware/dvisvgm/ChangeLog
index 76ae6adb0e..ad24ed0c63 100644
--- a/dviware/dvisvgm/ChangeLog
+++ b/dviware/dvisvgm/ChangeLog
@@ -1,3 +1,440 @@
+2021-08-16 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .appveyor.yml, .travis.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile,
+ src/version.hpp:
+ set version to 2.12
+
+ * NEWS:
+ updated NEWS
+
+2021-08-15 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PsSpecialHandler.cpp:
+ skip fill actions if colorspace with unsupported pattern type is active
+
+2021-08-13 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PsSpecialHandler.cpp, src/PsSpecialHandler.hpp:
+ ensure adding color attribute to tiling patterns
+(closes #158)
+
+2021-07-19 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .appveyor.yml:
+ updated FreeType to version 2.11
+
+2021-07-04 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/FilePath.cpp:
+ prevent out-of-bounds access
+
+ * src/InputBuffer.hpp:
+ delete unused assignment operator
+
+2021-06-15 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .gitattributes:
+ Update .gitattributes
+
+marked all files in libs and its subfolders as
+ vendored code
+
+2021-06-13 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/FilePath.cpp:
+ fixed handling of root directories in file paths
+
+ * src/FilePath.cpp, src/FileSystem.cpp, tests/FilePathTest.cpp:
+ improved handling of drive letters on Windows
+
+2021-06-11 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PsSpecialHandler.cpp:
+ fixed displaced graphics if PDF MediaBox isn't located at origin
+
+ * tests/data/Makefile.am:
+ added missing test data file to Makefile
+
+2021-06-10 Martin Gieseking <martin.gieseking@uos.de>
+
+ * m4/ax_cxx_compile_stdcxx.m4:
+ ax_cxx_compile_stdcxx.m4 to version 12
+
+2021-05-30 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/Font.hpp:
+ simplified boolean expression
+
+ * src/Font.hpp, src/SVGCharPathHandler.cpp:
+ removed default parameter from virtual methods
+
+2021-05-25 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PSPattern.hpp, src/PsSpecialHandler.cpp:
+ removed dynamic casting in processing of PS patterns
+
+ * src/PdfSpecialHandler.cpp:
+ replaced dynamic_cast with static_cast as type is unambiguous
+
+ * src/TensorProductPatch.cpp, src/TriangularPatch.cpp:
+ replaced dynamic casts of shading patches with PS type comparisons
+
+ * src/CMapManager.cpp:
+ replaced dynamic cast of CMap type test with existing method
+ mapsToUnicode()
+
+2021-05-24 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/DVIReader.cpp, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp,
+ src/Font.cpp, src/Font.hpp, src/FontEngine.cpp, src/FontManager.cpp,
+ src/SVGCharHandler.cpp, src/SVGCharPathHandler.cpp,
+ src/SVGCharTspanTextHandler.cpp, src/SVGTree.cpp, src/utility.hpp,
+ tests/FontManagerTest.cpp, tests/data/lmmono12-regular.otf:
+ added font_cast to replace dynamic casts of Font pointers
+
+2021-05-20 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/DVIReader.cpp, src/FontMetrics.hpp, src/JFM.hpp:
+ replaced dynamic cast to test for JFM with dedicated method
+
+2021-04-23 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/psdefs.cpp:
+ fixed PS error thrown when trying to set a shading pattern
+
+ * src/PsSpecialHandler.cpp, src/SVGElement.cpp, src/SVGElement.hpp:
+ always add fill attribute to pattern paths
+
+2021-04-10 Martin Gieseking <martin.gieseking@uos.de>
+
+ * doc/dvisvgm.1, doc/dvisvgm.txt.in:
+ reworded few parts of the manual page
+
+2021-04-01 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/PsSpecialHandler.cpp:
+ restore proper context node at end of pattern definition
+
+2021-03-22 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/GraphicsPath.hpp:
+ use std::equal to check equality of GraphicsPaths
+
+ * src/EllipticalArc.cpp, src/Matrix.cpp, src/Matrix.hpp,
+ tests/MatrixTest.cpp:
+ Matrix: added default constructor; explicit init list constructor
+
+ * src/GFReader.cpp, src/Message.cpp, src/VectorIterator.hpp:
+ removed redundant index checks
+
+ * src/DVIToSVG.cpp, src/DVIToSVG.hpp:
+ initialize basic members outside constructor body
+
+ * src/DvisvgmSpecialHandler.cpp:
+ two small code improvements
+
+ * src/FontManager.cpp:
+ removed redundant check
+
+ * src/GFGlyphTracer.cpp, src/GFGlyphTracer.hpp, src/HyperlinkManager.hpp,
+ src/PSInterpreter.cpp, src/PsSpecialHandler.cpp:
+ added missing const to reference parameters
+
+ * src/InputBuffer.hpp:
+ prevent unwanted copying of input buffers
+
+2021-03-15 Martin Gieseking <martin.gieseking@uos.de>
+
+ * doc/dvisvgm.1:
+ fixed typo in manual
+
+ * src/PSInterpreter.cpp:
+ fixed expression to check current GS running mode
+
+ * src/SVGSingleCharTextHandler.cpp:
+ reset change flag of color and opacity properties unconditionally
+
+ * src/SVGCharTspanTextHandler.cpp:
+ create initial tspan if opacity values differ from defaults
+
+ * src/Ghostscript.cpp, src/Ghostscript.hpp, src/PSInterpreter.cpp,
+ src/PSInterpreter.hpp, src/psdefs.cpp, tests/PSInterpreterTest.cpp:
+ update opacity settings on grestore
+Requires GS >= 9.52 because earlier
+ versions only provide operators to set the
+opacity/blendmode values and
+ none to retrieve them.
+
+ * src/PSInterpreter.cpp, src/PSInterpreter.hpp, src/PsSpecialHandler.hpp,
+ src/psdefs.cpp, tests/PSInterpreterTest.cpp:
+ renamed PS operator setisshapealpha
+
+ * src/dvisvgm.cpp:
+ added missing parenthesis in info message
+
+2021-03-14 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/optimizer/GroupCollapser.cpp, src/optimizer/TextSimplifier.cpp:
+ minor loop optimizations
+
+ * src/XMLNode.cpp:
+ don't create newlines inside text elements
+since they may lead to
+ additional whitespace, e.g. between tspans that lack absolute coordinates
+
+ * src/SVGCharPathHandler.cpp, src/SVGElement.cpp, src/SVGElement.hpp:
+ don't add style attributes to groups because they're not inheritable
+
+2021-03-13 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/Makefile.am, src/Opacity.cpp, src/Opacity.hpp,
+ src/PsSpecialHandler.cpp, src/PsSpecialHandler.hpp:
+ combined alpha and blendmode values into dedicated class
+
+ * src/SVGCharHandler.hpp:
+ added default and move constructor to CharProperty
+
+ * src/DVIToSVGActions.hpp, src/ImageToSVG.hpp, src/Opacity.hpp,
+ src/PsSpecialHandler.cpp, src/PsSpecialHandler.hpp,
+ src/SVGCharHandler.hpp, src/SVGCharPathHandler.cpp,
+ src/SVGCharTspanTextHandler.cpp, src/SVGSingleCharTextHandler.cpp,
+ src/SVGTree.hpp, src/SpecialActions.hpp:
+ added opacity properties to text elements
+
+ * src/SVGCharHandler.cpp, src/SVGCharHandler.hpp,
+ src/SVGCharPathHandler.cpp, src/SVGCharTspanTextHandler.cpp,
+ src/SVGSingleCharTextHandler.cpp:
+ added shorthand operator for CharProperty::get()
+
+ * src/Opacity.hpp, src/PsSpecialHandler.cpp, src/PsSpecialHandler.hpp:
+ PS handler: replaced isolated opacity variables with Opacity class
+
+ * src/Makefile.am, src/Opacity.hpp, src/PsSpecialHandler.cpp,
+ src/PsSpecialHandler.hpp, src/SVGElement.cpp, src/SVGElement.hpp,
+ src/XMLNode.hpp:
+ added class to handle SVG attributes in a uniform manner
+
+ * src/DVIToSVGActions.cpp, src/DVIToSVGActions.hpp,
+ src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.hpp,
+ src/EmSpecialHandler.cpp, src/HyperlinkManager.cpp, src/ImageToSVG.hpp,
+ src/PSPattern.cpp, src/PsSpecialHandler.cpp, src/SVGCharHandler.cpp,
+ src/SVGCharHandler.hpp, src/SVGCharPathHandler.cpp,
+ src/SVGCharPathHandler.hpp, src/SVGCharTspanTextHandler.cpp,
+ src/SVGCharTspanTextHandler.hpp, src/SVGElement.cpp, src/SVGElement.hpp,
+ src/SVGSingleCharTextHandler.cpp, src/SVGTree.cpp, src/SVGTree.hpp,
+ src/SpecialActions.hpp, src/TpicSpecialHandler.cpp,
+ tests/TpicSpecialTest.cpp:
+ added opacity properties to graphics elements created outside the PS
+ handler
+(closes #148)
+
+ * src/EmSpecialHandler.cpp, src/SVGElement.cpp, src/SVGElement.hpp,
+ src/TpicSpecialHandler.cpp, tests/EmSpecialTest.cpp,
+ tests/TpicSpecialTest.cpp:
+ unified handling of "point" attributes
+
+ * src/EmSpecialHandler.cpp, src/SVGCharHandler.cpp,
+ src/SVGCharPathHandler.cpp, src/SVGElement.cpp, src/SVGTree.cpp,
+ src/TpicSpecialHandler.cpp:
+ removed redundant casts to XMLString
+
+2021-03-05 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .github/workflows/c-cpp.yml:
+ added GitHub CI configuration
+
+ * .github/workflows/c-cpp.yml:
+ removed distcheck from CI
+
+ * README.md:
+ added GitHub CI badge; removed Copr badge
+
+2021-03-04 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/BgColorSpecialHandler.cpp, src/BoundingBox.cpp,
+ src/DvisvgmSpecialHandler.cpp, src/EllipticalArc.cpp,
+ src/EmSpecialHandler.cpp, src/FontCache.cpp, src/FontEngine.cpp,
+ src/FontManager.cpp, src/FontWriter.cpp, src/PSInterpreter.cpp,
+ src/PapersizeSpecialHandler.cpp, src/RangeMap.cpp, src/Subfont.cpp,
+ src/TpicSpecialHandler.cpp, src/TrueTypeFont.cpp, src/XMLDocument.cpp,
+ src/XMLNode.cpp, src/dvisvgm.cpp, src/utility.cpp:
+ avoid copying objects in emplace methods
+
+2021-02-15 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .gitignore:
+ added .pyc to ignored file suffixes
+
+2021-02-09 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/FilePath.cpp, src/FileSystem.cpp, src/FileSystem.hpp:
+ improved handling of differing drive letters in Windows file paths
+
+2021-01-27 Martin Gieseking <martin.gieseking@uos.de>
+
+ * doc/dvisvgm.txt.in:
+ fixed typo in manual
+
+2021-01-26 Martin Gieseking <martin.gieseking@uos.de>
+
+ * doc/tweak-dblatex-tex.py:
+ updated tweak-dblatex-tex to Python 3
+
+2021-01-21 Martin Gieseking <martin.gieseking@uos.de>
+
+ * .appveyor.yml, .travis.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile,
+ src/version.hpp:
+ set version to 2.11.1
+
+ * NEWS:
+ updated NEWS
+
+2021-01-03 Martin Gieseking <martin.gieseking@uos.de>
+
+ * Makefile.am, README, README.md, configure.ac, doc/Makefile.am,
+ doc/conf-dblatex-man.xsl, doc/conf-dblatex-pdf.xsl, doc/db2html.xsl,
+ doc/dvisvgm.1, doc/dvisvgm.txt.in, doc/tweak-db-article.xsl,
+ doc/tweak-db-refentry.xsl, doc/tweak-dblatex-pdf.xsl, libs/Makefile.am,
+ libs/ff-woff/fontforge/tmpfile2.cpp, src/AGLTable.hpp,
+ src/BasicDVIReader.cpp, src/BasicDVIReader.hpp, src/Bezier.cpp,
+ src/Bezier.hpp, src/BgColorSpecialHandler.cpp,
+ src/BgColorSpecialHandler.hpp, src/Bitmap.cpp, src/Bitmap.hpp,
+ src/BoundingBox.cpp, src/BoundingBox.hpp, src/CLCommandLine.cpp,
+ src/CLCommandLine.hpp, src/CLOption.hpp, src/CMap.cpp, src/CMap.hpp,
+ src/CMapManager.cpp, src/CMapManager.hpp, src/CMapReader.cpp,
+ src/CMapReader.hpp, src/Calculator.cpp, src/Calculator.hpp,
+ src/CharMapID.cpp, src/CharMapID.hpp, src/Character.hpp, src/Color.cpp,
+ src/Color.hpp, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.hpp,
+ src/CommandLine.hpp, src/DLLoader.cpp, src/DLLoader.hpp,
+ src/DVIActions.hpp, src/DVIReader.cpp, src/DVIReader.hpp,
+ src/DVIToSVG.cpp, src/DVIToSVG.hpp, src/DVIToSVGActions.cpp,
+ src/DVIToSVGActions.hpp, src/Directory.cpp, src/Directory.hpp,
+ src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.hpp,
+ src/EPSFile.cpp, src/EPSFile.hpp, src/EPSToSVG.hpp,
+ src/EllipticalArc.cpp, src/EllipticalArc.hpp, src/EmSpecialHandler.cpp,
+ src/EmSpecialHandler.hpp, src/EncFile.cpp, src/EncFile.hpp,
+ src/FileFinder.cpp, src/FileFinder.hpp, src/FilePath.cpp,
+ src/FilePath.hpp, src/FileSystem.cpp, src/FileSystem.hpp,
+ src/FixWord.hpp, src/Font.cpp, src/Font.hpp, src/FontCache.cpp,
+ src/FontCache.hpp, src/FontEncoding.cpp, src/FontEncoding.hpp,
+ src/FontEngine.cpp, src/FontEngine.hpp, src/FontManager.cpp,
+ src/FontManager.hpp, src/FontMap.cpp, src/FontMap.hpp,
+ src/FontMetrics.cpp, src/FontMetrics.hpp, src/FontStyle.hpp,
+ src/FontWriter.cpp, src/FontWriter.hpp, src/GFGlyphTracer.cpp,
+ src/GFGlyphTracer.hpp, src/GFReader.cpp, src/GFReader.hpp,
+ src/GFTracer.cpp, src/GFTracer.hpp, src/Ghostscript.cpp,
+ src/Ghostscript.hpp, src/Glyph.hpp, src/GlyphTracerMessages.hpp,
+ src/GraphicsPath.hpp, src/HashFunction.cpp, src/HashFunction.hpp,
+ src/HtmlSpecialHandler.cpp, src/HtmlSpecialHandler.hpp,
+ src/HyperlinkManager.cpp, src/HyperlinkManager.hpp, src/ImageToSVG.cpp,
+ src/ImageToSVG.hpp, src/InputBuffer.cpp, src/InputBuffer.hpp,
+ src/InputReader.cpp, src/InputReader.hpp, src/JFM.cpp, src/JFM.hpp,
+ src/Length.cpp, src/Length.hpp, src/MD5HashFunction.hpp, src/Makefile.am,
+ src/MapLine.cpp, src/MapLine.hpp, src/Matrix.cpp, src/Matrix.hpp,
+ src/Message.cpp, src/Message.hpp, src/MessageException.hpp,
+ src/MetafontWrapper.cpp, src/MetafontWrapper.hpp, src/MiKTeXCom.cpp,
+ src/MiKTeXCom.hpp, src/NoPsSpecialHandler.cpp,
+ src/NoPsSpecialHandler.hpp, src/NumericRanges.hpp, src/PDFParser.cpp,
+ src/PDFParser.hpp, src/PDFToSVG.hpp, src/PSFilter.hpp,
+ src/PSInterpreter.cpp, src/PSInterpreter.hpp, src/PSPattern.cpp,
+ src/PSPattern.hpp, src/PSPreviewFilter.cpp, src/PSPreviewFilter.hpp,
+ src/PageRanges.cpp, src/PageRanges.hpp, src/PageSize.cpp,
+ src/PageSize.hpp, src/Pair.hpp, src/PapersizeSpecialHandler.cpp,
+ src/PapersizeSpecialHandler.hpp, src/PathClipper.cpp,
+ src/PathClipper.hpp, src/PdfSpecialHandler.cpp,
+ src/PdfSpecialHandler.hpp, src/PreScanDVIReader.cpp,
+ src/PreScanDVIReader.hpp, src/Process.cpp, src/Process.hpp,
+ src/PsSpecialHandler.cpp, src/PsSpecialHandler.hpp, src/RangeMap.cpp,
+ src/RangeMap.hpp, src/SVGCharHandler.cpp, src/SVGCharHandler.hpp,
+ src/SVGCharHandlerFactory.cpp, src/SVGCharHandlerFactory.hpp,
+ src/SVGCharPathHandler.cpp, src/SVGCharPathHandler.hpp,
+ src/SVGCharTspanTextHandler.cpp, src/SVGCharTspanTextHandler.hpp,
+ src/SVGOutput.cpp, src/SVGOutput.hpp, src/SVGSingleCharTextHandler.cpp,
+ src/SVGSingleCharTextHandler.hpp, src/SVGTree.cpp, src/SVGTree.hpp,
+ src/ShadingPatch.cpp, src/ShadingPatch.hpp, src/SignalHandler.cpp,
+ src/SignalHandler.hpp, src/SourceInput.cpp, src/SourceInput.hpp,
+ src/SpecialActions.hpp, src/SpecialHandler.hpp, src/SpecialManager.cpp,
+ src/SpecialManager.hpp, src/StreamReader.cpp, src/StreamReader.hpp,
+ src/StreamWriter.cpp, src/StreamWriter.hpp, src/Subfont.cpp,
+ src/Subfont.hpp, src/System.cpp, src/System.hpp, src/TFM.cpp,
+ src/TFM.hpp, src/TTFAutohint.cpp, src/TTFAutohint.hpp,
+ src/TensorProductPatch.cpp, src/TensorProductPatch.hpp, src/Terminal.cpp,
+ src/Terminal.hpp, src/ToUnicodeMap.cpp, src/ToUnicodeMap.hpp,
+ src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.hpp,
+ src/TriangularPatch.cpp, src/TriangularPatch.hpp, src/TrueTypeFont.cpp,
+ src/TrueTypeFont.hpp, src/Unicode.cpp, src/Unicode.hpp,
+ src/VFActions.hpp, src/VFReader.cpp, src/VFReader.hpp,
+ src/VectorIterator.hpp, src/VectorStream.hpp, src/XMLDocument.cpp,
+ src/XMLDocument.hpp, src/XMLNode.cpp, src/XMLNode.hpp, src/XMLString.cpp,
+ src/XMLString.hpp, src/XXHashFunction.hpp, src/ZLibOutputStream.hpp,
+ src/dvisvgm.cpp, src/ffwrapper.c, src/ffwrapper.h, src/macros.hpp,
+ src/optimizer/AttributeExtractor.cpp,
+ src/optimizer/AttributeExtractor.hpp, src/optimizer/DependencyGraph.hpp,
+ src/optimizer/GroupCollapser.cpp, src/optimizer/GroupCollapser.hpp,
+ src/optimizer/OptimizerModule.hpp,
+ src/optimizer/RedundantElementRemover.cpp,
+ src/optimizer/RedundantElementRemover.hpp,
+ src/optimizer/SVGOptimizer.cpp, src/optimizer/SVGOptimizer.hpp,
+ src/optimizer/TextSimplifier.cpp, src/optimizer/TextSimplifier.hpp,
+ src/optimizer/TransformSimplifier.cpp,
+ src/optimizer/TransformSimplifier.hpp, src/optimizer/WSNodeRemover.cpp,
+ src/optimizer/WSNodeRemover.hpp, src/options.dtd, src/options.xml,
+ src/psdefs.cpp, src/utility.cpp, src/utility.hpp, src/version.hpp,
+ src/version.hpp.in, src/windows.hpp, tests/BezierTest.cpp,
+ tests/BitmapTest.cpp, tests/BoundingBoxTest.cpp,
+ tests/CMapManagerTest.cpp, tests/CMapReaderTest.cpp, tests/CMapTest.cpp,
+ tests/CalculatorTest.cpp, tests/ColorSpecialTest.cpp,
+ tests/ColorTest.cpp, tests/CommandLineTest.cpp, tests/DVIReaderTest.cpp,
+ tests/DependencyGraphTest.cpp, tests/DirectoryTest.cpp,
+ tests/DvisvgmSpecialTest.cpp, tests/EllipticalArcTest.cpp,
+ tests/EmSpecialTest.cpp, tests/FileFinderTest.cpp,
+ tests/FilePathTest.cpp, tests/FileSystemTest.cpp,
+ tests/FontCacheTest.cpp, tests/FontManagerTest.cpp,
+ tests/FontMapTest.cpp, tests/GFGlyphTracerTest.cpp,
+ tests/GFReaderTest.cpp, tests/GhostscriptTest.cpp,
+ tests/GraphicsPathTest.cpp, tests/HashFunctionTest.cpp,
+ tests/JFMReaderTest.cpp, tests/LengthTest.cpp, tests/Makefile.am,
+ tests/MapLineTest.cpp, tests/MatrixTest.cpp,
+ tests/MessageExceptionTest.cpp, tests/PDFParserTest.cpp,
+ tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp,
+ tests/PageSizeTest.cpp, tests/PairTest.cpp,
+ tests/PapersizeSpecialTest.cpp, tests/RangeMapTest.cpp,
+ tests/SVGOutputTest.cpp, tests/ShadingPatchTest.cpp,
+ tests/SpecialManagerTest.cpp, tests/SplittedCharInputBufferTest.cpp,
+ tests/StreamInputBufferTest.cpp, tests/StreamReaderTest.cpp,
+ tests/StreamWriterTest.cpp, tests/StringMatcherTest.cpp,
+ tests/SubfontTest.cpp, tests/TFMReaderTest.cpp,
+ tests/TensorProductPatchTest.cpp, tests/ToUnicodeMapTest.cpp,
+ tests/TpicSpecialTest.cpp, tests/TriangularPatchTest.cpp,
+ tests/UnicodeTest.cpp, tests/UtilityTest.cpp,
+ tests/VectorIteratorTest.cpp, tests/VectorStreamTest.cpp,
+ tests/XMLNodeTest.cpp, tests/XMLStringTest.cpp, tests/check-conv,
+ tests/create-makefile, tests/data/Makefile.am, tests/genhashcheck.py,
+ tests/normalize.xsl, tests/testmain.cpp:
+ updated year in copyright statements to 2021
+
+2020-12-30 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/Calculator.cpp, tests/CalculatorTest.cpp:
+ fixed a comment and added minor calculator tests
+
+ * src/Calculator.cpp, src/Calculator.hpp, tests/CalculatorTest.cpp:
+ use variant type for token objects in class Calculator
+
+2020-12-29 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/FontEngine.cpp:
+ renamed some local variables
+
+2020-12-21 Martin Gieseking <martin.gieseking@uos.de>
+
+ * src/FontEngine.cpp:
+ ensure unambiguity of GID to charcode mappings
+(fixes #147)
+
+ * src/Font.cpp, src/FontEngine.cpp, src/FontEngine.hpp:
+ Renamed FontEngine::buildCharMap()
+
2020-11-28 Martin Gieseking <martin.gieseking@uos.de>
* .appveyor.yml, .travis.yml, configure.ac, doc/dvisvgm.1, src/Doxyfile,
diff --git a/dviware/dvisvgm/Makefile.am b/dviware/dvisvgm/Makefile.am
index 7bb20a01c7..d5445a09ed 100644
--- a/dviware/dvisvgm/Makefile.am
+++ b/dviware/dvisvgm/Makefile.am
@@ -1,5 +1,5 @@
## This file is part of dvisvgm
-## Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
diff --git a/dviware/dvisvgm/Makefile.in b/dviware/dvisvgm/Makefile.in
index e4e663c7fb..a39a2f7d6b 100644
--- a/dviware/dvisvgm/Makefile.in
+++ b/dviware/dvisvgm/Makefile.in
@@ -354,6 +354,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/NEWS b/dviware/dvisvgm/NEWS
index 9d8991c5d0..c711e4503c 100644
--- a/dviware/dvisvgm/NEWS
+++ b/dviware/dvisvgm/NEWS
@@ -1,3 +1,19 @@
+dvisvgm-2.12 (2021-08-16)
+- added transparency support of SVG elements created outside the PS handler
+ (GH issue #148)
+- fixed spacing issue caused by unexpected newline characters in SVG output
+- fixed PS error occurred when defining (yet unsupported) PS shading patterns
+- fixed issue in color handling of PS tiling patterns (GH issue #158)
+- fixed displaced graphics occurred if PDF MediBox is not located at the origin
+- fixed handling of root directories of file paths
+- improved handling of drive letters (Windows only)
+- several code refactorings and improvements
+
+dvisvgm-2.11.1 (2021-01-21)
+- fixed possible ambiguity of GID to charcode mappings (GH issue #147)
+- refactored representation of token objects in calculator class
+- few minor code and test improvements
+
dvisvgm-2.11 (2020-11-28)
- added fallback mechanism for JFM-based virtual fonts proposed
by Takuji Tanaka (GH issue #144)
diff --git a/dviware/dvisvgm/README b/dviware/dvisvgm/README
index f880af15f8..e5a2d98c8a 100644
--- a/dviware/dvisvgm/README
+++ b/dviware/dvisvgm/README
@@ -130,7 +130,7 @@ ADDITIONAL INFORMATION
COPYRIGHT
- Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+ Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/dviware/dvisvgm/configure b/dviware/dvisvgm/configure
index fa07dfa281..307a061c43 100755
--- a/dviware/dvisvgm/configure
+++ b/dviware/dvisvgm/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dvisvgm 2.11.
+# Generated by GNU Autoconf 2.69 for dvisvgm 2.12.
#
# Report bugs to <martin.gieseking@uos.de>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dvisvgm'
PACKAGE_TARNAME='dvisvgm'
-PACKAGE_VERSION='2.11'
-PACKAGE_STRING='dvisvgm 2.11'
+PACKAGE_VERSION='2.12'
+PACKAGE_STRING='dvisvgm 2.12'
PACKAGE_BUGREPORT='martin.gieseking@uos.de'
PACKAGE_URL=''
@@ -795,6 +795,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -904,6 +905,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1156,6 +1158,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1293,7 +1304,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1406,7 +1417,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dvisvgm 2.11 to adapt to many kinds of systems.
+\`configure' configures dvisvgm 2.12 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1446,6 +1457,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1477,7 +1489,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dvisvgm 2.11:";;
+ short | recursive ) echo "Configuration of dvisvgm 2.12:";;
esac
cat <<\_ACEOF
@@ -1625,7 +1637,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dvisvgm configure 2.11
+dvisvgm configure 2.12
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2169,7 +2181,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dvisvgm $as_me 2.11, which was
+It was created by dvisvgm $as_me 2.12, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2527,7 +2539,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DATE="November 2020"
+DATE="August 2021"
ac_config_headers="$ac_config_headers config.h"
@@ -3157,7 +3169,7 @@ fi
# Define the identity of the package.
PACKAGE='dvisvgm'
- VERSION='2.11'
+ VERSION='2.12'
cat >>confdefs.h <<_ACEOF
@@ -4868,6 +4880,315 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_success=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx11+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+ namespace test_static_assert
+ {
+
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ }
+
+ namespace test_final_override
+ {
+
+ struct Base
+ {
+ virtual ~Base() {}
+ virtual void f() {}
+ };
+
+ struct Derived : public Base
+ {
+ virtual ~Derived() override {}
+ virtual void f() override {}
+ };
+
+ }
+
+ namespace test_double_right_angle_brackets
+ {
+
+ template < typename T >
+ struct check {};
+
+ typedef check<void> single_type;
+ typedef check<check<void>> double_type;
+ typedef check<check<check<void>>> triple_type;
+ typedef check<check<check<check<void>>>> quadruple_type;
+
+ }
+
+ namespace test_decltype
+ {
+
+ int
+ f()
+ {
+ int a = 1;
+ decltype(a) b = 2;
+ return a + b;
+ }
+
+ }
+
+ namespace test_type_deduction
+ {
+
+ template < typename T1, typename T2 >
+ struct is_same
+ {
+ static const bool value = false;
+ };
+
+ template < typename T >
+ struct is_same<T, T>
+ {
+ static const bool value = true;
+ };
+
+ template < typename T1, typename T2 >
+ auto
+ add(T1 a1, T2 a2) -> decltype(a1 + a2)
+ {
+ return a1 + a2;
+ }
+
+ int
+ test(const int c, volatile int v)
+ {
+ static_assert(is_same<int, decltype(0)>::value == true, "");
+ static_assert(is_same<int, decltype(c)>::value == false, "");
+ static_assert(is_same<int, decltype(v)>::value == false, "");
+ auto ac = c;
+ auto av = v;
+ auto sumi = ac + av + 'x';
+ auto sumf = ac + av + 1.0;
+ static_assert(is_same<int, decltype(ac)>::value == true, "");
+ static_assert(is_same<int, decltype(av)>::value == true, "");
+ static_assert(is_same<int, decltype(sumi)>::value == true, "");
+ static_assert(is_same<int, decltype(sumf)>::value == false, "");
+ static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+ return (sumf > 0.0) ? sumi : add(c, v);
+ }
+
+ }
+
+ namespace test_noexcept
+ {
+
+ int f() { return 0; }
+ int g() noexcept { return 0; }
+
+ static_assert(noexcept(f()) == false, "");
+ static_assert(noexcept(g()) == true, "");
+
+ }
+
+ namespace test_constexpr
+ {
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+ {
+ return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+ }
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c(const CharT *const s) noexcept
+ {
+ return strlen_c_r(s, 0UL);
+ }
+
+ static_assert(strlen_c("") == 0UL, "");
+ static_assert(strlen_c("1") == 1UL, "");
+ static_assert(strlen_c("example") == 7UL, "");
+ static_assert(strlen_c("another\0example") == 7UL, "");
+
+ }
+
+ namespace test_rvalue_references
+ {
+
+ template < int N >
+ struct answer
+ {
+ static constexpr int value = N;
+ };
+
+ answer<1> f(int&) { return answer<1>(); }
+ answer<2> f(const int&) { return answer<2>(); }
+ answer<3> f(int&&) { return answer<3>(); }
+
+ void
+ test()
+ {
+ int i = 0;
+ const int c = 0;
+ static_assert(decltype(f(i))::value == 1, "");
+ static_assert(decltype(f(c))::value == 2, "");
+ static_assert(decltype(f(0))::value == 3, "");
+ }
+
+ }
+
+ namespace test_uniform_initialization
+ {
+
+ struct test
+ {
+ static const int zero {};
+ static const int one {1};
+ };
+
+ static_assert(test::zero == 0, "");
+ static_assert(test::one == 1, "");
+
+ }
+
+ namespace test_lambdas
+ {
+
+ void
+ test1()
+ {
+ auto lambda1 = [](){};
+ auto lambda2 = lambda1;
+ lambda1();
+ lambda2();
+ }
+
+ int
+ test2()
+ {
+ auto a = [](int i, int j){ return i + j; }(1, 2);
+ auto b = []() -> int { return '0'; }();
+ auto c = [=](){ return a + b; }();
+ auto d = [&](){ return c; }();
+ auto e = [a, &b](int x) mutable {
+ const auto identity = [](int y){ return y; };
+ for (auto i = 0; i < a; ++i)
+ a += b--;
+ return x + identity(a + b);
+ }(0);
+ return a + b + c + d + e;
+ }
+
+ int
+ test3()
+ {
+ const auto nullary = [](){ return 0; };
+ const auto unary = [](int x){ return x; };
+ using nullary_t = decltype(nullary);
+ using unary_t = decltype(unary);
+ const auto higher1st = [](nullary_t f){ return f(); };
+ const auto higher2nd = [unary](nullary_t f1){
+ return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+ };
+ return higher1st(nullary) + higher2nd(nullary)(unary);
+ }
+
+ }
+
+ namespace test_variadic_templates
+ {
+
+ template <int...>
+ struct sum;
+
+ template <int N0, int... N1toN>
+ struct sum<N0, N1toN...>
+ {
+ static constexpr auto value = N0 + sum<N1toN...>::value;
+ };
+
+ template <>
+ struct sum<>
+ {
+ static constexpr auto value = 0;
+ };
+
+ static_assert(sum<>::value == 0, "");
+ static_assert(sum<1>::value == 1, "");
+ static_assert(sum<23>::value == 23, "");
+ static_assert(sum<1, 2>::value == 3, "");
+ static_assert(sum<5, 5, 11>::value == 21, "");
+ static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+ }
+
+ // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+ // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+ // because of this.
+ namespace test_template_alias_sfinae
+ {
+
+ struct foo {};
+
+ template<typename T>
+ using member = typename T::member_type;
+
+ template<typename T>
+ void func(...) {}
+
+ template<typename T>
+ void func(member<T>*) {}
+
+ void test();
+
+ void test() { func<foo>(0); }
+
+ }
+
+} // namespace cxx11
+
+#endif // __cplusplus >= 201103L
+
+
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ax_cv_cxx_compile_cxx11=yes
+else
+ ax_cv_cxx_compile_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
+$as_echo "$ax_cv_cxx_compile_cxx11" >&6; }
+ if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+ ac_success=yes
+ fi
+
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
@@ -20138,7 +20459,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dvisvgm $as_me 2.11, which was
+This file was extended by dvisvgm $as_me 2.12, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20204,7 +20525,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dvisvgm config.status 2.11
+dvisvgm config.status 2.12
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/dviware/dvisvgm/configure.ac b/dviware/dvisvgm/configure.ac
index adeab7d4bf..05590fc521 100644
--- a/dviware/dvisvgm/configure.ac
+++ b/dviware/dvisvgm/configure.ac
@@ -1,11 +1,11 @@
# This file is part of dvisvgm
-# Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+# Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
#
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([dvisvgm],[2.11],[martin.gieseking@uos.de])
-DATE="November 2020"
+AC_INIT([dvisvgm],[2.12],[martin.gieseking@uos.de])
+DATE="August 2021"
AC_CONFIG_SRCDIR(src)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/dviware/dvisvgm/doc/Makefile.am b/dviware/dvisvgm/doc/Makefile.am
index 92c7d25efd..dfdc0483b2 100644
--- a/dviware/dvisvgm/doc/Makefile.am
+++ b/dviware/dvisvgm/doc/Makefile.am
@@ -1,5 +1,5 @@
## This file is part of dvisvgm
-## Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
diff --git a/dviware/dvisvgm/doc/Makefile.in b/dviware/dvisvgm/doc/Makefile.in
index 8efa4e7554..5e7f5aab37 100644
--- a/dviware/dvisvgm/doc/Makefile.in
+++ b/dviware/dvisvgm/doc/Makefile.in
@@ -306,6 +306,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/doc/conf-dblatex-man.xsl b/dviware/dvisvgm/doc/conf-dblatex-man.xsl
index 2e52f9e96f..a42a929360 100644
--- a/dviware/dvisvgm/doc/conf-dblatex-man.xsl
+++ b/dviware/dvisvgm/doc/conf-dblatex-man.xsl
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of dvisvgm -->
-<!-- Copyright (C) 2015-2020 Martin Gieseking <martin.gieseking@uos.de> -->
+<!-- Copyright (C) 2015-2021 Martin Gieseking <martin.gieseking@uos.de> -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- output monospaced text in bold -->
<xsl:template match="literal">
diff --git a/dviware/dvisvgm/doc/conf-dblatex-pdf.xsl b/dviware/dvisvgm/doc/conf-dblatex-pdf.xsl
index bb3bd93b63..dd676ef67b 100644
--- a/dviware/dvisvgm/doc/conf-dblatex-pdf.xsl
+++ b/dviware/dvisvgm/doc/conf-dblatex-pdf.xsl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding="iso-8859-1"?>
<!-- This file is part of dvisvgm -->
-<!-- Copyright (C) 2015-2020 Martin Gieseking <martin.gieseking@uos.de> -->
+<!-- Copyright (C) 2015-2021 Martin Gieseking <martin.gieseking@uos.de> -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="xetex.font">
<xsl:text>\setmainfont{Source Serif Pro}&#10;</xsl:text>
diff --git a/dviware/dvisvgm/doc/dvisvgm.1 b/dviware/dvisvgm/doc/dvisvgm.1
index ee6b6d0315..995ad789fd 100644
--- a/dviware/dvisvgm/doc/dvisvgm.1
+++ b/dviware/dvisvgm/doc/dvisvgm.1
@@ -2,12 +2,12 @@
.\" Title: dvisvgm
.\" Author: Martin Gieseking <martin.gieseking@uos.de>
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 2020-08-23
+.\" Date: 2021-04-10
.\" Manual: dvisvgm Manual
-.\" Source: dvisvgm 2.11
+.\" Source: dvisvgm 2.12
.\" Language: English
.\"
-.TH "DVISVGM" "1" "2020\-08\-23" "dvisvgm 2\&.11" "dvisvgm Manual"
+.TH "DVISVGM" "1" "2021\-04\-10" "dvisvgm 2\&.12" "dvisvgm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -46,7 +46,7 @@ SVG is a vector\-based graphics format and therefore dvisvgm tries to convert th
.sp
However, TeX\(cqs main source for font descriptions is Metafont, which produces bitmap output (GF files)\&. That\(cqs why not all obtainable TeX fonts are available in a scalable format\&. In these cases, dvisvgm tries to vectorize Metafont\(cqs output by tracing the glyph bitmaps\&. The results are not as perfect as most (manually optimized) PFB or OTF counterparts, but are nonetheless really nice in most cases\&.
.sp
-When running dvisvgm without option \fB\-\-no\-fonts\fR, it creates \fIfont\fR elements (\fB<font>\fR\&...\fB</font>\fR) to embed the font data into the SVG files\&. Unfortunately, only few SVG renderers support these elements yet\&. Most web browsers and vector graphics applications don\(cqt evaluate them properly so that the text components of the resulting graphics might look strange\&. In order to create more compatible SVG files, command\-line option \fB\-\-no\-fonts\fR can be given to replace the font elements by plain graphics paths\&. Most web browsers (but only few external SVG renderers) also suppport WOFF and WOFF2 fonts that can be used instead of the default SVG fonts\&. Option \fB\-\-font\-format\fR offers the functionality to change the format applied to the fonts being embedded\&. This, however, only works when converting DVI files\&. Text present in PDF and PostScript files is always converted to path elements\&.
+When running dvisvgm without option \fB\-\-no\-fonts\fR, it creates \fIfont\fR elements (\fB<font>\fR\&...\fB</font>\fR) to embed the font data into the SVG files\&. Unfortunately, only few SVG renderers support these elements yet\&. Most web browsers and vector graphics applications don\(cqt evaluate them properly so that the text components of the resulting graphics might look strange\&. In order to create more compatible SVG files, command\-line option \fB\-\-no\-fonts\fR can be given to replace the font elements by plain graphics paths\&. Most web browsers (but only few external SVG renderers) also support WOFF and WOFF2 fonts that can be used instead of the default SVG fonts\&. Option \fB\-\-font\-format\fR offers the functionality to change the format applied to the fonts being embedded\&. This, however, only works when converting DVI files\&. Text present in PDF and PostScript files is always converted to path elements\&.
.SH "OPTIONS"
.sp
dvisvgm provides a POSIX\-compliant command\-line interface with short and long option names\&. They may be given before and/or after the name of the file to be converted\&. Also, the order of specifying the options is not significant, i\&.e\&. you can add them in any order without changing dvisvgm\(cqs behavior\&. Certain options accept or require additional parameters which are directly appended to or separated by whitespace from a short option (e\&.g\&. \fB\-v0\fR or \fB\-v 0\fR)\&. Long options require an additional equals sign (\fB=\fR) between option name and argument but without any surrounding whitespace (e\&.g\&. \fB\-\-verbosity=0\fR)\&. Multiple short options that don\(cqt expect a further parameter can be combined after a single dash (e\&.g\&. \fB\-ejs\fR rather than \fB\-e \-j \-s\fR)\&.
@@ -662,21 +662,22 @@ expression, it\(cqs assigned to the attribute\&. Otherwise, the matrix expressio
.PP
\fB\-o, \-\-output\fR=\fIpattern\fR
.RS 4
-Sets the pattern specifying the names of the generated SVG files\&. Parameter
+Sets the pattern that determines the names of the generated SVG files\&. The required parameter
\fIpattern\fR
-is a string that may contain static character sequences as well as the variables
+may consist of an arbitrary sequence of characters which make up the filenames\&. With the exception of the following mentioned variables and expressions, all characters are treated as static parts of the filenames and are therefore identical for all pages processed during a run of dvisvgm\&. The strings
\fB%f\fR,
\fB%p\fR,
\fB%P\fR,
\fB%hd\fR,
\fB%ho\fR, and
-\fB%hc\fR\&.
+\fB%hc\fR
+are variables that can be used as part of the pattern\&.
\fB%f\fR
expands to the base name of the DVI file, i\&.e\&. the filename without suffix,
\fB%p\fR
is the current page number, and
\fB%P\fR
-the total number of pages in the DVI file\&. An optional number (0\-9) given directly after the percent sign specifies the minimal number of digits to be written\&. If a particular value consists of less digits, the number is padded with leading zeros\&. Example:
+the total number of pages in the DVI file\&. An optional number (0\-9) given directly after the percent sign of a variable holding a numeric value denotes the minimal number of digits to be created\&. If a particular value consists of less digits, the number is padded with leading zeros\&. Example:
\fB%3p\fR
enforces 3 digits for the current page number (001, 002, etc\&.)\&. Without an explicit width specifier,
\fB%p\fR
@@ -703,7 +704,7 @@ and
\fB%hc\fR
are only set if option
\fB\-\-page\-hashes\fR
-is present\&. Otherwise, it\(cqs empty\&. For further information, see the description of option
+is present\&. Otherwise, they are empty\&. For further information, see the description of option
\fB\-\-page\-hashes\fR
below\&.
.sp
@@ -1692,4 +1693,4 @@ Please report bugs using the bug tracker at GitHub (\m[blue]https://github.com/m
Written by Martin Gieseking <\m[blue]\fBmartin\&.gieseking@uos\&.de\fR\m[]>
.SH "COPYING"
.sp
-Copyright \(co 2005\-2020 Martin Gieseking\&. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 3 or, (at your option) any later version\&.
+Copyright \(co 2005\-2021 Martin Gieseking\&. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 3 or, (at your option) any later version\&.
diff --git a/dviware/dvisvgm/doc/dvisvgm.txt.in b/dviware/dvisvgm/doc/dvisvgm.txt.in
index 4613c1a08e..2c98ac0500 100644
--- a/dviware/dvisvgm/doc/dvisvgm.txt.in
+++ b/dviware/dvisvgm/doc/dvisvgm.txt.in
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////
// This file is part of dvisvgm -- a fast DVI to SVG converter //
-// Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> //
+// Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> //
// //
// This program is free software; you can redistribute it and/or //
// modify it under the terms of the GNU General Public License as //
@@ -22,7 +22,7 @@ Martin Gieseking <@PACKAGE_BUGREPORT@>
:man source: dvisvgm
:man version: @VERSION@
:man manual: dvisvgm Manual
-:revdate: 2020-08-23 09:04 +0200
+:revdate: 2021-04-10 01:45 +0200
Name
----
@@ -69,7 +69,7 @@ to embed the font data into the SVG files. Unfortunately, only few SVG renderers
elements yet. Most web browsers and vector graphics applications don't evaluate them properly so
that the text components of the resulting graphics might look strange. In order to create more
compatible SVG files, command-line option *--no-fonts* can be given to replace the font elements
-by plain graphics paths. Most web browsers (but only few external SVG renderers) also suppport
+by plain graphics paths. Most web browsers (but only few external SVG renderers) also support
WOFF and WOFF2 fonts that can be used instead of the default SVG fonts. Option *--font-format*
offers the functionality to change the format applied to the fonts being embedded. This, however,
only works when converting DVI files. Text present in PDF and PostScript files is always
@@ -454,14 +454,18 @@ The following list describes the currently available optimizer modules.
expression is used.
*-o, --output*='pattern'::
-Sets the pattern specifying the names of the generated SVG files. Parameter 'pattern' is a string
-that may contain static character sequences as well as the variables +%f+, +%p+, +%P+, +%hd+,
-+%ho+, and +%hc+. +%f+ expands to the base name of the DVI file, i.e. the filename without
-suffix, +%p+ is the current page number, and +%P+ the total number of pages in the DVI file. An
-optional number (0-9) given directly after the percent sign specifies the minimal number of digits
-to be written. If a particular value consists of less digits, the number is padded with leading
-zeros. Example: +%3p+ enforces 3 digits for the current page number (001, 002, etc.). Without an
-explicit width specifier, +%p+ gets the same number of digits as +%P+.
+Sets the pattern that determines the names of the generated SVG files. The required parameter
+'pattern' may consist of an arbitrary sequence of characters which make up the filenames. With the
+exception of the following mentioned variables and expressions, all characters are treated as static
+parts of the filenames and are therefore identical for all pages processed during a run of dvisvgm.
+The strings +%f+, +%p+, +%P+, +%hd+, +%ho+, and +%hc+ are variables that can be used as part of the
+pattern. +%f+ expands to the base name of the DVI file, i.e. the filename without suffix, +%p+ is the
+current page number, and +%P+ the total number of pages in the DVI file.
+An optional number (0-9) given directly after the percent sign of a variable holding a numeric value
+denotes the minimal number of digits to be created. If a particular value consists of less digits,
+the number is padded with leading zeros.
+Example: +%3p+ enforces 3 digits for the current page number (001, 002, etc.). Without an explicit
+width specifier, +%p+ gets the same number of digits as +%P+.
+
If you need more control over the numbering, you can use arithmetic expressions as part of a pattern.
The syntax is +%(+'expr'+)+ where 'expr' may contain additions, subtractions, multiplications, and
@@ -471,7 +475,8 @@ where the numbering starts with 0 rather than 1.
+
The variables +%hX+ contain different hash values computed from the DVI page data and the options
given on the command-line. +%hd+ and +%hc+ are only set if option *--page-hashes* is present.
-Otherwise, it's empty. For further information, see the description of option *--page-hashes* below.
+Otherwise, they are empty. For further information, see the description of option *--page-hashes*
+below.
+
The default pattern is +%f-%p.svg+ if the DVI file consists of more than one page, and
+%f.svg+ otherwise. That means, a DVI file 'foo.dvi' is converted to 'foo.svg' if 'foo.dvi'
@@ -1001,7 +1006,7 @@ Written by {author} <{email}>
Copying
-------
-Copyright (C) 2005-2020 Martin Gieseking. Free use of this software is
+Copyright (C) 2005-2021 Martin Gieseking. Free use of this software is
granted under the terms of the GNU General Public License (GPL) version 3
or, (at your option) any later version.
diff --git a/dviware/dvisvgm/doc/tweak-db-refentry.xsl b/dviware/dvisvgm/doc/tweak-db-refentry.xsl
index 1750d7a4f7..fc77008ed1 100644
--- a/dviware/dvisvgm/doc/tweak-db-refentry.xsl
+++ b/dviware/dvisvgm/doc/tweak-db-refentry.xsl
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!-- This file is part of dvisvgm -->
-<!-- Copyright (C) 2015-2020 Martin Gieseking <martin.gieseking@uos.de> -->
+<!-- Copyright (C) 2015-2021 Martin Gieseking <martin.gieseking@uos.de> -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
diff --git a/dviware/dvisvgm/doc/tweak-dblatex-pdf.xsl b/dviware/dvisvgm/doc/tweak-dblatex-pdf.xsl
index d1762adecb..d4e3c8b0c1 100644
--- a/dviware/dvisvgm/doc/tweak-dblatex-pdf.xsl
+++ b/dviware/dvisvgm/doc/tweak-dblatex-pdf.xsl
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of dvisvgm -->
-<!-- Copyright (C) 2015-2020 Martin Gieseking <martin.gieseking@uos.de> -->
+<!-- Copyright (C) 2015-2021 Martin Gieseking <martin.gieseking@uos.de> -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output doctype-public="-//OASIS//DTD DocBook XML V4.5//EN" doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
diff --git a/dviware/dvisvgm/doc/tweak-dblatex-tex.py b/dviware/dvisvgm/doc/tweak-dblatex-tex.py
index 3f34d94e65..68a649e559 100644
--- a/dviware/dvisvgm/doc/tweak-dblatex-tex.py
+++ b/dviware/dvisvgm/doc/tweak-dblatex-tex.py
@@ -10,9 +10,9 @@ def main (latex_file, stdout):
lines = infile.readlines()
for line in lines:
if re.match(r'(.*\\def)|(.*\\href)', line) == None:
- line = re.sub(r'([a-zA-Z0-9]+)/', r'\1\slash{}', line)
+ line = re.sub(r'([a-zA-Z0-9]+)/', r'\1\\slash{}', line)
line = re.sub(r'-{}-{}', r'\=/\=/', line)
line = re.sub(r'([^a-zA-Z0-9])-{}', r'\1\=/', line)
- print >>outfile, line.rstrip()
+ print(line.rstrip(), file=outfile)
os.remove(latex_file_old)
return 0
diff --git a/dviware/dvisvgm/libs/Makefile.am b/dviware/dvisvgm/libs/Makefile.am
index 6b6e0433e4..e756a6be09 100644
--- a/dviware/dvisvgm/libs/Makefile.am
+++ b/dviware/dvisvgm/libs/Makefile.am
@@ -1,5 +1,5 @@
## This file is part of dvisvgm
-## Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
diff --git a/dviware/dvisvgm/libs/Makefile.in b/dviware/dvisvgm/libs/Makefile.in
index 2f71ea816b..8bc25f567a 100644
--- a/dviware/dvisvgm/libs/Makefile.in
+++ b/dviware/dvisvgm/libs/Makefile.in
@@ -332,6 +332,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/brotli/Makefile.in b/dviware/dvisvgm/libs/brotli/Makefile.in
index 023388493b..9e978253bf 100644
--- a/dviware/dvisvgm/libs/brotli/Makefile.in
+++ b/dviware/dvisvgm/libs/brotli/Makefile.in
@@ -397,6 +397,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/clipper/Makefile.in b/dviware/dvisvgm/libs/clipper/Makefile.in
index 0a219fa872..241afcb139 100644
--- a/dviware/dvisvgm/libs/clipper/Makefile.in
+++ b/dviware/dvisvgm/libs/clipper/Makefile.in
@@ -345,6 +345,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/ff-woff/Makefile.in b/dviware/dvisvgm/libs/ff-woff/Makefile.in
index 05f8d3c8e2..cb23f3e56a 100644
--- a/dviware/dvisvgm/libs/ff-woff/Makefile.in
+++ b/dviware/dvisvgm/libs/ff-woff/Makefile.in
@@ -409,6 +409,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/ff-woff/fontforge/tmpfile2.cpp b/dviware/dvisvgm/libs/ff-woff/fontforge/tmpfile2.cpp
index d9e5280b2c..9e4a26dbfb 100644
--- a/dviware/dvisvgm/libs/ff-woff/fontforge/tmpfile2.cpp
+++ b/dviware/dvisvgm/libs/ff-woff/fontforge/tmpfile2.cpp
@@ -3,7 +3,7 @@
* works on POSIX and Windows systems.
* License: Revised BSD license used by FontForge
* https://github.com/fontforge/fontforge/blob/master/LICENSE
-* (C) 2017-2020 Martin Gieseking <martin.gieseking@uos.de> */
+* (C) 2017-2021 Martin Gieseking <martin.gieseking@uos.de> */
#include <cstdio>
#include <cstdlib>
diff --git a/dviware/dvisvgm/libs/md5/Makefile.in b/dviware/dvisvgm/libs/md5/Makefile.in
index c38b576680..47788de0b1 100644
--- a/dviware/dvisvgm/libs/md5/Makefile.in
+++ b/dviware/dvisvgm/libs/md5/Makefile.in
@@ -328,6 +328,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/potrace/Makefile.in b/dviware/dvisvgm/libs/potrace/Makefile.in
index b735f00749..a6f517bf4c 100644
--- a/dviware/dvisvgm/libs/potrace/Makefile.in
+++ b/dviware/dvisvgm/libs/potrace/Makefile.in
@@ -333,6 +333,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/variant/Makefile.in b/dviware/dvisvgm/libs/variant/Makefile.in
index 1fa76c5068..11d200e521 100644
--- a/dviware/dvisvgm/libs/variant/Makefile.in
+++ b/dviware/dvisvgm/libs/variant/Makefile.in
@@ -292,6 +292,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/woff2/Makefile.in b/dviware/dvisvgm/libs/woff2/Makefile.in
index 279493dc64..673488dce6 100644
--- a/dviware/dvisvgm/libs/woff2/Makefile.in
+++ b/dviware/dvisvgm/libs/woff2/Makefile.in
@@ -366,6 +366,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/libs/xxHash/Makefile.in b/dviware/dvisvgm/libs/xxHash/Makefile.in
index 322bf0a182..be3355a4f1 100644
--- a/dviware/dvisvgm/libs/xxHash/Makefile.in
+++ b/dviware/dvisvgm/libs/xxHash/Makefile.in
@@ -328,6 +328,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/m4/Makefile.in b/dviware/dvisvgm/m4/Makefile.in
index 557e923063..2fb5c67bac 100644
--- a/dviware/dvisvgm/m4/Makefile.in
+++ b/dviware/dvisvgm/m4/Makefile.in
@@ -271,6 +271,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/m4/ax_cxx_compile_stdcxx.m4 b/dviware/dvisvgm/m4/ax_cxx_compile_stdcxx.m4
index 43087b2e68..9413da624d 100644
--- a/dviware/dvisvgm/m4/ax_cxx_compile_stdcxx.m4
+++ b/dviware/dvisvgm/m4/ax_cxx_compile_stdcxx.m4
@@ -16,7 +16,7 @@
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
-# preference for an extended mode.
+# preference for no added switch, and then for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
@@ -35,13 +35,14 @@
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
+# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 11
+#serial 12
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
@@ -62,6 +63,16 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
AC_LANG_PUSH([C++])dnl
ac_success=no
+ m4_if([$2], [], [dnl
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
+ ax_cv_cxx_compile_cxx$1,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [ax_cv_cxx_compile_cxx$1=yes],
+ [ax_cv_cxx_compile_cxx$1=no])])
+ if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
+ ac_success=yes
+ fi])
+
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
diff --git a/dviware/dvisvgm/src/AGLTable.hpp b/dviware/dvisvgm/src/AGLTable.hpp
index c1d460273a..67c6dbcea1 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/BasicDVIReader.cpp b/dviware/dvisvgm/src/BasicDVIReader.cpp
index 29ca84999f..d37a89c20c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/BasicDVIReader.hpp b/dviware/dvisvgm/src/BasicDVIReader.hpp
index a5b18b0420..a71c547fa5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Bezier.cpp b/dviware/dvisvgm/src/Bezier.cpp
index 87a0070621..b26ed71149 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Bezier.hpp b/dviware/dvisvgm/src/Bezier.hpp
index 322dd4e72d..18050ca857 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/BgColorSpecialHandler.cpp b/dviware/dvisvgm/src/BgColorSpecialHandler.cpp
index 3b315b50a3..3ae90b13a5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -36,7 +36,7 @@ void BgColorSpecialHandler::preprocess (const string&, std::istream &is, Special
if (!_pageColors.empty() && _pageColors.back().first == pageno)
_pageColors.back().second = color;
else
- _pageColors.emplace_back(PageColor(pageno, color));
+ _pageColors.emplace_back(pageno, color);
}
}
diff --git a/dviware/dvisvgm/src/BgColorSpecialHandler.hpp b/dviware/dvisvgm/src/BgColorSpecialHandler.hpp
index 9334a5c541..07c13437e5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Bitmap.cpp b/dviware/dvisvgm/src/Bitmap.cpp
index 64ebd6195e..c59e444608 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Bitmap.hpp b/dviware/dvisvgm/src/Bitmap.hpp
index 0d04aa2a69..f0bba3b41e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/BoundingBox.cpp b/dviware/dvisvgm/src/BoundingBox.cpp
index 2dbcc2ebcd..0fb6fde883 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -76,7 +76,7 @@ vector<Length> BoundingBox::extractLengths (string boxstr) {
vector<string> lengthStrings = util::split(boxstr, " ");
for (const string &lenstr : lengthStrings) {
if (!lenstr.empty())
- lengths.emplace_back(Length(lenstr));
+ lengths.emplace_back(lenstr);
}
return lengths;
}
diff --git a/dviware/dvisvgm/src/BoundingBox.hpp b/dviware/dvisvgm/src/BoundingBox.hpp
index c52312a24a..e3b59ebf5d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CLCommandLine.cpp b/dviware/dvisvgm/src/CLCommandLine.cpp
index 1f6bb4475e..ae245699c5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CLCommandLine.hpp b/dviware/dvisvgm/src/CLCommandLine.hpp
index 257ff4160f..9f9814368b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CLOption.hpp b/dviware/dvisvgm/src/CLOption.hpp
index d9da7ae008..594610b896 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CMap.cpp b/dviware/dvisvgm/src/CMap.cpp
index 193def52fd..6c9b10ed10 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CMap.hpp b/dviware/dvisvgm/src/CMap.hpp
index 37a54ba0f8..606a401ff7 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CMapManager.cpp b/dviware/dvisvgm/src/CMapManager.cpp
index 52b323ebc6..3a4c1a4e80 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -119,7 +119,7 @@ const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, co
// try to find a compatible encoding CMap
- const bool is_unicode_map = bool(dynamic_cast<const UnicodeCMap*>(cmap));
+ const bool is_unicode_map = cmap->mapsToUnicode();
const string ro = cmap->getROString();
for (const CharMapIDToEncName &enc : encodings) {
for (const CharMapID &id : charmapIDs) {
diff --git a/dviware/dvisvgm/src/CMapManager.hpp b/dviware/dvisvgm/src/CMapManager.hpp
index aeb9156e84..eab32e7646 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CMapReader.cpp b/dviware/dvisvgm/src/CMapReader.cpp
index 8ab22c22e3..c56d3bd463 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CMapReader.hpp b/dviware/dvisvgm/src/CMapReader.hpp
index 04ce5740c0..6e9a03ce98 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Calculator.cpp b/dviware/dvisvgm/src/Calculator.cpp
index 0fdcf0f2fa..00490efa04 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -25,20 +25,19 @@
using namespace std;
-// token types
-const char END = 0;
-const char NUMBER = 1;
-const char NAME = 2;
-
-
/** Evaluates a given arithmetic expression and returns its value.
* The evaluator is implemented as a recursive descent parser.
* @param[in] is reads expression from this stream
* @return expression value */
-double Calculator::eval (istream &is) {
+double Calculator::eval (istream &is) const {
double ret = expr(is, false);
- if (lookAhead(is) > 0)
+ try {
+ // check if expression has been fully evaluated (next token is of type bool)
+ mpark::get<bool>(lookAhead(is));
+ }
+ catch (mpark::bad_variant_access &e) {
throw CalculatorException("expression syntax error");
+ }
return ret;
}
@@ -46,7 +45,7 @@ double Calculator::eval (istream &is) {
/** Evaluates a given arithmetic expression and returns its value.
* @param[in] expr expression to evaluate
* @return expression value */
-double Calculator::eval (const string &expr) {
+double Calculator::eval (const string &expr) const {
istringstream iss;
iss.str(expr);
return eval(iss);
@@ -54,133 +53,150 @@ double Calculator::eval (const string &expr) {
/** Evaluates the root rule of the expression grammar. */
-double Calculator::expr (istream &is, bool skip) { // expr:
+double Calculator::expr (istream &is, bool skip) const { // expr:
double left = term(is, skip);
- for (;;) {
- switch (lookAhead(is)) {
- case '+': left += term(is, true); break; // term '+' term => $1 + $3
- case '-': left -= term(is, true); break; // term '-' term => $1 - $3
- default : return left; // term => $1
+ bool ready=false;
+ while (!ready) {
+ Token token = lookAhead(is);
+ char *op = mpark::get_if<char>(&token);
+ if (!op)
+ ready = true;
+ else {
+ switch (*op) {
+ case '+': left += term(is, true); break; // term '+' term => $1 + $3
+ case '-': left -= term(is, true); break; // term '-' term => $1 - $3
+ default : ready = true;
+ }
}
}
+ return left; // term => $1
}
-double Calculator::term (istream &is, bool skip) { // term:
+double Calculator::term (istream &is, bool skip) const { // term:
double left = prim(is, skip);
- for (;;)
- switch (lookAhead(is)) {
- case '*': left *= prim(is, true); break; // prim '*' prim => $1 * $3
- case '(': left *= prim(is, false); break; // prim '*' prim => $1 * $3
- case '/': { // prim '/' prim => $1 / $3
- double denom = prim(is, true);
- if (denom == 0)
- throw CalculatorException("division by zero");
- left /= denom;
- break;
+ bool ready=false;
+ while (!ready) {
+ Token token = lookAhead(is);
+ char *op = mpark::get_if<char>(&token);
+ if (!op)
+ ready = true;
+ else {
+ switch (*op) {
+ case '*': left *= prim(is, true); break; // prim '*' prim => $1 * $3
+ case '(': left *= prim(is, false); break; // prim '(' prim => $1 * $3
+ case '/': { // prim '/' prim => $1 / $3
+ double denom = prim(is, true);
+ if (denom == 0)
+ throw CalculatorException("division by zero");
+ left /= denom;
+ break;
+ }
+ case '%': { // prim '%' prim => $1 mod $3
+ double denom = prim(is, true);
+ if (denom == 0)
+ throw CalculatorException("division by zero");
+ left -= denom * floor(left / denom);
+ break;
+ }
+ default:
+ ready = true;
}
- case '%': { // prim '%' prim => $1 mod $3
- double denom = prim(is, true);
- if (denom == 0)
- throw CalculatorException("division by zero");
- left -= denom*floor(left/denom);
- break;
- }
- default: // prim => $1
- return left;
}
+ }
+ return left;
}
-double Calculator::prim (istream &is, bool skip) { // prim:
+/** Evaluates a primary expression of the grammar which doesn't contain any binary operators. */
+double Calculator::prim (istream &is, bool skip) const { // prim:
if (skip)
lex(is);
- switch (lookAhead(is)) {
- case NUMBER: { // NUMBER => $1
- lex(is);
- double ret = _numValue;
- if (lookAhead(is) == NAME) { // NUMBER NAME => $1 * $2
- lex(is);
- ret *= getVariable(_strValue);
+ Token token = lookAhead(is);
+ if (mpark::get_if<double>(&token)) { // NUMBER => $1
+ double ret = mpark::get<double>(lex(is));
+ token = lookAhead(is);
+ if (mpark::get_if<string>(&token)) // NUMBER STRING => $1 * $2
+ ret *= getVariable(mpark::get<string>(lex(is)));
+ return ret;
+ }
+ if (mpark::get_if<string>(&token)) // STRING => getVariable($1)
+ return getVariable(mpark::get<string>(lex(is)));
+ if (char *op = mpark::get_if<char>(&token)) {
+ switch (*op) {
+ case '-': // '-' prim => -$2
+ return -prim(is, true);
+ case '(': { // '(' expr ')' => $2
+ double e = expr(is, true);
+ try {
+ if (mpark::get<char>(lookAhead(is)) != ')')
+ throw CalculatorException("')' expected");
+ }
+ catch (mpark::bad_variant_access &e) {
+ throw CalculatorException("')' expected");
+ }
+ is.get(); // skip processed char
+ return e;
}
- return ret;
- }
- case NAME: { // NAME => getVariable($1)
- lex(is);
- return getVariable(_strValue);
- }
- case '-': // '-' prim => -$2
- return -prim(is, true);
- case '(': { // '(' expr ')' => $2
- double e = expr(is, true);
- if (lookAhead(is) != ')')
- throw CalculatorException("')' expected");
- lex(is);
- return e;
}
- default:
- throw CalculatorException("primary expression expected");
}
+ throw CalculatorException("primary expression expected");
+}
+
+
+/** Returns the value of a previously defined variable. If there
+ * is no variable of the given name, a CalculatorException is thrown.
+ * @param[in] name name of variable
+ * @return assigned value */
+double Calculator::getVariable (const string &name) const {
+ auto it = _variables.find(name);
+ if (it == _variables.end())
+ throw CalculatorException("undefined variable '" + name + "'");
+ return it->second;
}
-/** Determines type of next token without swallowing it. That means
- * the same token will be read again next time. */
-char Calculator::lookAhead (istream &is) {
+/** Determines the type of the next token without swallowing it. That means
+ * the same token will be read again next time. The value of the returned token
+ * object is only set for character tokens and should be considered undefined
+ * for the other types. */
+Calculator::Token Calculator::lookAhead (istream &is) {
is >> ws;
int c = is.peek();
if (is.eof())
- return END;
+ return false;
if (isdigit(c) || c == '.')
- return NUMBER;
+ return double(0);
if (isalpha(c))
- return NAME;
+ return string();
return char(c);
}
-/** Reads next token and returns its type. The token value is either assigned
- * to the object members numValue or strValue depending on the type. The token
- * type is represented by a unique integer. In contrast to method 'lookAhead'
- * lex consumes the read token.
+/** Reads and swallows the next token. The returned Token object is represented by
+ * a variant and thus contains both its type and value.
* @param[in] is next token is read from this stream
- * @return token type */
-char Calculator::lex (istream &is) {
- int tokenType = lookAhead(is);
- switch (tokenType) {
- case NUMBER: {
- string str;
- while (isdigit(is.peek()) || is.peek() == '.')
- str += char(is.get());
- try {
- _numValue = stod(str);
- }
- catch (const exception&) {
- throw CalculatorException("invalid number: "+str);
- }
- break;
+ * @return the read token */
+Calculator::Token Calculator::lex (istream &is) {
+ Token token = lookAhead(is);
+ if (mpark::get_if<char>(&token))
+ is.get(); // token already contains the value from look ahead
+ else if (mpark::get_if<double>(&token)) {
+ string str;
+ while (isdigit(is.peek()) || is.peek() == '.')
+ str += char(is.get());
+ try {
+ token.emplace<double>(stod(str));
}
- case NAME: {
- _strValue.clear();
- while (isalpha(is.peek()))
- _strValue += char(is.get());
- break;
+ catch (const exception&) {
+ throw CalculatorException("invalid number: "+str);
}
- default:
- tokenType = is.get();
}
- return char(tokenType);
-}
-
-
-/** Returns the value of a previously defined variable. If there
- * is no variable of the given name, a CalculatorException is thrown.
- * @param[in] name name of variable
- * @return assigned value */
-double Calculator::getVariable (const string &name) const {
- auto it = _variables.find(name);
- if (it == _variables.end())
- throw CalculatorException("undefined variable '" + name + "'");
- return it->second;
+ else if (mpark::get_if<string>(&token)) {
+ string name;
+ while (isalpha(is.peek()))
+ name += char(is.get());
+ token.emplace<string>(name);
+ }
+ return token;
}
-
diff --git a/dviware/dvisvgm/src/Calculator.hpp b/dviware/dvisvgm/src/Calculator.hpp
index 92ec4e40b1..50f8fb959c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -24,31 +24,31 @@
#include <istream>
#include <map>
#include <string>
+#include <mpark/variant.hpp>
#include "MessageException.hpp"
-
struct CalculatorException : public MessageException {
explicit CalculatorException (const std::string &msg) : MessageException(msg) {}
};
class Calculator {
public:
- double eval (std::istream &is);
- double eval (const std::string &expr);
+ double eval (std::istream &is) const;
+ double eval (const std::string &expr) const;
void setVariable (const std::string &name, double value) {_variables[name] = value;}
double getVariable (const std::string &name) const;
protected:
- double expr (std::istream &is, bool skip);
- double term (std::istream &is, bool skip);
- double prim (std::istream &is, bool skip);
- char lex (std::istream &is);
- char lookAhead (std::istream &is);
+ double expr (std::istream &is, bool skip) const;
+ double term (std::istream &is, bool skip) const;
+ double prim (std::istream &is, bool skip) const;
+
+ using Token = mpark::variant<bool, char, double, std::string>;
+ static Token lex (std::istream &is);
+ static Token lookAhead (std::istream &is);
private:
std::map<std::string,double> _variables;
- double _numValue=0;
- std::string _strValue;
};
#endif
diff --git a/dviware/dvisvgm/src/CharMapID.cpp b/dviware/dvisvgm/src/CharMapID.cpp
index 9c56afc73a..0020b38d04 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CharMapID.hpp b/dviware/dvisvgm/src/CharMapID.hpp
index ed044a9cf3..8b8890bc3a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Character.hpp b/dviware/dvisvgm/src/Character.hpp
index 667a583100..1e381f9311 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Color.cpp b/dviware/dvisvgm/src/Color.cpp
index bf9a05d7a3..60107be9de 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Color.hpp b/dviware/dvisvgm/src/Color.hpp
index 6f6f812207..061e3e1236 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ColorSpecialHandler.cpp b/dviware/dvisvgm/src/ColorSpecialHandler.cpp
index 2cacf82992..fed3a985f4 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ColorSpecialHandler.hpp b/dviware/dvisvgm/src/ColorSpecialHandler.hpp
index eeab300f47..0d90283503 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/CommandLine.hpp b/dviware/dvisvgm/src/CommandLine.hpp
index 7ea6ddd76e..c4a215b301 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-2020 Martin Gieseking <martin.gieseking@uos.de>
+// Copyright (C) 2016-2021 Martin Gieseking <martin.gieseking@uos.de>
#ifndef COMMANDLINE_HPP
#define COMMANDLINE_HPP
@@ -20,7 +20,7 @@ class CommandLine : public CL::CommandLine {
CommandLine () : CL::CommandLine(
"This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.",
"[options] dvifile\n--eps [options] epsfile\n--pdf [options] pdffile",
- "Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>"
+ "Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>"
) {}
CommandLine (int argc, char **argv) : CommandLine() {
diff --git a/dviware/dvisvgm/src/DLLoader.cpp b/dviware/dvisvgm/src/DLLoader.cpp
index 9a974e89d9..064368c24a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/DLLoader.hpp b/dviware/dvisvgm/src/DLLoader.hpp
index 469fd1c4aa..558c27d0c3 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/DVIActions.hpp b/dviware/dvisvgm/src/DVIActions.hpp
index 31ea693477..f51120ab77 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/DVIReader.cpp b/dviware/dvisvgm/src/DVIReader.cpp
index 893e6a818b..c524ff60db 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -26,7 +26,6 @@
#include "Font.hpp"
#include "FontManager.hpp"
#include "HashFunction.hpp"
-#include "JFM.hpp"
#include "utility.hpp"
#include "VectorStream.hpp"
@@ -203,11 +202,11 @@ void DVIReader::cmdPop (int) {
* @param[in] font current font (corresponding to _currFontNum)
* @param[in] c character to typeset */
void DVIReader::putVFChar (Font *font, uint32_t c) {
- if (auto vf = dynamic_cast<VirtualFont*>(font)) { // is current font a virtual font?
+ if (auto vf = font_cast<VirtualFont*>(font)) { // is current font a virtual font?
FontManager &fm = FontManager::instance();
const vector<uint8_t> *dvi = vf->getDVI(c); // try to get DVI snippet that represents character c
Font *firstFont = fm.vfFirstFont(vf);
- if (!dvi && (!firstFont || !dynamic_cast<const JFM*>(firstFont->getMetrics())))
+ if (!dvi && (!firstFont || !firstFont->getMetrics()->isJFM()))
return;
fm.enterVF(vf); // enter VF font number context
int savedFontNum = _currFontNum; // save current font number
@@ -485,7 +484,7 @@ const Font* DVIReader::defineFont (uint32_t fontnum, const string &name, uint32_
else { // TFM-based font specified by name
int id = fm.registerFont(fontnum, name, cs, dsize, ssize);
font = fm.getFontById(id);
- if (auto vf = dynamic_cast<VirtualFont*>(font)) {
+ if (auto vf = font_cast<VirtualFont*>(font)) {
// read vf file, register its font and character definitions
fm.enterVF(vf);
ifstream ifs(vf->path(), ios::binary);
@@ -592,7 +591,7 @@ void DVIReader::cmdXFontDef (int) {
FontManager::instance().registerFont(fontnum, fontname, fontIndex, ptsize, style, color);
font = FontManager::instance().getFont(fontnum);
}
- dviXFontDef(fontnum, dynamic_cast<const NativeFont*>(font));
+ dviXFontDef(fontnum, font_cast<const NativeFont*>(font));
}
diff --git a/dviware/dvisvgm/src/DVIReader.hpp b/dviware/dvisvgm/src/DVIReader.hpp
index 0e227ba8f6..ff8390f515 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/DVIToSVG.cpp b/dviware/dvisvgm/src/DVIToSVG.cpp
index df3d3e39e6..22c41415bf 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -74,13 +74,10 @@ bool DVIToSVG::COMPUTE_PROGRESS = false;
DVIToSVG::HashSettings DVIToSVG::PAGE_HASH_SETTINGS;
-DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) : DVIReader(is), _out(out)
+DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out)
+ : DVIReader(is), _out(out), _prevWritingMode(WritingMode::LR)
{
- _pageHeight = _pageWidth = 0;
- _tx = _ty = 0; // no cursor translation
- _pageByte = 0;
_prevXPos = _prevYPos = numeric_limits<double>::min();
- _prevWritingMode = WritingMode::LR;
_actions = util::make_unique<DVIToSVGActions>(*this, _svg);
}
@@ -362,7 +359,7 @@ void DVIToSVG::embedFonts (XMLElement *svgElement) {
unordered_set<const Font*> tracedFonts; // collect unique fonts already traced
for (const auto &fontchar : usedCharsMap) {
const Font *font = fontchar.first;
- if (auto ph_font = dynamic_cast<const PhysicalFont*>(font)) {
+ if (auto ph_font = font_cast<const PhysicalFont*>(font)) {
// Check if glyphs should be traced. Only trace the glyphs of unique fonts, i.e.
// avoid retracing the same glyphs again if they are referenced in various sizes.
if (TRACE_MODE != 0 && tracedFonts.find(ph_font->uniqueFont()) == tracedFonts.end()) {
@@ -481,7 +478,7 @@ void DVIToSVG::dviEop () {
void DVIToSVG::dviSetChar0 (uint32_t c, const Font *font) {
- if (_actions && !dynamic_cast<const VirtualFont*>(font))
+ if (_actions && !font_cast<const VirtualFont*>(font))
_actions->setChar(dviState().h+_tx, dviState().v+_ty, c, dviState().d != WritingMode::LR, *font);
}
@@ -520,7 +517,7 @@ void DVIToSVG::dviPop () {
void DVIToSVG::dviFontNum (uint32_t fontnum, SetFontMode, const Font *font) {
- if (_actions && font && !dynamic_cast<const VirtualFont*>(font))
+ if (_actions && font && !font_cast<const VirtualFont*>(font))
_actions->setFont(FontManager::instance().fontID(fontnum), *font); // all fonts get a recomputed ID
}
diff --git a/dviware/dvisvgm/src/DVIToSVG.hpp b/dviware/dvisvgm/src/DVIToSVG.hpp
index 1bafa7cb3d..150f611fd0 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -101,13 +101,13 @@ class DVIToSVG : public DVIReader {
SVGTree _svg;
SVGOutputBase &_out;
std::unique_ptr<DVIActions> _actions;
- std::string _bboxFormatString; ///< bounding box size/format set by the user
- std::string _transCmds; ///< page transformation commands set by the user
- double _pageHeight, _pageWidth; ///< global page height and width stored in the postamble
- double _tx, _ty; ///< translation of cursor position
- double _prevXPos, _prevYPos; ///< previous cursor position
- WritingMode _prevWritingMode; ///< previous writing mode
- std::streampos _pageByte; ///< position of the stream pointer relative to the preceding bop (in bytes)
+ std::string _bboxFormatString; ///< bounding box size/format set by the user
+ std::string _transCmds; ///< page transformation commands set by the user
+ double _pageHeight=0, _pageWidth=0; ///< global page height and width stored in the postamble
+ double _tx=0, _ty=0; ///< translation of cursor position
+ double _prevXPos, _prevYPos; ///< previous cursor position
+ WritingMode _prevWritingMode; ///< previous writing mode
+ std::streampos _pageByte=0; ///< position of the stream pointer relative to the preceding bop (in bytes)
};
#endif
diff --git a/dviware/dvisvgm/src/DVIToSVGActions.cpp b/dviware/dvisvgm/src/DVIToSVGActions.cpp
index 2464aec517..6de95de7b8 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -105,7 +105,7 @@ void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, co
GlyphMetrics metrics;
font.getGlyphMetrics(c, vertical, metrics);
- auto pf = dynamic_cast<const PhysicalFont*>(&font);
+ auto pf = font_cast<const PhysicalFont*>(&font);
if (PhysicalFont::EXACT_BBOX && pf) {
GlyphMetrics exact_metrics;
pf->getExactGlyphBox(c, exact_metrics, vertical, &callback);
@@ -166,15 +166,13 @@ void DVIToSVGActions::setRule (double x, double y, double height, double width)
return;
// (x,y) is the lower left corner of the rectangle
- auto rect = util::make_unique<XMLElement>("rect");
+ auto rect = util::make_unique<SVGElement>("rect");
rect->addAttribute("x", x);
rect->addAttribute("y", y-height);
rect->addAttribute("height", height);
rect->addAttribute("width", width);
- if (!getMatrix().isIdentity())
- rect->addAttribute("transform", getMatrix().toSVG());
- if (getColor() != Color::BLACK)
- rect->addAttribute("fill", _svg.getColor().svgColorString());
+ rect->setTransform(getMatrix());
+ rect->setFillColor(_svg.getColor());
_svg.appendToPage(std::move(rect));
// update bounding box
@@ -237,12 +235,12 @@ void DVIToSVGActions::endPage (unsigned pageno) {
_svg.transformPage(matrix);
if (_bgcolor != Color::TRANSPARENT) {
// create a rectangle filled with the background color
- auto rect = util::make_unique<XMLElement>("rect");
+ auto rect = util::make_unique<SVGElement>("rect");
rect->addAttribute("x", _bbox.minX());
rect->addAttribute("y", _bbox.minY());
rect->addAttribute("width", _bbox.width());
rect->addAttribute("height", _bbox.height());
- rect->addAttribute("fill", _bgcolor.svgColorString());
+ rect->setFillColor(_bgcolor);
_svg.prependToPage(std::move(rect));
}
}
diff --git a/dviware/dvisvgm/src/DVIToSVGActions.hpp b/dviware/dvisvgm/src/DVIToSVGActions.hpp
index 2ae3fb9a2e..23706f987d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -49,6 +49,8 @@ class DVIToSVGActions : public DVIActions, public SpecialActions {
void setBgColor (const Color &color) override;
void setColor (const Color &color) override {_svg.setColor(color);}
void setMatrix (const Matrix &m) override {_svg.setMatrix(m);}
+ void setOpacity (const Opacity &opacity) override {_svg.setOpacity(opacity);}
+ const Opacity& getOpacity () const override {return _svg.getOpacity();}
const Matrix& getMatrix () const override {return _svg.getMatrix();}
Matrix getPageTransformation () const override {return _dvireader->getPageTransformation();}
Color getColor () const override {return _svg.getColor();}
diff --git a/dviware/dvisvgm/src/Directory.cpp b/dviware/dvisvgm/src/Directory.cpp
index e7200a0dc3..224165e255 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Directory.hpp b/dviware/dvisvgm/src/Directory.hpp
index d617b4fcbd..14360a9f67 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp b/dviware/dvisvgm/src/DvisvgmSpecialHandler.cpp
index 97285db1a9..e6f444fa84 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -81,8 +81,7 @@ void DvisvgmSpecialHandler::preprocessRawSet (InputReader &ir) {
_currentMacro = _macros.end();
throw SpecialException("redefinition of SVG fragment '" + id + "'");
}
- pair<string, StringVector> entry(id, StringVector());
- pair<MacroMap::iterator, bool> state = _macros.emplace(move(entry));
+ pair<MacroMap::iterator, bool> state = _macros.emplace(id, StringVector());
_currentMacro = state.first;
}
@@ -194,7 +193,7 @@ static void expand_constants (string &str, SpecialActions &actions) {
/** Evaluates substrings of the form {?(expr)} where 'expr' is a math expression,
* and replaces the substring by the computed value.
* @param[in,out] str string to scan for expressions */
-static void evaluate_expressions (string &str, SpecialActions &actions) {
+static void evaluate_expressions (string &str, const SpecialActions &actions) {
size_t left = str.find("{?("); // start position of expression macro
while (left != string::npos) {
size_t right = str.find(")}", left+2); // end position of expression macro
@@ -386,14 +385,13 @@ void DvisvgmSpecialHandler::processImg (InputReader &ir, SpecialActions &actions
Length h = read_length(ir);
string f = ir.getString();
update_bbox(w, h, Length(0), false, actions);
- auto img = util::make_unique<XMLElement>("image");
+ auto img = util::make_unique<SVGElement>("image");
img->addAttribute("x", actions.getX());
img->addAttribute("y", actions.getY());
img->addAttribute("width", w.bp());
img->addAttribute("height", h.bp());
img->addAttribute("xlink:href", f);
- if (!actions.getMatrix().isIdentity())
- img->addAttribute("transform", actions.getMatrix().toSVG());
+ img->setTransform(actions.getMatrix());
actions.svgTree().appendToPage(std::move(img));
}
catch (const UnitException &e) {
@@ -448,10 +446,10 @@ void DvisvgmSpecialHandler::XMLParser::parse (const string &xml, SpecialActions
// collect/extract an XML fragment that only contains complete tags
// incomplete tags are held back
_xmlbuf += xml;
- size_t left=0, right;
+ size_t left=0;
try {
while (left != string::npos) {
- right = _xmlbuf.find('<', left);
+ size_t right = _xmlbuf.find('<', left);
if (left < right && left < _xmlbuf.length()) // plain text found?
(actions.svgTree().*_append)(util::make_unique<XMLText>(_xmlbuf.substr(left, right-left)));
if (right != string::npos) {
@@ -523,7 +521,7 @@ void DvisvgmSpecialHandler::XMLParser::openElement (const string &tag, SpecialAc
BufferInputReader ir(ib);
string name = ir.getString("/ \t\n\r");
ir.skipSpace();
- auto elemNode = util::make_unique<XMLElement>(name);
+ auto elemNode = util::make_unique<SVGElement>(name);
map<string, string> attribs;
if (ir.parseAttributes(attribs, true, "\"'")) {
for (const auto &attrpair : attribs)
diff --git a/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp b/dviware/dvisvgm/src/DvisvgmSpecialHandler.hpp
index d6aa32c9ee..5bd8d66874 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -29,6 +29,7 @@
class InputReader;
class SpecialActions;
+class SVGElement;
class SVGTree;
class XMLElement;
class XMLNode;
@@ -44,7 +45,7 @@ class XMLNode;
class DvisvgmSpecialHandler : public SpecialHandler {
class XMLParser {
using AppendFunc = void (SVGTree::*)(std::unique_ptr<XMLNode>);
- using PushFunc = void (SVGTree::*)(std::unique_ptr<XMLElement>);
+ using PushFunc = void (SVGTree::*)(std::unique_ptr<SVGElement>);
using PopFunc = void (SVGTree::*)();
using NameStack = std::vector<std::string>;
diff --git a/dviware/dvisvgm/src/EPSFile.cpp b/dviware/dvisvgm/src/EPSFile.cpp
index 1a19c07cc7..2f61f9f07d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EPSFile.hpp b/dviware/dvisvgm/src/EPSFile.hpp
index 7b02db95b1..384af7225e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EPSToSVG.hpp b/dviware/dvisvgm/src/EPSToSVG.hpp
index 64f5ac604d..75a574cf38 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EllipticalArc.cpp b/dviware/dvisvgm/src/EllipticalArc.cpp
index a151c51307..e7353458e3 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -177,7 +177,7 @@ vector<Bezier> EllipticalArc::approximate () const {
if (isStraightLine()) {
DPair dir = (_endPoint - _startPoint);
dir /= dir.length()/3.0;
- beziers.emplace_back(Bezier(_startPoint, _startPoint+dir, _endPoint-dir, _endPoint));
+ beziers.emplace_back(_startPoint, _startPoint+dir, _endPoint-dir, _endPoint);
}
else {
CenterParams cparams = getCenterParams();
@@ -190,11 +190,11 @@ vector<Bezier> EllipticalArc::approximate () const {
if (numCurves > 0) {
double c = cos(_rotationAngle);
double s = sin(_rotationAngle);
- Matrix ellipse = {_rx*c, -_ry*s, cparams.center.x(), _rx*s, _ry*c, cparams.center.y()};
+ Matrix ellipse{_rx*c, -_ry*s, cparams.center.x(), _rx*s, _ry*c, cparams.center.y()};
double angle = cparams.startAngle;
double diff = cparams.deltaAngle/numCurves;
while (numCurves-- > 0) {
- beziers.emplace_back(approx_unit_arc(angle, diff).transform(ellipse));
+ beziers.push_back(approx_unit_arc(angle, diff).transform(ellipse));
angle += diff;
}
}
diff --git a/dviware/dvisvgm/src/EllipticalArc.hpp b/dviware/dvisvgm/src/EllipticalArc.hpp
index 422a40b207..78785c4ff1 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EmSpecialHandler.cpp b/dviware/dvisvgm/src/EmSpecialHandler.cpp
index efbd7abef3..ac1d4fc6bc 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -24,9 +24,8 @@
#include "InputReader.hpp"
#include "Length.hpp"
#include "SpecialActions.hpp"
+#include "SVGElement.hpp"
#include "SVGTree.hpp"
-#include "XMLNode.hpp"
-#include "XMLString.hpp"
using namespace std;
@@ -77,17 +76,19 @@ static DPair cut_vector (char cuttype, const DPair &linedir, double linewidth) {
static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, double lw, SpecialActions &actions) {
if (actions.outputLocked())
return;
- unique_ptr<XMLElement> node;
+ unique_ptr<SVGElement> node;
DPair dir = p2-p1;
if (dir.x() == 0 || dir.y() == 0 || (c1 == 'p' && c2 == 'p')) {
// draw regular line
- node = util::make_unique<XMLElement>("line");
+ node = util::make_unique<SVGElement>("line");
node->addAttribute("x1", p1.x());
node->addAttribute("y1", p1.y());
node->addAttribute("x2", p2.x());
node->addAttribute("y2", p2.y());
- node->addAttribute("stroke-width", lw);
- node->addAttribute("stroke", actions.getColor().svgColorString());
+ node->setStrokeWidth(lw);
+ node->setStrokeColor(actions.getColor());
+ node->setStrokeOpacity(actions.getOpacity());
+
// update bounding box
DPair cv = cut_vector('p', dir, lw);
actions.embed(p1+cv);
@@ -97,24 +98,24 @@ static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, dou
}
else {
// draw polygon
+ vector<DPair> points;
DPair cv1 = cut_vector(c1, dir, lw);
DPair cv2 = cut_vector(c2, dir, lw);
- DPair q11 = p1+cv1, q12 = p1-cv1;
- DPair q21 = p2+cv2, q22 = p2-cv2;
- ostringstream oss;
- oss << XMLString(q11.x()) << ',' << XMLString(q11.y()) << ' '
- << XMLString(q12.x()) << ',' << XMLString(q12.y()) << ' '
- << XMLString(q22.x()) << ',' << XMLString(q22.y()) << ' '
- << XMLString(q21.x()) << ',' << XMLString(q21.y());
- node = util::make_unique<XMLElement>("polygon");
- node->addAttribute("points", oss.str());
- if (actions.getColor() != Color::BLACK)
- node->addAttribute("fill", actions.getColor().svgColorString());
+ points.push_back(p1+cv1);
+ points.push_back(p1-cv1);
+ points.push_back(p2-cv2);
+ points.push_back(p2+cv2);
+
+ node = util::make_unique<SVGElement>("polygon");
+ node->setPoints(points);
+ node->setFillColor(actions.getColor());
+ node->setFillOpacity(actions.getOpacity());
+
// update bounding box
- actions.embed(q11);
- actions.embed(q12);
- actions.embed(q21);
- actions.embed(q22);
+ actions.embed(points[0]);
+ actions.embed(points[1]);
+ actions.embed(points[2]);
+ actions.embed(points[3]);
}
actions.svgTree().appendToPage(std::move(node));
}
@@ -236,7 +237,7 @@ void EmSpecialHandler::line (InputReader &ir, SpecialActions& actions) {
// Line endpoints don't necessarily have to be defined before
// a line definition. If a point isn't defined yet, we put the line
// in a wait list and process the lines at the end of the page.
- _lines.emplace_back(Line(pointnum1, pointnum2, char(cut1), char(cut2), linewidth));
+ _lines.emplace_back(pointnum1, pointnum2, char(cut1), char(cut2), linewidth);
}
}
diff --git a/dviware/dvisvgm/src/EmSpecialHandler.hpp b/dviware/dvisvgm/src/EmSpecialHandler.hpp
index e20339e548..fc9f14a468 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EncFile.cpp b/dviware/dvisvgm/src/EncFile.cpp
index ce0f18d81e..d08791c03e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/EncFile.hpp b/dviware/dvisvgm/src/EncFile.hpp
index 8f2b14c430..0e5f90bcb3 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FileFinder.cpp b/dviware/dvisvgm/src/FileFinder.cpp
index a52ccd37d3..3358d5c273 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FileFinder.hpp b/dviware/dvisvgm/src/FileFinder.hpp
index 7218bf6c0b..5774f8165c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FilePath.cpp b/dviware/dvisvgm/src/FilePath.cpp
index 2150cf31f7..fd81c0221b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -37,34 +37,24 @@ static string& single_slashes (string &str) {
#ifdef _WIN32
+/** Returns the drive letter of a given path string or 0 if there's none. */
+static char drive_letter (const string &path) {
+ if (path.length() >= 2 && path[1] == ':' && isalpha(path[0]))
+ return tolower(path[0]);
+ return '\0';
+}
+
+/** Removes the drive letter and following colon from a given path string if present.
+ * @param[in] path path to strip drive letter from
+ * @return drive letter or 0 if there was none */
static char strip_drive_letter (string &path) {
- char letter = 0;
+ char letter = '\0';
if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) {
letter = path[0];
path.erase(0, 2);
}
- return letter;
-}
-
-
-static char adapt_current_path (string &path, char target_drive) {
- if (char current_drive = strip_drive_letter(path)) {
- if (target_drive != current_drive) {
- if (target_drive == 0)
- target_drive = current_drive;
- if (path.empty() || path[0] != '/') {
- if (FileSystem::chdir(string(1, target_drive) + ":")) {
- path.insert(0, FileSystem::getcwd()+"/");
- strip_drive_letter(path);
- }
- else
- throw MessageException("drive " + string(1, target_drive) + ": not accessible");
- }
- }
- }
- return target_drive;
+ return tolower(letter);
}
-
#endif
@@ -99,7 +89,7 @@ void FilePath::set (const string &path) {
* @param[in] path absolute or relative path to a file or directory
* @param[in] isfile true if 'path' references a file, false if a directory is referenced */
void FilePath::set (const string &path, bool isfile) {
- init(path, isfile, FileSystem::getcwd());
+ init(path, isfile, "");
}
@@ -121,47 +111,42 @@ void FilePath::init (string path, bool isfile, string current_dir) {
_fname.clear();
single_slashes(path);
single_slashes(current_dir);
-#ifdef _WIN32
- path = FileSystem::ensureForwardSlashes(path);
+#ifndef _WIN32
+ if (current_dir.empty())
+ current_dir = FileSystem::getcwd();
+#else
_drive = strip_drive_letter(path);
+ if (current_dir.empty() || drive_letter(current_dir) != _drive)
+ current_dir = FileSystem::getcwd(_drive);
+ if (!_drive)
+ _drive = drive_letter(current_dir);
+ strip_drive_letter(current_dir);
+ path = FileSystem::ensureForwardSlashes(path);
#endif
if (isfile) {
size_t pos = path.rfind('/');
_fname = path.substr((pos == string::npos) ? 0 : pos+1);
- if (pos != string::npos)
+ // remove filename from path
+ if (pos == 0 && _fname.length() > 1) // file in root directory?
+ path.erase(1);
+ else if (pos != string::npos)
path.erase(pos);
else
path.clear();
}
- if (current_dir.empty())
- current_dir = FileSystem::getcwd();
-#ifdef _WIN32
- _drive = adapt_current_path(current_dir, _drive);
-#endif
- if (!path.empty()) {
- if (path[0] == '/')
- current_dir.clear();
- else if (current_dir[0] != '/')
- current_dir = "/";
- else {
- FilePath curr(current_dir, false, "/");
- current_dir = curr.absolute();
-#ifdef _WIN32
- adapt_current_path(current_dir, _drive);
-#endif
- }
- }
- path.insert(0, current_dir + "/");
+ if ((path.empty() || path[0] != '/') && !current_dir.empty())
+ path.insert(0, current_dir + "/");
string elem;
for (char c : path) {
if (c != '/')
elem += c;
- else {
+ else if (!elem.empty()){
add(elem);
elem.clear();
}
}
- add(elem);
+ if (!elem.empty())
+ add(elem);
}
@@ -169,7 +154,7 @@ void FilePath::init (string path, bool isfile, string current_dir) {
void FilePath::add (const string &dir) {
if (dir == ".." && !_dirs.empty())
_dirs.pop_back();
- else if (dir.length() > 0 && dir != ".")
+ else if (!dir.empty() && dir != ".")
_dirs.emplace_back(dir);
}
@@ -223,16 +208,16 @@ string FilePath::basename () const {
* @return the absolute path string */
string FilePath::absolute (bool with_filename) const {
string path;
+#ifdef _WIN32
+ if (_drive)
+ path = string(1, _drive) + ":";
+#endif
for (const Directory &dir : _dirs)
path += "/" + string(dir);
if (path.empty())
path = "/";
if (with_filename && !_fname.empty())
path += "/"+_fname;
-#ifdef _WIN32
- if (_drive)
- path.insert(0, string(1, _drive) + ":");
-#endif
return single_slashes(path);
}
@@ -245,28 +230,32 @@ string FilePath::absolute (bool with_filename) const {
* @param[in] with_filename if false, the filename is omitted
* @return the relative path string */
string FilePath::relative (string reldir, bool with_filename) const {
+#ifdef _WIN32
+ char reldrive = drive_letter(reldir);
+ if (reldir.empty()) {
+ reldir = FileSystem::getcwd(_drive);
+ reldrive = drive_letter(FileSystem::getcwd());
+ }
+ bool isAbsolute = (reldir[0] == '/')
+ || (reldir.length() >= 3 && isalpha(reldir[0]) && reldir[1] == ':' && reldir[2] == '/');
+#else
if (reldir.empty())
reldir = FileSystem::getcwd();
-#ifdef _WIN32
- adapt_current_path(reldir, _drive);
+ bool isAbsolute = (reldir[0] == '/');
#endif
- if (reldir[0] != '/')
+ if (!isAbsolute)
return absolute();
- FilePath rel(reldir, false);
+ FilePath relpath(reldir, false);
string path;
-#ifdef _WIN32
- if (rel._drive && _drive && tolower(rel._drive) != tolower(_drive))
- path += string(1, _drive) + ":";
-#endif
auto it1 = _dirs.begin();
- auto it2 = rel._dirs.begin();
- while (it1 != _dirs.end() && it2 != rel._dirs.end() && *it1 == *it2)
+ auto it2 = relpath._dirs.begin();
+ while (it1 != _dirs.end() && it2 != relpath._dirs.end() && *it1 == *it2)
++it1, ++it2;
- for (; it2 != rel._dirs.end(); ++it2)
+ for (; it2 != relpath._dirs.end(); ++it2)
path += "../";
for (; it1 != _dirs.end(); ++it1)
path += string(*it1) + "/";
- if (!path.empty())
+ if (!path.empty() && path.back() == '/')
path.erase(path.length()-1, 1); // remove trailing slash
if (with_filename && !_fname.empty()) {
if (!path.empty() && path != "/")
@@ -275,6 +264,10 @@ string FilePath::relative (string reldir, bool with_filename) const {
}
if (path.empty())
path = ".";
+#ifdef _WIN32
+ if (relpath._drive && _drive && _drive != reldrive)
+ path.insert(0, string(1, _drive) + ":");
+#endif
return single_slashes(path);
}
diff --git a/dviware/dvisvgm/src/FilePath.hpp b/dviware/dvisvgm/src/FilePath.hpp
index e9d55562c5..af81db66f4 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FileSystem.cpp b/dviware/dvisvgm/src/FileSystem.cpp
index e1db59fa03..ada3f8e47c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -135,16 +135,38 @@ string FileSystem::ensureForwardSlashes (string path) {
}
+/** Returns the absolute path of the current working directory. */
string FileSystem::getcwd () {
char buf[1024];
#ifdef _WIN32
- return ensureForwardSlashes(_getcwd(buf, 1024));
+ GetCurrentDirectoryA(1024, buf);
+ return ensureForwardSlashes(buf);
#else
return ::getcwd(buf, 1024);
#endif
}
+#ifdef _WIN32
+/** Returns the absolute path of the current directory of a given drive.
+ * Windows keeps a current directory for every drive, i.e. when accessing a drive
+ * without specifying a path (e.g. with "cd z:"), the current directory of that
+ * drive is used.
+ * @param[in] drive letter of drive to get the current directory from
+ * @return absolute path of the directory */
+string FileSystem::getcwd (char drive) {
+ string cwd = getcwd();
+ if (cwd.length() > 1 && cwd[1] == ':' && tolower(cwd[0]) != tolower(drive)) {
+ chdir(string(1, drive)+":");
+ string cwd2 = cwd;
+ cwd = getcwd();
+ chdir(string(1, cwd2[0])+":");
+ }
+ return cwd;
+}
+#endif
+
+
/** Changes the work directory.
* @param[in] dir path to new work directory
* @return true on success */
diff --git a/dviware/dvisvgm/src/FileSystem.hpp b/dviware/dvisvgm/src/FileSystem.hpp
index 9a45c4ac19..0c13f178e9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -48,6 +48,9 @@ class FileSystem {
static uint64_t filesize (const std::string &fname);
static std::string ensureForwardSlashes (std::string path);
static std::string getcwd ();
+#ifdef _WIN32
+ static std::string getcwd (char drive);
+#endif
static std::string tmpdir ();
static bool chdir (const std::string &dir);
static bool exists (const std::string &fname);
diff --git a/dviware/dvisvgm/src/FixWord.hpp b/dviware/dvisvgm/src/FixWord.hpp
index 3414e1ead4..b6166b15dc 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Font.cpp b/dviware/dvisvgm/src/Font.cpp
index 5aee699422..052d6c038f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -636,7 +636,7 @@ bool NativeFontImpl::findAndAssignBaseFontMap () {
FontEngine &fe = FontEngine::instance();
fe.setFont(*this);
fe.setUnicodeCharMap();
- fe.buildCharMap(_toUnicodeMap);
+ fe.buildGidToCharCodeMap(_toUnicodeMap);
if (!_toUnicodeMap.addMissingMappings(fe.getNumGlyphs()))
Message::wstream(true) << "incomplete Unicode mapping for native font " << name() << " (" << filename() << ")\n";
return true;
@@ -679,3 +679,11 @@ const vector<uint8_t>* VirtualFontImpl::getDVI (int c) const {
return (it == _charDefs.end() ? nullptr : &it->second);
}
+//////////////////////////////////////////////////////////////////////////////
+
+void PhysicalFont::visit (FontVisitor &visitor) {visitor.visited(this);}
+void VirtualFont::visit (FontVisitor &visitor) {visitor.visited(this);}
+void NativeFont::visit (FontVisitor &visitor) {visitor.visited(this);}
+void PhysicalFont::visit (FontVisitor &visitor) const {visitor.visited(this);}
+void VirtualFont::visit (FontVisitor &visitor) const {visitor.visited(this);}
+void NativeFont::visit (FontVisitor &visitor) const {visitor.visited(this);}
diff --git a/dviware/dvisvgm/src/Font.hpp b/dviware/dvisvgm/src/Font.hpp
index 0a92cbeff5..f4bb58a9c6 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -50,6 +50,7 @@ struct GlyphMetrics {
double wl, wr, h, d;
};
+class FontVisitor;
/** Abstract base for all font classes. */
class Font {
@@ -69,17 +70,19 @@ class Font {
virtual const char* path () const =0;
virtual const char* filename () const;
virtual const FontEncoding* encoding () const;
- virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *callback=nullptr) const =0;
+ virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *callback) const =0;
virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const;
virtual uint32_t unicode (uint32_t c) const;
virtual void tidy () const {}
virtual bool findAndAssignBaseFontMap () {return true;}
- virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;}
+ virtual bool verticalLayout () const {return getMetrics() != nullptr && getMetrics()->verticalLayout();}
virtual bool verifyChecksums () const {return true;}
virtual int fontIndex () const {return 0;}
virtual const FontStyle* style () const {return nullptr;}
virtual Color color () const {return Color::BLACK;}
virtual const FontMap::Entry* fontMapEntry () const;
+ virtual void visit (FontVisitor &visitor) =0;
+ virtual void visit (FontVisitor &visitor) const =0;
};
@@ -100,7 +103,9 @@ class EmptyFont : public Font {
double italicCorr (int c) const override {return 0;}
const FontMetrics* getMetrics () const override {return nullptr;}
const char* path () const override {return nullptr;}
- bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override {return false;}
+ bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback*) const override {return false;}
+ void visit (FontVisitor &visitor) override {}
+ void visit (FontVisitor &visitor) const override {}
private:
std::string _fontname;
@@ -115,9 +120,9 @@ class PhysicalFont : public virtual Font {
static std::unique_ptr<Font> create (const std::string &name, uint32_t checksum, double dsize, double ssize, PhysicalFont::Type type);
static std::unique_ptr<Font> create (const std::string &name, int fontindex, uint32_t checksum, double dsize, double ssize);
virtual Type type () const =0;
- bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override;
- virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=nullptr) const;
- virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=nullptr) const;
+ bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb) const override;
+ virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb) const;
+ virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb) const;
virtual bool isCIDFont () const;
virtual int hAdvance () const;
virtual std::string familyName () const;
@@ -129,12 +134,14 @@ class PhysicalFont : public virtual Font {
virtual double scaledAscent () const;
virtual int ascent () const;
virtual int descent () const;
- virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=nullptr) const;
+ virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const;
virtual int collectCharMapIDs (std::vector<CharMapID> &charmapIDs) const;
virtual CharMapID getCharMapID () const =0;
virtual void setCharMapID (const CharMapID &id) {}
virtual Character decodeChar (uint32_t c) const;
const char* path () const override;
+ void visit (FontVisitor &visitor) override;
+ void visit (FontVisitor &visitor) const override;
protected:
bool createGF (std::string &gfname) const;
@@ -159,7 +166,9 @@ class VirtualFont : public virtual Font {
public:
static std::unique_ptr<Font> create (const std::string &name, uint32_t checksum, double dsize, double ssize);
virtual const DVIVector* getDVI (int c) const =0;
- bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=nullptr) const override {return false;}
+ bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback*) const override {return false;}
+ void visit (FontVisitor &visitor) override;
+ void visit (FontVisitor &visitor) const override;
protected:
virtual void assignChar (uint32_t c, DVIVector &&dvi) =0;
@@ -272,6 +281,8 @@ class NativeFont : public PhysicalFont {
Color color () const override {return _color;}
const FontMap::Entry* fontMapEntry () const override {return nullptr;}
static std::string uniqueName (const std::string &path, const FontStyle &style);
+ void visit (FontVisitor &visitor) override;
+ void visit (FontVisitor &visitor) const override;
protected:
NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {}
@@ -390,6 +401,33 @@ class VirtualFontImpl : public VirtualFont, public TFMFont {
};
+struct FontVisitor {
+ virtual ~FontVisitor () =default;
+ virtual void visited (const PhysicalFont *font) {}
+ virtual void visited (const VirtualFont *font) {}
+ virtual void visited (const NativeFont *font) {visited(static_cast<const PhysicalFont*>(font));}
+ virtual void visited (PhysicalFont *font) {}
+ virtual void visited (VirtualFont *font) {}
+ virtual void visited (NativeFont *font) {visited(static_cast<PhysicalFont*>(font));}
+};
+
+
+/** This function works similar to dynamic_cast but only on pointers to Font classes.
+ * It uses double dispatch instead of RTTI and should therefore be faster.
+ * @param[in] font font pointer to be cast
+ * @return cast pointer on success, nullptr otherwise */
+template <typename C>
+C font_cast (typename util::set_const_of<Font>::by<typename std::remove_pointer<C>::type>::type *font) {
+ struct : FontVisitor {
+ void visited (C font) override {result = font;}
+ C result = nullptr;
+ } visitor;
+ if (font)
+ font->visit(visitor);
+ return visitor.result;
+}
+
+
struct FontException : public MessageException {
explicit FontException (const std::string &msg) : MessageException(msg) {}
};
diff --git a/dviware/dvisvgm/src/FontCache.cpp b/dviware/dvisvgm/src/FontCache.cpp
index 1fd13c9c11..2e741fb82c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -281,9 +281,9 @@ bool FontCache::fontinfo (const string &dirname, vector<FontInfo> &infos, vector
string path = dirname+"/"+(fname.substr(1));
ifstream ifs(path, ios::binary);
if (fontinfo(ifs, info))
- infos.emplace_back(move(info));
+ infos.push_back(move(info));
else
- invalid.emplace_back(fname.substr(1));
+ invalid.push_back(fname.substr(1));
}
}
}
diff --git a/dviware/dvisvgm/src/FontCache.hpp b/dviware/dvisvgm/src/FontCache.hpp
index 8a6025a3d2..e7bbf36126 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontEncoding.cpp b/dviware/dvisvgm/src/FontEncoding.cpp
index f1e1e38383..afc221063e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontEncoding.hpp b/dviware/dvisvgm/src/FontEncoding.hpp
index a50d97eabf..141f4486fe 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontEngine.cpp b/dviware/dvisvgm/src/FontEngine.cpp
index bee1ca886d..4a9e9dd955 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -103,7 +103,7 @@ bool FontEngine::setFont (const Font &font) {
return true;
if (const char *path=font.path()) {
- auto pf = dynamic_cast<const PhysicalFont*>(&font);
+ auto pf = font_cast<const PhysicalFont*>(&font);
if (setFont(path, font.fontIndex(), pf ? pf->getCharMapID() : CharMapID())) {
_currentFont = &font;
return true;
@@ -131,37 +131,38 @@ bool FontEngine::setCharMap (const CharMapID &charMapID) {
}
-/** Returns a character map that maps from character indexes to character codes
+/** Returns a character map that maps from glyph indexes to character codes
* of the current encoding.
* @param[out] charmap the resulting charmap */
-void FontEngine::buildCharMap (RangeMap &charmap) {
+void FontEngine::buildGidToCharCodeMap (RangeMap &charmap) {
charmap.clear();
- FT_UInt glyph_index;
- uint32_t charcode = FT_Get_First_Char(_currentFace, &glyph_index);
- while (glyph_index) {
- charmap.addRange(glyph_index, glyph_index, charcode);
- charcode = FT_Get_Next_Char(_currentFace, charcode, &glyph_index);
+ FT_UInt gid; // index of current glyph
+ uint32_t charcode = FT_Get_First_Char(_currentFace, &gid);
+ while (gid) {
+ if (!charmap.valueAt(gid))
+ charmap.addRange(gid, gid, charcode);
+ charcode = FT_Get_Next_Char(_currentFace, charcode, &gid);
}
}
-/** Creates a charmap that maps from the custom character encoding to unicode.
+/** Creates a charmap that maps from the custom character encoding to Unicode.
* @return pointer to charmap if it could be created, 0 otherwise */
unique_ptr<const RangeMap> FontEngine::createCustomToUnicodeMap () {
FT_CharMap ftcharmap = _currentFace->charmap;
if (FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) != 0)
return nullptr;
- RangeMap index_to_source_chrcode;
- buildCharMap(index_to_source_chrcode);
+ RangeMap gidToCharCodeMap;
+ buildGidToCharCodeMap(gidToCharCodeMap);
if (FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) != 0)
return nullptr;
auto charmap = util::make_unique<RangeMap>();
- FT_UInt glyph_index;
- uint32_t unicode_point = FT_Get_First_Char(_currentFace, &glyph_index);
- while (glyph_index) {
- uint32_t custom_charcode = index_to_source_chrcode.valueAt(glyph_index);
- charmap->addRange(custom_charcode, custom_charcode, unicode_point);
- unicode_point = FT_Get_Next_Char(_currentFace, unicode_point, &glyph_index);
+ FT_UInt gid; // index of current glyph
+ uint32_t ucCharcode = FT_Get_First_Char(_currentFace, &gid); // Unicode code point
+ while (gid) {
+ uint32_t customCharcode = gidToCharCodeMap.valueAt(gid);
+ charmap->addRange(customCharcode, customCharcode, ucCharcode);
+ ucCharcode = FT_Get_Next_Char(_currentFace, ucCharcode, &gid);
}
FT_Set_Charmap(_currentFace, ftcharmap);
return std::move(charmap);
@@ -307,7 +308,7 @@ int FontEngine::getCharMapIDs (vector<CharMapID> &charmapIDs) const {
if (_currentFace) {
for (int i=0; i < _currentFace->num_charmaps; i++) {
FT_CharMap charmap = _currentFace->charmaps[i];
- charmapIDs.emplace_back(CharMapID(charmap->platform_id, charmap->encoding_id));
+ charmapIDs.emplace_back(charmap->platform_id, charmap->encoding_id);
}
}
return charmapIDs.size();
diff --git a/dviware/dvisvgm/src/FontEngine.hpp b/dviware/dvisvgm/src/FontEngine.hpp
index 5796c2b1b3..45d9c6d3b6 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -64,7 +64,7 @@ class FontEngine {
std::string getGlyphName (const Character &c) const;
int getCharByGlyphName (const char *name) const;
bool setCharMap (const CharMapID &charMapID);
- void buildCharMap (RangeMap &charmap);
+ void buildGidToCharCodeMap (RangeMap &charmap);
std::unique_ptr<const RangeMap> createCustomToUnicodeMap ();
protected:
diff --git a/dviware/dvisvgm/src/FontManager.cpp b/dviware/dvisvgm/src/FontManager.cpp
index 929e9f823b..a41b8563b8 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -221,16 +221,14 @@ int FontManager::registerFont (uint32_t fontnum, const string &name, uint32_t ch
}
_name2id[name] = newid;
}
- _fonts.emplace_back(std::move(newfont));
+ _fonts.push_back(std::move(newfont));
if (_vfStack.empty()) // register font referenced in dvi file?
_num2id[fontnum] = newid;
else { // register font referenced in vf file
const VirtualFont *vf = _vfStack.top();
_vfnum2id[vf][fontnum] = newid;
- if (_vfFirstFontNumMap.find(vf) == _vfFirstFontNumMap.end()) { // first fontdef of VF?
- _vfFirstFontNumMap.emplace(vf, fontnum);
- _vfFirstFontMap.emplace(vf, _fonts.back().get());
- }
+ _vfFirstFontNumMap.emplace(vf, fontnum);
+ _vfFirstFontMap.emplace(vf, _fonts.back().get());
}
return newid;
}
@@ -269,7 +267,7 @@ int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex,
const int newid = _fonts.size(); // the new font gets this ID
auto it = _name2id.find(fontname);
if (it != _name2id.end()) { // font with same name already registered?
- if (auto font = dynamic_cast<NativeFont*>(_fonts[it->second].get()))
+ if (auto font = font_cast<NativeFont*>(_fonts[it->second].get()))
newfont = font->clone(ptsize, style, color);
}
else {
@@ -291,7 +289,7 @@ int FontManager::registerFont (uint32_t fontnum, string filename, int fontIndex,
}
_name2id[fontname] = newid;
}
- _fonts.emplace_back(std::move(newfont));
+ _fonts.push_back(std::move(newfont));
_num2id[fontnum] = newid;
return newid;
}
@@ -330,7 +328,7 @@ ostream& FontManager::write (ostream &os, Font *font, int level) {
if (_fonts[i] == font)
id = i;
- VirtualFont *vf = dynamic_cast<VirtualFont*>(font);
+ VirtualFont *vf = font_cast<VirtualFont*>(font);
for (int j=0; j < level+1; j++)
os << " ";
os << "id " << id
diff --git a/dviware/dvisvgm/src/FontManager.hpp b/dviware/dvisvgm/src/FontManager.hpp
index 321e167b11..413b649169 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontMap.cpp b/dviware/dvisvgm/src/FontMap.cpp
index 6be5fe6690..a16d38aa2f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontMap.hpp b/dviware/dvisvgm/src/FontMap.hpp
index f4824aa7f1..8ed6519922 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontMetrics.cpp b/dviware/dvisvgm/src/FontMetrics.cpp
index 7d858fea90..b2cba24818 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontMetrics.hpp b/dviware/dvisvgm/src/FontMetrics.hpp
index 66637e3044..20a2d46be0 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -43,6 +43,7 @@ struct FontMetrics {
virtual uint32_t getChecksum () const =0;
virtual uint16_t firstChar () const =0;
virtual uint16_t lastChar () const =0;
+ virtual bool isJFM () const {return false;}
static std::unique_ptr<FontMetrics> read (const std::string &fontname);
};
diff --git a/dviware/dvisvgm/src/FontStyle.hpp b/dviware/dvisvgm/src/FontStyle.hpp
index 79a03dac36..094ba2da1f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/FontWriter.cpp b/dviware/dvisvgm/src/FontWriter.cpp
index 4dd4c5c0d8..ccd4d037f5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -59,7 +59,7 @@ const FontWriter::FontFormatInfo* FontWriter::fontFormatInfo (FontFormat format)
vector<string> FontWriter::supportedFormats () {
vector<string> formats;
for (const FontFormatInfo &info : _formatInfos)
- formats.emplace_back(info.formatstr_short);
+ formats.push_back(info.formatstr_short);
return formats;
}
diff --git a/dviware/dvisvgm/src/FontWriter.hpp b/dviware/dvisvgm/src/FontWriter.hpp
index e6cad37e88..1fa5dab4db 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/GFGlyphTracer.cpp b/dviware/dvisvgm/src/GFGlyphTracer.cpp
index db77ae1dc8..8c346b0464 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -25,7 +25,7 @@ using namespace std;
/** Constructs a new glyph tracer.
* @param[in] is GF input stream
* @param[in] upp target units per PS point */
-GFGlyphTracer::GFGlyphTracer (string &fname, double upp, Callback *cb)
+GFGlyphTracer::GFGlyphTracer (const string &fname, double upp, Callback *cb)
: GFTracer(_ifs, upp), _callback(cb)
{
if (_callback)
@@ -34,7 +34,7 @@ GFGlyphTracer::GFGlyphTracer (string &fname, double upp, Callback *cb)
}
-void GFGlyphTracer::reset (string &fname, double upp) {
+void GFGlyphTracer::reset (const string &fname, double upp) {
if (_callback)
_callback->setFont(fname);
if (_ifs.is_open())
diff --git a/dviware/dvisvgm/src/GFGlyphTracer.hpp b/dviware/dvisvgm/src/GFGlyphTracer.hpp
index d0d45ffd61..21ff3178fc 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -38,8 +38,8 @@ class GFGlyphTracer : public GFTracer {
public:
GFGlyphTracer () : GFTracer(_ifs, 0) {}
- GFGlyphTracer (std::string &fname, double upp, Callback *cb=nullptr);
- void reset (std::string &fname, double upp);
+ GFGlyphTracer (const std::string &fname, double upp, Callback *cb=nullptr);
+ void reset (const std::string &fname, double upp);
void setCallback (Callback *cb) {_callback = cb;}
bool executeChar (uint8_t c) override;
void moveTo (double x, double y) override;
diff --git a/dviware/dvisvgm/src/GFReader.cpp b/dviware/dvisvgm/src/GFReader.cpp
index 4712de41d3..fba6e665de 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -92,7 +92,7 @@ int GFReader::executeCommand () {
if (opcode < 0) // at end of file?
throw GFException("unexpected end of file");
- if (opcode >= 0 && opcode <= 63)
+ if (opcode <= 63)
cmdPaint0(opcode);
else if (opcode >= 74 && opcode <= 238)
cmdNewRow(opcode-74);
diff --git a/dviware/dvisvgm/src/GFReader.hpp b/dviware/dvisvgm/src/GFReader.hpp
index e829bf8ffa..401f89babb 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/GFTracer.cpp b/dviware/dvisvgm/src/GFTracer.cpp
index 4a3fa5e776..408fb49d0b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/GFTracer.hpp b/dviware/dvisvgm/src/GFTracer.hpp
index e72848896d..f52ffd6cc8 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Ghostscript.cpp b/dviware/dvisvgm/src/Ghostscript.cpp
index 11ea79fc1a..96b06b1b68 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -215,7 +215,7 @@ bool Ghostscript::available () {
/** Retrieves version information about Ghostscript.
* @param[out] r takes the revision information (see GS API documentation for further details)
* @return true on success */
-bool Ghostscript::revision (gsapi_revision_t *r) {
+bool Ghostscript::revision (gsapi_revision_t *r) const {
#if defined(HAVE_LIBGS)
return (gsapi_revision(r, sizeof(gsapi_revision_t)) == 0);
#else
@@ -227,7 +227,7 @@ bool Ghostscript::revision (gsapi_revision_t *r) {
/** Returns the revision number of the GS library. */
-int Ghostscript::revision () {
+int Ghostscript::revision () const {
gsapi_revision_t r;
if (revision(&r))
return static_cast<int>(r.revision);
diff --git a/dviware/dvisvgm/src/Ghostscript.hpp b/dviware/dvisvgm/src/Ghostscript.hpp
index 8c9a429798..88bebf01ea 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -78,8 +78,8 @@ class Ghostscript
~Ghostscript ();
bool init (int argc, const char **argv, void *caller=nullptr);
bool available ();
- bool revision (gsapi_revision_t *r);
- int revision ();
+ bool revision (gsapi_revision_t *r) const;
+ int revision () const;
std::string revisionstr ();
int set_stdio (Stdin in, Stdout out, Stderr err);
int run_string_begin (int user_errors, int *pexit_code);
diff --git a/dviware/dvisvgm/src/Glyph.hpp b/dviware/dvisvgm/src/Glyph.hpp
index dfa8cb366a..37de9bd58c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/GlyphTracerMessages.hpp b/dviware/dvisvgm/src/GlyphTracerMessages.hpp
index f291d05ccc..32f4f08955 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/GraphicsPath.hpp b/dviware/dvisvgm/src/GraphicsPath.hpp
index 64c112ad0b..a0c9f8ab8f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -20,6 +20,7 @@
#pragma once
+#include <algorithm>
#include <array>
#include <cctype>
#include <cmath>
@@ -662,24 +663,14 @@ class GraphicsPath {
bool operator == (const GraphicsPath &path) const {
if (size() != path.size())
return false;
- auto it = _commands.begin();
- for (const auto &cmd : path._commands) {
- if (*it++ != cmd)
- return false;
- }
- return true;
+ return std::equal(_commands.begin(), _commands.end(), path._commands.begin());
}
/** Returns true if this path differs from another one (command-wise). */
bool operator != (const GraphicsPath &path) const {
if (size() != path.size())
return true;
- auto it = _commands.begin();
- for (const auto &cmd : path._commands) {
- if (*it++ != cmd)
- return true;
- }
- return false;
+ return !std::equal(_commands.begin(), _commands.end(), path._commands.begin());
}
/** Iterates over all commands defining this path and calls the corresponding template methods.
diff --git a/dviware/dvisvgm/src/HashFunction.cpp b/dviware/dvisvgm/src/HashFunction.cpp
index 16661fb3d6..bada148b6c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/HashFunction.hpp b/dviware/dvisvgm/src/HashFunction.hpp
index e31040075e..5efbdf8468 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/HtmlSpecialHandler.cpp b/dviware/dvisvgm/src/HtmlSpecialHandler.cpp
index 01051f9d64..dca8111405 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/HtmlSpecialHandler.hpp b/dviware/dvisvgm/src/HtmlSpecialHandler.hpp
index e09a6d7b51..2122ed749d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/HyperlinkManager.cpp b/dviware/dvisvgm/src/HyperlinkManager.cpp
index ef636c5aac..f991e13145 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -106,7 +106,7 @@ void HyperlinkManager::createLink (string uri, SpecialActions &actions) {
uri = "/" + uri;
uri = _base + uri;
}
- auto anchorNode = util::make_unique<XMLElement>("a");
+ auto anchorNode = util::make_unique<SVGElement>("a");
anchorNode->addAttribute("xlink:href", uri);
anchorNode->addAttribute("xlink:title", XMLString(name.empty() ? uri : name, false));
actions.svgTree().pushPageContext(std::move(anchorNode));
@@ -148,14 +148,14 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) {
if (bbox.width() > 0 && bbox.height() > 0) { // does the bounding box extend in both dimensions?
if (MARKER_TYPE != MarkerType::NONE) {
const double linewidth = _linewidth >= 0 ? _linewidth : min(0.5, bbox.height()/15);
- auto rect = util::make_unique<XMLElement>("rect");
+ auto rect = util::make_unique<SVGElement>("rect");
double x = bbox.minX();
double y = bbox.maxY()+linewidth;
double w = bbox.width();
double h = linewidth;
const Color linecolor = COLORSOURCE == ColorSource::DEFAULT ? actions.getColor() : LINK_LINECOLOR;
if (MARKER_TYPE == MarkerType::LINE)
- rect->addAttribute("fill", linecolor.svgColorString());
+ rect->setFillColor(linecolor);
else {
const double offset = _linewidth < 0 ? linewidth : 0 ;
x -= offset;
@@ -163,16 +163,16 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) {
w += 2*offset;
h += bbox.height()+offset;
if (MARKER_TYPE == MarkerType::BGCOLOR) {
- rect->addAttribute("fill", LINK_BGCOLOR.svgColorString());
+ rect->setFillColor(LINK_BGCOLOR);
if (COLORSOURCE != ColorSource::DEFAULT) {
- rect->addAttribute("stroke", linecolor.svgColorString());
- rect->addAttribute("stroke-width", linewidth);
+ rect->setStrokeColor(linecolor);
+ rect->setStrokeWidth(linewidth);
}
}
else { // LM_BOX
- rect->addAttribute("fill", "none");
- rect->addAttribute("stroke", linecolor.svgColorString());
- rect->addAttribute("stroke-width", linewidth);
+ rect->setNoFillColor();
+ rect->setStrokeColor(linecolor);
+ rect->setStrokeWidth(linewidth);
}
}
rect->addAttribute("x", x);
@@ -192,13 +192,13 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) {
// Create an invisible rectangle around the linked area so that it's easier to access.
// This is only necessary when using paths rather than real text elements together with fonts.
if (!SVGTree::USE_FONTS) {
- auto rect = util::make_unique<XMLElement>("rect");
+ auto rect = util::make_unique<SVGElement>("rect");
rect->addAttribute("x", bbox.minX());
rect->addAttribute("y", bbox.minY());
rect->addAttribute("width", bbox.width());
rect->addAttribute("height", bbox.height());
- rect->addAttribute("fill", "white");
- rect->addAttribute("fill-opacity", 0);
+ rect->setFillColor(Color::WHITE);
+ rect->setFillOpacity(OpacityAlpha(0, 0));
actions.svgTree().appendToPage(std::move(rect));
}
}
diff --git a/dviware/dvisvgm/src/HyperlinkManager.hpp b/dviware/dvisvgm/src/HyperlinkManager.hpp
index ca8d4fd0ef..9dfbb02532 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -52,7 +52,7 @@ class HyperlinkManager {
void checkNewLine (SpecialActions &actions);
void createLink (std::string uri, SpecialActions &actions);
void createViews (unsigned pageno, SpecialActions &actions);
- void setBaseUrl (std::string &base) {_base = base;}
+ void setBaseUrl (const std::string &base) {_base = base;}
void setLineWidth (double w) {_linewidth = w;}
static HyperlinkManager& instance ();
static bool setLinkMarker (const std::string &marker);
diff --git a/dviware/dvisvgm/src/ImageToSVG.cpp b/dviware/dvisvgm/src/ImageToSVG.cpp
index dfb7943a06..6c52a0b826 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ImageToSVG.hpp b/dviware/dvisvgm/src/ImageToSVG.hpp
index 92a860949c..04d86751eb 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -57,9 +57,11 @@ class ImageToSVG : protected SpecialActions {
void setY (double y) override {_y = y; _svg.setY(y);}
void finishLine () override {}
void setColor (const Color &color) override {_svg.setColor(color);}
+ void setOpacity (const Opacity &opacity) override {_svg.setOpacity(opacity);}
Color getColor () const override {return _svg.getColor();}
void setMatrix (const Matrix &m) override {_svg.setMatrix(m);}
const Matrix& getMatrix () const override {return _svg.getMatrix();}
+ const Opacity& getOpacity () const override {return _svg.getOpacity();}
const SVGTree& svgTree () const override {return _svg;}
void setBgColor (const Color &color) override {}
void embed (const BoundingBox &bbox) override {_bbox.embed(bbox);}
diff --git a/dviware/dvisvgm/src/InputBuffer.cpp b/dviware/dvisvgm/src/InputBuffer.cpp
index b6e85f27e1..6ee562da7d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/InputBuffer.hpp b/dviware/dvisvgm/src/InputBuffer.hpp
index 1474ce0a52..a59cdc31c9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -40,12 +40,14 @@ struct InputBuffer {
class StreamInputBuffer : public InputBuffer {
public:
explicit StreamInputBuffer (std::istream &is, size_t bufsize=1024);
+ StreamInputBuffer (const StreamInputBuffer &ib) =delete;
~StreamInputBuffer () override;
int get () override;
int peek () const override;
int peek (size_t n) const override;
bool eof () const override {return pos() == _size1 && _size2 == 0;}
void invalidate () override {_bufptr = _buf1+_size1; _size2 = 0;}
+ void operator = (const StreamInputBuffer &ib) =delete;
protected:
int fillBuffer (uint8_t *buf);
@@ -65,6 +67,7 @@ class StreamInputBuffer : public InputBuffer {
class StringInputBuffer : public InputBuffer {
public:
explicit StringInputBuffer (const std::string &str) : _str(&str) {}
+ StringInputBuffer (const StreamInputBuffer &ib) =delete;
void assign (const std::string &str) {_str = &str; _pos=0;}
int get () override {return _pos < _str->length() ? _str->at(_pos++) : -1;}
int peek () const override {return _pos < _str->length() ? _str->at(_pos) : -1;}
@@ -81,6 +84,7 @@ class StringInputBuffer : public InputBuffer {
class CharInputBuffer : public InputBuffer {
public:
CharInputBuffer (const char *buf, size_t size) : _pos(buf), _size(buf ? size : 0) {}
+ CharInputBuffer (const CharInputBuffer &ib) =delete;
int get () override {
if (_size == 0)
@@ -112,6 +116,7 @@ class CharInputBuffer : public InputBuffer {
class SplittedCharInputBuffer : public InputBuffer {
public:
SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2);
+ SplittedCharInputBuffer (const SplittedCharInputBuffer &ib) =delete;
int get () override;
int peek () const override;
int peek (size_t n) const override;
diff --git a/dviware/dvisvgm/src/InputReader.cpp b/dviware/dvisvgm/src/InputReader.cpp
index 074c184822..6b5a7b70f0 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/InputReader.hpp b/dviware/dvisvgm/src/InputReader.hpp
index 9825156c09..d9b697963b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/JFM.cpp b/dviware/dvisvgm/src/JFM.cpp
index 7c749fd34e..d0dd13c9b9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/JFM.hpp b/dviware/dvisvgm/src/JFM.hpp
index 8d4a1daf21..29da9d53c3 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -29,6 +29,7 @@ class JFM : public TFM {
public:
explicit JFM (std::istream &is);
bool verticalLayout () const override {return _vertical;}
+ bool isJFM () const override {return true;}
uint32_t minChar () const {return _minchar;}
uint32_t maxChar () const {return static_cast<uint32_t>(_minchar+_charTypeTable.size()-1);}
diff --git a/dviware/dvisvgm/src/Length.cpp b/dviware/dvisvgm/src/Length.cpp
index d20af5056c..d4992c77ef 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Length.hpp b/dviware/dvisvgm/src/Length.hpp
index 1b0d35d35f..f03711ecd2 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MD5HashFunction.hpp b/dviware/dvisvgm/src/MD5HashFunction.hpp
index 27539576ed..e34db10602 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Makefile.am b/dviware/dvisvgm/src/Makefile.am
index e7c7c27522..3163e892a8 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-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
@@ -104,6 +104,7 @@ libdvisvgm_la_SOURCES = \
MetafontWrapper.hpp MetafontWrapper.cpp \
NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \
NumericRanges.hpp \
+ Opacity.hpp Opacity.cpp \
PageRanges.hpp PageRanges.cpp \
PageSize.hpp PageSize.cpp \
Pair.hpp \
@@ -134,6 +135,7 @@ libdvisvgm_la_SOURCES = \
SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \
SVGCharPathHandler.hpp SVGCharPathHandler.cpp \
SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \
+ SVGElement.hpp SVGElement.cpp \
SVGOutput.hpp SVGOutput.cpp \
SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \
SVGTree.hpp SVGTree.cpp \
diff --git a/dviware/dvisvgm/src/Makefile.in b/dviware/dvisvgm/src/Makefile.in
index b327bda7ac..0ef19f52c2 100644
--- a/dviware/dvisvgm/src/Makefile.in
+++ b/dviware/dvisvgm/src/Makefile.in
@@ -163,29 +163,30 @@ am__libdvisvgm_la_SOURCES_DIST = AGLTable.hpp BasicDVIReader.hpp \
MD5HashFunction.hpp Message.hpp Message.cpp \
MessageException.hpp MetafontWrapper.hpp MetafontWrapper.cpp \
NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \
- NumericRanges.hpp PageRanges.hpp PageRanges.cpp PageSize.hpp \
- PageSize.cpp Pair.hpp PapersizeSpecialHandler.hpp \
- PapersizeSpecialHandler.cpp PathClipper.hpp PathClipper.cpp \
- PDFParser.hpp PDFParser.cpp PdfSpecialHandler.hpp \
- PdfSpecialHandler.cpp PDFToSVG.hpp PreScanDVIReader.hpp \
- PreScanDVIReader.cpp Process.hpp Process.cpp psdefs.cpp \
- PSFilter.hpp PSInterpreter.hpp PSInterpreter.cpp PSPattern.hpp \
- PSPattern.cpp PSPreviewFilter.hpp PSPreviewFilter.cpp \
- PsSpecialHandler.hpp PsSpecialHandler.cpp RangeMap.hpp \
- RangeMap.cpp ShadingPatch.hpp ShadingPatch.cpp \
- SignalHandler.hpp SignalHandler.cpp SourceInput.hpp \
- SourceInput.cpp SpecialActions.hpp SpecialHandler.hpp \
- SpecialManager.hpp SpecialManager.cpp StreamReader.hpp \
- StreamReader.cpp StreamWriter.hpp StreamWriter.cpp Subfont.hpp \
- Subfont.cpp SVGCharHandler.hpp SVGCharHandler.cpp \
+ NumericRanges.hpp Opacity.hpp Opacity.cpp PageRanges.hpp \
+ PageRanges.cpp PageSize.hpp PageSize.cpp Pair.hpp \
+ PapersizeSpecialHandler.hpp PapersizeSpecialHandler.cpp \
+ PathClipper.hpp PathClipper.cpp PDFParser.hpp PDFParser.cpp \
+ PdfSpecialHandler.hpp PdfSpecialHandler.cpp PDFToSVG.hpp \
+ PreScanDVIReader.hpp PreScanDVIReader.cpp Process.hpp \
+ Process.cpp psdefs.cpp PSFilter.hpp PSInterpreter.hpp \
+ PSInterpreter.cpp PSPattern.hpp PSPattern.cpp \
+ PSPreviewFilter.hpp PSPreviewFilter.cpp PsSpecialHandler.hpp \
+ PsSpecialHandler.cpp RangeMap.hpp RangeMap.cpp \
+ ShadingPatch.hpp ShadingPatch.cpp SignalHandler.hpp \
+ SignalHandler.cpp SourceInput.hpp SourceInput.cpp \
+ SpecialActions.hpp SpecialHandler.hpp SpecialManager.hpp \
+ SpecialManager.cpp StreamReader.hpp StreamReader.cpp \
+ StreamWriter.hpp StreamWriter.cpp Subfont.hpp Subfont.cpp \
+ SVGCharHandler.hpp SVGCharHandler.cpp \
SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \
SVGCharPathHandler.hpp SVGCharPathHandler.cpp \
SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \
- SVGOutput.hpp SVGOutput.cpp SVGSingleCharTextHandler.hpp \
- SVGSingleCharTextHandler.cpp SVGTree.hpp SVGTree.cpp \
- System.hpp System.cpp TensorProductPatch.hpp \
- TensorProductPatch.cpp Terminal.hpp Terminal.cpp TFM.hpp \
- TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \
+ SVGElement.hpp SVGElement.cpp SVGOutput.hpp SVGOutput.cpp \
+ SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \
+ SVGTree.hpp SVGTree.cpp System.hpp System.cpp \
+ TensorProductPatch.hpp TensorProductPatch.cpp Terminal.hpp \
+ Terminal.cpp TFM.hpp TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \
TpicSpecialHandler.hpp TpicSpecialHandler.cpp \
TriangularPatch.hpp TriangularPatch.cpp TrueTypeFont.hpp \
TrueTypeFont.cpp TTFAutohint.hpp TTFAutohint.cpp Unicode.hpp \
@@ -208,7 +209,7 @@ am_libdvisvgm_la_OBJECTS = BasicDVIReader.lo Bezier.lo \
Ghostscript.lo HashFunction.lo HtmlSpecialHandler.lo \
HyperlinkManager.lo ImageToSVG.lo InputBuffer.lo \
InputReader.lo JFM.lo Length.lo MapLine.lo Matrix.lo \
- Message.lo MetafontWrapper.lo NoPsSpecialHandler.lo \
+ Message.lo MetafontWrapper.lo NoPsSpecialHandler.lo Opacity.lo \
PageRanges.lo PageSize.lo PapersizeSpecialHandler.lo \
PathClipper.lo PDFParser.lo PdfSpecialHandler.lo \
PreScanDVIReader.lo Process.lo psdefs.lo PSInterpreter.lo \
@@ -216,8 +217,8 @@ am_libdvisvgm_la_OBJECTS = BasicDVIReader.lo Bezier.lo \
RangeMap.lo ShadingPatch.lo SignalHandler.lo SourceInput.lo \
SpecialManager.lo StreamReader.lo StreamWriter.lo Subfont.lo \
SVGCharHandler.lo SVGCharHandlerFactory.lo \
- SVGCharPathHandler.lo SVGCharTspanTextHandler.lo SVGOutput.lo \
- SVGSingleCharTextHandler.lo SVGTree.lo System.lo \
+ SVGCharPathHandler.lo SVGCharTspanTextHandler.lo SVGElement.lo \
+ SVGOutput.lo SVGSingleCharTextHandler.lo SVGTree.lo System.lo \
TensorProductPatch.lo Terminal.lo TFM.lo ToUnicodeMap.lo \
TpicSpecialHandler.lo TriangularPatch.lo TrueTypeFont.lo \
TTFAutohint.lo Unicode.lo utility.lo VFReader.lo \
@@ -277,10 +278,10 @@ am__depfiles_remade = ./$(DEPDIR)/BasicDVIReader.Plo \
./$(DEPDIR)/JFM.Plo ./$(DEPDIR)/Length.Plo \
./$(DEPDIR)/MapLine.Plo ./$(DEPDIR)/Matrix.Plo \
./$(DEPDIR)/Message.Plo ./$(DEPDIR)/MetafontWrapper.Plo \
- ./$(DEPDIR)/NoPsSpecialHandler.Plo ./$(DEPDIR)/PDFParser.Plo \
- ./$(DEPDIR)/PSInterpreter.Plo ./$(DEPDIR)/PSPattern.Plo \
- ./$(DEPDIR)/PSPreviewFilter.Plo ./$(DEPDIR)/PageRanges.Plo \
- ./$(DEPDIR)/PageSize.Plo \
+ ./$(DEPDIR)/NoPsSpecialHandler.Plo ./$(DEPDIR)/Opacity.Plo \
+ ./$(DEPDIR)/PDFParser.Plo ./$(DEPDIR)/PSInterpreter.Plo \
+ ./$(DEPDIR)/PSPattern.Plo ./$(DEPDIR)/PSPreviewFilter.Plo \
+ ./$(DEPDIR)/PageRanges.Plo ./$(DEPDIR)/PageSize.Plo \
./$(DEPDIR)/PapersizeSpecialHandler.Plo \
./$(DEPDIR)/PathClipper.Plo ./$(DEPDIR)/PdfSpecialHandler.Plo \
./$(DEPDIR)/PreScanDVIReader.Plo ./$(DEPDIR)/Process.Plo \
@@ -289,7 +290,7 @@ am__depfiles_remade = ./$(DEPDIR)/BasicDVIReader.Plo \
./$(DEPDIR)/SVGCharHandlerFactory.Plo \
./$(DEPDIR)/SVGCharPathHandler.Plo \
./$(DEPDIR)/SVGCharTspanTextHandler.Plo \
- ./$(DEPDIR)/SVGOutput.Plo \
+ ./$(DEPDIR)/SVGElement.Plo ./$(DEPDIR)/SVGOutput.Plo \
./$(DEPDIR)/SVGSingleCharTextHandler.Plo \
./$(DEPDIR)/SVGTree.Plo ./$(DEPDIR)/ShadingPatch.Plo \
./$(DEPDIR)/SignalHandler.Plo ./$(DEPDIR)/SourceInput.Plo \
@@ -559,6 +560,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -618,29 +620,30 @@ libdvisvgm_la_SOURCES = AGLTable.hpp BasicDVIReader.hpp \
MD5HashFunction.hpp Message.hpp Message.cpp \
MessageException.hpp MetafontWrapper.hpp MetafontWrapper.cpp \
NoPsSpecialHandler.hpp NoPsSpecialHandler.cpp \
- NumericRanges.hpp PageRanges.hpp PageRanges.cpp PageSize.hpp \
- PageSize.cpp Pair.hpp PapersizeSpecialHandler.hpp \
- PapersizeSpecialHandler.cpp PathClipper.hpp PathClipper.cpp \
- PDFParser.hpp PDFParser.cpp PdfSpecialHandler.hpp \
- PdfSpecialHandler.cpp PDFToSVG.hpp PreScanDVIReader.hpp \
- PreScanDVIReader.cpp Process.hpp Process.cpp psdefs.cpp \
- PSFilter.hpp PSInterpreter.hpp PSInterpreter.cpp PSPattern.hpp \
- PSPattern.cpp PSPreviewFilter.hpp PSPreviewFilter.cpp \
- PsSpecialHandler.hpp PsSpecialHandler.cpp RangeMap.hpp \
- RangeMap.cpp ShadingPatch.hpp ShadingPatch.cpp \
- SignalHandler.hpp SignalHandler.cpp SourceInput.hpp \
- SourceInput.cpp SpecialActions.hpp SpecialHandler.hpp \
- SpecialManager.hpp SpecialManager.cpp StreamReader.hpp \
- StreamReader.cpp StreamWriter.hpp StreamWriter.cpp Subfont.hpp \
- Subfont.cpp SVGCharHandler.hpp SVGCharHandler.cpp \
+ NumericRanges.hpp Opacity.hpp Opacity.cpp PageRanges.hpp \
+ PageRanges.cpp PageSize.hpp PageSize.cpp Pair.hpp \
+ PapersizeSpecialHandler.hpp PapersizeSpecialHandler.cpp \
+ PathClipper.hpp PathClipper.cpp PDFParser.hpp PDFParser.cpp \
+ PdfSpecialHandler.hpp PdfSpecialHandler.cpp PDFToSVG.hpp \
+ PreScanDVIReader.hpp PreScanDVIReader.cpp Process.hpp \
+ Process.cpp psdefs.cpp PSFilter.hpp PSInterpreter.hpp \
+ PSInterpreter.cpp PSPattern.hpp PSPattern.cpp \
+ PSPreviewFilter.hpp PSPreviewFilter.cpp PsSpecialHandler.hpp \
+ PsSpecialHandler.cpp RangeMap.hpp RangeMap.cpp \
+ ShadingPatch.hpp ShadingPatch.cpp SignalHandler.hpp \
+ SignalHandler.cpp SourceInput.hpp SourceInput.cpp \
+ SpecialActions.hpp SpecialHandler.hpp SpecialManager.hpp \
+ SpecialManager.cpp StreamReader.hpp StreamReader.cpp \
+ StreamWriter.hpp StreamWriter.cpp Subfont.hpp Subfont.cpp \
+ SVGCharHandler.hpp SVGCharHandler.cpp \
SVGCharHandlerFactory.hpp SVGCharHandlerFactory.cpp \
SVGCharPathHandler.hpp SVGCharPathHandler.cpp \
SVGCharTspanTextHandler.hpp SVGCharTspanTextHandler.cpp \
- SVGOutput.hpp SVGOutput.cpp SVGSingleCharTextHandler.hpp \
- SVGSingleCharTextHandler.cpp SVGTree.hpp SVGTree.cpp \
- System.hpp System.cpp TensorProductPatch.hpp \
- TensorProductPatch.cpp Terminal.hpp Terminal.cpp TFM.hpp \
- TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \
+ SVGElement.hpp SVGElement.cpp SVGOutput.hpp SVGOutput.cpp \
+ SVGSingleCharTextHandler.hpp SVGSingleCharTextHandler.cpp \
+ SVGTree.hpp SVGTree.cpp System.hpp System.cpp \
+ TensorProductPatch.hpp TensorProductPatch.cpp Terminal.hpp \
+ Terminal.cpp TFM.hpp TFM.cpp ToUnicodeMap.hpp ToUnicodeMap.cpp \
TpicSpecialHandler.hpp TpicSpecialHandler.cpp \
TriangularPatch.hpp TriangularPatch.cpp TrueTypeFont.hpp \
TrueTypeFont.cpp TTFAutohint.hpp TTFAutohint.cpp Unicode.hpp \
@@ -821,6 +824,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Message.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetafontWrapper.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NoPsSpecialHandler.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Opacity.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDFParser.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSInterpreter.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PSPattern.Plo@am__quote@ # am--include-marker
@@ -838,6 +842,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandlerFactory.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharPathHandler.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharTspanTextHandler.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGElement.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGOutput.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGSingleCharTextHandler.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGTree.Plo@am__quote@ # am--include-marker
@@ -1180,6 +1185,7 @@ distclean: distclean-recursive
-rm -f ./$(DEPDIR)/Message.Plo
-rm -f ./$(DEPDIR)/MetafontWrapper.Plo
-rm -f ./$(DEPDIR)/NoPsSpecialHandler.Plo
+ -rm -f ./$(DEPDIR)/Opacity.Plo
-rm -f ./$(DEPDIR)/PDFParser.Plo
-rm -f ./$(DEPDIR)/PSInterpreter.Plo
-rm -f ./$(DEPDIR)/PSPattern.Plo
@@ -1197,6 +1203,7 @@ distclean: distclean-recursive
-rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Plo
-rm -f ./$(DEPDIR)/SVGCharPathHandler.Plo
-rm -f ./$(DEPDIR)/SVGCharTspanTextHandler.Plo
+ -rm -f ./$(DEPDIR)/SVGElement.Plo
-rm -f ./$(DEPDIR)/SVGOutput.Plo
-rm -f ./$(DEPDIR)/SVGSingleCharTextHandler.Plo
-rm -f ./$(DEPDIR)/SVGTree.Plo
@@ -1321,6 +1328,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f ./$(DEPDIR)/Message.Plo
-rm -f ./$(DEPDIR)/MetafontWrapper.Plo
-rm -f ./$(DEPDIR)/NoPsSpecialHandler.Plo
+ -rm -f ./$(DEPDIR)/Opacity.Plo
-rm -f ./$(DEPDIR)/PDFParser.Plo
-rm -f ./$(DEPDIR)/PSInterpreter.Plo
-rm -f ./$(DEPDIR)/PSPattern.Plo
@@ -1338,6 +1346,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Plo
-rm -f ./$(DEPDIR)/SVGCharPathHandler.Plo
-rm -f ./$(DEPDIR)/SVGCharTspanTextHandler.Plo
+ -rm -f ./$(DEPDIR)/SVGElement.Plo
-rm -f ./$(DEPDIR)/SVGOutput.Plo
-rm -f ./$(DEPDIR)/SVGSingleCharTextHandler.Plo
-rm -f ./$(DEPDIR)/SVGTree.Plo
diff --git a/dviware/dvisvgm/src/MapLine.cpp b/dviware/dvisvgm/src/MapLine.cpp
index cd3d8ae7ea..5b43cd448a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MapLine.hpp b/dviware/dvisvgm/src/MapLine.hpp
index 9a6fa17648..2d75665353 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Matrix.cpp b/dviware/dvisvgm/src/Matrix.cpp
index d0dcb2124d..d4c6e19629 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -520,7 +520,7 @@ Matrix Matrix::parseSVGTransform (const string &transform) {
vector<double> params;
if (parse_transform_cmd(iss, "matrix", 6, 6, params)) {
if (ne(params[0], 1) || ne(params[1], 0) || ne(params[2], 0) || ne(params[3], 1) || ne(params[4], 0) || ne(params[5], 0))
- matrix.rmultiply({params[0], params[2], params[4], params[1], params[3], params[5]});
+ matrix.rmultiply(Matrix{params[0], params[2], params[4], params[1], params[3], params[5]});
}
else if (parse_transform_cmd(iss, "rotate", 1, 3, params)) {
if (params.size() == 1) {
diff --git a/dviware/dvisvgm/src/Matrix.hpp b/dviware/dvisvgm/src/Matrix.hpp
index 154ac8a37b..cff7353055 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -40,11 +40,12 @@ class Matrix {
friend double det (const Matrix &m, int row, int col);
public:
+ Matrix () {set(0);}
+ Matrix (double d);
Matrix (const std::string &cmds, Calculator &calc);
- Matrix (double d=0);
explicit Matrix (const double *v, unsigned size=9);
explicit Matrix (const std::vector<double> &v, int start=0);
- Matrix (std::initializer_list<double> initlist);
+ explicit Matrix (std::initializer_list<double> initlist);
Matrix& set (double d);
Matrix& set (const double *v, unsigned size);
Matrix& set (const std::vector<double> &v, int start=0);
diff --git a/dviware/dvisvgm/src/Message.cpp b/dviware/dvisvgm/src/Message.cpp
index caf8051f88..e829f78e16 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -74,7 +74,7 @@ void MessageStream::putChar (char c, ostream &os) {
_col++;
}
_nl = false;
- if (!_nl || c != '\n')
+ if (c != '\n')
os << c;
}
}
diff --git a/dviware/dvisvgm/src/Message.hpp b/dviware/dvisvgm/src/Message.hpp
index fd6f048622..afb93d9432 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MessageException.hpp b/dviware/dvisvgm/src/MessageException.hpp
index 325e83e403..1cfcb49e7d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MetafontWrapper.cpp b/dviware/dvisvgm/src/MetafontWrapper.cpp
index 11667fb5e7..7788bef3d9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MetafontWrapper.hpp b/dviware/dvisvgm/src/MetafontWrapper.hpp
index 582a146aee..4ec5afd304 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MiKTeXCom.cpp b/dviware/dvisvgm/src/MiKTeXCom.cpp
index 9cd02edf41..1bbd40cae6 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/MiKTeXCom.hpp b/dviware/dvisvgm/src/MiKTeXCom.hpp
index 3da270cea1..b05b26a132 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/NoPsSpecialHandler.cpp b/dviware/dvisvgm/src/NoPsSpecialHandler.cpp
index f5b3d7244e..77af3d9d0c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/NoPsSpecialHandler.hpp b/dviware/dvisvgm/src/NoPsSpecialHandler.hpp
index 9af3d47df5..b4af33ab6c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/NumericRanges.hpp b/dviware/dvisvgm/src/NumericRanges.hpp
index 1669f7ddce..5102b715b0 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Opacity.cpp b/dviware/dvisvgm/src/Opacity.cpp
new file mode 100644
index 0000000000..efc8bed05e
--- /dev/null
+++ b/dviware/dvisvgm/src/Opacity.cpp
@@ -0,0 +1,59 @@
+/*************************************************************************
+** Opacity.cpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
+** **
+** This program is free software; you can redistribute it and/or **
+** modify it under the terms of the GNU General Public License as **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#include "Opacity.hpp"
+
+using namespace std;
+
+string Opacity::cssBlendMode (BlendMode bm) {
+ switch (bm) {
+ case BM_NORMAL : return "normal";
+ case BM_MULTIPLY : return "multiply";
+ case BM_SCREEN : return "screen";
+ case BM_OVERLAY : return "overlay";
+ case BM_SOFTLIGHT : return "soft-light";
+ case BM_HARDLIGHT : return "hard-light";
+ case BM_COLORDODGE: return "color-dodge";
+ case BM_COLORBURN : return "color-burn";
+ case BM_DARKEN : return "darken";
+ case BM_LIGHTEN : return "lighten";
+ case BM_DIFFERENCE: return "difference";
+ case BM_EXCLUSION : return "exclusion";
+ case BM_HUE : return "hue";
+ case BM_SATURATION: return "saturation";
+ case BM_COLOR : return "color";
+ case BM_LUMINOSITY: return "luminosity";
+ }
+ return "";
+}
+
+
+bool Opacity::operator == (const Opacity &opacity) const {
+ return opacity._fillalpha == _fillalpha
+ && opacity._strokealpha == _strokealpha
+ && opacity._blendMode == _blendMode;
+}
+
+
+bool Opacity::operator != (const Opacity &opacity) const {
+ return opacity._fillalpha != _fillalpha
+ || opacity._strokealpha != _strokealpha
+ || opacity._blendMode != _blendMode;
+} \ No newline at end of file
diff --git a/dviware/dvisvgm/src/Opacity.hpp b/dviware/dvisvgm/src/Opacity.hpp
new file mode 100644
index 0000000000..8a4e1edac6
--- /dev/null
+++ b/dviware/dvisvgm/src/Opacity.hpp
@@ -0,0 +1,75 @@
+/*************************************************************************
+** Opacity.hpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
+** **
+** This program is free software; you can redistribute it and/or **
+** modify it under the terms of the GNU General Public License as **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#ifndef OPACITY_HPP
+#define OPACITY_HPP
+
+#include <string>
+
+class OpacityAlpha {
+ public:
+ OpacityAlpha () =default;
+ OpacityAlpha (double constalpha, double shapealpha) : _constalpha(constalpha), _shapealpha(shapealpha) {}
+ void setConstAlpha (double alpha) { _constalpha = alpha;}
+ void setShapeAlpha (double shapealpha) {_shapealpha = shapealpha;}
+ double value () const {return _constalpha * _shapealpha;}
+ bool operator == (const OpacityAlpha &alpha) const {return alpha._constalpha == _constalpha && alpha._shapealpha == _shapealpha;}
+ bool operator != (const OpacityAlpha &alpha) const {return alpha._constalpha != _constalpha || alpha._shapealpha != _shapealpha;}
+ bool isOpaque () const {return _constalpha == 1.0 && _shapealpha == 1.0;}
+
+ private:
+ double _constalpha=1.0;
+ double _shapealpha=1.0;
+};
+
+class Opacity {
+ public:
+ enum BlendMode {
+ BM_NORMAL, BM_MULTIPLY, BM_SCREEN, BM_OVERLAY,
+ BM_SOFTLIGHT, BM_HARDLIGHT, BM_COLORDODGE, BM_COLORBURN,
+ BM_DARKEN, BM_LIGHTEN, BM_DIFFERENCE, BM_EXCLUSION,
+ BM_HUE, BM_SATURATION, BM_COLOR, BM_LUMINOSITY
+ };
+
+ public:
+ Opacity () =default;
+ Opacity (OpacityAlpha fillalpha, OpacityAlpha strokealpha, BlendMode bm) : _fillalpha(fillalpha), _strokealpha(strokealpha), _blendMode(bm) {}
+ Opacity (OpacityAlpha fillalpha, OpacityAlpha strokealpha) : Opacity(fillalpha, strokealpha, BM_NORMAL) {}
+ explicit Opacity (BlendMode bm) : _blendMode(bm) {}
+ OpacityAlpha& fillalpha () {return _fillalpha;}
+ OpacityAlpha& strokealpha () {return _strokealpha;}
+ const OpacityAlpha& fillalpha () const {return _fillalpha;}
+ const OpacityAlpha& strokealpha () const {return _strokealpha;}
+ BlendMode blendMode () const {return _blendMode;}
+ void setBlendMode (BlendMode mode) {_blendMode = mode;}
+ std::string cssBlendMode () const {return cssBlendMode(_blendMode);}
+ static std::string cssBlendMode (BlendMode bm);
+ bool isFillDefault () const {return _fillalpha.isOpaque() && _blendMode == BM_NORMAL;}
+ bool isStrokeDefault () const {return _strokealpha.isOpaque() && _blendMode == BM_NORMAL;}
+ bool operator == (const Opacity &opacity) const;
+ bool operator != (const Opacity &opacity) const;
+
+ private:
+ OpacityAlpha _fillalpha;
+ OpacityAlpha _strokealpha;
+ BlendMode _blendMode=BM_NORMAL;
+};
+
+#endif
diff --git a/dviware/dvisvgm/src/PDFParser.cpp b/dviware/dvisvgm/src/PDFParser.cpp
index e511d4dc39..aaf50886ec 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PDFParser.hpp b/dviware/dvisvgm/src/PDFParser.hpp
index b261ee9cf7..a342e740cd 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PDFToSVG.hpp b/dviware/dvisvgm/src/PDFToSVG.hpp
index a6c71f964b..91792689a2 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PSFilter.hpp b/dviware/dvisvgm/src/PSFilter.hpp
index 87aff89a7c..59a4565d1d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PSInterpreter.cpp b/dviware/dvisvgm/src/PSInterpreter.cpp
index 5e09642ef6..c296a18f04 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -59,8 +59,10 @@ void PSInterpreter::init () {
// in conjunction with -dDELAYBIND and -dWRITESYSTEMDICT.
// Thus, -dDELAYSAFER (or -dNOSAFER) must be added.
// https://www.ghostscript.com/doc/9.50/Use.htm#Safer
- if (gsrev >= 950)
+ if (gsrev >= 950) {
gsargs.emplace_back("-dDELAYSAFER");
+ gsargs.emplace_back("-dALLOWPSTRANSPARENCY");
+ }
}
_gs.init(gsargs.size(), gsargs.data(), this);
_gs.set_stdio(input, output, error);
@@ -130,7 +132,7 @@ bool PSInterpreter::execute (const char *str, size_t len, bool flush) {
// feed Ghostscript with code chunks that are not larger than 64KB
// => see documentation of gsapi_run_string_foo()
const char *p=str;
- while (PS_RUNNING && len > 0) {
+ while (_mode == PS_RUNNING && len > 0) {
SignalHandler::instance().check();
size_t chunksize = min(len, (size_t)0xffff);
_gs.run_string_continue(p, chunksize, 0, &status);
@@ -279,6 +281,7 @@ void PSInterpreter::callActions (InputReader &in) {
{"rotate", { 1, &PSActions::rotate}},
{"save", { 1, &PSActions::save}},
{"scale", { 2, &PSActions::scale}},
+ {"setalphaisshape", { 1, &PSActions::setalphaisshape}},
{"setblendmode", { 1, &PSActions::setblendmode}},
{"setcolorspace", { 1, &PSActions::setcolorspace}},
{"setcmykcolor", { 4, &PSActions::setcmykcolor}},
@@ -286,7 +289,6 @@ void PSInterpreter::callActions (InputReader &in) {
{"setfillconstantalpha", { 1, &PSActions::setfillconstantalpha}},
{"setgray", { 1, &PSActions::setgray}},
{"sethsbcolor", { 3, &PSActions::sethsbcolor}},
- {"setisshapealpha", { 1, &PSActions::setisshapealpha}},
{"setlinecap", { 1, &PSActions::setlinecap}},
{"setlinejoin", { 1, &PSActions::setlinejoin}},
{"setlinewidth", { 1, &PSActions::setlinewidth}},
@@ -309,7 +311,7 @@ void PSInterpreter::callActions (InputReader &in) {
_rawData.clear();
in.skipSpace();
while (!in.eof()) {
- _rawData.emplace_back(in.getString());
+ _rawData.push_back(in.getString());
in.skipSpace();
}
}
@@ -320,14 +322,14 @@ void PSInterpreter::callActions (InputReader &in) {
if (pcount < 0) { // variable number of parameters?
in.skipSpace();
while (!in.eof()) { // read all available parameters
- params.emplace_back(in.getString());
+ params.push_back(in.getString());
in.skipSpace();
}
}
else { // fix number of parameters
for (int i=0; i < pcount; i++) {
in.skipSpace();
- params.emplace_back(in.getString());
+ params.push_back(in.getString());
}
}
// convert parameter strings to doubles
@@ -415,7 +417,7 @@ bool PSInterpreter::imageDeviceKnown (string deviceStr) {
return false;
deviceStr = deviceStr.substr(0, deviceStr.find(':')); // strip optional argument
auto infos = getImageDeviceInfos();
- auto it = find_if(infos.begin(), infos.end(), [&](PSDeviceInfo &info) {
+ auto it = find_if(infos.begin(), infos.end(), [&](const PSDeviceInfo &info) {
return info.name == deviceStr;
});
return it != infos.end();
diff --git a/dviware/dvisvgm/src/PSInterpreter.hpp b/dviware/dvisvgm/src/PSInterpreter.hpp
index 638e42dd8d..180b99e0ea 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -62,6 +62,7 @@ struct PSActions {
virtual void rotate (std::vector<double> &p) =0;
virtual void save (std::vector<double> &p) =0;
virtual void scale (std::vector<double> &p) =0;
+ virtual void setalphaisshape (std::vector<double> &p) =0;
virtual void setblendmode (std::vector<double> &p) =0;
virtual void setcolorspace (std::vector<double> &p) =0;
virtual void setcmykcolor (std::vector<double> &cmyk) =0;
@@ -69,7 +70,6 @@ struct PSActions {
virtual void setfillconstantalpha (std::vector<double> &p) =0;
virtual void setgray (std::vector<double> &p) =0;
virtual void sethsbcolor (std::vector<double> &hsb) =0;
- virtual void setisshapealpha (std::vector<double> &p) =0;
virtual void setlinecap (std::vector<double> &p) =0;
virtual void setlinejoin (std::vector<double> &p) =0;
virtual void setlinewidth (std::vector<double> &p) =0;
@@ -114,6 +114,7 @@ class PSInterpreter {
BoundingBox pdfPageBox (const std::string &fname, int pageno);
const std::vector<std::string>& rawData () const {return _rawData;}
bool setImageDevice (const std::string &deviceStr);
+ bool hasFullOpacitySupport () const {return _gs.revision() >= 952;}
static std::vector<PSDeviceInfo> getImageDeviceInfos ();
static void listImageDeviceInfos (std::ostream &os);
static bool imageDeviceKnown (std::string deviceStr);
diff --git a/dviware/dvisvgm/src/PSPattern.cpp b/dviware/dvisvgm/src/PSPattern.cpp
index 4659dc7a84..2320e14cac 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -106,8 +106,8 @@ unique_ptr<XMLElement> PSTilingPattern::createClipNode() const {
* define the pattern graphic. */
unique_ptr<XMLElement> PSTilingPattern::createGroupNode () const {
// add all succeeding path elements to this group
- auto group = util::make_unique<XMLElement>("g");
- group->addAttribute("clip-path", XMLString("url(#pc")+XMLString(psID())+")");
+ auto group = util::make_unique<SVGElement>("g");
+ group->setClipPathUrl("pc"+XMLString(psID()));
return group;
}
diff --git a/dviware/dvisvgm/src/PSPattern.hpp b/dviware/dvisvgm/src/PSPattern.hpp
index 2c53dd2b3e..5e3661fd35 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -40,6 +40,8 @@ class PSPattern {
virtual int psID () const {return _id;}
virtual std::string svgID () const;
virtual void apply (SpecialActions &actions);
+ virtual void setColor (Color color) {}
+ virtual bool tiled () const =0;
protected:
explicit PSPattern (int id) : _id(id) {}
@@ -54,6 +56,8 @@ class PSTilingPattern : public PSPattern {
public:
virtual XMLElement* getContainerNode () {return _groupNode.get();}
void apply (SpecialActions &actions) override;
+ bool tiled () const override {return true;}
+
protected:
PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep);
@@ -82,7 +86,7 @@ class PSUncoloredTilingPattern final : public PSTilingPattern {
public:
PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep);
std::string svgID () const override;
- void setColor (Color color) {_currentColor = color;}
+ void setColor (Color color) override {_currentColor = color;}
void apply (SpecialActions &actions) override;
protected:
diff --git a/dviware/dvisvgm/src/PSPreviewFilter.cpp b/dviware/dvisvgm/src/PSPreviewFilter.cpp
index 20e8b53643..312b3eb6de 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PSPreviewFilter.hpp b/dviware/dvisvgm/src/PSPreviewFilter.hpp
index acadf9f39e..62860b6932 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PageRanges.cpp b/dviware/dvisvgm/src/PageRanges.cpp
index 2623d2ef46..46f2707821 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PageRanges.hpp b/dviware/dvisvgm/src/PageRanges.hpp
index 555338449a..f03dfc5162 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PageSize.cpp b/dviware/dvisvgm/src/PageSize.cpp
index ac8e1c5275..8b5c29445b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PageSize.hpp b/dviware/dvisvgm/src/PageSize.hpp
index 43c555b9dd..4eb4e5e201 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Pair.hpp b/dviware/dvisvgm/src/Pair.hpp
index 63806c5b6a..466e6fd8f2 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp b/dviware/dvisvgm/src/PapersizeSpecialHandler.cpp
index c2ab96a8a8..00a7a4191e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -58,7 +58,7 @@ void PapersizeSpecialHandler::storePaperSize (unsigned pageno, Length width, Len
if (!_pageSizes.empty() && _pageSizes.back().first == pageno)
_pageSizes.back().second = whpair;
else
- _pageSizes.emplace_back(PageSize(pageno, whpair));
+ _pageSizes.emplace_back(pageno, whpair);
}
}
diff --git a/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp b/dviware/dvisvgm/src/PapersizeSpecialHandler.hpp
index ed836f37d7..02599d8c32 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PathClipper.cpp b/dviware/dvisvgm/src/PathClipper.cpp
index f1cca09fd6..a36dc5d3df 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PathClipper.hpp b/dviware/dvisvgm/src/PathClipper.hpp
index 7c42f5de6d..8ab9b48c4f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PdfSpecialHandler.cpp b/dviware/dvisvgm/src/PdfSpecialHandler.cpp
index 0d1b7177bd..9a12af7a64 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -95,7 +95,7 @@ static char prepare_mode (InputReader &ir) {
void PdfSpecialHandler::preprocessPagesize (StreamInputReader &ir, SpecialActions &actions) {
// add page sizes to collection of paper sizes in order to handle them equally
SpecialHandler *handler = SpecialManager::instance().findHandlerByName("papersize");
- if (auto papersizeHandler = dynamic_cast<PapersizeSpecialHandler*>(handler)) {
+ if (auto papersizeHandler = static_cast<PapersizeSpecialHandler*>(handler)) {
try {
Length width, height;
// parse parameter sequence of the form (name length)+
diff --git a/dviware/dvisvgm/src/PdfSpecialHandler.hpp b/dviware/dvisvgm/src/PdfSpecialHandler.hpp
index 0e7d3382ad..e7a18bacce 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PreScanDVIReader.cpp b/dviware/dvisvgm/src/PreScanDVIReader.cpp
index 8e255ef088..ef862f02cc 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PreScanDVIReader.hpp b/dviware/dvisvgm/src/PreScanDVIReader.hpp
index 900fd1fc01..a0e5a5fc64 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Process.cpp b/dviware/dvisvgm/src/Process.cpp
index 2e15153b9e..2010b05db9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Process.hpp b/dviware/dvisvgm/src/Process.hpp
index 53311921c9..3e9417d7bb 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.cpp b/dviware/dvisvgm/src/PsSpecialHandler.cpp
index f7b5508b65..0df21e8804 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -32,7 +32,7 @@
#include "PSPreviewFilter.hpp"
#include "PsSpecialHandler.hpp"
#include "SpecialActions.hpp"
-#include "SVGTree.hpp"
+#include "SVGElement.hpp"
#include "TensorProductPatch.hpp"
#include "TriangularPatch.hpp"
#include "utility.hpp"
@@ -81,11 +81,11 @@ void PsSpecialHandler::initgraphics () {
_linecap = _linejoin = 0; // butt end caps and miter joins
_miterlimit = 4;
_xmlnode = _savenode = nullptr;
- _isshapealpha = false; // opacity operators change constant component by default
- _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent
- _blendmode = 0; // "normal" mode (no blending)
+ _isshapealpha = false; // opacity operators change constant component by default
+ _opacity = Opacity();
_sx = _sy = _cos = 1.0;
_pattern = nullptr;
+ _makingPattern = false;
_patternEnabled = false;
_currentcolor = Color::BLACK;
_dashoffset = 0;
@@ -287,7 +287,6 @@ bool PsSpecialHandler::process (const string &prefix, istream &is, SpecialAction
return true;
}
-
/** Handles a psfile/pdffile special which places an external EPS/PDF graphic
* at the current DVI position. The lower left corner (llx,lly) of the
* given bounding box is placed at the DVI position.
@@ -366,16 +365,15 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const ma
matrix.scale(sx, sy).rotate(-angle).scale(hscale/100, vscale/100); // apply transformation attributes
matrix.translate(x+hoffset, y-voffset); // move image to current DVI position
matrix.lmultiply(_actions->getMatrix());
-
// update bounding box
BoundingBox bbox(0, 0, urx-llx, ury-lly);
bbox.transform(matrix);
_actions->embed(bbox);
// insert element containing the image data
- matrix.rmultiply(TranslationMatrix(-llx, -lly)); // move lower left corner of image to origin
- if (!matrix.isIdentity())
- imgNode->addAttribute("transform", matrix.toSVG());
+ if (filetype != FileType::PDF)
+ matrix.rmultiply(TranslationMatrix(-llx, -lly)); // move lower left corner of image to origin
+ imgNode->setTransform(matrix);
_actions->svgTree().appendToPage(std::move(imgNode));
}
// restore DVI position
@@ -386,7 +384,7 @@ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const ma
/** Returns path + basename of temporary bitmap images. */
-static string image_base_path (SpecialActions &actions) {
+static string image_base_path (const SpecialActions &actions) {
FilePath imgpath = actions.getSVGFilePath(actions.getCurrentPageNumber());
return FileSystem::tmpdir() + "/" + imgpath.basename() + "-tmp-";
}
@@ -399,8 +397,8 @@ static string image_base_path (SpecialActions &actions) {
* @param[in] bbox bounding box of the image
* @param[in] clip if true, the image is clipped to its bounding box
* @return pointer to the element or nullptr if there's no image data */
-unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const string &fname, int pageno, BoundingBox bbox, bool clip) {
- unique_ptr<XMLElement> node;
+unique_ptr<SVGElement> PsSpecialHandler::createImageNode (FileType type, const string &fname, int pageno, BoundingBox bbox, bool clip) {
+ unique_ptr<SVGElement> node;
string pathstr;
if (const char *path = FileFinder::instance().lookup(fname, false))
pathstr = FileSystem::ensureForwardSlashes(path);
@@ -409,7 +407,7 @@ unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const s
if (pathstr.empty())
Message::wstream(true) << "file '" << fname << "' not found\n";
else if (type == FileType::BITMAP || type == FileType::SVG) {
- node = util::make_unique<XMLElement>("image");
+ node = util::make_unique<SVGElement>("image");
node->addAttribute("x", 0);
node->addAttribute("y", 0);
node->addAttribute("width", bbox.width());
@@ -429,7 +427,7 @@ unique_ptr<XMLElement> PsSpecialHandler::createImageNode (FileType type, const s
if (clip)
rectclip = to_string(bbox.minX())+" "+to_string(bbox.minY())+" "+to_string(bbox.width())+" "+to_string(bbox.height())+" rectclip";
- node = util::make_unique<XMLElement>("g"); // put SVG nodes created from the EPS/PDF file in this group
+ node = util::make_unique<SVGElement>("g"); // put SVG nodes created from the EPS/PDF file in this group
_xmlnode = node.get();
_psi.execute(
"\n@beginspecial @setspecial" // enter special environment
@@ -556,9 +554,8 @@ void PsSpecialHandler::setpagedevice (std::vector<double> &p) {
_linewidth = 1;
_linecap = _linejoin = 0; // butt end caps and miter joins
_miterlimit = 4;
- _isshapealpha = false; // opacity operators change constant component by default
- _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent
- _blendmode = 0; // "normal" mode (no blending)
+ _isshapealpha = false; // opacity operators change constant component by default
+ _opacity = Opacity();
_sx = _sy = _cos = 1.0;
_pattern = nullptr;
_currentcolor = Color::BLACK;
@@ -613,14 +610,37 @@ void PsSpecialHandler::closepath (vector<double>&) {
}
-static string css_blendmode_name (int mode) {
- static const array<const char*,16> modenames = {{
- "normal", "multiply", "screen", "overlay", "soft-light", "hard-light", "color-dodge", "color-burn",
- "darken", "lighten", "difference", "exclusion", "hue", "saturation", "color", "luminosity"
- }};
+void PsSpecialHandler::setblendmode (vector<double> &p) {
+ int mode = static_cast<int>(p[0]);
+ static const Opacity::BlendMode blendmodes[] = {
+ Opacity::BM_NORMAL, Opacity::BM_MULTIPLY, Opacity::BM_SCREEN, Opacity::BM_OVERLAY,
+ Opacity::BM_SOFTLIGHT, Opacity::BM_HARDLIGHT, Opacity::BM_COLORDODGE, Opacity::BM_COLORBURN,
+ Opacity::BM_DARKEN, Opacity::BM_LIGHTEN, Opacity::BM_DIFFERENCE, Opacity::BM_EXCLUSION,
+ Opacity::BM_HUE, Opacity::BM_SATURATION, Opacity::BM_COLOR, Opacity::BM_LUMINOSITY
+ };
if (mode < 0 || mode > 15)
- return "";
- return modenames[mode];
+ mode = Opacity::BM_NORMAL;
+ _opacity.setBlendMode(blendmodes[mode]);
+}
+
+
+void PsSpecialHandler::setfillconstantalpha (vector<double> &p) {
+ if (_isshapealpha)
+ _opacity.fillalpha().setShapeAlpha(p[0]);
+ else
+ _opacity.fillalpha().setConstAlpha(p[0]);
+ if (_actions)
+ _actions->setOpacity(_opacity);
+}
+
+
+void PsSpecialHandler::setstrokeconstantalpha (vector<double> &p) {
+ if (_isshapealpha)
+ _opacity.strokealpha().setShapeAlpha(p[0]);
+ else
+ _opacity.strokealpha().setConstAlpha(p[0]);
+ if (_actions)
+ _actions->setOpacity(_opacity);
}
@@ -639,18 +659,18 @@ void PsSpecialHandler::stroke (vector<double> &p) {
}
if (_clipStack.prependedPath())
_path.prepend(*_clipStack.prependedPath());
- unique_ptr<XMLElement> path;
+ unique_ptr<SVGElement> path;
Pair<double> point;
if (_path.isDot(point)) { // zero-length path?
if (_linecap == 1) { // round line ends? => draw dot
double x = point.x();
double y = point.y();
double r = _linewidth/2.0;
- path = util::make_unique<XMLElement>("circle");
+ path = util::make_unique<SVGElement>("circle");
path->addAttribute("cx", x);
path->addAttribute("cy", y);
path->addAttribute("r", r);
- path->addAttribute("fill", _actions->getColor().svgColorString());
+ path->setFillColor(_actions->getColor());
bbox = BoundingBox(x-r, y-r, x+r, y+r);
}
}
@@ -661,35 +681,20 @@ void PsSpecialHandler::stroke (vector<double> &p) {
ostringstream oss;
_path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
- path = util::make_unique<XMLElement>("path");
+ path = util::make_unique<SVGElement>("path");
path->addAttribute("d", oss.str());
- path->addAttribute("stroke", _actions->getColor().svgColorString());
- path->addAttribute("fill", "none");
- if (_linewidth != 1)
- path->addAttribute("stroke-width", _linewidth);
- if (_miterlimit != 4)
- path->addAttribute("stroke-miterlimit", _miterlimit);
- if (_linecap > 0) // default value is "butt", no need to set it explicitly
- path->addAttribute("stroke-linecap", _linecap == 1 ? "round" : "square");
- if (_linejoin > 0) // default value is "miter", no need to set it explicitly
- path->addAttribute("stroke-linejoin", _linecap == 1 ? "round" : "bevel");
- if (_strokealpha[0] < 1 || _strokealpha[1] < 1)
- path->addAttribute("stroke-opacity", _strokealpha[0] * _strokealpha[1]);
- if (_blendmode > 0 && _blendmode < 16)
- path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode));
- if (!_dashpattern.empty()) {
- string patternStr;
- for (double dashValue : _dashpattern)
- patternStr += XMLString(dashValue)+",";
- patternStr.pop_back();
- path->addAttribute("stroke-dasharray", patternStr);
- if (_dashoffset != 0)
- path->addAttribute("stroke-dashoffset", _dashoffset);
- }
+ path->setStrokeColor(_actions->getColor());
+ path->setNoFillColor();
+ path->setStrokeWidth(_linewidth);
+ path->setStrokeMiterLimit(_miterlimit);
+ path->setStrokeLineCap(_linecap == 0 ? SVGElement::LC_BUTT : _linecap == 1 ? SVGElement::LC_ROUND : SVGElement::LC_SQUARE);
+ path->setStrokeLineJoin(_linejoin == 0 ? SVGElement::LJ_MITER : _linecap == 1 ? SVGElement::LJ_ROUND : SVGElement::LJ_BEVEL);
+ path->setStrokeOpacity(_opacity);
+ path->setStrokeDash(_dashpattern, _dashoffset);
}
- if (path && _clipStack.path() && !_savenode) {
+ if (path && _clipStack.path() && !_makingPattern) {
// assign clipping path and clip bounding box
- path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")");
+ path->setClipPathUrl("clip"+XMLString(_clipStack.topID()));
bbox.intersect(_clipStack.path()->computeBBox());
_clipStack.removePrependedPath();
}
@@ -708,7 +713,7 @@ void PsSpecialHandler::stroke (vector<double> &p) {
* @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */
void PsSpecialHandler::fill (vector<double> &p, bool evenodd) {
_path.removeRedundantCommands();
- if ((_path.empty() && !_clipStack.prependedPath()) || !_actions)
+ if ((_path.empty() && !_clipStack.prependedPath()) || (_patternEnabled && !_pattern) || !_actions)
return;
// compute bounding box
@@ -723,24 +728,20 @@ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) {
ostringstream oss;
_path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
- unique_ptr<XMLElement> path = util::make_unique<XMLElement>("path");
+ auto path = util::make_unique<SVGElement>("path");
path->addAttribute("d", oss.str());
if (_pattern)
- path->addAttribute("fill", XMLString("url(#")+_pattern->svgID()+")");
- else if (_actions->getColor() != Color::BLACK || _savenode)
- path->addAttribute("fill", _actions->getColor().svgColorString());
- if (_clipStack.path() && !_savenode) { // clip path active and not inside pattern definition?
+ path->setFillPatternUrl(XMLString(_pattern->svgID()));
+ else if (_actions->getColor() != Color::BLACK || _makingPattern)
+ path->setFillColor(_actions->getColor(), false);
+ if (_clipStack.path() && !_makingPattern) { // clip path active and not inside pattern definition?
// assign clipping path and clip bounding box
- path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")");
+ path->setClipPathUrl("clip"+XMLString(_clipStack.topID()));
bbox.intersect(_clipStack.path()->computeBBox());
_clipStack.removePrependedPath();
}
- if (evenodd) // SVG default fill rule is "nonzero" algorithm
- path->addAttribute("fill-rule", "evenodd");
- if (_fillalpha[0] < 1 || _fillalpha[1] < 1)
- path->addAttribute("fill-opacity", _fillalpha[0] * _fillalpha[1]);
- if (_blendmode > 0 && _blendmode < 16)
- path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode));
+ path->setFillRule(evenodd ? SVGElement::FR_EVENODD : SVGElement::FR_NONZERO);
+ path->setFillOpacity(_opacity);
if (_xmlnode)
_xmlnode->append(std::move(path));
else {
@@ -788,8 +789,8 @@ void PsSpecialHandler::image (std::vector<double> &p) {
// if set, assign clipping path to image
if (_clipStack.path()) {
- auto group = util::make_unique<XMLElement>("g");
- group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")");
+ auto group = util::make_unique<SVGElement>("g");
+ group->setClipPathUrl("clip"+XMLString(_clipStack.topID()));
group->append(std::move(image));
image = std::move(group); // handle the entire group as image to add
}
@@ -846,10 +847,9 @@ void PsSpecialHandler::makepattern (vector<double> &p) {
switch (pattern_type) {
case 0:
// pattern definition completed
- if (_savenode) {
- _xmlnode = _savenode;
- _savenode = nullptr;
- }
+ _xmlnode = _savenode;
+ _savenode = nullptr;
+ _makingPattern = false;
break;
case 1: { // tiling pattern
int id = static_cast<int>(p[1]);
@@ -869,6 +869,7 @@ void PsSpecialHandler::makepattern (vector<double> &p) {
_savenode = _xmlnode;
_xmlnode = pattern->getContainerNode(); // insert the following SVG elements into this node
_patterns[id] = std::move(pattern);
+ _makingPattern = true;
break;
}
case 2: {
@@ -891,13 +892,9 @@ void PsSpecialHandler::setpattern (vector<double> &p) {
if (it == _patterns.end())
_pattern = nullptr;
else {
- if (auto pattern = dynamic_cast<PSUncoloredTilingPattern*>(it->second.get()))
- pattern->setColor(color);
+ it->second->setColor(color);
it->second->apply(*_actions);
- if (auto pattern = dynamic_cast<PSTilingPattern*>(it->second.get()))
- _pattern = pattern;
- else
- _pattern = nullptr;
+ _pattern = it->second->tiled() ? static_cast<PSTilingPattern*>(it->second.get()) : nullptr;
}
}
@@ -961,16 +958,15 @@ void PsSpecialHandler::clip (Path path, bool evenodd) {
intersectedPath.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
}
if (pathReplaced) {
- auto pathElem = util::make_unique<XMLElement>("path");
+ auto pathElem = util::make_unique<SVGElement>("path");
pathElem->addAttribute("d", oss.str());
- if (evenodd)
- pathElem->addAttribute("clip-rule", "evenodd");
+ pathElem->setClipRule(evenodd ? SVGElement::FR_EVENODD : SVGElement::FR_NONZERO);
int newID = _clipStack.topID();
- auto clipElem = util::make_unique<XMLElement>("clipPath");
+ auto clipElem = util::make_unique<SVGElement>("clipPath");
clipElem->addAttribute("id", XMLString("clip")+XMLString(newID));
if (!COMPUTE_CLIPPATHS_INTERSECTIONS && oldID)
- clipElem->addAttribute("clip-path", XMLString("url(#clip")+XMLString(oldID)+")");
+ clipElem->setClipPathUrl("clip"+XMLString(oldID));
clipElem->append(std::move(pathElem));
_actions->svgTree().appendToDefs(std::move(clipElem));
@@ -1046,7 +1042,7 @@ void PsSpecialHandler::shfill (vector<double> &params) {
* @param[in,out] it iterator used to sequentially access the patch data
* @param[out] points the points defining the geometry of the patch
* @param[out] colors the colors assigned to the vertices of the patch */
-static void read_patch_data (ShadingPatch &patch, int edgeflag,
+static void read_patch_data (const ShadingPatch &patch, int edgeflag,
VectorIterator<double> &it, vector<DPair> &points, vector<Color> &colors)
{
// number of control points and colors required to define a single patch
@@ -1087,14 +1083,14 @@ class ShadingCallback : public ShadingPatch::Callback {
ShadingCallback (SpecialActions &actions, XMLElement *parent, int clippathID)
: _actions(actions)
{
- auto group = util::make_unique<XMLElement>("g");
+ auto group = util::make_unique<SVGElement>("g");
_group = group.get();
if (parent)
parent->append(std::move(group));
else
actions.svgTree().appendToPage(std::move(group));
if (clippathID > 0)
- _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")");
+ _group->setClipPathUrl("clip"+XMLString(clippathID));
}
void patchSegment (GraphicsPath<double> &path, const Color &color) override {
@@ -1104,15 +1100,15 @@ class ShadingCallback : public ShadingPatch::Callback {
// draw a single patch segment
ostringstream oss;
path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
- auto pathElem = util::make_unique<XMLElement>("path");
+ auto pathElem = util::make_unique<SVGElement>("path");
pathElem->addAttribute("d", oss.str());
- pathElem->addAttribute("fill", color.svgColorString());
+ pathElem->setFillColor(color);
_group->append(std::move(pathElem));
}
private:
SpecialActions &_actions;
- XMLElement *_group;
+ SVGElement *_group;
};
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.hpp b/dviware/dvisvgm/src/PsSpecialHandler.hpp
index 8b66499041..72586ba659 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -28,12 +28,13 @@
#include <vector>
#include "GraphicsPath.hpp"
#include "PSInterpreter.hpp"
-#include "SpecialHandler.hpp"
+#include "Opacity.hpp"
#include "PSPattern.hpp"
#include "PSPreviewFilter.hpp"
-
+#include "SpecialHandler.hpp"
class PSPattern;
+class SVGElement;
class XMLElement;
class PsSpecialHandler : public SpecialHandler, protected PSActions {
@@ -104,7 +105,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void executeAndSync (std::istream &is, bool updatePos);
void processHeaderFile (const char *fname);
void imgfile (FileType type, const std::string &fname, const std::map<std::string,std::string> &attr);
- std::unique_ptr<XMLElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip);
+ std::unique_ptr<SVGElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip);
void dviBeginPage (unsigned int pageno, SpecialActions &actions) override;
void dviEndPage (unsigned pageno, SpecialActions &actions) override;
void clip (Path path, bool evenodd);
@@ -138,14 +139,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void rotate (std::vector<double> &p) override;
void save (std::vector<double> &p) override;
void scale (std::vector<double> &p) override;
- void setblendmode (std::vector<double> &p) override {_blendmode = int(p[0]);}
+ void setalphaisshape (std::vector<double> &p) override { _isshapealpha = bool(p[0]);}
+ void setblendmode (std::vector<double> &p) override;
void setcolorspace (std::vector<double> &p) override {_patternEnabled = bool(p[0]);}
void setcmykcolor (std::vector<double> &cmyk) override;
void setdash (std::vector<double> &p) override;
- void setfillconstantalpha (std::vector<double> &p) override {_fillalpha[_isshapealpha ? 1 : 0] = p[0];}
+ void setfillconstantalpha (std::vector<double> &p) override;
void setgray (std::vector<double> &p) override;
void sethsbcolor (std::vector<double> &hsb) override;
- void setisshapealpha (std::vector<double> &p) override {_isshapealpha = bool(p[0]);}
void setlinecap (std::vector<double> &p) override {_linecap = uint8_t(p[0]);}
void setlinejoin (std::vector<double> &p) override {_linejoin = uint8_t(p[0]);}
void setlinewidth (std::vector<double> &p) override {_linewidth = scale(p[0] ? p[0] : 0.5);}
@@ -155,7 +156,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void setpagedevice (std::vector<double> &p) override;
void setpattern (std::vector<double> &p) override;
void setrgbcolor (std::vector<double> &rgb) override;
- void setstrokeconstantalpha (std::vector<double> &p) override {_strokealpha[_isshapealpha ? 1 : 0] = p[0];}
+ void setstrokeconstantalpha (std::vector<double> &p) override;
void shfill (std::vector<double> &p) override;
void stroke (std::vector<double> &p) override;
void translate (std::vector<double> &p) override;
@@ -176,15 +177,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
double _cos; ///< cosine of angle between (1,0) and transform(1,0)
double _linewidth; ///< current line width in bp units
double _miterlimit; ///< current miter limit in bp units
- bool _isshapealpha; ///< if true, opacity operators act on index 1 (shape component), otherwise on index 0 (constant component)
- std::array<double,2> _fillalpha; ///< constant and shape opacity used for fill operations (0=fully transparent, ..., 1=opaque)
- std::array<double,2> _strokealpha; ///< constant and shape opacity used for stroke operations (0=fully transparent, ..., 1=opaque)
- int _blendmode; ///< blend mode used when overlaying colored areas
+ bool _isshapealpha; ///< if true, opacity operators act on shape component, otherwise on constant component
+ Opacity _opacity;
uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square)
uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel)
double _dashoffset; ///< current dash offset
std::vector<double> _dashpattern;
ClippingStack _clipStack;
+ bool _makingPattern=false; ///< true if executing makepattern operator
std::map<int, std::unique_ptr<PSPattern>> _patterns;
PSTilingPattern *_pattern; ///< current pattern
bool _patternEnabled; ///< true if active color space is a pattern
diff --git a/dviware/dvisvgm/src/RangeMap.cpp b/dviware/dvisvgm/src/RangeMap.cpp
index 86190cacf9..27aa8bc427 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -82,14 +82,14 @@ void RangeMap::addRange (uint32_t cmin, uint32_t cmax, uint32_t vmin) {
Range range(cmin, cmax, vmin);
if (_ranges.empty())
- _ranges.emplace_back(std::move(range));
+ _ranges.push_back(std::move(range));
else {
// check for simple cases that can be handled pretty fast
Range &lrange = *_ranges.begin();
Range &rrange = *_ranges.rbegin();
if (cmin > rrange.max()) { // non-overlapping range at end of vector?
if (!rrange.join(range))
- _ranges.emplace_back(std::move(range));
+ _ranges.push_back(std::move(range));
}
else if (cmax < lrange.min()) { // non-overlapping range at begin of vector?
if (!lrange.join(range))
diff --git a/dviware/dvisvgm/src/RangeMap.hpp b/dviware/dvisvgm/src/RangeMap.hpp
index 3e3bff9d4b..3f5cb7a6e5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGCharHandler.cpp b/dviware/dvisvgm/src/SVGCharHandler.cpp
index f8d75a28d3..3b3f4d3f31 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -20,12 +20,12 @@
#include "SVGCharHandler.hpp"
#include "utility.hpp"
-#include "XMLNode.hpp"
+#include "SVGElement.hpp"
using namespace std;
-void SVGCharHandler::setInitialContextNode (XMLElement *node) {
+void SVGCharHandler::setInitialContextNode (SVGElement *node) {
resetContextNode();
_initialContextNode = node;
}
@@ -34,9 +34,9 @@ void SVGCharHandler::setInitialContextNode (XMLElement *node) {
/** Changes the context element. All following nodes will be appended to this node.
* @param[in] node the new context node
* @return bare pointer to the new context node or 0 if context hasn't changed */
-XMLElement* SVGCharHandler::pushContextNode (unique_ptr<XMLElement> node) {
+SVGElement* SVGCharHandler::pushContextNode (unique_ptr<SVGElement> node) {
if (node && (_contextNodeStack.empty() || node.get() != _contextNodeStack.top())) {
- XMLElement *nodeptr = node.get();
+ SVGElement *nodeptr = node.get();
contextNode()->append(std::move(node));
_contextNodeStack.push(nodeptr);
return nodeptr;
@@ -61,23 +61,22 @@ void SVGCharHandler::resetContextNode () {
/** Creates and returns a new SVG text element.
* @param[in] x current x coordinate
* @param[in] y current y coordinate */
-unique_ptr<XMLElement> SVGCharTextHandler::createTextNode (double x, double y) const {
+unique_ptr<SVGElement> SVGCharTextHandler::createTextNode (double x, double y) const {
const Font *font = _font.get();
if (!font)
return nullptr;
- auto textNode = util::make_unique<XMLElement>("text");
+ auto textNode = util::make_unique<SVGElement>("text");
if (_selectFontByClass)
textNode->addAttribute("class", string("f")+XMLString(_fontnum));
else {
textNode->addAttribute("font-family", font->name());
- textNode->addAttribute("font-size", XMLString(font->scaledSize()));
- if (font->color() != Color::BLACK)
- textNode->addAttribute("fill", font->color().svgColorString());
+ textNode->addAttribute("font-size", font->scaledSize());
+ textNode->setFillColor(font->color());
}
if (_vertical) {
textNode->addAttribute("writing-mode", "tb");
// align glyphs designed for horizontal layout properly
- if (auto pf = dynamic_cast<const PhysicalFont*>(font)) {
+ if (auto pf = font_cast<const PhysicalFont*>(font)) {
if (!pf->getMetrics()->verticalLayout()) { // alphabetic text designed for horizontal layout?
x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset
textNode->addAttribute("glyph-orientation-vertical", 90); // ensure rotation
@@ -86,7 +85,7 @@ unique_ptr<XMLElement> SVGCharTextHandler::createTextNode (double x, double y) c
}
textNode->addAttribute("x", x);
textNode->addAttribute("y", y);
- if (!_matrix.get().isIdentity())
- textNode->addAttribute("transform", _matrix.get().toSVG());
+ if (!_matrix->isIdentity())
+ textNode->addAttribute("transform", _matrix->toSVG());
return textNode;
}
diff --git a/dviware/dvisvgm/src/SVGCharHandler.hpp b/dviware/dvisvgm/src/SVGCharHandler.hpp
index f75df47215..99ac4af858 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -26,12 +26,15 @@
#include "Color.hpp"
#include "Font.hpp"
#include "Matrix.hpp"
+#include "Opacity.hpp"
template <typename T>
class CharProperty {
public:
+ CharProperty () =default;
CharProperty (const T &v) : _value(v) {}
+ CharProperty (T &&v) : _value(std::move(v)) {}
void set (const T &v) {
if (v != _value) {
@@ -40,10 +43,11 @@ class CharProperty {
}
}
- const T& get () const {return _value;}
- operator const T& () const {return _value;}
- bool changed () const {return _changed;}
- void changed (bool c) {_changed = c;}
+ const T& get () const {return _value;}
+ const T* operator -> () const {return &_value;}
+ operator const T& () const {return _value;}
+ bool changed () const {return _changed;}
+ void changed (bool c) {_changed = c;}
private:
T _value;
@@ -51,7 +55,7 @@ class CharProperty {
};
-class XMLElement;
+class SVGElement;
/** Base class for all character handlers. These handlers create SVG representations
@@ -60,36 +64,39 @@ class SVGCharHandler {
public:
SVGCharHandler () : _matrix(1) {}
virtual ~SVGCharHandler() =default;
- virtual void setInitialContextNode (XMLElement *node);
+ virtual void setInitialContextNode (SVGElement *node);
virtual void appendChar (uint32_t c, double x, double y) =0;
virtual void notifyXAdjusted () {}
virtual void notifyYAdjusted () {}
- void setColor (const Color &color) {_color.set(color);}
- void setFont (const Font &font, int id) {_font.set(&font); _fontnum = id;}
- void setMatrix (const Matrix &matrix) {_matrix.set(matrix);}
- void setVertical (bool vertical) {_vertical.set(vertical);}
- Color getColor () const {return _color.get();}
- const Font* getFont () const {return _font.get();}
- const Matrix& getMatrix () const {return _matrix.get();}
+ void setColor (const Color &color) {_color.set(color);}
+ void setOpacity (const Opacity &opacity) {_opacity.set(opacity);}
+ void setFont (const Font &font, int id) {_font.set(&font); _fontnum = id;}
+ void setMatrix (const Matrix &matrix) {_matrix.set(matrix);}
+ void setVertical (bool vertical) {_vertical.set(vertical);}
+ Color getColor () const {return _color.get();}
+ const Opacity& getOpacity () const {return _opacity.get();}
+ const Font* getFont () const {return _font.get();}
+ const Matrix& getMatrix () const {return _matrix.get();}
protected:
virtual void resetContextNode ();
- XMLElement* pushContextNode (std::unique_ptr<XMLElement> node);
+ SVGElement* pushContextNode (std::unique_ptr<SVGElement> node);
void popContextNode ();
- XMLElement* contextNode () const {
+ SVGElement* contextNode () const {
return _contextNodeStack.empty() ? _initialContextNode : _contextNodeStack.top();
}
CharProperty<Color> _color=Color::BLACK; ///< current color
+ CharProperty<Opacity> _opacity; ///< current opacity values
CharProperty<const Font*> _font=0; ///< current font
int _fontnum=0; ///< current font ID
CharProperty<Matrix> _matrix; ///< current transformation
CharProperty<bool> _vertical=false; ///< current writing mode
private:
- XMLElement *_initialContextNode= nullptr; ///< SVG element the generated character nodes are attached to
- std::stack<XMLElement*> _contextNodeStack;
+ SVGElement *_initialContextNode= nullptr; ///< SVG element the generated character nodes are attached to
+ std::stack<SVGElement*> _contextNodeStack;
};
@@ -99,7 +106,7 @@ class SVGCharTextHandler : public SVGCharHandler {
explicit SVGCharTextHandler (bool selectFontByClass) : _selectFontByClass(selectFontByClass) {}
protected:
- std::unique_ptr<XMLElement> createTextNode (double x, double y) const;
+ std::unique_ptr<SVGElement> createTextNode (double x, double y) const;
private:
bool _selectFontByClass;
diff --git a/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp b/dviware/dvisvgm/src/SVGCharHandlerFactory.cpp
index 397943ace0..0a4666f5ae 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp b/dviware/dvisvgm/src/SVGCharHandlerFactory.hpp
index f37b9977c2..a43257bc15 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGCharPathHandler.cpp b/dviware/dvisvgm/src/SVGCharPathHandler.cpp
index 7a766bae49..2aa9209dda 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -23,7 +23,7 @@
#include "FontManager.hpp"
#include "SVGCharPathHandler.hpp"
#include "utility.hpp"
-#include "XMLNode.hpp"
+#include "SVGElement.hpp"
using namespace std;
@@ -61,22 +61,23 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) {
// Glyphs of non-black fonts (e.g. defined in a XeTeX document) can't change their color.
CharProperty<Color> &color = (_fontColor.get() != Color::BLACK) ? _fontColor : _color;
bool applyColor = color.get() != Color::BLACK;
- bool applyMatrix = !_matrix.get().isIdentity();
+ bool applyMatrix = !_matrix->isIdentity();
+ bool applyOpacity = !_opacity->isFillDefault();
if (!_groupNode) {
color.changed(applyColor);
_matrix.changed(applyMatrix);
}
- if (color.changed() || _matrix.changed()) {
+ if (color.changed() || _matrix.changed() || _opacity.changed()) {
resetContextNode();
- if (applyColor || applyMatrix) {
- _groupNode = pushContextNode(util::make_unique<XMLElement>("g"));
- if (applyColor)
- contextNode()->addAttribute("fill", color.get().svgColorString());
- if (applyMatrix)
- contextNode()->addAttribute("transform", _matrix.get().toSVG());
+ if (applyColor || applyMatrix || applyOpacity) {
+ _groupNode = pushContextNode(util::make_unique<SVGElement>("g"));
+ contextNode()->setFillColor(color);
+ contextNode()->setFillOpacity(_opacity->fillalpha());
+ contextNode()->setTransform(_matrix);
}
color.changed(false);
_matrix.changed(false);
+ _opacity.changed(false);
}
const Font *font = _font.get();
if (font->verticalLayout()) {
@@ -84,12 +85,12 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) {
GlyphMetrics metrics;
font->getGlyphMetrics(c, _vertical, metrics);
x -= metrics.wl;
- if (auto pf = dynamic_cast<const PhysicalFont*>(font)) {
+ if (auto pf = font_cast<const PhysicalFont*>(font)) {
// Center glyph between top and bottom border of the TFM box.
// This is just an approximation used until I find a way to compute
// the exact location in vertical mode.
GlyphMetrics exact_metrics;
- pf->getExactGlyphBox(c, exact_metrics, false);
+ pf->getExactGlyphBox(c, exact_metrics, false, nullptr);
y += exact_metrics.h+(metrics.d-exact_metrics.h-exact_metrics.d)/2;
}
else
@@ -109,28 +110,27 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) {
void SVGCharPathHandler::appendUseElement (uint32_t c, double x, double y, const Matrix &matrix) {
string id = "#g" + to_string(FontManager::instance().fontID(_font)) + "-" + to_string(c);
- auto useNode = util::make_unique<XMLElement>("use");
- useNode->addAttribute("x", XMLString(x));
- useNode->addAttribute("y", XMLString(y));
+ auto useNode = util::make_unique<SVGElement>("use");
+ useNode->addAttribute("x", x);
+ useNode->addAttribute("y", y);
useNode->addAttribute("xlink:href", id);
- if (!matrix.isIdentity())
- useNode->addAttribute("transform", matrix.toSVG());
+ useNode->setFillOpacity(_opacity->blendMode()); // add blend mode style here because it's not inheritable
+ useNode->setTransform(matrix);
contextNode()->append(std::move(useNode));
}
void SVGCharPathHandler::appendPathElement (uint32_t c, double x, double y, const Matrix &matrix) {
Glyph glyph;
- auto pf = dynamic_cast<const PhysicalFont*>(_font.get());
- if (pf && pf->getGlyph(c, glyph)) {
+ auto pf = font_cast<const PhysicalFont*>(_font.get());
+ if (pf && pf->getGlyph(c, glyph, nullptr)) {
double sx = pf->scaledSize()/pf->unitsPerEm();
double sy = -sx;
ostringstream oss;
glyph.writeSVG(oss, _relativePathCommands, sx, sy, x, y);
- auto glyphNode = util::make_unique<XMLElement>("path");
+ auto glyphNode = util::make_unique<SVGElement>("path");
glyphNode->addAttribute("d", oss.str());
- if (!matrix.isIdentity())
- glyphNode->addAttribute("transform", matrix.toSVG());
+ glyphNode->setTransform(matrix);
contextNode()->append(std::move(glyphNode));
}
}
diff --git a/dviware/dvisvgm/src/SVGCharPathHandler.hpp b/dviware/dvisvgm/src/SVGCharPathHandler.hpp
index c404cbcd5a..4ecdd5272e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -39,7 +39,7 @@ class SVGCharPathHandler : public SVGCharHandler {
private:
AppendMethod _appendChar; ///< method called to append a single character
bool _relativePathCommands; ///< if true, create relative rather than absolute SVG path commands
- XMLElement *_groupNode=nullptr; ///< current group node taking the path elements
+ SVGElement *_groupNode=nullptr; ///< current group node taking the path elements
CharProperty<Color> _fontColor=Color::BLACK; ///< color of current font
};
diff --git a/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp b/dviware/dvisvgm/src/SVGCharTspanTextHandler.cpp
index 6b89348dc1..5c9d57f8a9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -20,7 +20,7 @@
#include "SVGCharTspanTextHandler.hpp"
#include "utility.hpp"
-#include "XMLNode.hpp"
+#include "SVGElement.hpp"
using namespace std;
@@ -36,9 +36,10 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) {
if (!_textNode || _font.changed() || _matrix.changed() || _vertical.changed()) {
resetContextNode();
_textNode = pushContextNode(createTextNode(x, y));
- _color.changed(true); // force creating tspan with color attribute if current color differs from font color
+ _color.changed(true); // force creating tspan with color attribute if current color differs from font color
+ _opacity.changed(true); // dito for opacity properties
}
- if (_tspanNode && (_xchanged || _ychanged || _color.changed())) {
+ if (_tspanNode && (_xchanged || _ychanged || _color.changed() || _opacity.changed())) {
// if drawing position or color was explicitly changed, finish current tspan element
popContextNode();
_tspanNode = nullptr;
@@ -46,15 +47,18 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) {
// Apply text color changes only if the color of the entire font is black.
// Glyphs of non-black fonts (e.g. defined in a XeTeX document) can't change their color.
bool applyColor = _color.get() != Color::BLACK && _font.get()->color() == Color::BLACK;
- if (_xchanged || _ychanged || (_color.changed() && applyColor)) {
- _tspanNode = pushContextNode(util::make_unique<XMLElement>("tspan"));
+ bool applyOpacity = !_opacity->isFillDefault();
+ if (_xchanged || _ychanged || (_color.changed() && applyColor) || (_opacity.changed() && applyOpacity)) {
+ _tspanNode = pushContextNode(util::make_unique<SVGElement>("tspan"));
if (applyColor)
- _tspanNode->addAttribute("fill", _color.get().svgColorString());
+ _tspanNode->setFillColor(_color);
_color.changed(false);
+ _tspanNode->setFillOpacity(_opacity);
+ _opacity.changed(false);
if (_xchanged) {
if (_vertical) {
// align glyphs designed for horizontal layout properly
- if (auto pf = dynamic_cast<const PhysicalFont*>(_font.get()))
+ if (auto pf = font_cast<const PhysicalFont*>(_font.get()))
if (!pf->getMetrics()->verticalLayout())
x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset
}
@@ -70,7 +74,7 @@ void SVGCharTspanTextHandler::appendChar (uint32_t c, double x, double y) {
}
-void SVGCharTspanTextHandler::setInitialContextNode (XMLElement *node) {
+void SVGCharTspanTextHandler::setInitialContextNode (SVGElement *node) {
SVGCharHandler::setInitialContextNode(node);
_textNode = _tspanNode = nullptr;
_xchanged = _ychanged = false;
diff --git a/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp b/dviware/dvisvgm/src/SVGCharTspanTextHandler.hpp
index b847965a1a..28ec792ece 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -29,15 +29,15 @@ class SVGCharTspanTextHandler : public SVGCharTextHandler {
void notifyXAdjusted () override {_xchanged = true;}
void notifyYAdjusted() override {_ychanged = true;}
void appendChar (uint32_t c, double x, double y) override;
- void setInitialContextNode (XMLElement *node) override;
+ void setInitialContextNode (SVGElement *node) override;
protected:
void resetContextNode () override;
private:
bool _xchanged, _ychanged;
- XMLElement *_textNode;
- XMLElement *_tspanNode;
+ SVGElement *_textNode;
+ SVGElement *_tspanNode;
};
#endif
diff --git a/dviware/dvisvgm/src/SVGElement.cpp b/dviware/dvisvgm/src/SVGElement.cpp
new file mode 100644
index 0000000000..129bb22c82
--- /dev/null
+++ b/dviware/dvisvgm/src/SVGElement.cpp
@@ -0,0 +1,153 @@
+/*************************************************************************
+** SVGElement.cpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
+** **
+** This program is free software; you can redistribute it and/or **
+** modify it under the terms of the GNU General Public License as **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#include <sstream>
+#include "Color.hpp"
+#include "Matrix.hpp"
+#include "Opacity.hpp"
+#include "SVGElement.hpp"
+#include "XMLString.hpp"
+
+using namespace std;
+
+
+void SVGElement::setClipPathUrl (const string &url) {
+ if (!url.empty())
+ addAttribute("clip-path", "url(#"+url+")");
+}
+
+
+void SVGElement::setClipRule (FillRule rule) {
+ if (rule != FR_NONZERO)
+ addAttribute("clip-rule", "evenodd");
+}
+
+
+void SVGElement::setFillColor (Color color, bool skipBlack) {
+ if (color != Color::BLACK || !skipBlack)
+ addAttribute("fill", color.svgColorString());
+}
+
+
+void SVGElement::setFillOpacity (const Opacity &opacity) {
+ if (!opacity.isFillDefault()) {
+ setFillOpacity(opacity.fillalpha());
+ setFillOpacity(opacity.blendMode());
+ }
+}
+
+
+void SVGElement::setFillOpacity (const OpacityAlpha &alpha) {
+ if (!alpha.isOpaque())
+ addAttribute("fill-opacity", alpha.value());
+}
+
+
+void SVGElement::setFillOpacity (Opacity::BlendMode blendMode) {
+ if (blendMode != Opacity::BM_NORMAL)
+ addAttribute("style", "mix-blend-mode:"+Opacity::cssBlendMode(blendMode));
+}
+
+
+void SVGElement::setFillRule (FillRule rule) {
+ if (rule != FR_NONZERO)
+ addAttribute("fill-rule", "evenodd");
+}
+
+
+void SVGElement::setFillPatternUrl (const std::string &url) {
+ if (!url.empty())
+ addAttribute("fill", "url(#" + url + ")");
+}
+
+
+void SVGElement::setNoFillColor () {
+ addAttribute("fill", "none");
+}
+
+
+void SVGElement::setPoints (const vector<DPair> &points) {
+ if (!points.empty()) {
+ ostringstream oss;
+ for (const DPair &p : points)
+ oss << XMLString(p.x()) << ' ' << XMLString(p.y()) << ' ';
+ string str = oss.str();
+ str.pop_back();
+ addAttribute("points", str);
+ }
+}
+
+
+void SVGElement::setStrokeColor (Color color) {
+ addAttribute("stroke", color.svgColorString());
+}
+
+
+void SVGElement::setStrokeDash (const vector<double> &pattern, double offset) {
+ if (!pattern.empty()) {
+ string patternStr;
+ for (double dashValue : pattern)
+ patternStr += XMLString(dashValue)+" ";
+ patternStr.pop_back();
+ addAttribute("stroke-dasharray", patternStr);
+ if (offset != 0)
+ addAttribute("stroke-dashoffset", offset);
+ }
+}
+
+
+void SVGElement::setStrokeLineCap (LineCap cap) {
+ if (cap != LC_BUTT)
+ addAttribute("stroke-linecap", cap == LC_ROUND ? "round" : "square");
+}
+
+
+void SVGElement::setStrokeLineJoin (LineJoin join) {
+ if (join != LJ_MITER)
+ addAttribute("stroke-linejoin", join == LJ_BEVEL ? "bevel" : "round");
+}
+
+
+void SVGElement::setStrokeMiterLimit (double limit) {
+ if (limit != 4)
+ addAttribute("stroke-miterlimit", limit);
+}
+
+
+void SVGElement::setStrokeOpacity (const Opacity &opacity) {
+ if (!opacity.isStrokeDefault()) {
+ if (!opacity.strokealpha().isOpaque())
+ addAttribute("stroke-opacity", opacity.strokealpha().value());
+ if (opacity.blendMode() != Opacity::BM_NORMAL)
+ addAttribute("style", "mix-blend-mode:"+opacity.cssBlendMode());
+ }
+}
+
+
+void SVGElement::setStrokeWidth (double width) {
+ if (width != 1)
+ addAttribute("stroke-width", width);
+}
+
+
+void SVGElement::setTransform (const Matrix &matrix) {
+ if (!matrix.isIdentity())
+ addAttribute("transform", matrix.toSVG());
+}
diff --git a/dviware/dvisvgm/src/SVGElement.hpp b/dviware/dvisvgm/src/SVGElement.hpp
new file mode 100644
index 0000000000..c3d68bf593
--- /dev/null
+++ b/dviware/dvisvgm/src/SVGElement.hpp
@@ -0,0 +1,60 @@
+/*************************************************************************
+** SVGElement.hpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
+** **
+** This program is free software; you can redistribute it and/or **
+** modify it under the terms of the GNU General Public License as **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#ifndef SVGELEMENT_HPP
+#define SVGELEMENT_HPP
+
+#include "XMLNode.hpp"
+
+class Color;
+class Matrix;
+class Opacity;
+
+class SVGElement : public XMLElement {
+ public:
+ enum FillRule {FR_EVENODD, FR_NONZERO};
+ enum LineCap {LC_BUTT, LC_ROUND, LC_SQUARE};
+ enum LineJoin {LJ_BEVEL, LJ_MITER, LJ_ROUND};
+
+ public:
+ explicit SVGElement (std::string name) : XMLElement(std::move(name)) {}
+ explicit SVGElement (const XMLElement &node) : XMLElement(node) {}
+ explicit SVGElement (XMLElement &&node) noexcept : XMLElement(std::move(node)) {}
+ void setClipPathUrl (const std::string &url);
+ void setClipRule (FillRule rule);
+ void setFillColor (Color color, bool skipBlack=true);
+ void setFillOpacity (const Opacity &opacity);
+ void setFillOpacity (const OpacityAlpha &alpha);
+ void setFillOpacity (Opacity::BlendMode blendMode);
+ void setFillPatternUrl (const std::string &url);
+ void setFillRule (FillRule rule);
+ void setNoFillColor ();
+ void setPoints (const std::vector<DPair> &points);
+ void setStrokeColor (Color color);
+ void setStrokeDash (const std::vector<double> &pattern, double offset=0);
+ void setStrokeLineCap (LineCap cap);
+ void setStrokeLineJoin (LineJoin join);
+ void setStrokeOpacity (const Opacity &opacity);
+ void setStrokeWidth (double width);
+ void setStrokeMiterLimit (double limit);
+ void setTransform (const Matrix &matrix);
+};
+
+#endif
diff --git a/dviware/dvisvgm/src/SVGOutput.cpp b/dviware/dvisvgm/src/SVGOutput.cpp
index 18702be776..59a26764a7 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGOutput.hpp b/dviware/dvisvgm/src/SVGOutput.hpp
index f29a032674..96acf807e3 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp b/dviware/dvisvgm/src/SVGSingleCharTextHandler.cpp
index 89d1c548b0..4cece0bdab 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -19,7 +19,7 @@
*************************************************************************/
#include "SVGSingleCharTextHandler.hpp"
-#include "XMLNode.hpp"
+#include "SVGElement.hpp"
using namespace std;
@@ -29,9 +29,11 @@ void SVGSingleCharTextHandler::appendChar (uint32_t c, double x, double y) {
textNode->append(XMLString(font->unicode(c), false));
// Apply color changes only if the color differs from black and if the font color itself is black.
// Glyphs from non-black fonts (e.g. defined in a XeTeX document) can't change their color.
- if (_color.get() != Color::BLACK && font->color() == Color::BLACK) {
- textNode->addAttribute("fill", _color.get().svgColorString());
- _color.changed(false);
- }
+ if (_color.get() != Color::BLACK && font->color() == Color::BLACK)
+ textNode->setFillColor(_color);
+ _color.changed(false);
+ if (!_opacity->isFillDefault())
+ textNode->setFillOpacity(_opacity);
+ _opacity.changed(false);
contextNode()->append(std::move(textNode));
}
diff --git a/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp b/dviware/dvisvgm/src/SVGSingleCharTextHandler.hpp
index 67fcabd44c..57f05a4b07 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SVGTree.cpp b/dviware/dvisvgm/src/SVGTree.cpp
index e35a14d9b3..f501a2c85b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -31,7 +31,6 @@
#include "SVGCharHandlerFactory.hpp"
#include "SVGTree.hpp"
#include "XMLDocument.hpp"
-#include "XMLNode.hpp"
#include "XMLString.hpp"
using namespace std;
@@ -55,7 +54,7 @@ SVGTree::SVGTree () : _charHandler(SVGCharHandlerFactory::createHandler()) {
/** Clears the SVG tree and initializes the root element. */
void SVGTree::reset () {
_doc.clear();
- auto rootNode = util::make_unique<XMLElement>("svg");
+ auto rootNode = util::make_unique<SVGElement>("svg");
rootNode->addAttribute("version", "1.1");
rootNode->addAttribute("xmlns", "http://www.w3.org/2000/svg");
rootNode->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
@@ -111,20 +110,20 @@ bool SVGTree::setFontFormat (string formatstr) {
/** Starts a new page.
* @param[in] pageno number of new page */
void SVGTree::newPage (int pageno) {
- auto pageNode = util::make_unique<XMLElement>("g");
+ auto pageNode = util::make_unique<SVGElement>("g");
if (pageno >= 0)
pageNode->addAttribute("id", string("page")+XMLString(pageno));
_charHandler->setInitialContextNode(pageNode.get());
_page = pageNode.get();
_root->append(std::move(pageNode));
- _defsContextStack = stack<XMLElement*>();
- _pageContextStack = stack<XMLElement*>();
+ _defsContextStack = stack<SVGElement*>();
+ _pageContextStack = stack<SVGElement*>();
}
void SVGTree::appendToDefs (unique_ptr<XMLNode> node) {
if (!_defs) {
- auto defsNode = util::make_unique<XMLElement>("defs");
+ auto defsNode = util::make_unique<SVGElement>("defs");
_defs = defsNode.get();
_root->prepend(std::move(defsNode));
}
@@ -134,7 +133,7 @@ void SVGTree::appendToDefs (unique_ptr<XMLNode> node) {
void SVGTree::appendToPage (unique_ptr<XMLNode> node) {
- XMLElement *parent = _pageContextStack.empty() ? _page : _pageContextStack.top();
+ SVGElement *parent = _pageContextStack.empty() ? _page : _pageContextStack.top();
parent->append(std::move(node));
_charHandler->setInitialContextNode(parent);
}
@@ -149,8 +148,7 @@ void SVGTree::prependToPage (unique_ptr<XMLNode> node) {
void SVGTree::transformPage (const Matrix &usermatrix) {
- if (!usermatrix.isIdentity())
- _page->addAttribute("transform", usermatrix.toSVG());
+ _page->setTransform(usermatrix);
}
@@ -171,8 +169,8 @@ static unique_ptr<XMLElement> createGlyphNode (int c, const PhysicalFont &font,
double extend = font.style() ? font.style()->extend : 1;
glyphNode = util::make_unique<XMLElement>("glyph");
glyphNode->addAttribute("unicode", XMLString(font.unicode(c), false));
- glyphNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance(c)*extend));
- glyphNode->addAttribute("vert-adv-y", XMLString(font.vAdvance(c)));
+ glyphNode->addAttribute("horiz-adv-x", font.hAdvance(c)*extend);
+ glyphNode->addAttribute("vert-adv-y", font.vAdvance(c));
string name = font.glyphName(c);
if (!name.empty())
glyphNode->addAttribute("glyph-name", name);
@@ -192,7 +190,7 @@ static unique_ptr<XMLElement> createGlyphNode (int c, const PhysicalFont &font,
static string font_info (const Font &font) {
ostringstream oss;
- if (auto nf = dynamic_cast<const NativeFont*>(&font)) {
+ if (auto nf = font_cast<const NativeFont*>(&font)) {
oss << nf->familyName() << ' ' << nf->styleName() << "; " << nf->filename();
if (nf->style()) {
if (nf->style()->bold != 0)
@@ -211,7 +209,7 @@ void SVGTree::appendFontStyles (const unordered_set<const Font*> &fonts) {
if (CREATE_CSS && USE_FONTS && !fonts.empty() && _page) {
map<int, const Font*> sortmap;
for (const Font *font : fonts)
- if (!dynamic_cast<const VirtualFont*>(font)) // skip virtual fonts
+ if (!font_cast<const VirtualFont*>(font)) // skip virtual fonts
sortmap[FontManager::instance().fontID(font)] = font;
ostringstream style;
// add font style definitions in ascending order
@@ -260,14 +258,14 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr
auto fontNode = util::make_unique<XMLElement>("font");
string fontname = font.name();
fontNode->addAttribute("id", fontname);
- fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance()));
+ fontNode->addAttribute("horiz-adv-x", font.hAdvance());
auto faceNode = util::make_unique<XMLElement>("font-face");
faceNode->addAttribute("font-family", fontname);
- faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm()));
+ faceNode->addAttribute("units-per-em", font.unitsPerEm());
if (!font.verticalLayout()) {
- faceNode->addAttribute("ascent", XMLString(font.ascent()));
- faceNode->addAttribute("descent", XMLString(font.descent()));
+ faceNode->addAttribute("ascent", font.ascent());
+ faceNode->addAttribute("descent", font.descent());
}
fontNode->append(std::move(faceNode));
for (int c : chars)
@@ -297,8 +295,8 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr
}
-void SVGTree::pushDefsContext (unique_ptr<XMLElement> node) {
- XMLElement *nodePtr = node.get();
+void SVGTree::pushDefsContext (unique_ptr<SVGElement> node) {
+ SVGElement *nodePtr = node.get();
if (_defsContextStack.empty())
appendToDefs(std::move(node));
else
@@ -314,8 +312,8 @@ void SVGTree::popDefsContext () {
/** Pushes a new context element that will take all following nodes added to the page. */
-void SVGTree::pushPageContext (unique_ptr<XMLElement> node) {
- XMLElement *nodePtr = node.get();
+void SVGTree::pushPageContext (unique_ptr<SVGElement> node) {
+ SVGElement *nodePtr = node.get();
if (_pageContextStack.empty())
_page->append(std::move(node));
else
diff --git a/dviware/dvisvgm/src/SVGTree.hpp b/dviware/dvisvgm/src/SVGTree.hpp
index a441a314a5..86d9411449 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -31,13 +31,14 @@
#include "GFGlyphTracer.hpp"
#include "Matrix.hpp"
#include "SVGCharHandler.hpp"
+#include "SVGElement.hpp"
#include "XMLDocument.hpp"
-#include "XMLNode.hpp"
class BoundingBox;
class Color;
class Font;
class Matrix;
+class Opacity;
class PhysicalFont;
class SVGTree {
@@ -54,24 +55,26 @@ class SVGTree {
void appendChar (int c, double x, double y) {_charHandler->appendChar(c, x, y);}
void appendFontStyles (const std::unordered_set<const Font*> &fonts);
void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *callback=nullptr);
- void pushDefsContext (std::unique_ptr<XMLElement> node);
+ void pushDefsContext (std::unique_ptr<SVGElement> node);
void popDefsContext ();
- void pushPageContext (std::unique_ptr<XMLElement> node);
+ void pushPageContext (std::unique_ptr<SVGElement> node);
void popPageContext ();
void setBBox (const BoundingBox &bbox);
void setFont (int id, const Font &font);
static bool setFontFormat (std::string formatstr);
- void setX (double x) {_charHandler->notifyXAdjusted();}
- void setY (double y) {_charHandler->notifyYAdjusted();}
- void setMatrix (const Matrix &m) {_charHandler->setMatrix(m);}
+ void setX (double x) {_charHandler->notifyXAdjusted();}
+ void setY (double y) {_charHandler->notifyYAdjusted();}
+ void setMatrix (const Matrix &m) {_charHandler->setMatrix(m);}
void setColor (const Color &c);
- void setVertical (bool state) {_charHandler->setVertical(state);}
+ void setOpacity (const Opacity &op) {_charHandler->setOpacity(op);}
+ void setVertical (bool state) {_charHandler->setVertical(state);}
void transformPage (const Matrix &m);
- Color getColor () const {return _charHandler->getColor();}
- const Matrix& getMatrix () const {return _charHandler->getMatrix();}
- XMLElement* rootNode () const {return _root;}
- XMLElement* defsNode () const {return _defs;}
- XMLElement* pageNode () const {return _page;}
+ Color getColor () const {return _charHandler->getColor();}
+ const Opacity& getOpacity () const {return _charHandler->getOpacity();}
+ const Matrix& getMatrix () const {return _charHandler->getMatrix();}
+ XMLElement* rootNode () const {return _root;}
+ XMLElement* defsNode () const {return _defs;}
+ XMLElement* pageNode () const {return _page;}
protected:
XMLCData* styleCDataNode ();
@@ -88,11 +91,11 @@ class SVGTree {
private:
XMLDocument _doc;
- XMLElement *_root, *_page, *_defs;
+ SVGElement *_root, *_page, *_defs;
XMLCData *_styleCDataNode;
std::unique_ptr<SVGCharHandler> _charHandler;
- std::stack<XMLElement*> _defsContextStack;
- std::stack<XMLElement*> _pageContextStack;
+ std::stack<SVGElement*> _defsContextStack;
+ std::stack<SVGElement*> _pageContextStack;
};
#endif
diff --git a/dviware/dvisvgm/src/ShadingPatch.cpp b/dviware/dvisvgm/src/ShadingPatch.cpp
index 847dc3aa0c..a734c4c48b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ShadingPatch.hpp b/dviware/dvisvgm/src/ShadingPatch.hpp
index 573188b77b..2a8103d044 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SignalHandler.cpp b/dviware/dvisvgm/src/SignalHandler.cpp
index 14badba085..129b010d72 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SignalHandler.hpp b/dviware/dvisvgm/src/SignalHandler.hpp
index 647a3650fc..ef6a0a4e55 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SourceInput.cpp b/dviware/dvisvgm/src/SourceInput.cpp
index 5cd2e22749..55196c76ce 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SourceInput.hpp b/dviware/dvisvgm/src/SourceInput.hpp
index 63f4af9b7a..7d7a08c88f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SpecialActions.hpp b/dviware/dvisvgm/src/SpecialActions.hpp
index f8eba3fd12..a7e4ac31f9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -27,6 +27,7 @@
#include "Color.hpp"
#include "FilePath.hpp"
#include "Matrix.hpp"
+#include "Opacity.hpp"
#include "SVGTree.hpp"
class XMLElement;
@@ -46,6 +47,8 @@ class SpecialActions {
virtual const Matrix& getMatrix () const =0;
virtual Matrix getPageTransformation () const {return Matrix(1);}
virtual void setBgColor (const Color &color) =0;
+ virtual void setOpacity (const Opacity &opacity) =0;
+ virtual const Opacity& getOpacity () const =0;
virtual const SVGTree& svgTree () const =0;
SVGTree& svgTree () {return const_cast<SVGTree&>(const_cast<const SpecialActions*>(this)->svgTree());}
virtual BoundingBox& bbox () =0;
@@ -75,6 +78,8 @@ class EmptySpecialActions : public SpecialActions {
void finishLine () override {}
void setColor (const Color &color) override {}
void setBgColor (const Color &color) override {}
+ void setOpacity (const Opacity &opacity) override {}
+ const Opacity& getOpacity () const override {return _svg.getOpacity();}
Color getColor () const override {return Color::BLACK;}
void setMatrix (const Matrix &m) override {}
const Matrix& getMatrix () const override {return _matrix;}
diff --git a/dviware/dvisvgm/src/SpecialHandler.hpp b/dviware/dvisvgm/src/SpecialHandler.hpp
index 6c676a6ba0..382f0e53d1 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SpecialManager.cpp b/dviware/dvisvgm/src/SpecialManager.cpp
index f3b2f3aa50..68e1c68b51 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/SpecialManager.hpp b/dviware/dvisvgm/src/SpecialManager.hpp
index 4c4ccae281..76cdb3e2e6 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/StreamReader.cpp b/dviware/dvisvgm/src/StreamReader.cpp
index 200b6592d9..8924d885b5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/StreamReader.hpp b/dviware/dvisvgm/src/StreamReader.hpp
index 653b451b69..08a4fd3636 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/StreamWriter.cpp b/dviware/dvisvgm/src/StreamWriter.cpp
index c0885c31b1..21eefd1b9e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/StreamWriter.hpp b/dviware/dvisvgm/src/StreamWriter.hpp
index 16a54b1050..5128bbf736 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Subfont.cpp b/dviware/dvisvgm/src/Subfont.cpp
index 540270f8a8..738ce24455 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -53,7 +53,7 @@ SubfontDefinition::SubfontDefinition (string name, const char *fpath) : _sfname(
while (is && !isspace(is.peek()))
id += char(is.get());
if (!id.empty()) {
- auto state = _subfonts.emplace(pair<string,unique_ptr<Subfont>>(id, unique_ptr<Subfont>()));
+ auto state = _subfonts.emplace(id, unique_ptr<Subfont>());
if (state.second) // id was not present in map already
state.first->second = unique_ptr<Subfont>(new Subfont(*this, state.first->first));
skip_mapping_data(is);
diff --git a/dviware/dvisvgm/src/Subfont.hpp b/dviware/dvisvgm/src/Subfont.hpp
index 5b921bdddb..961720a99c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/System.cpp b/dviware/dvisvgm/src/System.cpp
index ed14df6821..4f8b0a139c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/System.hpp b/dviware/dvisvgm/src/System.hpp
index 72a0cb3da8..fb698d303b 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TFM.cpp b/dviware/dvisvgm/src/TFM.cpp
index ea6f2ecbe4..011e659dc9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TFM.hpp b/dviware/dvisvgm/src/TFM.hpp
index 261a5ce736..0bb881df8f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TTFAutohint.cpp b/dviware/dvisvgm/src/TTFAutohint.cpp
index ad1b03f21a..6e8fbefd48 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TTFAutohint.hpp b/dviware/dvisvgm/src/TTFAutohint.hpp
index d23ceb2be0..3d774984c7 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TensorProductPatch.cpp b/dviware/dvisvgm/src/TensorProductPatch.cpp
index dcd31e275d..261dbc28f5 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -63,7 +63,9 @@ void TensorProductPatch::setFirstMatrixColumn (DPair source[4][4], int col, bool
* @param[in] edgeflag defines how to connect this patch with another one
* @param[in] patch reference patch required if edgeflag > 0 */
void TensorProductPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) {
- auto tpPatch = dynamic_cast<TensorProductPatch*>(patch);
+ TensorProductPatch *tpPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ tpPatch = static_cast<TensorProductPatch*>(patch);
if (edgeflag > 0 && !tpPatch)
throw ShadingException("missing preceding data in definition of tensor-product patch");
if ((edgeflag == 0 && points.size() != 16) || (edgeflag > 0 && points.size() != 12))
@@ -107,7 +109,9 @@ void TensorProductPatch::setPoints (const PointVec &points, int edgeflag, Shadin
* @param[in] edgeflag defines how to connect this patch with another one
* @param[in] patch reference patch required if edgeflag > 0 */
void TensorProductPatch::setColors(const ColorVec &colors, int edgeflag, ShadingPatch* patch) {
- auto tpPatch = dynamic_cast<TensorProductPatch*>(patch);
+ TensorProductPatch *tpPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ tpPatch = static_cast<TensorProductPatch*>(patch);
if (edgeflag > 0 && !tpPatch)
throw ShadingException("missing preceding data in definition of tensor-product patch");
if ((edgeflag == 0 && colors.size() != 4) || (edgeflag > 0 && colors.size() != 2))
@@ -492,7 +496,9 @@ DPair CoonsPatch::valueAt (double u, double v) const {
* @param[in] edgeflag defines how to connect this patch to another one
* @param[in] patch reference patch required if edgeflag > 0 */
void CoonsPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) {
- auto coonsPatch = dynamic_cast<CoonsPatch*>(patch);
+ CoonsPatch *coonsPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ coonsPatch = static_cast<CoonsPatch*>(patch);
if (edgeflag > 0 && !coonsPatch)
throw ShadingException("missing preceding data in definition of relative Coons patch");
if ((edgeflag == 0 && points.size() != 12) || (edgeflag > 0 && points.size() != 8))
@@ -529,7 +535,9 @@ void CoonsPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *
void CoonsPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) {
- auto coonsPatch = dynamic_cast<CoonsPatch*>(patch);
+ CoonsPatch *coonsPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ coonsPatch = static_cast<CoonsPatch*>(patch);
if (edgeflag > 0 && !coonsPatch)
throw ShadingException("missing preceding data in definition of relative Coons patch");
if ((edgeflag == 0 && colors.size() != 4) || (edgeflag > 0 && colors.size() != 2))
diff --git a/dviware/dvisvgm/src/TensorProductPatch.hpp b/dviware/dvisvgm/src/TensorProductPatch.hpp
index e53604cf52..654271b90d 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Terminal.cpp b/dviware/dvisvgm/src/Terminal.cpp
index 3b2ff2b871..274426443a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Terminal.hpp b/dviware/dvisvgm/src/Terminal.hpp
index fd7a920c16..f84d47b707 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ToUnicodeMap.cpp b/dviware/dvisvgm/src/ToUnicodeMap.cpp
index 6ab99a248e..0a0b069e96 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ToUnicodeMap.hpp b/dviware/dvisvgm/src/ToUnicodeMap.hpp
index 74d6dcb648..806233e12f 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TpicSpecialHandler.cpp b/dviware/dvisvgm/src/TpicSpecialHandler.cpp
index 47d3e46988..b611117725 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -28,6 +28,7 @@
#include "InputReader.hpp"
#include "GraphicsPath.hpp"
#include "SpecialActions.hpp"
+#include "SVGElement.hpp"
#include "SVGTree.hpp"
#include "TpicSpecialHandler.hpp"
#include "utility.hpp"
@@ -70,28 +71,32 @@ Color TpicSpecialHandler::fillColor (bool grayOnly) const {
* @param[in] penwidth pen with used to compute the stroke parameters
* @param[in] pencolor the drawing color
* @param[in] ddist dash/dot distance of line in PS point units (0:solid line, >0:dashed line, <0:dotted line) */
-static void add_stroke_attribs (XMLElement *elem, double penwidth, Color pencolor, double ddist) {
+static void add_stroke_attribs (SVGElement *elem, double penwidth, Color pencolor, double ddist) {
if (penwidth > 0) { // attributes actually required?
- elem->addAttribute("stroke", pencolor.svgColorString());
- elem->addAttribute("stroke-width", XMLString(penwidth));
+ elem->setStrokeColor(pencolor);
+ elem->setStrokeWidth(penwidth);
+ vector<double> dasharray;
if (ddist > 0)
- elem->addAttribute("stroke-dasharray", XMLString(ddist));
- else if (ddist < 0)
- elem->addAttribute("stroke-dasharray", XMLString(penwidth) + ' ' + XMLString(-ddist));
+ dasharray.push_back(ddist);
+ else if (ddist < 0) {
+ dasharray.push_back(penwidth);
+ dasharray.push_back(-ddist);
+ }
+ elem->setStrokeDash(dasharray);
}
}
-static unique_ptr<XMLElement> create_ellipse_element (double cx, double cy, double rx, double ry) {
+static unique_ptr<SVGElement> create_ellipse_element (double cx, double cy, double rx, double ry) {
bool is_circle = (rx == ry);
- auto elem = util::make_unique<XMLElement>(is_circle ? "circle" : "ellipse");
- elem->addAttribute("cx", XMLString(cx));
- elem->addAttribute("cy", XMLString(cy));
+ auto elem = util::make_unique<SVGElement>(is_circle ? "circle" : "ellipse");
+ elem->addAttribute("cx", cx);
+ elem->addAttribute("cy", cy);
if (is_circle)
- elem->addAttribute("r", XMLString(rx));
+ elem->addAttribute("r", rx);
else {
- elem->addAttribute("rx", XMLString(rx));
- elem->addAttribute("ry", XMLString(ry));
+ elem->addAttribute("rx", rx);
+ elem->addAttribute("ry", ry);
}
return elem;
}
@@ -102,7 +107,7 @@ static unique_ptr<XMLElement> create_ellipse_element (double cx, double cy, doub
* @param[in] actions object providing the actions that can be performed by the SpecialHandler */
void TpicSpecialHandler::drawLines (double ddist, SpecialActions &actions) {
if (!_points.empty() && (_penwidth > 0 || _grayLevel >= 0) && !actions.outputLocked()) {
- unique_ptr<XMLElement> elem;
+ unique_ptr<SVGElement> elem;
if (_points.size() == 1) {
const DPair &p = _points.back();
elem = create_ellipse_element(p.x()+actions.getX(), p.y()+actions.getY(), _penwidth/2.0, _penwidth/2.0);
@@ -110,26 +115,27 @@ void TpicSpecialHandler::drawLines (double ddist, SpecialActions &actions) {
}
else {
if (_points.size() == 2 || (_grayLevel < 0 && _points.front() != _points.back())) {
- elem = util::make_unique<XMLElement>("polyline");
- elem->addAttribute("fill", "none");
- elem->addAttribute("stroke-linecap", "round");
+ elem = util::make_unique<SVGElement>("polyline");
+ elem->setNoFillColor();
+ elem->setStrokeLineCap(SVGElement::LC_ROUND);
}
else {
while (_points.front() == _points.back())
_points.pop_back();
- elem = util::make_unique<XMLElement>("polygon");
- elem->addAttribute("fill", _grayLevel < 0 ? "none" : fillColor(false).svgColorString());
+ elem = util::make_unique<SVGElement>("polygon");
+ if (_grayLevel < 0)
+ elem->setNoFillColor();
+ else
+ elem->setFillColor(fillColor(false));
}
- ostringstream oss;
- for (auto it=_points.begin(); it != _points.end(); ++it) {
- if (it != _points.begin())
- oss << ' ';
- double x = it->x()+actions.getX();
- double y = it->y()+actions.getY();
- oss << XMLString(x) << ',' << XMLString(y);
+ vector<DPair> points;
+ for (const DPair &p : _points) {
+ double x = p.x()+actions.getX();
+ double y = p.y()+actions.getY();
+ points.emplace_back(x, y);
actions.embed(DPair(x, y));
}
- elem->addAttribute("points", oss.str());
+ elem->setPoints(points);
add_stroke_attribs(elem.get(), _penwidth, Color::BLACK, ddist);
}
actions.svgTree().appendToPage(std::move(elem));
@@ -175,8 +181,8 @@ void TpicSpecialHandler::drawSplines (double ddist, SpecialActions &actions) {
path.lineto(p+_points[numPoints-1]);
actions.embed(p+_points[numPoints-1]);
}
- auto pathElem = util::make_unique<XMLElement>("path");
- pathElem->addAttribute("fill", "none");
+ auto pathElem = util::make_unique<SVGElement>("path");
+ pathElem->setNoFillColor();
ostringstream oss;
path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
pathElem->addAttribute("d", oss.str());
@@ -200,7 +206,7 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do
if ((_penwidth > 0 || _grayLevel >= 0) && !actions.outputLocked()) {
cx += actions.getX();
cy += actions.getY();
- unique_ptr<XMLElement> elem;
+ unique_ptr<SVGElement> elem;
bool closed=true;
if (abs(angle2-angle1) >= math::TWO_PI) // closed ellipse?
elem = create_ellipse_element(cx, cy, rx, ry);
@@ -213,18 +219,21 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do
path.closepath();
else
closed = false;
- elem = util::make_unique<XMLElement>("path");
+ elem = util::make_unique<SVGElement>("path");
ostringstream oss;
path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS);
elem->addAttribute("d", oss.str());
}
if (_penwidth > 0) {
- elem->addAttribute("stroke-width", _penwidth);
- elem->addAttribute("stroke", actions.getColor().svgColorString());
+ elem->setStrokeWidth(_penwidth);
+ elem->setStrokeColor(actions.getColor());
if (!closed)
- elem->addAttribute("stroke-linecap", "round");
+ elem->setStrokeLineCap(SVGElement::LC_ROUND);
}
- elem->addAttribute("fill", _grayLevel < 0 ? "none" : fillColor(true).svgColorString());
+ if (_grayLevel < 0)
+ elem->setNoFillColor();
+ else
+ elem->setFillColor(fillColor(true));
actions.svgTree().appendToPage(std::move(elem));
double pw = _penwidth/2.0;
actions.embed(BoundingBox(cx-rx-pw, cy-ry-pw, cx+rx+pw, cy+ry+pw));
@@ -296,7 +305,7 @@ bool TpicSpecialHandler::process (const string &prefix, istream &is, SpecialActi
case cmd_id("pa"): { // add point to path
double x = ir.getDouble()*mi2bp;
double y = ir.getDouble()*mi2bp;
- _points.emplace_back(DPair(x,y));
+ _points.emplace_back(x, y);
break;
}
case cmd_id("fp"): // draw solid lines through recorded points; close and fill path if fill color was defined
diff --git a/dviware/dvisvgm/src/TpicSpecialHandler.hpp b/dviware/dvisvgm/src/TpicSpecialHandler.hpp
index f6ec271994..8a9b458056 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TriangularPatch.cpp b/dviware/dvisvgm/src/TriangularPatch.cpp
index fadeb725ff..c57836d900 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -31,7 +31,9 @@ TriangularPatch::TriangularPatch (const PointVec &points, const ColorVec &colors
void TriangularPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) {
- auto triangularPatch = dynamic_cast<TriangularPatch*>(patch);
+ TriangularPatch *triangularPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ triangularPatch = static_cast<TriangularPatch*>(patch);
if (edgeflag > 0 && !triangularPatch)
throw ShadingException("missing preceding data in definition of triangular patch");
if ((edgeflag == 0 && points.size() != 3) || (edgeflag > 0 && points.size() != 1))
@@ -62,7 +64,9 @@ void TriangularPatch::setPoints (const DPair &p1, const DPair &p2, const DPair &
void TriangularPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) {
- auto triangularPatch = dynamic_cast<TriangularPatch*>(patch);
+ TriangularPatch *triangularPatch = nullptr;
+ if (patch && patch->psShadingType() == psShadingType())
+ triangularPatch = static_cast<TriangularPatch*>(patch);
if (edgeflag > 0 && !triangularPatch)
throw ShadingException("missing preceding data in definition of triangular patch");
if ((edgeflag == 0 && colors.size() != 3) || (edgeflag > 0 && colors.size() != 1))
diff --git a/dviware/dvisvgm/src/TriangularPatch.hpp b/dviware/dvisvgm/src/TriangularPatch.hpp
index 797068bacd..8d4453e5db 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/TrueTypeFont.cpp b/dviware/dvisvgm/src/TrueTypeFont.cpp
index 2921af59ea..84b56c5850 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -56,7 +56,7 @@ bool TrueTypeFont::read (const string &fname) {
if ((offset | length) > _buffer.size() || offset+length > _buffer.size())
return false;
TTFTableRecord record = {tag, checksum, length, reinterpret_cast<const uint8_t*>(_buffer.data())+offset};
- _tableRecords.emplace_back(std::move(record));
+ _tableRecords.push_back(std::move(record));
}
return true;
}
@@ -94,7 +94,7 @@ void TrueTypeFont::writeWOFF (ostream &os) const {
woffRecord.compressTableData();
woffSize += woffRecord.paddedSize();
ttfSize += ttfRecord.paddedSize();
- woffRecords.emplace_back(std::move(woffRecord));
+ woffRecords.push_back(std::move(woffRecord));
}
// write WOFF header
StreamWriter writer(os);
diff --git a/dviware/dvisvgm/src/TrueTypeFont.hpp b/dviware/dvisvgm/src/TrueTypeFont.hpp
index 0ae155c52c..a287f305fa 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Unicode.cpp b/dviware/dvisvgm/src/Unicode.cpp
index 0fea9c3daf..5b7fb3d238 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/Unicode.hpp b/dviware/dvisvgm/src/Unicode.hpp
index e085bac54d..1547e3f7d4 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/VFActions.hpp b/dviware/dvisvgm/src/VFActions.hpp
index 2d4a2a2c5f..6939d8e710 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/VFReader.cpp b/dviware/dvisvgm/src/VFReader.cpp
index eb1193ddaa..6533333b5e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/VFReader.hpp b/dviware/dvisvgm/src/VFReader.hpp
index bbf4986d7f..dabad67460 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/VectorIterator.hpp b/dviware/dvisvgm/src/VectorIterator.hpp
index 0fb53d78e4..45009e4ea1 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -93,7 +93,7 @@ class VectorIterator {
bool operator >= (const VectorIterator &it) const {return _pos >= it._pos;}
bool operator < (const VectorIterator &it) const {return _pos < it._pos;}
bool operator > (const VectorIterator &it) const {return _pos > it._pos;}
- bool valid () const {return _pos >= 0 && _pos < _vector.size();}
+ bool valid () const {return _pos < _vector.size();}
void invalidate () {_pos = _vector.size();}
void reset () {_pos = 0;}
diff --git a/dviware/dvisvgm/src/VectorStream.hpp b/dviware/dvisvgm/src/VectorStream.hpp
index 0372d368d0..22709803ca 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/XMLDocument.cpp b/dviware/dvisvgm/src/XMLDocument.cpp
index ffe23b1f80..8b3c7f31e9 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -39,7 +39,7 @@ void XMLDocument::append (unique_ptr<XMLNode> node) {
if (node->toElement())
_rootElement = util::static_unique_ptr_cast<XMLElement>(std::move(node));
else
- _nodes.emplace_back(std::move(node));
+ _nodes.push_back(std::move(node));
}
}
diff --git a/dviware/dvisvgm/src/XMLDocument.hpp b/dviware/dvisvgm/src/XMLDocument.hpp
index 2eaaee4a28..c6b5645226 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/XMLNode.cpp b/dviware/dvisvgm/src/XMLNode.cpp
index eb49b9c9db..8549593a13 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -107,7 +107,7 @@ void XMLElement::addAttribute (const string &name, const string &value) {
if (Attribute *attr = getAttribute(name))
attr->value = value;
else
- _attributes.emplace_back(Attribute(name, value));
+ _attributes.emplace_back(name, value);
}
@@ -387,12 +387,12 @@ ostream& XMLElement::write (ostream &os) const {
os << '>';
// Insert newlines around children except text nodes. According to the
// SVG specification, pure whitespace nodes are ignored by the SVG renderer.
- if (WRITE_NEWLINES && !_firstChild->toText())
+ if (WRITE_NEWLINES && name() != "text" && !_firstChild->toText())
os << '\n';
for (XMLNode *child = _firstChild.get(); child; child = child->next()) {
child->write(os);
if (!child->toText()) {
- if (WRITE_NEWLINES && (!child->next() || !child->next()->toText()))
+ if (WRITE_NEWLINES && name() != "text" && (!child->next() || !child->next()->toText()))
os << '\n';
}
}
diff --git a/dviware/dvisvgm/src/XMLNode.hpp b/dviware/dvisvgm/src/XMLNode.hpp
index 65bd69fab8..aeab862130 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -128,7 +128,7 @@ class XMLElement : public XMLNode {
explicit XMLElement (std::string name);
XMLElement (const XMLElement &node);
XMLElement (XMLElement &&node) noexcept;
- ~XMLElement ();
+ ~XMLElement () override;
std::unique_ptr<XMLNode> clone () const override {return util::make_unique<XMLElement>(*this);}
void clear () override;
void addAttribute (const std::string &name, const std::string &value);
diff --git a/dviware/dvisvgm/src/XMLString.cpp b/dviware/dvisvgm/src/XMLString.cpp
index 31de6a7b33..72026bdd76 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/XMLString.hpp b/dviware/dvisvgm/src/XMLString.hpp
index 52c227ae8a..36ef2bee55 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/XXHashFunction.hpp b/dviware/dvisvgm/src/XXHashFunction.hpp
index d26a4e4984..4478a2204c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ZLibOutputStream.hpp b/dviware/dvisvgm/src/ZLibOutputStream.hpp
index c1c065e357..a995dbf01e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/dvisvgm.cpp b/dviware/dvisvgm/src/dvisvgm.cpp
index 803e34e717..5cf833dd82 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -244,7 +244,7 @@ class VersionInfo {
protected:
void append (const string &name, const string &version) {
- _versionPairs.emplace_back(pair<string,string>(name, version));
+ _versionPairs.emplace_back(name, version);
}
private:
@@ -349,7 +349,8 @@ static void set_variables (const CommandLine &cmdline) {
string msg = "unknown font format '"+cmdline.fontFormatOpt.value()+"' (supported formats: ";
for (const string &format : FontWriter::supportedFormats())
msg += format + ", ";
- msg.erase(msg.end()-2);
+ msg.erase(msg.end()-2, msg.end());
+ msg += ")";
throw CL::CommandLineException(msg);
}
SVGTree::CREATE_USE_ELEMENTS = cmdline.noFontsOpt.value() < 1;
diff --git a/dviware/dvisvgm/src/ffwrapper.c b/dviware/dvisvgm/src/ffwrapper.c
index 61f17fdc6d..4f89c2b6d1 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/ffwrapper.h b/dviware/dvisvgm/src/ffwrapper.h
index e3e2f98832..6474d854a2 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/macros.hpp b/dviware/dvisvgm/src/macros.hpp
index 0a03776057..907e402c8c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp b/dviware/dvisvgm/src/optimizer/AttributeExtractor.cpp
index 28046e45a2..e5f3b95536 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp b/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp
index b4c6f2775c..c8ab6bd61a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/DependencyGraph.hpp b/dviware/dvisvgm/src/optimizer/DependencyGraph.hpp
index 98d2a8d699..912d4a9110 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/GroupCollapser.cpp b/dviware/dvisvgm/src/optimizer/GroupCollapser.cpp
index c3060be788..c5954d705c 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -107,7 +107,7 @@ void GroupCollapser::execute (XMLElement *context) {
* @return true if all attributes have been moved */
bool GroupCollapser::moveAttributes (XMLElement &source, XMLElement &dest) {
vector<string> movedAttributes;
- for (const XMLElement::Attribute &attr : source.attributes()) {
+ for (const auto &attr : source.attributes()) {
if (attr.name == "transform") {
string transform;
if (const char *destvalue = dest.getAttributeValue("transform"))
diff --git a/dviware/dvisvgm/src/optimizer/GroupCollapser.hpp b/dviware/dvisvgm/src/optimizer/GroupCollapser.hpp
index 08db518a90..2694c4f355 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/Makefile.in b/dviware/dvisvgm/src/optimizer/Makefile.in
index 0913c8462f..26731769a2 100644
--- a/dviware/dvisvgm/src/optimizer/Makefile.in
+++ b/dviware/dvisvgm/src/optimizer/Makefile.in
@@ -346,6 +346,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/src/optimizer/OptimizerModule.hpp b/dviware/dvisvgm/src/optimizer/OptimizerModule.hpp
index 276cfa5578..91f0263bb8 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp b/dviware/dvisvgm/src/optimizer/RedundantElementRemover.cpp
index a8aca1a993..f8d040a329 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp b/dviware/dvisvgm/src/optimizer/RedundantElementRemover.hpp
index 8d5a6b689f..52ce905c8e 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp b/dviware/dvisvgm/src/optimizer/SVGOptimizer.cpp
index ac4a78fe20..8f9635a836 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp b/dviware/dvisvgm/src/optimizer/SVGOptimizer.hpp
index 0da157fbbb..b15723d9ea 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/TextSimplifier.cpp b/dviware/dvisvgm/src/optimizer/TextSimplifier.cpp
index b94ab9458e..2b778dadbc 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -39,7 +39,7 @@ static XMLElement::Attributes common_inheritable_attributes (const vector<XMLEle
if (commonAttribs.empty()) {
if (intersected)
break;
- for (const auto attrib : elem->attributes()) {
+ for (const auto &attrib : elem->attributes()) {
if (AttributeExtractor::inheritable(attrib))
commonAttribs.push_back(attrib);
}
@@ -94,11 +94,11 @@ void TextSimplifier::execute (XMLElement *context) {
vector<XMLElement::Attribute> attribs = common_inheritable_attributes(tspans);
if (!tspans.empty() && !attribs.empty()) {
// move all common tspan attributes to the parent text element
- for (const XMLElement::Attribute &attr : attribs)
+ for (const auto &attr : attribs)
context->addAttribute(attr.name, attr.value);
// remove all common attributes from the tspan elements
for (XMLElement *tspan : tspans) {
- for (const XMLElement::Attribute &attr : attribs)
+ for (const auto &attr : attribs)
tspan->removeAttribute(attr.name);
// unwrap the tspan if there are no remaining attributes
if (tspan->attributes().empty())
diff --git a/dviware/dvisvgm/src/optimizer/TextSimplifier.hpp b/dviware/dvisvgm/src/optimizer/TextSimplifier.hpp
index cfdd548e87..9ad3e0edb0 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp b/dviware/dvisvgm/src/optimizer/TransformSimplifier.cpp
index 2541631b0e..ce0a6d8d7a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp b/dviware/dvisvgm/src/optimizer/TransformSimplifier.hpp
index 5d503635ba..10591dc271 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp b/dviware/dvisvgm/src/optimizer/WSNodeRemover.cpp
index 3f83011f5a..09de2f19bb 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp b/dviware/dvisvgm/src/optimizer/WSNodeRemover.hpp
index 8c21ce2b6e..438c21c8fd 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/options.dtd b/dviware/dvisvgm/src/options.dtd
index d2806badce..21c33a168a 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/options.xml b/dviware/dvisvgm/src/options.xml
index b1911694dd..1d0d09e3d6 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-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -26,7 +26,7 @@
<usage>--eps [options] epsfile</usage>
<usage>--pdf [options] pdffile</usage>
<description>This program converts DVI files, as created by TeX/LaTeX, as well as\nEPS and PDF files to the XML-based scalable vector graphics format SVG.</description>
- <copyright>Copyright (C) 2005-2020 Martin Gieseking &lt;martin.gieseking@uos.de></copyright>
+ <copyright>Copyright (C) 2005-2021 Martin Gieseking &lt;martin.gieseking@uos.de></copyright>
</program>
<options>
<section title="Input options">
diff --git a/dviware/dvisvgm/src/psdefs.cpp b/dviware/dvisvgm/src/psdefs.cpp
index 8cc5a10cb9..baa8b09a6c 100644
--- a/dviware/dvisvgm/src/psdefs.cpp
+++ b/dviware/dvisvgm/src/psdefs.cpp
@@ -2,7 +2,7 @@
** psdefs.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -115,47 +115,51 @@ const char *PSInterpreter::PSDEFS =
"rgbcolor 3(setrgbcolor)prcmd}def/printgstate{@dodraw @GD/@nulldev get not and{"
"matrix currentmatrix aload pop 6(setmatrix)prcmd applyscalevals currentlinewid"
"th 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoin 1(se"
-"tlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd prcolor currentdash ma"
-"rk 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}if}d"
-"ef/strconcat{exch dup length 2 index length add string dup dup 4 2 roll copy l"
-"ength 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgstate}def/s"
-"ave{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prcmd}def/"
-"restore{:restore @checknulldev printgstate @UD/@saveID known{@UD begin @saveID"
-" end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore @checknull"
-"dev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @checknulldev se"
-"tstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup 1("
-"rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype ne "
-"@dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate"
-"{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/translate sysex"
-"ec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd app"
-"lyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{matrix curr"
-"entmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1 roll>>"
-"begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin PatternTy"
-"pe 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload pop "
-"15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(makepattern)p"
-"rcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpattern{begin Pa"
-"tternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorsp"
-"ace aload length -1 roll pop]/setcolorspace sysexec/setcolor sysexec XUID aloa"
-"d pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd currentcolo"
-"rspace 0 get/Pattern ne{[/Pattern currentcolorspace]/setcolorspace sysexec}if "
-"currentcolorspace @setcolorspace}{/setpattern sysexec}ifelse end}def/setcolor{"
-"dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor sysexec set"
-"rgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sysexec @setcolorspace}def"
-"/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern eq{1}{0}ifelse 1(setcol"
-"orspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/set"
-"rgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape known{dup/.setalphaissh"
-"ape sysexec}if{1}{0}ifelse 1(setisshapealpha)prcmd}bind def/.setfillconstantal"
-"pha{@SD/.setfillconstantalpha known{dup/.setfillconstantalpha sysexec}if 1(set"
-"fillconstantalpha)prcmd}bind def/.setstrokeconstantalpha{@SD/.setstrokeconstan"
-"talpha known{dup/.setstrokeconstantalpha sysexec}if 1(setstrokeconstantalpha)p"
-"rcmd}bind def/.setopacityalpha{false .setalphaisshape dup .setfillconstantalph"
-"a .setstrokeconstantalpha}bind def/.setshapealpha{true .setalphaisshape dup .s"
-"etfillconstantalpha .setstrokeconstantalpha}bind def/.setblendmode{dup/.setble"
-"ndmode sysexec<</Normal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3/SoftLight"
-" 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Lighten 9/Difference 10/Exclu"
-"sion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverprint 16>>ex"
-"ch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file runpdfbegin pdfpagecount"
-" runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup 1 lt exch pdfpagecount "
-"gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse runpdfend}def DELAYBI"
-"ND{.bindnow}if ";
+"tlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd revision dup 952 lt{po"
+"p}{.currentblendmode .setblendmode 952 eq{.currentopacityalpha .setopacityalph"
+"a .currentshapealpha .setshapealpha}{.currentalphaisshape{1}{0}ifelse 1(setalp"
+"haisshape)prcmd .currentstrokeconstantalpha 1(setstrokeconstantalpha)prcmd .cu"
+"rrentfillconstantalpha 1(setfillconstantalpha)prcmd}ifelse}ifelse prcolor curr"
+"entdash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcm"
+"d pop}if}def/strconcat{exch dup length 2 index length add string dup dup 4 2 r"
+"oll copy length 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgs"
+"tate}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)"
+"prcmd}def/restore{:restore @checknulldev printgstate @UD/@saveID known{@UD beg"
+"in @saveID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore "
+"@checknulldev printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @check"
+"nulldev setstate 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw "
+"and{dup 1(rotate)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arr"
+"aytype ne @dodraw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def"
+"/translate{dup type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/trans"
+"late sysexec}def/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix"
+")prcmd applyscalevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{m"
+"atrix currentmatrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3"
+" -1 roll>>begin<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin"
+" PatternType 2 lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx "
+"aload pop 15(makepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(mak"
+"epattern)prcmd @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpatter"
+"n{dup begin PatternType end 1 eq{begin PaintType 1 eq{XUID aload pop exch pop "
+"1}{:gsave[currentcolorspace aload length -1 roll pop]/setcolorspace sysexec/se"
+"tcolor sysexec XUID aload pop exch pop currentrgbcolor :grestore 4}ifelse(setp"
+"attern)prcmd currentcolorspace 0 get/Pattern ne{[/Pattern currentcolorspace]/s"
+"etcolorspace sysexec}if currentcolorspace @setcolorspace end}{/setpattern syse"
+"xec}ifelse}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysexec/cur"
+"rentrgbcolor sysexec setrgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sy"
+"sexec @setcolorspace}def/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern"
+" eq{1}{0}ifelse 1(setcolorspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr"
+"/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape"
+" known{dup/.setalphaisshape sysexec}if{1}{0}ifelse 1(setalphaisshape)prcmd}bin"
+"d def/.setfillconstantalpha{@SD/.setfillconstantalpha known{dup/.setfillconsta"
+"ntalpha sysexec}if 1(setfillconstantalpha)prcmd}bind def/.setstrokeconstantalp"
+"ha{@SD/.setstrokeconstantalpha known{dup/.setstrokeconstantalpha sysexec}if 1("
+"setstrokeconstantalpha)prcmd}bind def/.setopacityalpha{false .setalphaisshape "
+"dup .setfillconstantalpha .setstrokeconstantalpha}bind def/.setshapealpha{true"
+" .setalphaisshape dup .setfillconstantalpha .setstrokeconstantalpha}bind def/."
+"setblendmode{dup/.setblendmode sysexec<</Normal 0/Compatible 0/Multiply 1/Scre"
+"en 2/Overlay 3/SoftLight 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Light"
+"en 9/Difference 10/Exclusion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/Co"
+"mpatibleOverprint 16>>exch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file "
+"runpdfbegin pdfpagecount runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup"
+" 1 lt exch pdfpagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifel"
+"se runpdfend}def DELAYBIND{.bindnow}if ";
diff --git a/dviware/dvisvgm/src/utility.cpp b/dviware/dvisvgm/src/utility.cpp
index 8fe31fcf2d..37055f2cb8 100644
--- a/dviware/dvisvgm/src/utility.cpp
+++ b/dviware/dvisvgm/src/utility.cpp
@@ -2,7 +2,7 @@
** utility.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -134,17 +134,17 @@ string util::replace (string str, const string &find, const string &repl) {
vector<string> util::split (const string &str, const string &sep) {
vector<string> parts;
if (str.empty() || sep.empty())
- parts.emplace_back(str);
+ parts.push_back(str);
else {
size_t left=0;
while (left <= str.length()) {
size_t right = str.find(sep, left);
if (right == string::npos) {
- parts.emplace_back(str.substr(left));
+ parts.push_back(str.substr(left));
left = string::npos;
}
else {
- parts.emplace_back(str.substr(left, right-left));
+ parts.push_back(str.substr(left, right-left));
left = right+sep.length();
}
}
diff --git a/dviware/dvisvgm/src/utility.hpp b/dviware/dvisvgm/src/utility.hpp
index 7ad3bc8d69..275da3cc3a 100644
--- a/dviware/dvisvgm/src/utility.hpp
+++ b/dviware/dvisvgm/src/utility.hpp
@@ -2,7 +2,7 @@
** utility.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -25,6 +25,7 @@
#include <memory>
#include <sstream>
#include <string>
+#include <type_traits>
#include <vector>
namespace math {
@@ -145,6 +146,17 @@ std::unique_ptr<T> static_unique_ptr_cast (std::unique_ptr<U> &&old){
return std::unique_ptr<T>{static_cast<T*>(old.release())};
}
+template <typename T>
+struct set_const_of {
+ template <typename U>
+ struct by {
+ using type = typename std::conditional<
+ std::is_const<U>::value,
+ typename std::add_const<T>::type,
+ typename std::remove_const<T>::type
+ >::type;
+ };
+};
} // namespace util
#endif
diff --git a/dviware/dvisvgm/src/version.hpp.in b/dviware/dvisvgm/src/version.hpp.in
index 20ba32bbd5..70d27f6e48 100644
--- a/dviware/dvisvgm/src/version.hpp.in
+++ b/dviware/dvisvgm/src/version.hpp.in
@@ -2,7 +2,7 @@
** version.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/src/windows.hpp b/dviware/dvisvgm/src/windows.hpp
index 114420c3d5..5f71bbed1e 100644
--- a/dviware/dvisvgm/src/windows.hpp
+++ b/dviware/dvisvgm/src/windows.hpp
@@ -2,7 +2,7 @@
** windows.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/BezierTest.cpp b/dviware/dvisvgm/tests/BezierTest.cpp
index e03e4670fe..aa86660d84 100644
--- a/dviware/dvisvgm/tests/BezierTest.cpp
+++ b/dviware/dvisvgm/tests/BezierTest.cpp
@@ -2,7 +2,7 @@
** BezierTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/BitmapTest.cpp b/dviware/dvisvgm/tests/BitmapTest.cpp
index 7c12d80b35..547988bf57 100644
--- a/dviware/dvisvgm/tests/BitmapTest.cpp
+++ b/dviware/dvisvgm/tests/BitmapTest.cpp
@@ -2,7 +2,7 @@
** BitmapTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/BoundingBoxTest.cpp b/dviware/dvisvgm/tests/BoundingBoxTest.cpp
index 417080b5be..15c9ae0e00 100644
--- a/dviware/dvisvgm/tests/BoundingBoxTest.cpp
+++ b/dviware/dvisvgm/tests/BoundingBoxTest.cpp
@@ -2,7 +2,7 @@
** BoundingBoxTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/CMapManagerTest.cpp b/dviware/dvisvgm/tests/CMapManagerTest.cpp
index 5e4a98b9e7..2456780e4f 100644
--- a/dviware/dvisvgm/tests/CMapManagerTest.cpp
+++ b/dviware/dvisvgm/tests/CMapManagerTest.cpp
@@ -2,7 +2,7 @@
** CMapManagerTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/CMapReaderTest.cpp b/dviware/dvisvgm/tests/CMapReaderTest.cpp
index 28df86bb41..e890562f56 100644
--- a/dviware/dvisvgm/tests/CMapReaderTest.cpp
+++ b/dviware/dvisvgm/tests/CMapReaderTest.cpp
@@ -2,7 +2,7 @@
** CMapReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/CMapTest.cpp b/dviware/dvisvgm/tests/CMapTest.cpp
index 68a216a898..1b95e31cce 100644
--- a/dviware/dvisvgm/tests/CMapTest.cpp
+++ b/dviware/dvisvgm/tests/CMapTest.cpp
@@ -2,7 +2,7 @@
** CMapTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/CalculatorTest.cpp b/dviware/dvisvgm/tests/CalculatorTest.cpp
index af79a4c8e1..09945222d4 100644
--- a/dviware/dvisvgm/tests/CalculatorTest.cpp
+++ b/dviware/dvisvgm/tests/CalculatorTest.cpp
@@ -2,7 +2,7 @@
** CalculatorTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -25,7 +25,10 @@
TEST(CalculatorTest, eval) {
Calculator calc;
+ EXPECT_EQ(calc.eval("2"), 2);
+ EXPECT_EQ(calc.eval("-2"), -2);
EXPECT_EQ(calc.eval("2+3+4"), 9);
+ EXPECT_EQ(calc.eval(" 2 + 3+ 4 "), 9);
EXPECT_EQ(calc.eval("2*3+4"), 10);
EXPECT_EQ(calc.eval("2+3*4"), 14);
EXPECT_EQ(calc.eval("(2+3)*4"), 20);
@@ -36,7 +39,11 @@ TEST(CalculatorTest, eval) {
EXPECT_EQ(calc.eval("(1+2)-(3+4)"), -4);
EXPECT_EQ(calc.eval("-2+3+4"), 5);
EXPECT_EQ(calc.eval("3/2"), 1.5);
+ EXPECT_EQ(calc.eval("1+3/2"), 2.5);
+ EXPECT_EQ(calc.eval("3/2+1"), 2.5);
EXPECT_EQ(calc.eval("3%2"), 1);
+ EXPECT_EQ(calc.eval("1+3%2"), 2);
+ EXPECT_EQ(calc.eval("3%2+1"), 2);
EXPECT_EQ(calc.eval("-(4)"), -4);
}
@@ -51,6 +58,8 @@ TEST(CalculatorTest, variables) {
calc.setVariable("b", 3);
EXPECT_EQ(calc.eval("a+b"), 5);
+ EXPECT_EQ(calc.eval("a+a*b"), 8);
+ EXPECT_EQ(calc.eval("a*a+b"), 7);
EXPECT_EQ(calc.eval("2a+2b"), 10);
EXPECT_EQ(calc.eval("2a(1+2b)"), 28);
}
@@ -64,6 +73,8 @@ TEST(CalculatorTest, exceptions) {
ASSERT_THROW(calc.eval("1%0"), CalculatorException);
ASSERT_THROW(calc.eval("2*(3+4"), CalculatorException);
ASSERT_THROW(calc.eval("2*(3+4))"), CalculatorException);
+ ASSERT_THROW(calc.eval("2*3+4)"), CalculatorException);
+ ASSERT_THROW(calc.eval("2(3+4"), CalculatorException);
}
diff --git a/dviware/dvisvgm/tests/ColorSpecialTest.cpp b/dviware/dvisvgm/tests/ColorSpecialTest.cpp
index f05393a61a..453ba09a20 100644
--- a/dviware/dvisvgm/tests/ColorSpecialTest.cpp
+++ b/dviware/dvisvgm/tests/ColorSpecialTest.cpp
@@ -2,7 +2,7 @@
** ColorSpecialTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/ColorTest.cpp b/dviware/dvisvgm/tests/ColorTest.cpp
index c82d384fae..116400ef91 100644
--- a/dviware/dvisvgm/tests/ColorTest.cpp
+++ b/dviware/dvisvgm/tests/ColorTest.cpp
@@ -2,7 +2,7 @@
** ColorTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/CommandLineTest.cpp b/dviware/dvisvgm/tests/CommandLineTest.cpp
index ad7b0768c2..e9149ffeb6 100644
--- a/dviware/dvisvgm/tests/CommandLineTest.cpp
+++ b/dviware/dvisvgm/tests/CommandLineTest.cpp
@@ -2,7 +2,7 @@
** CommandLineTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/DVIReaderTest.cpp b/dviware/dvisvgm/tests/DVIReaderTest.cpp
index e5b0ef8dc0..9998ccfbcc 100644
--- a/dviware/dvisvgm/tests/DVIReaderTest.cpp
+++ b/dviware/dvisvgm/tests/DVIReaderTest.cpp
@@ -2,7 +2,7 @@
** DVIReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/DependencyGraphTest.cpp b/dviware/dvisvgm/tests/DependencyGraphTest.cpp
index 866d505864..6246e35738 100644
--- a/dviware/dvisvgm/tests/DependencyGraphTest.cpp
+++ b/dviware/dvisvgm/tests/DependencyGraphTest.cpp
@@ -2,7 +2,7 @@
** DependencyGraphTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/DirectoryTest.cpp b/dviware/dvisvgm/tests/DirectoryTest.cpp
index b610737930..7534cc498c 100644
--- a/dviware/dvisvgm/tests/DirectoryTest.cpp
+++ b/dviware/dvisvgm/tests/DirectoryTest.cpp
@@ -2,7 +2,7 @@
** DirectoryTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/DvisvgmSpecialTest.cpp b/dviware/dvisvgm/tests/DvisvgmSpecialTest.cpp
index 89dba64201..c7963b290c 100644
--- a/dviware/dvisvgm/tests/DvisvgmSpecialTest.cpp
+++ b/dviware/dvisvgm/tests/DvisvgmSpecialTest.cpp
@@ -2,7 +2,7 @@
** DvisvgmSpecialTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/EllipticalArcTest.cpp b/dviware/dvisvgm/tests/EllipticalArcTest.cpp
index 4bf4977cca..4e367a4804 100644
--- a/dviware/dvisvgm/tests/EllipticalArcTest.cpp
+++ b/dviware/dvisvgm/tests/EllipticalArcTest.cpp
@@ -2,7 +2,7 @@
** EllipticalArcTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/EmSpecialTest.cpp b/dviware/dvisvgm/tests/EmSpecialTest.cpp
index 00cc10f73c..c06ea92592 100644
--- a/dviware/dvisvgm/tests/EmSpecialTest.cpp
+++ b/dviware/dvisvgm/tests/EmSpecialTest.cpp
@@ -2,7 +2,7 @@
** EmSpecialTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -152,7 +152,7 @@ TEST_F(EmSpecialTest, vline) {
handler.processSpecial("point 1, 10, 10");
handler.processSpecial("point 2, 100, 100");
handler.processSpecial("line 1v, 2v, 10bp"); // cut line ends vertically
- EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='10,17.07 10,2.93 100,92.93 100,107.07'/>\n</g>");
+ EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='10 17.07 10 2.93 100 92.93 100 107.07'/>\n</g>");
}
@@ -160,7 +160,7 @@ TEST_F(EmSpecialTest, hline) {
handler.processSpecial("point 1, 10, 10");
handler.processSpecial("point 2, 100, 100");
handler.processSpecial("line 1h, 2h, 10bp"); // cut line ends horizontally
- EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='2.93,10 17.07,10 107.07,100 92.93,100'/>\n</g>");
+ EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='2.93 10 17.07 10 107.07 100 92.93 100'/>\n</g>");
}
@@ -168,14 +168,14 @@ TEST_F(EmSpecialTest, hvline) {
handler.processSpecial("point 1, 10, 10");
handler.processSpecial("point 2, 100, 100");
handler.processSpecial("line 1h, 2v, 10bp"); // cut line ends horizontally
- EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='2.93,10 17.07,10 100,92.93 100,107.07'/>\n</g>");
+ EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='2.93 10 17.07 10 100 92.93 100 107.07'/>\n</g>");
recorder.clear();
recorder.setColor(Color(0.0, 0.0, 1.0));
handler.processSpecial("point 1, 10, 10");
handler.processSpecial("point 2, 100, 100");
handler.processSpecial("line 1v, 2h, 10bp"); // cut line ends horizontally
- EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='10,17.07 10,2.93 107.07,100 92.93,100' fill='#00f'/>\n</g>");
+ EXPECT_EQ(recorder.getPageXML(), "<g id='page1'>\n<polygon points='10 17.07 10 2.93 107.07 100 92.93 100' fill='#00f'/>\n</g>");
}
diff --git a/dviware/dvisvgm/tests/FileFinderTest.cpp b/dviware/dvisvgm/tests/FileFinderTest.cpp
index 7ea9bce627..a19bbb3341 100644
--- a/dviware/dvisvgm/tests/FileFinderTest.cpp
+++ b/dviware/dvisvgm/tests/FileFinderTest.cpp
@@ -2,7 +2,7 @@
** FileFinderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/FilePathTest.cpp b/dviware/dvisvgm/tests/FilePathTest.cpp
index d5b6f67d4b..c985e55945 100644
--- a/dviware/dvisvgm/tests/FilePathTest.cpp
+++ b/dviware/dvisvgm/tests/FilePathTest.cpp
@@ -2,7 +2,7 @@
** FilePathTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -90,16 +90,27 @@ TEST(FilePathTest, file2) {
}
+TEST(FilePathTest, file3) {
+ FilePath fp("/f.ext", true, "/x/y");
+ ASSERT_EQ(fp.absolute(), "/f.ext");
+ ASSERT_EQ(fp.relative("/a/b"), "../../f.ext");
+}
+
+
TEST(FilePathTest, autodetect) {
FileSystem::chdir(SRCDIR);
FilePath fp1("FilePathTest.cpp");
ASSERT_TRUE(fp1.isFile());
ASSERT_FALSE(fp1.empty());
string cwd = FileSystem::getcwd();
+#ifdef _WIN32
+ if (cwd.length() >=2 && isalpha(cwd[0]) && cwd[1] == ':')
+ cwd[0] = tolower(cwd[0]);
+#endif
ASSERT_EQ(fp1.absolute(), cwd + "/FilePathTest.cpp") << "fp1=" << fp1.absolute();
FilePath fp2("");
ASSERT_FALSE(fp2.isFile());
ASSERT_FALSE(fp2.empty());
- ASSERT_EQ(fp2.absolute(), FileSystem::getcwd());
+ ASSERT_EQ(fp2.absolute(), cwd);
}
diff --git a/dviware/dvisvgm/tests/FileSystemTest.cpp b/dviware/dvisvgm/tests/FileSystemTest.cpp
index e5acd22b73..93fa58c292 100644
--- a/dviware/dvisvgm/tests/FileSystemTest.cpp
+++ b/dviware/dvisvgm/tests/FileSystemTest.cpp
@@ -2,7 +2,7 @@
** FileSystemTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/FontCacheTest.cpp b/dviware/dvisvgm/tests/FontCacheTest.cpp
index d0e05be49a..ab7d20ad97 100644
--- a/dviware/dvisvgm/tests/FontCacheTest.cpp
+++ b/dviware/dvisvgm/tests/FontCacheTest.cpp
@@ -2,7 +2,7 @@
** FontCacheTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/FontManagerTest.cpp b/dviware/dvisvgm/tests/FontManagerTest.cpp
index 2ddb5b1064..e5263d3e51 100644
--- a/dviware/dvisvgm/tests/FontManagerTest.cpp
+++ b/dviware/dvisvgm/tests/FontManagerTest.cpp
@@ -2,7 +2,7 @@
** FontManagerTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -23,16 +23,23 @@
#include "Font.hpp"
#include "FontManager.hpp"
+#ifndef SRCDIR
+#define SRCDIR "."
+#endif
+
+
class FontManagerTest : public ::testing::Test {
public:
FontManagerTest () : fm(FontManager::instance()) {
fm.registerFont(10, "cmr10", 1274110073, 10, 10);
fm.registerFont(11, "cmr10", 1274110073, 10, 12);
fm.registerFont( 9, "cmr10", 1274110073, 10, 14);
+ fm.registerFont(12, SRCDIR"/data/lmmono12-regular.otf", 0, 12, _fontStyle, Color(.0, .0, 1.0));
}
protected:
FontManager &fm;
+ FontStyle _fontStyle;
};
@@ -40,11 +47,12 @@ TEST_F(FontManagerTest, fontID1) {
EXPECT_EQ(fm.fontID(10), 0);
EXPECT_EQ(fm.fontID(11), 1);
EXPECT_EQ(fm.fontID(9), 2);
+ EXPECT_EQ(fm.fontID(12), 3);
EXPECT_EQ(fm.fontID(1), -1);
}
-TEST_F(FontManagerTest, font_ID2) {
+TEST_F(FontManagerTest, fontID2) {
EXPECT_EQ(fm.fontID("cmr10"), 0);
}
@@ -54,6 +62,7 @@ TEST_F(FontManagerTest, getFont) {
EXPECT_TRUE(f1);
EXPECT_EQ(f1->name(), "cmr10");
EXPECT_TRUE(dynamic_cast<const PhysicalFontImpl*>(f1));
+ EXPECT_EQ(f1->color(), Color::BLACK);
const Font *f2 = fm.getFont(11);
EXPECT_TRUE(f2);
@@ -61,11 +70,42 @@ TEST_F(FontManagerTest, getFont) {
EXPECT_EQ(f2->name(), "cmr10");
EXPECT_TRUE(dynamic_cast<const PhysicalFontProxy*>(f2));
EXPECT_EQ(f2->uniqueFont(), f1);
+ EXPECT_EQ(f2->color(), Color::BLACK);
+
+ const Font *f3 = fm.getFont(12);
+ EXPECT_TRUE(f3);
+ EXPECT_NE(f2, f3);
+ EXPECT_EQ(f3->name(), "nf0");
+ EXPECT_TRUE(dynamic_cast<const NativeFontImpl*>(f3));
+ EXPECT_TRUE(dynamic_cast<const PhysicalFont*>(f3));
+ EXPECT_EQ(f3->uniqueFont(), f3);
+ EXPECT_EQ(f3->color(), Color(.0, .0, 1.0));
+}
+
+
+TEST_F(FontManagerTest, font_cast) {
+ const Font *f1 = fm.getFont(10);
+ EXPECT_TRUE(f1);
+ EXPECT_EQ(font_cast<const PhysicalFont*>(f1), f1);
+ EXPECT_EQ(font_cast<const NativeFont*>(f1), nullptr);
+ EXPECT_EQ(font_cast<const VirtualFont*>(f1), nullptr);
+
+ const Font *f2 = fm.getFont(11);
+ EXPECT_TRUE(f2);
+ EXPECT_EQ(font_cast<const PhysicalFont*>(f2), f2);
+ EXPECT_EQ(font_cast<const NativeFont*>(f1), nullptr);
+ EXPECT_EQ(font_cast<const VirtualFont*>(f1), nullptr);
+
+ const Font *f3 = fm.getFont(12);
+ EXPECT_TRUE(f3);
+ EXPECT_EQ(font_cast<const PhysicalFont*>(f3), f3);
+ EXPECT_EQ(font_cast<const NativeFont*>(f3), f3);
+ EXPECT_EQ(font_cast<const VirtualFont*>(f3), nullptr);
}
TEST_F(FontManagerTest, getFontById) {
EXPECT_EQ(fm.getFont(10), fm.getFontById(0));
EXPECT_EQ(fm.getFont("cmr10"), fm.getFontById(0));
+ EXPECT_EQ(fm.getFont(12), fm.getFontById(3));
}
-
diff --git a/dviware/dvisvgm/tests/FontMapTest.cpp b/dviware/dvisvgm/tests/FontMapTest.cpp
index f73dfe39bd..8f3e512fea 100644
--- a/dviware/dvisvgm/tests/FontMapTest.cpp
+++ b/dviware/dvisvgm/tests/FontMapTest.cpp
@@ -2,7 +2,7 @@
** FontMapTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/GFGlyphTracerTest.cpp b/dviware/dvisvgm/tests/GFGlyphTracerTest.cpp
index 71c08ee8e5..071bccf5c6 100644
--- a/dviware/dvisvgm/tests/GFGlyphTracerTest.cpp
+++ b/dviware/dvisvgm/tests/GFGlyphTracerTest.cpp
@@ -2,7 +2,7 @@
** GFGlyphTracerTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/GFReaderTest.cpp b/dviware/dvisvgm/tests/GFReaderTest.cpp
index ac582dcb29..82c11e9eec 100644
--- a/dviware/dvisvgm/tests/GFReaderTest.cpp
+++ b/dviware/dvisvgm/tests/GFReaderTest.cpp
@@ -2,7 +2,7 @@
** GFReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/GhostscriptTest.cpp b/dviware/dvisvgm/tests/GhostscriptTest.cpp
index 909fc80f6a..359d99a8bf 100644
--- a/dviware/dvisvgm/tests/GhostscriptTest.cpp
+++ b/dviware/dvisvgm/tests/GhostscriptTest.cpp
@@ -2,7 +2,7 @@
** GhostscriptTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/GraphicsPathTest.cpp b/dviware/dvisvgm/tests/GraphicsPathTest.cpp
index a6af6cdc77..625314c08d 100644
--- a/dviware/dvisvgm/tests/GraphicsPathTest.cpp
+++ b/dviware/dvisvgm/tests/GraphicsPathTest.cpp
@@ -2,7 +2,7 @@
** GraphicsPathTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/HashFunctionTest.cpp b/dviware/dvisvgm/tests/HashFunctionTest.cpp
index 0d5b7bc1b4..bf56ebda2d 100644
--- a/dviware/dvisvgm/tests/HashFunctionTest.cpp
+++ b/dviware/dvisvgm/tests/HashFunctionTest.cpp
@@ -2,7 +2,7 @@
** HashFunctionTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/JFMReaderTest.cpp b/dviware/dvisvgm/tests/JFMReaderTest.cpp
index b82d00febf..db6cb012f4 100644
--- a/dviware/dvisvgm/tests/JFMReaderTest.cpp
+++ b/dviware/dvisvgm/tests/JFMReaderTest.cpp
@@ -2,7 +2,7 @@
** JFMReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/LengthTest.cpp b/dviware/dvisvgm/tests/LengthTest.cpp
index f6a5bca573..4db8fe15d9 100644
--- a/dviware/dvisvgm/tests/LengthTest.cpp
+++ b/dviware/dvisvgm/tests/LengthTest.cpp
@@ -2,7 +2,7 @@
** LengthTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/Makefile.am b/dviware/dvisvgm/tests/Makefile.am
index 438a06b02b..ac841563f3 100644
--- a/dviware/dvisvgm/tests/Makefile.am
+++ b/dviware/dvisvgm/tests/Makefile.am
@@ -1,5 +1,5 @@
## This file is part of dvisvgm
-## Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
diff --git a/dviware/dvisvgm/tests/Makefile.in b/dviware/dvisvgm/tests/Makefile.in
index 61c6b3458e..d6007f031b 100644
--- a/dviware/dvisvgm/tests/Makefile.in
+++ b/dviware/dvisvgm/tests/Makefile.in
@@ -999,6 +999,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/dviware/dvisvgm/tests/MapLineTest.cpp b/dviware/dvisvgm/tests/MapLineTest.cpp
index 2d25c914f6..155d133e45 100644
--- a/dviware/dvisvgm/tests/MapLineTest.cpp
+++ b/dviware/dvisvgm/tests/MapLineTest.cpp
@@ -2,7 +2,7 @@
** MapLineTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/MatrixTest.cpp b/dviware/dvisvgm/tests/MatrixTest.cpp
index 2858c66aa6..587501343c 100644
--- a/dviware/dvisvgm/tests/MatrixTest.cpp
+++ b/dviware/dvisvgm/tests/MatrixTest.cpp
@@ -2,7 +2,7 @@
** MatrixTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -48,12 +48,12 @@ TEST(MatrixTest, construct1) {
TEST(MatrixTest, construct2) {
- Matrix m1 = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+ Matrix m1{1, 2, 3, 4, 5, 6, 7, 8, 9};
for (int row=0; row < 3; row++)
for (int col=0; col < 3; col++)
ASSERT_EQ(m1.get(row, col), 3*row+col+1) << "row=" << row << ", col=" << col;
- Matrix m2 = {1, 2, 3, 4, 5, 6};
+ Matrix m2{1, 2, 3, 4, 5, 6};
for (int row=0; row < 2; row++)
for (int col=0; col < 3; col++)
ASSERT_EQ(m2.get(row, col), 3*row+col+1) << "row=" << row << ", col=" << col;
diff --git a/dviware/dvisvgm/tests/MessageExceptionTest.cpp b/dviware/dvisvgm/tests/MessageExceptionTest.cpp
index 706921c223..396af63ad7 100644
--- a/dviware/dvisvgm/tests/MessageExceptionTest.cpp
+++ b/dviware/dvisvgm/tests/MessageExceptionTest.cpp
@@ -2,7 +2,7 @@
** MessageExceptionTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/PDFParserTest.cpp b/dviware/dvisvgm/tests/PDFParserTest.cpp
index 868b04de97..39ca9ca27a 100644
--- a/dviware/dvisvgm/tests/PDFParserTest.cpp
+++ b/dviware/dvisvgm/tests/PDFParserTest.cpp
@@ -2,7 +2,7 @@
** PDFParserTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/PSInterpreterTest.cpp b/dviware/dvisvgm/tests/PSInterpreterTest.cpp
index b40a210314..f396976de8 100644
--- a/dviware/dvisvgm/tests/PSInterpreterTest.cpp
+++ b/dviware/dvisvgm/tests/PSInterpreterTest.cpp
@@ -2,7 +2,7 @@
** PSInterpreterTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -52,6 +52,7 @@ class PSTestActions : public PSActions {
void rotate (vector<double> &p) override {print("rotate", p);}
void save(std::vector<double> &p) override {print("save", p);}
void scale (vector<double> &p) override {print("scale", p);}
+ void setalphaisshape (vector<double> &p) override {print("setalphaisshape", p);}
void setblendmode (vector<double> &p) override {print("setblendmode", p);}
void setcolorspace (vector<double> &p) override {print("setcolorspace", p);}
void setcmykcolor (vector<double> &p) override {print("setcmykcolor", p);}
@@ -59,7 +60,6 @@ class PSTestActions : public PSActions {
void setfillconstantalpha (vector<double> &p) override {print("setfillconstantalpha", p);}
void setgray (vector<double> &p) override {print("setgray", p);}
void sethsbcolor (vector<double> &p) override {print("sethsbcolor", p);}
- void setisshapealpha (vector<double> &p) override {print("setisshapealpha", p);}
void setlinecap (vector<double> &p) override {print("setlinecap", p);}
void setlinejoin (vector<double> &p) override {print("setlinejoin", p);}
void setlinewidth (vector<double> &p) override {print("setlinewidth", p);}
@@ -105,7 +105,10 @@ TEST(PSInterpreterTest, gsave_grestore) {
actions.clear();
psi.execute("grestore ");
- EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 0;setlinejoin 0;setmiterlimit 10;setcolorspace 0;setrgbcolor 0 0 0;setdash 0;grestore;");
+ if (psi.hasFullOpacitySupport())
+ EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 0;setlinejoin 0;setmiterlimit 10;setblendmode 0;setalphaisshape 0;setstrokeconstantalpha 1;setfillconstantalpha 1;setcolorspace 0;setrgbcolor 0 0 0;setdash 0;grestore;");
+ else
+ EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 0;setlinejoin 0;setmiterlimit 10;setcolorspace 0;setrgbcolor 0 0 0;setdash 0;grestore;");
actions.clear();
psi.execute("1 setlinecap 5 setmiterlimit 0 1 0 setrgbcolor gsave 0 setlinecap 10 setmiterlimit ");
@@ -113,7 +116,10 @@ TEST(PSInterpreterTest, gsave_grestore) {
actions.clear();
psi.execute("grestore ");
- EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 1;setlinejoin 0;setmiterlimit 5;setcolorspace 0;setrgbcolor 0 1 0;setdash 0;grestore;");
+ if (psi.hasFullOpacitySupport())
+ EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 1;setlinejoin 0;setmiterlimit 5;setblendmode 0;setalphaisshape 0;setstrokeconstantalpha 1;setfillconstantalpha 1;setcolorspace 0;setrgbcolor 0 1 0;setdash 0;grestore;");
+ else
+ EXPECT_EQ(actions.result(), "setmatrix 1 0 0 1 0 0;applyscalevals 1 1 1;setlinewidth 1;setlinecap 1;setlinejoin 0;setmiterlimit 5;setcolorspace 0;setrgbcolor 0 1 0;setdash 0;grestore;");
}
diff --git a/dviware/dvisvgm/tests/PageRagesTest.cpp b/dviware/dvisvgm/tests/PageRagesTest.cpp
index 60b6eb77ab..8f7effc9f8 100644
--- a/dviware/dvisvgm/tests/PageRagesTest.cpp
+++ b/dviware/dvisvgm/tests/PageRagesTest.cpp
@@ -2,7 +2,7 @@
** PageRagesTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/PageSizeTest.cpp b/dviware/dvisvgm/tests/PageSizeTest.cpp
index be9a25ec16..ed997951b7 100644
--- a/dviware/dvisvgm/tests/PageSizeTest.cpp
+++ b/dviware/dvisvgm/tests/PageSizeTest.cpp
@@ -2,7 +2,7 @@
** PageSizeTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/PairTest.cpp b/dviware/dvisvgm/tests/PairTest.cpp
index bbff66b2f7..e5f502cdbc 100644
--- a/dviware/dvisvgm/tests/PairTest.cpp
+++ b/dviware/dvisvgm/tests/PairTest.cpp
@@ -2,7 +2,7 @@
** PairTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/PapersizeSpecialTest.cpp b/dviware/dvisvgm/tests/PapersizeSpecialTest.cpp
index a4a155e8bc..7cba1c1864 100644
--- a/dviware/dvisvgm/tests/PapersizeSpecialTest.cpp
+++ b/dviware/dvisvgm/tests/PapersizeSpecialTest.cpp
@@ -2,7 +2,7 @@
** PapersizeSpecialTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/RangeMapTest.cpp b/dviware/dvisvgm/tests/RangeMapTest.cpp
index 1d9f46b82f..e9ca516d9c 100644
--- a/dviware/dvisvgm/tests/RangeMapTest.cpp
+++ b/dviware/dvisvgm/tests/RangeMapTest.cpp
@@ -2,7 +2,7 @@
** RangeMapTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/SVGOutputTest.cpp b/dviware/dvisvgm/tests/SVGOutputTest.cpp
index a20dfd63cb..79f89728e1 100644
--- a/dviware/dvisvgm/tests/SVGOutputTest.cpp
+++ b/dviware/dvisvgm/tests/SVGOutputTest.cpp
@@ -2,7 +2,7 @@
** SVGOutputTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/ShadingPatchTest.cpp b/dviware/dvisvgm/tests/ShadingPatchTest.cpp
index 3cf6b1096b..15e643f977 100644
--- a/dviware/dvisvgm/tests/ShadingPatchTest.cpp
+++ b/dviware/dvisvgm/tests/ShadingPatchTest.cpp
@@ -2,7 +2,7 @@
** ShadingPatchTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/SpecialManagerTest.cpp b/dviware/dvisvgm/tests/SpecialManagerTest.cpp
index 156dd14f2f..0ccaf5a172 100644
--- a/dviware/dvisvgm/tests/SpecialManagerTest.cpp
+++ b/dviware/dvisvgm/tests/SpecialManagerTest.cpp
@@ -2,7 +2,7 @@
** SpecialManagerTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/SplittedCharInputBufferTest.cpp b/dviware/dvisvgm/tests/SplittedCharInputBufferTest.cpp
index 6ca61d53ed..093b4c652e 100644
--- a/dviware/dvisvgm/tests/SplittedCharInputBufferTest.cpp
+++ b/dviware/dvisvgm/tests/SplittedCharInputBufferTest.cpp
@@ -2,7 +2,7 @@
** SplittedCharInputBufferTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/StreamInputBufferTest.cpp b/dviware/dvisvgm/tests/StreamInputBufferTest.cpp
index 10124341e8..845c5f22ba 100644
--- a/dviware/dvisvgm/tests/StreamInputBufferTest.cpp
+++ b/dviware/dvisvgm/tests/StreamInputBufferTest.cpp
@@ -2,7 +2,7 @@
** StreamInputBufferTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/StreamReaderTest.cpp b/dviware/dvisvgm/tests/StreamReaderTest.cpp
index 864efab3b4..8a517be03c 100644
--- a/dviware/dvisvgm/tests/StreamReaderTest.cpp
+++ b/dviware/dvisvgm/tests/StreamReaderTest.cpp
@@ -2,7 +2,7 @@
** StreamReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/StreamWriterTest.cpp b/dviware/dvisvgm/tests/StreamWriterTest.cpp
index 05d5da2e3f..afddcfdfc2 100644
--- a/dviware/dvisvgm/tests/StreamWriterTest.cpp
+++ b/dviware/dvisvgm/tests/StreamWriterTest.cpp
@@ -2,7 +2,7 @@
** StreamWriterTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/StringMatcherTest.cpp b/dviware/dvisvgm/tests/StringMatcherTest.cpp
index 89ee78fa8b..ca3072c7d3 100644
--- a/dviware/dvisvgm/tests/StringMatcherTest.cpp
+++ b/dviware/dvisvgm/tests/StringMatcherTest.cpp
@@ -2,7 +2,7 @@
** StringMatcherTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/SubfontTest.cpp b/dviware/dvisvgm/tests/SubfontTest.cpp
index 939fef81c9..95a4476ef7 100644
--- a/dviware/dvisvgm/tests/SubfontTest.cpp
+++ b/dviware/dvisvgm/tests/SubfontTest.cpp
@@ -2,7 +2,7 @@
** SubfontTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/TFMReaderTest.cpp b/dviware/dvisvgm/tests/TFMReaderTest.cpp
index fa701f036d..8f8da092cb 100644
--- a/dviware/dvisvgm/tests/TFMReaderTest.cpp
+++ b/dviware/dvisvgm/tests/TFMReaderTest.cpp
@@ -2,7 +2,7 @@
** TFMReaderTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/TensorProductPatchTest.cpp b/dviware/dvisvgm/tests/TensorProductPatchTest.cpp
index 576ce581a8..c31ab1a025 100644
--- a/dviware/dvisvgm/tests/TensorProductPatchTest.cpp
+++ b/dviware/dvisvgm/tests/TensorProductPatchTest.cpp
@@ -2,7 +2,7 @@
** TensorProductPatchTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/ToUnicodeMapTest.cpp b/dviware/dvisvgm/tests/ToUnicodeMapTest.cpp
index a0a5ee9868..97ae10c07e 100644
--- a/dviware/dvisvgm/tests/ToUnicodeMapTest.cpp
+++ b/dviware/dvisvgm/tests/ToUnicodeMapTest.cpp
@@ -2,7 +2,7 @@
** ToUnicodeMapTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/TpicSpecialTest.cpp b/dviware/dvisvgm/tests/TpicSpecialTest.cpp
index 9f88b13412..795347842c 100644
--- a/dviware/dvisvgm/tests/TpicSpecialTest.cpp
+++ b/dviware/dvisvgm/tests/TpicSpecialTest.cpp
@@ -2,7 +2,7 @@
** TpicSpecialTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -154,7 +154,7 @@ TEST_F(TpicSpecialTest, stroke_polyline) {
handler.processSpecial("pa", "1000 0");
handler.processSpecial("fp");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polyline fill='none' stroke-linecap='round' points='0,0 72,72 72,0' stroke='#000' stroke-width='1'/>"
+ "<polyline fill='none' stroke-linecap='round' points='0 0 72 72 72 0' stroke='#000'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -169,7 +169,7 @@ TEST_F(TpicSpecialTest, stroke_polygon) {
handler.processSpecial("pa", "0 0");
handler.processSpecial("fp");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polygon fill='none' points='0,0 72,72 72,0' stroke='#000' stroke-width='1'/>"
+ "<polygon fill='none' points='0 0 72 72 72 0' stroke='#000'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -184,7 +184,7 @@ TEST_F(TpicSpecialTest, fill_polygon) {
handler.processSpecial("wh");
handler.processSpecial("fp");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polygon fill='#fff' points='0,0 72,72 72,0' stroke='#000' stroke-width='1'/>"
+ "<polygon fill='#fff' points='0 0 72 72 72 0' stroke='#000'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -196,7 +196,7 @@ TEST_F(TpicSpecialTest, fill_polygon) {
handler.processSpecial("wh");
handler.processSpecial("ip");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polygon fill='#fff' points='0,0 72,72 72,0'/>"
+ "<polygon fill='#fff' points='0 0 72 72 72 0'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -211,7 +211,7 @@ TEST_F(TpicSpecialTest, fill_dashed_polygon) {
handler.processSpecial("wh");
handler.processSpecial("da", "2");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polygon fill='#fff' points='0,0 72,72 72,0' stroke='#000' stroke-width='1' stroke-dasharray='144'/>"
+ "<polygon fill='#fff' points='0 0 72 72 72 0' stroke='#000' stroke-dasharray='144'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -227,7 +227,7 @@ TEST_F(TpicSpecialTest, fill_dotted_polygon) {
handler.processSpecial("wh");
handler.processSpecial("dt", "2 2");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polygon fill='#fff' points='0,0 72,72 72,0' stroke='#000' stroke-width='36' stroke-dasharray='36 144'/>"
+ "<polygon fill='#fff' points='0 0 72 72 72 0' stroke='#000' stroke-width='36' stroke-dasharray='36 144'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -239,7 +239,7 @@ TEST_F(TpicSpecialTest, stroke_spline) {
handler.processSpecial("pa", "1000 1000");
handler.processSpecial("sp");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<polyline fill='none' stroke-linecap='round' points='0,0 72,72' stroke='#000' stroke-width='1'/>"
+ "<polyline fill='none' stroke-linecap='round' points='0 0 72 72' stroke='#000'/>"
);
recorder.clear();
handler.processSpecial("pa", "0 0");
@@ -250,7 +250,7 @@ TEST_F(TpicSpecialTest, stroke_spline) {
handler.processSpecial("pa", "1000 500");
handler.processSpecial("sp");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T144 90L72 36' stroke='#000' stroke-width='1'/>"
+ "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T144 90L72 36' stroke='#000'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -266,7 +266,7 @@ TEST_F(TpicSpecialTest, stroke_dashed_spline) {
handler.processSpecial("pa", "0 0");
handler.processSpecial("sp", "1");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T108 72Z' stroke='#000' stroke-width='1' stroke-dasharray='72'/>"
+ "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T108 72Z' stroke='#000' stroke-dasharray='72'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -282,7 +282,7 @@ TEST_F(TpicSpecialTest, stroke_dotted_spline) {
handler.processSpecial("pa", "1000 500");
handler.processSpecial("sp", "-1");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T144 90L72 36' stroke='#000' stroke-width='1' stroke-dasharray='1 72'/>"
+ "<path fill='none' d='M0 0L36 36Q72 72 90 54T126 54T180 108T144 90L72 36' stroke='#000' stroke-dasharray='1 72'/>"
);
EXPECT_DOUBLE_EQ(handler.penwidth(), 1.0);
EXPECT_LT(handler.grayLevel(), 0);
@@ -292,12 +292,12 @@ TEST_F(TpicSpecialTest, stroke_dotted_spline) {
TEST_F(TpicSpecialTest, stroke_ellipse) {
handler.processSpecial("ar", "0 0 500 500 0 7");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<circle cx='0' cy='0' r='36' stroke-width='1' stroke='#000' fill='none'/>"
+ "<circle cx='0' cy='0' r='36' stroke='#000' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 7");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<ellipse cx='0' cy='0' rx='72' ry='36' stroke-width='1' stroke='#000' fill='none'/>"
+ "<ellipse cx='0' cy='0' rx='72' ry='36' stroke='#000' fill='none'/>"
);
recorder.clear();
handler.processSpecial("pn", "100");
@@ -312,13 +312,13 @@ TEST_F(TpicSpecialTest, fill_ellipse) {
handler.processSpecial("bk");
handler.processSpecial("ia", "0 0 500 500 0 7");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<circle cx='0' cy='0' r='36' fill='#000'/>"
+ "<circle cx='0' cy='0' r='36'/>"
);
recorder.clear();
handler.processSpecial("bk");
handler.processSpecial("ia", "0 0 1000 500 0 7");
EXPECT_EQ(recorder.getXMLSnippet(),
- "<ellipse cx='0' cy='0' rx='72' ry='36' fill='#000'/>"
+ "<ellipse cx='0' cy='0' rx='72' ry='36'/>"
);
recorder.clear();
handler.processSpecial("pn", "100");
@@ -333,37 +333,37 @@ TEST_F(TpicSpecialTest, fill_ellipse) {
TEST_F(TpicSpecialTest, stroke_arc) {
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(math::PI/4));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 0 1 50.91 25.46' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 0 1 50.91 25.46' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(math::PI/2));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 0 1 0 36' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 0 1 0 36' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(3*math::PI/4));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 0 1-50.91 25.46' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 0 1-50.91 25.46' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(math::PI));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 1 1-72 0' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 1 1-72 0' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(5*math::PI/4));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 1 1-50.91-25.46' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 1 1-50.91-25.46' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(3*math::PI/2));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 1 1 0-36' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 1 1 0-36' stroke='#000' stroke-linecap='round' fill='none'/>"
);
recorder.clear();
handler.processSpecial("ar", "0 0 1000 500 0 "+to_string(-3*math::PI/2));
EXPECT_EQ(recorder.getXMLSnippet(),
- "<path d='M72 0A72 36 0 0 1 0 36' stroke-width='1' stroke='#000' stroke-linecap='round' fill='none'/>"
+ "<path d='M72 0A72 36 0 0 1 0 36' stroke='#000' stroke-linecap='round' fill='none'/>"
);
}
diff --git a/dviware/dvisvgm/tests/TriangularPatchTest.cpp b/dviware/dvisvgm/tests/TriangularPatchTest.cpp
index 86ef13fb36..29fa437ad2 100644
--- a/dviware/dvisvgm/tests/TriangularPatchTest.cpp
+++ b/dviware/dvisvgm/tests/TriangularPatchTest.cpp
@@ -2,7 +2,7 @@
** TriangularPatchTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/UnicodeTest.cpp b/dviware/dvisvgm/tests/UnicodeTest.cpp
index 109b63f1ec..4b39ec2bce 100644
--- a/dviware/dvisvgm/tests/UnicodeTest.cpp
+++ b/dviware/dvisvgm/tests/UnicodeTest.cpp
@@ -2,7 +2,7 @@
** UnicodeTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/UtilityTest.cpp b/dviware/dvisvgm/tests/UtilityTest.cpp
index 4ca490379f..2e8ae696b7 100644
--- a/dviware/dvisvgm/tests/UtilityTest.cpp
+++ b/dviware/dvisvgm/tests/UtilityTest.cpp
@@ -2,7 +2,7 @@
** UtilityTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/VectorIteratorTest.cpp b/dviware/dvisvgm/tests/VectorIteratorTest.cpp
index 905a6fa743..8476c9a9cc 100644
--- a/dviware/dvisvgm/tests/VectorIteratorTest.cpp
+++ b/dviware/dvisvgm/tests/VectorIteratorTest.cpp
@@ -2,7 +2,7 @@
** VectorIteratorTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/VectorStreamTest.cpp b/dviware/dvisvgm/tests/VectorStreamTest.cpp
index 022b1c1fdc..4d767bb425 100644
--- a/dviware/dvisvgm/tests/VectorStreamTest.cpp
+++ b/dviware/dvisvgm/tests/VectorStreamTest.cpp
@@ -2,7 +2,7 @@
** VectorStreamTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/XMLNodeTest.cpp b/dviware/dvisvgm/tests/XMLNodeTest.cpp
index 8108d88db8..d7d4159970 100644
--- a/dviware/dvisvgm/tests/XMLNodeTest.cpp
+++ b/dviware/dvisvgm/tests/XMLNodeTest.cpp
@@ -2,7 +2,7 @@
** XMLNodeTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/XMLStringTest.cpp b/dviware/dvisvgm/tests/XMLStringTest.cpp
index 18c129c4cc..2ebe8cb0f8 100644
--- a/dviware/dvisvgm/tests/XMLStringTest.cpp
+++ b/dviware/dvisvgm/tests/XMLStringTest.cpp
@@ -2,7 +2,7 @@
** XMLStringTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/check-conv b/dviware/dvisvgm/tests/check-conv
index f87496762c..a68e88e888 100755
--- a/dviware/dvisvgm/tests/check-conv
+++ b/dviware/dvisvgm/tests/check-conv
@@ -2,7 +2,7 @@
# This file is part of the dvisvgm package and published under the
# terms of the GNU General Public License version 3 or later.
# See file COPYING for further details.
-# Copyright (C) 2009-2020 Martin Gieseking <martin.gieseking@uos.de>
+# Copyright (C) 2009-2021 Martin Gieseking <martin.gieseking@uos.de>
files=(sample frktest)
diff --git a/dviware/dvisvgm/tests/data/Makefile.am b/dviware/dvisvgm/tests/data/Makefile.am
index 55818cc0c6..af73d01f01 100644
--- a/dviware/dvisvgm/tests/data/Makefile.am
+++ b/dviware/dvisvgm/tests/data/Makefile.am
@@ -1,5 +1,5 @@
## This file is part of dvisvgm
-## Copyright (C) 2016-2020 Martin Gieseking <martin.gieseking@uos.de>
+## Copyright (C) 2016-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.
@@ -13,6 +13,7 @@ EXTRA_DIST = \
frktest.dvi \
frktest-nf-cmp.svg \
frktest-wf-cmp.svg \
+ lmmono12-regular.otf \
sample.dvi \
sample-nf-cmp.svg \
sample.sfd \
diff --git a/dviware/dvisvgm/tests/data/Makefile.in b/dviware/dvisvgm/tests/data/Makefile.in
index 78c73d04c7..3b44c55df0 100644
--- a/dviware/dvisvgm/tests/data/Makefile.in
+++ b/dviware/dvisvgm/tests/data/Makefile.in
@@ -271,6 +271,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -293,6 +294,7 @@ EXTRA_DIST = \
frktest.dvi \
frktest-nf-cmp.svg \
frktest-wf-cmp.svg \
+ lmmono12-regular.otf \
sample.dvi \
sample-nf-cmp.svg \
sample.sfd \
diff --git a/dviware/dvisvgm/tests/data/lmmono12-regular.otf b/dviware/dvisvgm/tests/data/lmmono12-regular.otf
new file mode 100644
index 0000000000..dc59181c10
--- /dev/null
+++ b/dviware/dvisvgm/tests/data/lmmono12-regular.otf
Binary files differ
diff --git a/dviware/dvisvgm/tests/genhashcheck.py b/dviware/dvisvgm/tests/genhashcheck.py
index 5f3495128c..88a08ab671 100755
--- a/dviware/dvisvgm/tests/genhashcheck.py
+++ b/dviware/dvisvgm/tests/genhashcheck.py
@@ -2,7 +2,7 @@
# This file is part of the dvisvgm package and published under the
# terms of the GNU General Public License version 3 or later.
# See file COPYING for further details.
-# Copyright (C) 2016-2020 Martin Gieseking <martin.gieseking@uos.de>
+# Copyright (C) 2016-2021 Martin Gieseking <martin.gieseking@uos.de>
import re
import sys
diff --git a/dviware/dvisvgm/tests/normalize.xsl b/dviware/dvisvgm/tests/normalize.xsl
index 2b39eba9f7..d231511835 100644
--- a/dviware/dvisvgm/tests/normalize.xsl
+++ b/dviware/dvisvgm/tests/normalize.xsl
@@ -2,7 +2,7 @@
<!-- *********************************************************************
** Stylesheet to rearrange font-/path-elements in an SVG file. **
** It's part of the dvisvgm package. **
-** Copyright (C) 2009-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2009-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
diff --git a/dviware/dvisvgm/tests/testmain.cpp b/dviware/dvisvgm/tests/testmain.cpp
index ce75cb5664..323b6c3915 100644
--- a/dviware/dvisvgm/tests/testmain.cpp
+++ b/dviware/dvisvgm/tests/testmain.cpp
@@ -2,7 +2,7 @@
** testmain.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **