From d8497022d7566dfeaca92ed7db1af58412409dae Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Thu, 3 Dec 2015 03:54:21 +0000 Subject: Import dvisvgm 1.12. git-svn-id: svn://tug.org/texlive/trunk@39005 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvisvgm/ChangeLog | 5 + Build/source/texk/dvisvgm/configure | 26 +- .../texk/dvisvgm/dvisvgm-1.11-PATCHES/ChangeLog | 109 - .../texk/dvisvgm/dvisvgm-1.11-PATCHES/TL-Changes | 21 - Build/source/texk/dvisvgm/dvisvgm-1.11/AUTHORS | 7 - Build/source/texk/dvisvgm/dvisvgm-1.11/COPYING | 674 --- Build/source/texk/dvisvgm/dvisvgm-1.11/ChangeLog | 4581 ------------------- Build/source/texk/dvisvgm/dvisvgm-1.11/INSTALL | 229 - .../source/texk/dvisvgm/dvisvgm-1.11/LGPL-2.1.txt | 504 --- Build/source/texk/dvisvgm/dvisvgm-1.11/Makefile.am | 26 - Build/source/texk/dvisvgm/dvisvgm-1.11/NEWS | 425 -- Build/source/texk/dvisvgm/dvisvgm-1.11/README | 117 - .../texk/dvisvgm/dvisvgm-1.11/clipper/Makefile.am | 9 - .../texk/dvisvgm/dvisvgm-1.11/clipper/clipper.cpp | 4457 ------------------- .../texk/dvisvgm/dvisvgm-1.11/clipper/clipper.hpp | 429 -- Build/source/texk/dvisvgm/dvisvgm-1.11/config.h.in | 169 - .../source/texk/dvisvgm/dvisvgm-1.11/configure.ac | 176 - .../texk/dvisvgm/dvisvgm-1.11/doc/Makefile.am | 54 - .../dvisvgm/dvisvgm-1.11/doc/conf-dblatex-man.xsl | 19 - .../dvisvgm/dvisvgm-1.11/doc/conf-dblatex-pdf.xsl | 52 - .../source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.1 | 1233 ------ .../texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.txt.in | 772 ---- .../dvisvgm/dvisvgm-1.11/doc/tweak-dblatex-pdf.xsl | 29 - .../dvisvgm/dvisvgm-1.11/m4/ax_code_coverage.m4 | 229 - .../dvisvgm/dvisvgm-1.11/src/BasicDVIReader.cpp | 293 -- .../texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.h | 105 - .../texk/dvisvgm/dvisvgm-1.11/src/Bezier.cpp | 256 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.h | 52 - .../dvisvgm-1.11/src/BgColorSpecialHandler.cpp | 38 - .../dvisvgm-1.11/src/BgColorSpecialHandler.h | 34 - .../texk/dvisvgm/dvisvgm-1.11/src/Bitmap.cpp | 164 - .../source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.h | 112 - .../texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.cpp | 287 -- .../texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.h | 91 - .../source/texk/dvisvgm/dvisvgm-1.11/src/CMap.cpp | 75 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.h | 116 - .../texk/dvisvgm/dvisvgm-1.11/src/CMapManager.cpp | 142 - .../texk/dvisvgm/dvisvgm-1.11/src/CMapManager.h | 52 - .../texk/dvisvgm/dvisvgm-1.11/src/CMapReader.cpp | 265 -- .../texk/dvisvgm/dvisvgm-1.11/src/CMapReader.h | 81 - .../source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.cpp | 113 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.h | 51 - .../texk/dvisvgm/dvisvgm-1.11/src/Calculator.cpp | 180 - .../texk/dvisvgm/dvisvgm-1.11/src/Calculator.h | 57 - .../texk/dvisvgm/dvisvgm-1.11/src/CharMapID.cpp | 36 - .../texk/dvisvgm/dvisvgm-1.11/src/CharMapID.h | 59 - .../texk/dvisvgm/dvisvgm-1.11/src/Character.h | 46 - .../dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.cpp | 372 -- .../dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.h | 99 - .../source/texk/dvisvgm/dvisvgm-1.11/src/Color.cpp | 509 --- Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.h | 95 - .../dvisvgm-1.11/src/ColorSpecialHandler.cpp | 126 - .../dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.h | 42 - .../texk/dvisvgm/dvisvgm-1.11/src/CommandLine.cpp | 398 -- .../texk/dvisvgm/dvisvgm-1.11/src/CommandLine.h | 219 - .../texk/dvisvgm/dvisvgm-1.11/src/DLLoader.cpp | 60 - .../texk/dvisvgm/dvisvgm-1.11/src/DLLoader.h | 50 - .../texk/dvisvgm/dvisvgm-1.11/src/DVIActions.h | 52 - .../texk/dvisvgm/dvisvgm-1.11/src/DVIReader.cpp | 687 --- .../texk/dvisvgm/dvisvgm-1.11/src/DVIReader.h | 144 - .../texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.cpp | 340 -- .../texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.h | 63 - .../dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.cpp | 368 -- .../dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.h | 105 - .../dvisvgm/dvisvgm-1.11/src/DependencyGraph.h | 122 - .../texk/dvisvgm/dvisvgm-1.11/src/Directory.cpp | 129 - .../texk/dvisvgm/dvisvgm-1.11/src/Directory.h | 56 - .../dvisvgm-1.11/src/DvisvgmSpecialHandler.cpp | 354 -- .../dvisvgm-1.11/src/DvisvgmSpecialHandler.h | 67 - .../texk/dvisvgm/dvisvgm-1.11/src/EPSFile.cpp | 115 - .../source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.h | 46 - .../texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.cpp | 108 - .../texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.h | 72 - .../dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.cpp | 233 - .../dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.h | 57 - .../texk/dvisvgm/dvisvgm-1.11/src/EncFile.cpp | 134 - .../source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.h | 50 - .../texk/dvisvgm/dvisvgm-1.11/src/FileFinder.cpp | 278 -- .../texk/dvisvgm/dvisvgm-1.11/src/FileFinder.h | 35 - .../texk/dvisvgm/dvisvgm-1.11/src/FilePath.cpp | 258 -- .../texk/dvisvgm/dvisvgm-1.11/src/FilePath.h | 59 - .../texk/dvisvgm/dvisvgm-1.11/src/FileSystem.cpp | 330 -- .../texk/dvisvgm/dvisvgm-1.11/src/FileSystem.h | 48 - .../source/texk/dvisvgm/dvisvgm-1.11/src/Font.cpp | 664 --- Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.h | 392 -- .../texk/dvisvgm/dvisvgm-1.11/src/FontCache.cpp | 390 -- .../texk/dvisvgm/dvisvgm-1.11/src/FontCache.h | 70 - .../texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.cpp | 98 - .../texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.h | 65 - .../texk/dvisvgm/dvisvgm-1.11/src/FontEngine.cpp | 414 -- .../texk/dvisvgm/dvisvgm-1.11/src/FontEngine.h | 85 - .../texk/dvisvgm/dvisvgm-1.11/src/FontManager.cpp | 348 -- .../texk/dvisvgm/dvisvgm-1.11/src/FontManager.h | 85 - .../texk/dvisvgm/dvisvgm-1.11/src/FontMap.cpp | 305 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.h | 78 - .../texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.cpp | 41 - .../texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.h | 64 - .../texk/dvisvgm/dvisvgm-1.11/src/FontStyle.h | 12 - .../dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.cpp | 93 - .../texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.h | 60 - .../texk/dvisvgm/dvisvgm-1.11/src/GFReader.cpp | 368 -- .../texk/dvisvgm/dvisvgm-1.11/src/GFReader.h | 111 - .../texk/dvisvgm/dvisvgm-1.11/src/GFTracer.cpp | 103 - .../texk/dvisvgm/dvisvgm-1.11/src/GFTracer.h | 47 - .../texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.cpp | 353 -- .../texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.h | 103 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/Glyph.h | 28 - .../dvisvgm/dvisvgm-1.11/src/GlyphTracerMessages.h | 74 - .../texk/dvisvgm/dvisvgm-1.11/src/GraphicPath.h | 395 -- .../dvisvgm-1.11/src/HtmlSpecialHandler.cpp | 306 -- .../dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.h | 79 - .../texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.cpp | 138 - .../texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.h | 145 - .../texk/dvisvgm/dvisvgm-1.11/src/InputReader.cpp | 349 -- .../texk/dvisvgm/dvisvgm-1.11/src/InputReader.h | 90 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.cpp | 99 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.h | 44 - .../texk/dvisvgm/dvisvgm-1.11/src/Length.cpp | 85 - .../source/texk/dvisvgm/dvisvgm-1.11/src/Length.h | 62 - .../texk/dvisvgm/dvisvgm-1.11/src/Makefile.am | 233 - .../texk/dvisvgm/dvisvgm-1.11/src/MapLine.cpp | 276 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.h | 72 - .../texk/dvisvgm/dvisvgm-1.11/src/Matrix.cpp | 491 --- .../source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.h | 108 - .../texk/dvisvgm/dvisvgm-1.11/src/Message.cpp | 274 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/Message.h | 114 - .../dvisvgm/dvisvgm-1.11/src/MessageException.h | 39 - .../dvisvgm/dvisvgm-1.11/src/MetafontWrapper.cpp | 134 - .../dvisvgm/dvisvgm-1.11/src/MetafontWrapper.h | 43 - .../texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.cpp | 114 - .../texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.h | 52 - .../dvisvgm-1.11/src/NoPsSpecialHandler.cpp | 46 - .../dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.h | 42 - .../texk/dvisvgm/dvisvgm-1.11/src/NumericRanges.h | 110 - .../texk/dvisvgm/dvisvgm-1.11/src/PSFilter.h | 41 - .../dvisvgm/dvisvgm-1.11/src/PSInterpreter.cpp | 359 -- .../texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.h | 129 - .../texk/dvisvgm/dvisvgm-1.11/src/PSPattern.cpp | 175 - .../texk/dvisvgm/dvisvgm-1.11/src/PSPattern.h | 100 - .../dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.cpp | 118 - .../dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.h | 56 - .../texk/dvisvgm/dvisvgm-1.11/src/PageRanges.cpp | 87 - .../texk/dvisvgm/dvisvgm-1.11/src/PageRanges.h | 36 - .../texk/dvisvgm/dvisvgm-1.11/src/PageSize.cpp | 157 - .../texk/dvisvgm/dvisvgm-1.11/src/PageSize.h | 48 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/Pair.h | 79 - .../texk/dvisvgm/dvisvgm-1.11/src/PathClipper.cpp | 340 -- .../texk/dvisvgm/dvisvgm-1.11/src/PathClipper.h | 55 - .../dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.cpp | 77 - .../dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.h | 39 - .../dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.cpp | 44 - .../dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.h | 43 - .../texk/dvisvgm/dvisvgm-1.11/src/Process.cpp | 190 - .../source/texk/dvisvgm/dvisvgm-1.11/src/Process.h | 41 - .../dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.cpp | 1190 ----- .../dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.h | 169 - .../texk/dvisvgm/dvisvgm-1.11/src/RangeMap.cpp | 188 - .../texk/dvisvgm/dvisvgm-1.11/src/RangeMap.h | 87 - .../texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.cpp | 174 - .../texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.h | 56 - .../texk/dvisvgm/dvisvgm-1.11/src/SVGTree.cpp | 479 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.h | 114 - .../texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.cpp | 64 - .../texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.h | 71 - .../dvisvgm/dvisvgm-1.11/src/SignalHandler.cpp | 86 - .../texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.h | 50 - .../texk/dvisvgm/dvisvgm-1.11/src/SpecialActions.h | 96 - .../texk/dvisvgm/dvisvgm-1.11/src/SpecialHandler.h | 74 - .../dvisvgm/dvisvgm-1.11/src/SpecialManager.cpp | 183 - .../texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.h | 66 - .../texk/dvisvgm/dvisvgm-1.11/src/StreamReader.cpp | 160 - .../texk/dvisvgm/dvisvgm-1.11/src/StreamReader.h | 71 - .../texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.cpp | 82 - .../texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.h | 46 - .../texk/dvisvgm/dvisvgm-1.11/src/Subfont.cpp | 267 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.h | 102 - .../texk/dvisvgm/dvisvgm-1.11/src/System.cpp | 50 - .../source/texk/dvisvgm/dvisvgm-1.11/src/System.h | 29 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.cpp | 156 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.h | 66 - .../dvisvgm-1.11/src/TensorProductPatch.cpp | 549 --- .../dvisvgm/dvisvgm-1.11/src/TensorProductPatch.h | 95 - .../texk/dvisvgm/dvisvgm-1.11/src/Terminal.cpp | 208 - .../texk/dvisvgm/dvisvgm-1.11/src/Terminal.h | 58 - .../texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.cpp | 106 - .../texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.h | 38 - .../dvisvgm-1.11/src/TpicSpecialHandler.cpp | 329 -- .../dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.h | 50 - .../dvisvgm/dvisvgm-1.11/src/TriangularPatch.cpp | 214 - .../dvisvgm/dvisvgm-1.11/src/TriangularPatch.h | 64 - .../texk/dvisvgm/dvisvgm-1.11/src/Unicode.cpp | 4553 ------------------- .../source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.h | 35 - .../texk/dvisvgm/dvisvgm-1.11/src/VFActions.h | 38 - .../texk/dvisvgm/dvisvgm-1.11/src/VFReader.cpp | 192 - .../texk/dvisvgm/dvisvgm-1.11/src/VFReader.h | 65 - .../texk/dvisvgm/dvisvgm-1.11/src/VectorIterator.h | 109 - .../texk/dvisvgm/dvisvgm-1.11/src/VectorStream.h | 46 - .../texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.cpp | 74 - .../texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.h | 42 - .../texk/dvisvgm/dvisvgm-1.11/src/XMLNode.cpp | 254 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.h | 118 - .../texk/dvisvgm/dvisvgm-1.11/src/XMLString.cpp | 104 - .../texk/dvisvgm/dvisvgm-1.11/src/XMLString.h | 40 - .../texk/dvisvgm/dvisvgm-1.11/src/dvisvgm.cpp | 334 -- .../texk/dvisvgm/dvisvgm-1.11/src/gzstream.cpp | 172 - .../texk/dvisvgm/dvisvgm-1.11/src/gzstream.h | 121 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/iapi.h | 300 -- .../source/texk/dvisvgm/dvisvgm-1.11/src/ierrors.h | 153 - .../source/texk/dvisvgm/dvisvgm-1.11/src/macros.h | 42 - .../texk/dvisvgm/dvisvgm-1.11/src/options.dtd | 51 - .../texk/dvisvgm/dvisvgm-1.11/src/options.xml | 175 - .../texk/dvisvgm/dvisvgm-1.11/src/psdefs.cpp | 95 - Build/source/texk/dvisvgm/dvisvgm-1.11/src/types.h | 84 - .../texk/dvisvgm/dvisvgm-1.11/xxHash/Makefile.am | 10 - .../texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.c | 915 ---- .../texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.h | 192 - .../texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog | 113 + .../texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes | 21 + Build/source/texk/dvisvgm/dvisvgm-src/AUTHORS | 7 + Build/source/texk/dvisvgm/dvisvgm-src/COPYING | 674 +++ Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog | 4630 ++++++++++++++++++++ Build/source/texk/dvisvgm/dvisvgm-src/INSTALL | 229 + Build/source/texk/dvisvgm/dvisvgm-src/LGPL-2.1.txt | 504 +++ Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am | 26 + Build/source/texk/dvisvgm/dvisvgm-src/NEWS | 430 ++ Build/source/texk/dvisvgm/dvisvgm-src/README | 117 + .../texk/dvisvgm/dvisvgm-src/clipper/Makefile.am | 9 + .../texk/dvisvgm/dvisvgm-src/clipper/clipper.cpp | 4457 +++++++++++++++++++ .../texk/dvisvgm/dvisvgm-src/clipper/clipper.hpp | 429 ++ Build/source/texk/dvisvgm/dvisvgm-src/config.h.in | 169 + Build/source/texk/dvisvgm/dvisvgm-src/configure.ac | 176 + .../texk/dvisvgm/dvisvgm-src/doc/Makefile.am | 54 + .../dvisvgm/dvisvgm-src/doc/conf-dblatex-man.xsl | 19 + .../dvisvgm/dvisvgm-src/doc/conf-dblatex-pdf.xsl | 52 + .../source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 | 1259 ++++++ .../texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in | 789 ++++ .../dvisvgm/dvisvgm-src/doc/tweak-dblatex-pdf.xsl | 29 + .../dvisvgm/dvisvgm-src/m4/ax_code_coverage.m4 | 229 + .../dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp | 293 ++ .../texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h | 105 + .../source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp | 256 ++ Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h | 52 + .../dvisvgm-src/src/BgColorSpecialHandler.cpp | 38 + .../dvisvgm-src/src/BgColorSpecialHandler.h | 34 + .../source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp | 164 + Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h | 112 + .../texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp | 287 ++ .../texk/dvisvgm/dvisvgm-src/src/BoundingBox.h | 91 + Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp | 75 + Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h | 116 + .../texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp | 142 + .../texk/dvisvgm/dvisvgm-src/src/CMapManager.h | 52 + .../texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp | 265 ++ .../texk/dvisvgm/dvisvgm-src/src/CMapReader.h | 81 + .../source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp | 113 + Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h | 51 + .../texk/dvisvgm/dvisvgm-src/src/Calculator.cpp | 180 + .../texk/dvisvgm/dvisvgm-src/src/Calculator.h | 57 + .../texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp | 36 + .../texk/dvisvgm/dvisvgm-src/src/CharMapID.h | 59 + .../texk/dvisvgm/dvisvgm-src/src/Character.h | 46 + .../dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp | 372 ++ .../dvisvgm/dvisvgm-src/src/CmdLineParserBase.h | 99 + .../source/texk/dvisvgm/dvisvgm-src/src/Color.cpp | 679 +++ Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h | 98 + .../dvisvgm-src/src/ColorSpecialHandler.cpp | 126 + .../dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h | 42 + .../texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp | 405 ++ .../texk/dvisvgm/dvisvgm-src/src/CommandLine.h | 222 + .../texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp | 60 + .../source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h | 50 + .../texk/dvisvgm/dvisvgm-src/src/DVIActions.h | 52 + .../texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp | 687 +++ .../texk/dvisvgm/dvisvgm-src/src/DVIReader.h | 144 + .../texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp | 340 ++ .../source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h | 63 + .../dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp | 368 ++ .../texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h | 105 + .../texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h | 122 + .../texk/dvisvgm/dvisvgm-src/src/Directory.cpp | 129 + .../texk/dvisvgm/dvisvgm-src/src/Directory.h | 56 + .../dvisvgm-src/src/DvisvgmSpecialHandler.cpp | 354 ++ .../dvisvgm-src/src/DvisvgmSpecialHandler.h | 67 + .../texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp | 115 + .../source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h | 46 + .../texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp | 108 + .../source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h | 72 + .../dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp | 233 + .../dvisvgm/dvisvgm-src/src/EmSpecialHandler.h | 57 + .../texk/dvisvgm/dvisvgm-src/src/EncFile.cpp | 134 + .../source/texk/dvisvgm/dvisvgm-src/src/EncFile.h | 50 + .../texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp | 278 ++ .../texk/dvisvgm/dvisvgm-src/src/FileFinder.h | 35 + .../texk/dvisvgm/dvisvgm-src/src/FilePath.cpp | 258 ++ .../source/texk/dvisvgm/dvisvgm-src/src/FilePath.h | 59 + .../texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp | 330 ++ .../texk/dvisvgm/dvisvgm-src/src/FileSystem.h | 48 + Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp | 664 +++ Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h | 392 ++ .../texk/dvisvgm/dvisvgm-src/src/FontCache.cpp | 390 ++ .../texk/dvisvgm/dvisvgm-src/src/FontCache.h | 70 + .../texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp | 98 + .../texk/dvisvgm/dvisvgm-src/src/FontEncoding.h | 65 + .../texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp | 416 ++ .../texk/dvisvgm/dvisvgm-src/src/FontEngine.h | 85 + .../texk/dvisvgm/dvisvgm-src/src/FontManager.cpp | 347 ++ .../texk/dvisvgm/dvisvgm-src/src/FontManager.h | 85 + .../texk/dvisvgm/dvisvgm-src/src/FontMap.cpp | 305 ++ .../source/texk/dvisvgm/dvisvgm-src/src/FontMap.h | 78 + .../texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp | 41 + .../texk/dvisvgm/dvisvgm-src/src/FontMetrics.h | 64 + .../texk/dvisvgm/dvisvgm-src/src/FontStyle.h | 12 + .../texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp | 93 + .../texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h | 60 + .../texk/dvisvgm/dvisvgm-src/src/GFReader.cpp | 368 ++ .../source/texk/dvisvgm/dvisvgm-src/src/GFReader.h | 111 + .../texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp | 103 + .../source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h | 47 + .../texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp | 353 ++ .../texk/dvisvgm/dvisvgm-src/src/Ghostscript.h | 103 + Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h | 28 + .../dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h | 74 + .../texk/dvisvgm/dvisvgm-src/src/GraphicPath.h | 395 ++ .../dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp | 306 ++ .../dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h | 79 + .../texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp | 138 + .../texk/dvisvgm/dvisvgm-src/src/InputBuffer.h | 145 + .../texk/dvisvgm/dvisvgm-src/src/InputReader.cpp | 349 ++ .../texk/dvisvgm/dvisvgm-src/src/InputReader.h | 90 + Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp | 99 + Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h | 44 + .../source/texk/dvisvgm/dvisvgm-src/src/Length.cpp | 85 + Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h | 62 + .../texk/dvisvgm/dvisvgm-src/src/Makefile.am | 233 + .../texk/dvisvgm/dvisvgm-src/src/MapLine.cpp | 276 ++ .../source/texk/dvisvgm/dvisvgm-src/src/MapLine.h | 72 + .../source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp | 491 +++ Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h | 108 + .../texk/dvisvgm/dvisvgm-src/src/Message.cpp | 274 ++ .../source/texk/dvisvgm/dvisvgm-src/src/Message.h | 114 + .../dvisvgm/dvisvgm-src/src/MessageException.h | 39 + .../dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp | 134 + .../texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h | 43 + .../texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp | 114 + .../texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h | 52 + .../dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp | 46 + .../dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h | 42 + .../texk/dvisvgm/dvisvgm-src/src/NumericRanges.h | 110 + .../source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h | 41 + .../texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp | 359 ++ .../texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h | 129 + .../texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp | 175 + .../texk/dvisvgm/dvisvgm-src/src/PSPattern.h | 100 + .../dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp | 118 + .../texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h | 56 + .../texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp | 87 + .../texk/dvisvgm/dvisvgm-src/src/PageRanges.h | 36 + .../texk/dvisvgm/dvisvgm-src/src/PageSize.cpp | 157 + .../source/texk/dvisvgm/dvisvgm-src/src/PageSize.h | 48 + Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h | 79 + .../texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp | 340 ++ .../texk/dvisvgm/dvisvgm-src/src/PathClipper.h | 55 + .../dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp | 77 + .../dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h | 39 + .../dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp | 44 + .../dvisvgm/dvisvgm-src/src/PreScanDVIReader.h | 43 + .../texk/dvisvgm/dvisvgm-src/src/Process.cpp | 191 + .../source/texk/dvisvgm/dvisvgm-src/src/Process.h | 41 + .../dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp | 1190 +++++ .../dvisvgm/dvisvgm-src/src/PsSpecialHandler.h | 169 + .../texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp | 188 + .../source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h | 87 + .../texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp | 174 + .../texk/dvisvgm/dvisvgm-src/src/SVGOutput.h | 56 + .../texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp | 479 ++ .../source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h | 114 + .../texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp | 64 + .../texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h | 71 + .../texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp | 86 + .../texk/dvisvgm/dvisvgm-src/src/SignalHandler.h | 50 + .../texk/dvisvgm/dvisvgm-src/src/SpecialActions.h | 96 + .../texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h | 74 + .../dvisvgm/dvisvgm-src/src/SpecialManager.cpp | 183 + .../texk/dvisvgm/dvisvgm-src/src/SpecialManager.h | 66 + .../texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp | 160 + .../texk/dvisvgm/dvisvgm-src/src/StreamReader.h | 71 + .../texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp | 82 + .../texk/dvisvgm/dvisvgm-src/src/StreamWriter.h | 46 + .../texk/dvisvgm/dvisvgm-src/src/Subfont.cpp | 267 ++ .../source/texk/dvisvgm/dvisvgm-src/src/Subfont.h | 102 + .../source/texk/dvisvgm/dvisvgm-src/src/System.cpp | 50 + Build/source/texk/dvisvgm/dvisvgm-src/src/System.h | 29 + Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp | 156 + Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h | 66 + .../dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp | 549 +++ .../dvisvgm/dvisvgm-src/src/TensorProductPatch.h | 95 + .../texk/dvisvgm/dvisvgm-src/src/Terminal.cpp | 208 + .../source/texk/dvisvgm/dvisvgm-src/src/Terminal.h | 58 + .../texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp | 106 + .../texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h | 38 + .../dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp | 329 ++ .../dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h | 50 + .../dvisvgm/dvisvgm-src/src/TriangularPatch.cpp | 214 + .../texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h | 64 + .../texk/dvisvgm/dvisvgm-src/src/Unicode.cpp | 4553 +++++++++++++++++++ .../source/texk/dvisvgm/dvisvgm-src/src/Unicode.h | 35 + .../texk/dvisvgm/dvisvgm-src/src/VFActions.h | 38 + .../texk/dvisvgm/dvisvgm-src/src/VFReader.cpp | 192 + .../source/texk/dvisvgm/dvisvgm-src/src/VFReader.h | 65 + .../texk/dvisvgm/dvisvgm-src/src/VectorIterator.h | 109 + .../texk/dvisvgm/dvisvgm-src/src/VectorStream.h | 46 + .../texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp | 74 + .../texk/dvisvgm/dvisvgm-src/src/XMLDocument.h | 42 + .../texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp | 254 ++ .../source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h | 118 + .../texk/dvisvgm/dvisvgm-src/src/XMLString.cpp | 104 + .../texk/dvisvgm/dvisvgm-src/src/XMLString.h | 40 + .../texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp | 335 ++ .../texk/dvisvgm/dvisvgm-src/src/gzstream.cpp | 172 + .../source/texk/dvisvgm/dvisvgm-src/src/gzstream.h | 121 + Build/source/texk/dvisvgm/dvisvgm-src/src/iapi.h | 300 ++ .../source/texk/dvisvgm/dvisvgm-src/src/ierrors.h | 153 + Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h | 42 + .../texk/dvisvgm/dvisvgm-src/src/options.dtd | 51 + .../texk/dvisvgm/dvisvgm-src/src/options.xml | 178 + .../source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp | 95 + Build/source/texk/dvisvgm/dvisvgm-src/src/types.h | 84 + .../texk/dvisvgm/dvisvgm-src/xxHash/Makefile.am | 10 + .../texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c | 915 ++++ .../texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h | 192 + Build/source/texk/dvisvgm/version.ac | 2 +- 431 files changed, 48421 insertions(+), 48126 deletions(-) delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/ChangeLog delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/TL-Changes delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/AUTHORS delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/COPYING delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/ChangeLog delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/INSTALL delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/LGPL-2.1.txt delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/Makefile.am delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/NEWS delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/README delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/Makefile.am delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.hpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/config.h.in delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/configure.ac delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/Makefile.am delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-man.xsl delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-pdf.xsl delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.1 delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.txt.in delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/doc/tweak-dblatex-pdf.xsl delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/m4/ax_code_coverage.m4 delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Character.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIActions.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DependencyGraph.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontStyle.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Glyph.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GlyphTracerMessages.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/GraphicPath.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Makefile.am delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MessageException.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/NumericRanges.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSFilter.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Pair.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialActions.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFActions.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorIterator.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorStream.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/dvisvgm.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/iapi.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/ierrors.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/macros.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.dtd delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.xml delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/psdefs.cpp delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/src/types.h delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/Makefile.am delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.c delete mode 100644 Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/AUTHORS create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/COPYING create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/INSTALL create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/LGPL-2.1.txt create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/NEWS create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/README create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/clipper/Makefile.am create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.hpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/config.h.in create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/configure.ac create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/Makefile.am create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-man.xsl create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-pdf.xsl create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/doc/tweak-dblatex-pdf.xsl create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/m4/ax_code_coverage.m4 create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/System.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/iapi.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/ierrors.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/src/types.h create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/xxHash/Makefile.am create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h (limited to 'Build/source/texk/dvisvgm') diff --git a/Build/source/texk/dvisvgm/ChangeLog b/Build/source/texk/dvisvgm/ChangeLog index 5c38cadd196..775e58db480 100644 --- a/Build/source/texk/dvisvgm/ChangeLog +++ b/Build/source/texk/dvisvgm/ChangeLog @@ -1,3 +1,8 @@ +2015-12-03 Akira Kakuto + + * Imported release 1.12. + * version.ac: Adapted. + 2015-09-28 Peter Breitenlohner * Imported release 1.11. diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure index f36bca83531..52540d00020 100755 --- a/Build/source/texk/dvisvgm/configure +++ b/Build/source/texk/dvisvgm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 1.11. +# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 1.12. # # Report bugs to . # @@ -590,12 +590,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvisvgm (TeX Live)' PACKAGE_TARNAME='dvisvgm--tex-live-' -PACKAGE_VERSION='1.11' -PACKAGE_STRING='dvisvgm (TeX Live) 1.11' +PACKAGE_VERSION='1.12' +PACKAGE_STRING='dvisvgm (TeX Live) 1.12' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="dvisvgm-1.11/src/dvisvgm.cpp" +ac_unique_file="dvisvgm-src/src/dvisvgm.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -1372,7 +1372,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dvisvgm (TeX Live) 1.11 to adapt to many kinds of systems. +\`configure' configures dvisvgm (TeX Live) 1.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1443,7 +1443,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvisvgm (TeX Live) 1.11:";; + short | recursive ) echo "Configuration of dvisvgm (TeX Live) 1.12:";; esac cat <<\_ACEOF @@ -1583,7 +1583,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvisvgm (TeX Live) configure 1.11 +dvisvgm (TeX Live) configure 1.12 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2451,7 +2451,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dvisvgm (TeX Live) $as_me 1.11, which was +It was created by dvisvgm (TeX Live) $as_me 1.12, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -8137,7 +8137,7 @@ fi # Define the identity of the package. PACKAGE='dvisvgm--tex-live-' - VERSION='1.11' + VERSION='1.12' cat >>confdefs.h <<_ACEOF @@ -18321,7 +18321,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -dvisvgm (TeX Live) config.lt 1.11 +dvisvgm (TeX Live) config.lt 1.12 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -20132,7 +20132,7 @@ $as_echo "#define KPSE_CXX_UNSAFE 1" >>confdefs.h fi -DVISVGM_TREE=dvisvgm-1.11 +DVISVGM_TREE=dvisvgm-src ac_config_files="$ac_config_files Makefile" @@ -20684,7 +20684,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dvisvgm (TeX Live) $as_me 1.11, which was +This file was extended by dvisvgm (TeX Live) $as_me 1.12, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20750,7 +20750,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 (TeX Live) config.status 1.11 +dvisvgm (TeX Live) config.status 1.12 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/ChangeLog deleted file mode 100644 index e8de4ebf0a2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/ChangeLog +++ /dev/null @@ -1,109 +0,0 @@ -2015-04-12 Peter Breitenlohner - - * Import release 1.9.2. - -2015-03-01 Peter Breitenlohner - - * Import release 1.9.1. - * patch-01-mingw32, patch-09-funccall, patch-10-pow-int-int - (removed): Included upstream. - -2015-01-15 Peter Breitenlohner - - * patch-10-pow-int-int (new): Build fix for ppc-darwin gcc-4.2, - from Mojca Miklavec . - -2015-01-11 Karl Berry - - * patch-09-funccall (new): LLVM/Clang build (or bug) fix. - problem found by Richard Koch . - -2015-01-07 Peter Breitenlohner - - * Import release 1.9. - * patch-01-mingw32 (new): Oldish MinGW32 may not define this. - -2014-09-15 Peter Breitenlohner - - * Import release 1.8.1. - -2014-07-31 Peter Breitenlohner - - * Import release 1.8. - * patch-01-cygwin (removed): Included upstream. - -2014-06-25 Peter Breitenlohner - - * patch-01-cygwin (new): Cygwin soname for gs library. - -2014-06-20 Peter Breitenlohner - - * Import release 1.7. - -2014-04-29 Peter Breitenlohner - - * Import release 1.6. - -2014-04-13 Peter Breitenlohner - - * Import release 1.5.3. - -2014-01-13 Peter Breitenlohner - - * Import release 1.5.2. - -2013-10-30 Peter Breitenlohner - - * Import release 1.5.1. - -2013-09-17 Akira Kakuto - - * patch-01-MSVC (removed): Instead compile with -DNOMINMAX. - -2013-09-16 Akira Kakuto - - * patch-01-MSVC (new): Build fix for Visual Studio 2010. - -2013-09-10 Peter Breitenlohner - - * Import release 1.5. - * patch-01-cpp, patch-02-config_h: Removed. - -2013-08-08 Peter Breitenlohner - - * Import release 1.4. - * patch-01-cpp, patch-02-config_h: Adapted. - -2013-06-28 Peter Breitenlohner - - * patch-02-config_h (new): Include always first. - -2013-06-16 Peter Breitenlohner - - * patch-01-cpp: New version for kpathsea adapted to C++. - -2013-05-17 Peter Breitenlohner - - * Import release 1.3. - * patch-01-cpp: Adapted. - -2013-04-11 Peter Breitenlohner - - * Import release 1.2.1. - * patch-1-cpp (removed): Renamed ... - * patch-01-cpp (new): ... and adapted. - -2013-04-02 Karl Berry - - * patch-1-cpp (new): Force __cplusplus to be 1, - for sake of g++ 4.7.x and including c-memstr.h and Solaris. - Patch from Apostolos, tlbuild 1 Apr 2013 00:34:43. - -2013-03-02 Peter Breitenlohner - - * Import release 1.2. - -2013-01-29 Peter Breitenlohner - - * Import release 1.1. - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/TL-Changes b/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/TL-Changes deleted file mode 100644 index 84e222f7d83..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11-PATCHES/TL-Changes +++ /dev/null @@ -1,21 +0,0 @@ -Changes applied to the dvisvgm-1.11 tree as obtained from: - http://dvisvgm.bplaced.net/Downloads - -Removed: - Makefile.in - aclocal.m4 - compile - config.guess - config.sub - configure - depcomp - install-sh - missing - test-driver - tests/ - */Makefile.in - -Converted Dos/Win line ends to native: - clipper/clipper.cpp - clipper/clipper.hpp - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/AUTHORS b/Build/source/texk/dvisvgm/dvisvgm-1.11/AUTHORS deleted file mode 100644 index d9b6468421e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -Martin Gieseking - author of dvisvgm - -Deepak Bandyopadhyay, Lutz Kettner - authors of gzstream library - dvisvgm uses a slightly modified version - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/COPYING b/Build/source/texk/dvisvgm/dvisvgm-1.11/COPYING deleted file mode 100644 index 94a9ed024d3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-1.11/ChangeLog deleted file mode 100644 index 062f02e146a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/ChangeLog +++ /dev/null @@ -1,4581 +0,0 @@ -2015-09-21 Martin Gieseking - - * NEWS, README, README.md: - updated NEWS and README files - -2015-09-18 Martin Gieseking - - * .travis.yml, configure.ac, src/Doxyfile: - set version to 1.11 - -2015-09-14 Martin Gieseking - - * src/Font.cpp, src/Unicode.cpp, src/Unicode.h, tests/UnicodeTest.cpp: - renamed Unicode::psName2Codepoint to Unicode::psNameToCodepoint - - * src/Font.cpp, src/ToUnicodeMap.cpp, src/Unicode.cpp, src/Unicode.h, - tests/UnicodeTest.cpp: - improved handling of invalid Unicode points - -2015-09-10 Martin Gieseking - - * src/HtmlSpecialHandler.cpp: - quote XML metacharacters in xlink:title attributes - - * src/Font.cpp: - prevent creating 0x00 codepoints if PS character name is unknown - -2015-09-09 Martin Gieseking - - * src/SVGTree.cpp: - force creating a new text element after appending a different node to - the page - -2015-08-13 Martin Gieseking - - * README, README.md: - minor updates to README and README.md - -2015-07-29 Martin Gieseking - - * tests/CommandLineTest.cpp, tests/MessageExceptionTest.cpp: - use ASSERT_STREQ in tests - - * tests/UnicodeTest.cpp: - improved UnicodeTest - - * tests/GhostscriptTest.cpp, tests/Makefile.am: - added GhostscriptTest - -2015-07-22 Martin Gieseking - - * README, README.md, doc/dvisvgm.txt.in: - updated links to project website again (relocated to - dvisvgm.bplaced.net) - -2015-07-20 Martin Gieseking - - * README, README.md, doc/dvisvgm.txt.in: - updated info about new project website - -2015-07-14 Martin Gieseking - - * NEWS: - updated NEWS - - * .travis.yml, configure.ac, src/Doxyfile: - set version to 1.10 - -2015-07-12 Martin Gieseking - - * README.md, doc/dvisvgm.txt.in, src/BasicDVIReader.cpp, - src/BasicDVIReader.h, src/DVIReader.cpp, src/DVIReader.h, src/Font.h, - src/FontManager.cpp, src/FontManager.h: - added support for new XDV format 6 - -2015-07-11 Martin Gieseking - - * README, README.md: - updated README - -2015-07-03 Martin Gieseking - - * src/MiKTeXCom.cpp: - added some comments to MiKTeXCom.cpp - - * src/dvisvgm.cpp: - check for option --help before initializing the FileFinder - -2015-07-02 Martin Gieseking - - * src/Font.cpp, src/Makefile.am, src/Unicode.cpp, src/Unicode.h, - tests/Makefile.am, tests/create-makefile: - added mapping from character names to unicode for PostScript fonts - - * Makefile.am, configure.ac, xxHash/LICENSE, xxHash/Makefile.am, - xxHash/xxhash.c, xxHash/xxhash.h: - added xxHash library (https://github.com/Cyan4973/xxHash) - - * tests/BezierTest.cpp: - removed #include "debug.h" from test - -2015-04-07 Martin Gieseking - - * src/SVGTree.cpp: - apply --precision settings to font-size attributes too - - * NEWS, README.md: - updated NEWS and README.md - - * .travis.yml, configure.ac, src/Doxyfile: - set version to 1.9.2 - -2015-04-04 Martin Gieseking - - * tests/SVGOutputTest.cpp: - remove output files created by SVGOutputTest::getPageStream() - -2015-04-02 Martin Gieseking - - * README.md: - minor additions to README.md - -2015-03-26 Martin Gieseking - - * src/GFReader.cpp, src/GFReader.h, tests/GFReaderTest.cpp: - improved GFReaderTest - - * src/GlyphTracerMessages.h: - always skip tracer message if no glyphs have been traced - -2015-03-25 Martin Gieseking - - * src/DVIToSVG.cpp: - avoid retracing of fonts if option --no-fonts is given - - * src/GFGlyphTracer.cpp, src/GFTracer.h, tests/GFGlyphTracerTest.cpp, - tests/Makefile.am: - ensure GFGlyphTracer::executeChar() returns the correct status; added - GFGlyphtracerTest - -2015-03-22 Martin Gieseking - - * tests/SVGOutputTest.cpp: - improved SVGOutputTest - - * tests/StreamWriterTest.cpp: - fixed StreamWriterTest - -2015-03-19 Martin Gieseking - - * tests/Makefile.am, tests/ShadingPatch.cpp: - added ShadingPatchTest - -2015-03-18 Martin Gieseking - - * src/TensorProductPatch.h, tests/TensorProductPatchTest.cpp: - improved TensorProductPatchTest - - * src/Bezier.cpp, src/Bezier.h, src/TensorProductPatch.cpp, - src/TriangularPatch.cpp, src/TriangularPatch.h, - tests/TriangularPatchTest.cpp: - renamed method pointAt() of class Bezier and TriangularPatch to - valueAt() - - * src/ShadingPatch.h, src/TensorProductPatch.cpp, - src/TensorProductPatch.h, src/TriangularPatch.cpp, src/TriangularPatch.h, - tests/Makefile.am, tests/TriangularPatchTest.cpp: - added test for class TriangularPatch - -2015-03-17 Martin Gieseking - - * autogen.sh: - updated autogen.sh - -2015-03-15 Martin Gieseking - - * tests/Makefile.am, tests/VectorIteratorTest.cpp: - added VectorIteratorTest - - * Makefile.am, clipper/Makefile.am, configure.ac, m4/ax_code_coverage.m4, - src/Makefile.am, tests/Makefile.am, tests/create-makefile: - extended build system to generate coverage reports - - * src/XMLNode.cpp, src/XMLNode.h, tests/Makefile.am, - tests/XMLNodeTest.cpp: - fixed a few issues in class XMLElementNode; added XMLNodeTest - -2015-03-13 Martin Gieseking - - * tests/XMLStringTest.cpp: - fixed test class name of XMLString - -2015-03-09 Martin Gieseking - - * tests/GraphicPathTest.cpp: - extended tests of class GraphicPath - - * tests/CRC32Test.cpp: - added test for 'compute' methods of class CRC32 - -2015-03-08 Martin Gieseking - - * tests/StreamReaderTest.cpp: - exteded StreamReader tests - -2015-03-07 Martin Gieseking - - * .gitignore: - added .gitignore - - * src/XMLString.cpp, tests/Makefile.am, tests/XMLStringTest.cpp: - fixed conversion from C and C++ strings to XMLString; added - XMLStringTest - -2015-03-06 Martin Gieseking - - * src/BoundingBox.cpp, src/BoundingBox.h, tests/BoundingBoxTest.cpp: - improved BoundingBox tests - - * src/Bitmap.cpp, src/Bitmap.h, tests/BitmapTest.cpp, - tests/GFReaderTest.cpp, tests/Makefile.am: - small refactorings of class Bitmap; added tests for class Bitmap - -2015-03-01 Martin Gieseking - - * README.md: - added license badge to README.md - - * .travis.yml: - Travis conf: added configuration data for Coverity Scan - -2015-02-28 Martin Gieseking - - * NEWS, README.md: - updated NEWS and README.md - -2015-02-27 Martin Gieseking - - * src/Calculator.cpp: - replaced while(1) with for(;;) for consistency - -2015-02-26 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.9.1 - -2015-02-25 Martin Gieseking - - * src/Ghostscript.cpp: - disable lookup of GS library in Windows registry for old gcc versions - -2015-02-20 Martin Gieseking - - * doc/Makefile.am, doc/db2html.xsl, doc/dvisvgm.css: - create html manpage with a separate stylesheet matching the new website - theme - - * doc/Makefile.am, doc/conf-dblatex-man.xsl, doc/conf-dblatex-pdf.xsl, - doc/dvisvgm.sty, doc/dvisvgm.xpr, doc/tweak-dblatex-pdf.xsl: - improved the layout of the pdf manpage - - * doc/dvisvgm.txt.in: - minor additions and formatting changes of the manpage - - * doc/dvisvgm.txt.in, src/SVGOutput.cpp, src/SVGOutput.h, - tests/Makefile.am, tests/SVGOutputTest.cpp, tests/create-makefile: - added width specifiers and exression evaluation to --output patterns - -2015-02-19 Martin Gieseking - - * .travis.yml: - Travis conf: build gtest libraries since Ubuntu doesn't provide the - binaries - - * .travis.yml: - Travis conf: added missing call of 'configure' - - * .travis.yml: - added dependency 'libgtest-dev' to Travis configuration; ensure call of - 'make check' - - * .travis.yml: - added dependency 'python-lxml' to Travis configuration - - * .travis.yml: - added configuration file for Travis CI - -2015-02-18 Martin Gieseking - - * src/TpicSpecialHandler.cpp: - use constant M_PI rather than computing PI locally - -2015-02-17 Martin Gieseking - - * README, README.md: - updated README and README.md - -2015-01-21 Martin Gieseking - - * src/TensorProductPatch.cpp, src/TriangularPatch.cpp: - renamed static helper function clip() to snap() - -2015-01-15 Martin Gieseking - - * src/Color.cpp: - resolved ambiguous call of pow (patch by Peter Breitenlohner) - -2015-01-12 Martin Gieseking - - * src/VectorIterator.h: - removed redundant method VectorIterator::distanceToLast() - -2014-12-30 Martin Gieseking - - * Makefile.am, README, README.md, configure.ac, doc/Makefile.am, - doc/dvisvgm.txt.in, src/BasicDVIReader.cpp, src/BasicDVIReader.h, - src/Bezier.cpp, src/Bezier.h, src/BgColorSpecialHandler.cpp, - src/BgColorSpecialHandler.h, src/Bitmap.cpp, src/Bitmap.h, - src/BoundingBox.cpp, src/BoundingBox.h, src/CMap.cpp, src/CMap.h, - src/CMapManager.cpp, src/CMapManager.h, src/CMapReader.cpp, - src/CMapReader.h, src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, - src/Calculator.h, src/CharMapID.cpp, src/CharMapID.h, src/Character.h, - src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, - src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/DependencyGraph.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EPSFile.cpp, src/EPSFile.h, src/EPSToSVG.cpp, src/EPSToSVG.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/EncFile.cpp, - src/EncFile.h, src/FileFinder.cpp, src/FileFinder.h, src/FilePath.cpp, - src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, - src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, - src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, - src/FontMetrics.cpp, src/FontMetrics.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, - src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, - src/InputReader.cpp, src/InputReader.h, src/JFM.cpp, src/JFM.h, - src/Length.cpp, src/Length.h, src/Makefile.am, src/Makefile.old, - src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, - src/Message.cpp, src/Message.h, src/MessageException.h, - src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/MiKTeXCom.cpp, - src/MiKTeXCom.h, src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, - src/NumericRanges.h, src/PSFilter.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PSPattern.cpp, src/PSPattern.h, - src/PSPreviewFilter.cpp, src/PSPreviewFilter.h, src/PageRanges.cpp, - src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/PathClipper.cpp, src/PathClipper.h, src/PdfSpecialHandler.cpp, - src/PdfSpecialHandler.h, src/PreScanDVIReader.cpp, - src/PreScanDVIReader.h, src/Process.cpp, src/Process.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/RangeMap.cpp, - src/RangeMap.h, src/SVGOutputBase.h, src/SVGTree.cpp, src/SVGTree.h, - src/SWFWriter.cpp, src/SWFWriter.h, src/ShadingPatch.cpp, - src/ShadingPatch.h, src/SignalHandler.cpp, src/SignalHandler.h, - src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, - src/SpecialManager.h, src/StreamReader.cpp, src/StreamReader.h, - src/StreamWriter.cpp, src/StreamWriter.h, src/Subfont.cpp, src/Subfont.h, - src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, - src/TensorProductPatch.cpp, src/TensorProductPatch.h, src/Terminal.cpp, - src/Terminal.h, src/ToUnicodeMap.cpp, src/ToUnicodeMap.h, - src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, - src/TriangularPatch.cpp, src/TriangularPatch.h, src/Unicode.cpp, - src/Unicode.h, src/VFActions.h, src/VFReader.cpp, src/VFReader.h, - src/VectorIterator.h, src/VectorStream.h, src/XMLDocument.cpp, - src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, - src/XMLString.h, src/dvisvgm.cpp, src/gfprint.mak, src/macros.h, - src/options.dtd, src/options.xml, src/psdefs.cpp, src/psdefs.ps, - src/types.h, tests/BoundingBoxTest.cpp, tests/CMapReaderTest.cpp, - tests/CMapTest.cpp, tests/CRC32Test.cpp, tests/CalculatorTest.cpp, - tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, - tests/CommandLineTest.cpp, tests/DependencyGraphTest.cpp, - tests/DirectoryTest.cpp, tests/DvisvgmSpecialTest.cpp, - tests/FileFinderTest.cpp, tests/FilePathTest.cpp, - tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, - tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, - tests/LengthTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, - tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, - tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, - tests/PageSizeTest.cpp, tests/PairTest.cpp, tests/RangeMapTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, - tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, - tests/SubfontTest.cpp, tests/TensorProductPatchTest.cpp, - tests/ToUnicodeMapTest.cpp, tests/TypesTest.cpp, - tests/VectorStreamTest.cpp, tests/check-conv, tests/create-makefile, - tests/normalize.xsl: - updated year in copyright statements to 2015 - -2014-12-28 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.9 - - * src/dvisvgm.cpp: - clear line before printing the message about user interruption to avoid - trailing text fragments - - * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/EPSToSVG.cpp, - src/EPSToSVG.h, src/SpecialActions.h, src/SpecialManager.cpp, - src/dvisvgm.cpp: - show PS instruction counter when processing EPS files with option - --progress - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/ShadingPatch.h, - src/TensorProductPatch.cpp, src/TensorProductPatch.h, - src/TriangularPatch.cpp, src/TriangularPatch.h, src/dvisvgm.cpp, - src/options.xml: - added command-line options --grad-overlap, --grad-segments, and - --grad-simplify - -2014-12-20 Martin Gieseking - - * src/DVIReader.cpp: - check validity of DVI file before trying to collect the BOPs - -2014-12-18 Martin Gieseking - - * src/Color.cpp, src/Color.h, src/Makefile.am, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/VectorIterator.h, src/psdefs.cpp, - src/psdefs.ps: - extended PS operator 'shfill' to support triangular patch meshes - - * src/Makefile.am, src/PsSpecialHandler.cpp, src/ShadingPatch.cpp, - src/ShadingPatch.h, src/TensorProductPatch.cpp, src/TensorProductPatch.h: - extracted common interface class ShadingPatch from TensorProductPatch - - * src/Makefile.am, src/TriangularPatch.cpp, src/TriangularPatch.h: - added class to compute triangular shading patches - -2014-12-16 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - added processing of the optional 'BBox' entry in a PS shading dictionary - -2014-12-03 Martin Gieseking - - * src/Color.cpp, tests/ColorSpecialTest.cpp, tests/ColorTest.cpp: - fixed CMYK to RGB approximation - - * src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, - src/options.xml: - disable option --clipjoin if PS support is disabled - -2014-11-27 Martin Gieseking - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.cpp, src/psdefs.ps, - tests/PSInterpreterTest.cpp: - added evaluation of PS operator "shfill" (Coons and tensor product - patches only) - -2014-11-24 Martin Gieseking - - * README.md: - added list of features and a download button to README.md - -2014-11-20 Martin Gieseking - - * src/MiKTeXCom.cpp: - added missing includes to make MinGW-w64 happy - -2014-11-09 Martin Gieseking - - * clipper/clipper.cpp, clipper/clipper.hpp: - updated clipper library to version 6.2.1 - -2014-11-08 Martin Gieseking - - * src/Bezier.cpp, src/Bezier.h, src/BoundingBox.h, src/GraphicPath.h, - src/Makefile.am, src/TensorProductPatch.cpp, src/TensorProductPatch.h, - tests/Makefile.am, tests/TensorProductPatchTest.cpp: - added code to compute tensor-product patches required for gradient fills - -2014-11-06 Martin Gieseking - - * src/Matrix.cpp: - use constant M_PI rather than defining PI locally - -2014-10-23 Martin Gieseking - - * src/Color.cpp, src/Color.h, tests/ColorTest.cpp: - added deltaE and L*a*b* color space methods to class Color - - * src/Color.cpp, src/Color.h: - replaced vectors with valarrays in class Color - - * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, - src/DVIReader.cpp, src/HtmlSpecialHandler.cpp, src/PsSpecialHandler.cpp, - tests/ColorTest.cpp: - renamed RGB setters/getters of class Color - - * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, - src/PsSpecialHandler.cpp, tests/ColorTest.cpp: - replaced float by double in class Color - -2014-10-17 Martin Gieseking - - * src/GraphicPath.h, src/PathClipper.cpp, src/PathClipper.h, - src/XMLNode.h: - fixed a couple of doxygen comments; removed redundant - PathClipperException - - * clipper/clipper.cpp, clipper/clipper.hpp: - updated clipper library to version 6.2.0 - -2014-10-08 Martin Gieseking - - * src/Ghostscript.cpp: - try to lookup the location of the GS DLL in the Windows registry - - * src/CommandLine.cpp: - updated CommandLine.cpp with description of option --no-merge - -2014-10-01 Martin Gieseking - - * doc/dvisvgm.txt.in, src/options.xml: - added info about option --no-merge to the manpage - -2014-09-24 Khaled Hosny - - * src/Makefile.am: - Add an opt2cpp Python script - -A very ugly script that should work as a - drop in replacement for the -opt2cpp XSLT. - -2014-09-15 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - ensure that colors set by a color special are always considered by the - PS handler - -2014-09-10 Martin Gieseking - - * src/BasicDVIReader.cpp, src/DVIReader.cpp, src/FontCache.cpp, - src/GFReader.cpp, src/dvisvgm.cpp: - replaced namespace 'ios_base' with 'ios' - -2014-08-29 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.8.1 - - * src/FontEngine.cpp, tests/PageRagesTest.cpp: - removed unused static functions - - * src/PsSpecialHandler.cpp: - added missing whitespace boundaries in PS code - -2014-08-20 Khaled Hosny - - * src/CommandLine.cpp, src/CommandLine.h, src/SVGTree.cpp, src/SVGTree.h, - src/dvisvgm.cpp, src/options.xml: - Add an option not to merge adjacent chars - -With this option on, each DVI - character is put in its own tag. -Makes post processing the SVG - file a bit simpler. - -2014-08-18 Martin Gieseking - - * src/DVIToSVG.cpp, src/DependencyGraph.h, src/Makefile.am, - src/SVGTree.cpp, src/SVGTree.h, src/XMLNode.cpp, src/XMLNode.h, - tests/DependencyGraphTest.cpp, tests/Makefile.am: - remove redundant clipPath elements from generated SVG files - -2014-08-16 Martin Gieseking - - * src/PSPattern.cpp, src/XMLNode.cpp, src/XMLNode.h: - renamed XMLElementNode::findDescendants() and made it constant - -2014-08-11 Martin Gieseking - - * tests/Makefile.am, tests/create-makefile: - link tests against FreeType library - -2014-08-10 Khaled Hosny - - * configure.ac, src/Makefile.am: - Don't override CPPFLAGS and LDFLAGS in configure - -For the same reasons - as the previous commit - - * configure.ac, src/Makefile.am: - Don't override CXXFLAGS in configure script - -Breaks standard things - like: - - make CXXFLAGS="-g -O0 -pg" - - * configure.ac, src/Makefile.am: - EXTRA_LIBS is not used anymore - -2014-08-07 Martin Gieseking - - * src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h: - removed unused emit() methods from XML classes - -2014-08-06 Martin Gieseking - - * README.md: - minor fixes to README.md - -2014-07-31 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/psdefs.cpp, src/psdefs.ps: - prevent side-effects caused by bop/eop operators present in PS specials - -2014-07-29 Martin Gieseking - - * NEWS: - updated NEWS - -2014-07-28 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.8 - - * src/GraphicPath.h, src/PSInterpreter.cpp, src/PSInterpreter.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/psdefs.cpp, - src/psdefs.ps, tests/PSInterpreterTest.cpp: - added evaluation of PS operator 'clippath' (copies clipping path into - graphics path) - -2014-07-26 Martin Gieseking - - * src/Font.cpp, src/GFGlyphTracer.cpp, src/GraphicPath.h, - src/PsSpecialHandler.cpp: - renamed GraphicPath::newpath() to GraphicPath::clear() - -2014-07-24 Martin Gieseking - - * src/InputReader.cpp, src/PSInterpreter.cpp: - ensure that InputReader::compare() checks whole and not just partial - words - -2014-07-22 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/dvisvgm.cpp, - src/options.xml: - added option --clippath to compute the intersection of clipping paths - - * README, README.md, src/Bezier.cpp, src/Bezier.h, src/GraphicPath.h, - src/Makefile.am, src/PathClipper.cpp, src/PathClipper.h, src/dvisvgm.cpp: - added class PathClipper to compute intersections of closed curved - graphics paths - - * src/GraphicPath.h: - added field to store the winding rule to class GraphicPath - - * Makefile.am, clipper/License.txt, clipper/Makefile.am, - clipper/clipper.cpp, clipper/clipper.hpp, configure.ac, src/Makefile.am: - added slightly modified sources of clipper library (computes boolops on - polygons) - - * src/DVIToSVG.h, src/dvisvgm.cpp: - prevent throwing a DVIException when option -l is present - -2014-07-20 Khaled Hosny - - * src/FontEngine.cpp: - free existing FT_Face before creating a new one - -2014-07-18 Martin Gieseking - - * src/TpicSpecialHandler.cpp: - TPIC handler: use class GraphicPath to create SVG path commands - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/GraphicPath.h, src/PsSpecialHandler.cpp, src/SVGTree.cpp, - src/SVGTree.h, src/dvisvgm.cpp, src/options.xml, - tests/GraphicPathTest.cpp: - added option to create relative rather than absolute path commands - -2014-07-07 Martin Gieseking - - * src/DVIToSVGActions.h, src/Doxyfile, src/HtmlSpecialHandler.h, - src/RangeMap.cpp, src/SpecialManager.cpp, src/ToUnicodeMap.cpp: - fixed a couple of broken doxygen comments - -2014-06-25 Martin Gieseking - - * src/Ghostscript.cpp: - get proper name of Ghostscript library when building for Cygwin - -2014-06-23 Martin Gieseking - - * README.md: - added markdown version of README - -2014-06-20 Martin Gieseking - - * src/psdefs.cpp, src/psdefs.ps: - suppress output of PS operator ':show' to prevent the creation of - additional graphic elements - -2014-06-17 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.7 - - * src/InputReader.cpp: - added missing include - - * doc/dvisvgm.txt.in, src/DVIToSVGActions.cpp, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - tests/DvisvgmSpecialTest.cpp, tests/Makefile.am: - added/improved dvisvgm::raw* specials - - * src/SpecialManager.cpp, src/SpecialManager.h: - removed redundant method SpecialManager::leavePSHeaderSection() - -2014-06-12 Martin Gieseking - - * src/XMLNode.cpp, src/XMLNode.h: - added clear() to XMLNode classes; added XMLTextNode::getText() - -2014-06-11 Martin Gieseking - - * src/DVIToSVG.cpp, src/SpecialHandler.h, src/SpecialManager.cpp, - src/SpecialManager.h: - added listener to allow SpecialHandlers being notified when - pre-processing has finished - - * src/InputReader.cpp, src/InputReader.h: - added InputReader::getLine() - -2014-06-10 Martin Gieseking - - * src/SpecialActions.h, tests/ColorSpecialTest.cpp: - renamed class SpecialEmptyActions to EmptySpecialActions - -2014-06-09 Martin Gieseking - - * src/DVIToSVG.h, src/SpecialManager.h: - removed redundant definition of assignment operators - - * src/DVIReader.cpp, src/Ghostscript.cpp: - removed unused variable; call Ghostscript::exit() with explicitely given - object - -2014-06-05 Martin Gieseking - - * src/BasicDVIReader.cpp, src/BasicDVIReader.h, src/Bitmap.h, - src/BoundingBox.h, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, - src/CMapReader.h, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, - src/CmdLineParserBase.h, src/Color.cpp, src/ColorSpecialHandler.cpp, - src/ColorSpecialHandler.h, src/CommandLine.cpp, src/CommandLine.h, - src/DLLoader.h, src/DVIReader.cpp, src/DVIToSVG.h, src/DVIToSVGActions.h, - src/Directory.h, src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, - src/EmSpecialHandler.h, src/EncFile.h, src/FileFinder.h, - src/FileSystem.cpp, src/Font.cpp, src/Font.h, src/FontCache.h, - src/FontEncoding.cpp, src/FontEngine.cpp, src/FontEngine.h, - src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, - src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, - src/GraphicPath.h, src/HtmlSpecialHandler.h, src/InputBuffer.cpp, - src/InputBuffer.h, src/JFM.h, src/Length.cpp, src/Length.h, - src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/NoPsSpecialHandler.h, src/NumericRanges.h, src/PSInterpreter.h, - src/PSPattern.h, src/PSPreviewFilter.h, src/PageRanges.h, src/PageSize.h, - src/Pair.h, src/PdfSpecialHandler.cpp, src/PdfSpecialHandler.h, - src/Process.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/SVGTree.h, src/SWFWriter.cpp, src/SignalHandler.h, - src/SpecialActions.h, src/SpecialManager.h, src/StreamWriter.h, - src/Subfont.cpp, src/Subfont.h, src/TFM.h, src/ToUnicodeMap.h, - src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, src/VFReader.cpp, - src/VectorStream.h, src/XMLDocument.h, src/XMLNode.h, src/XMLString.cpp, - src/XMLString.h, src/dvisvgm.cpp, src/types.h: - replaced leading spaces by tabs; removed trailing whitespace - - * doc/dvisvgm.txt.in, src/BasicDVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/EPSToSVG.cpp, src/EPSToSVG.h, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/PreScanDVIReader.cpp, - src/PreScanDVIReader.h, src/SpecialActions.h: - process hyperref anchors and links across pages - - * src/BasicDVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h: - allow to replace the DVI reader assigned to an instance of - DVIToSVGActions - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/SpecialManager.cpp, src/SpecialManager.h, src/dvisvgm.cpp: - made class SpecialManager a singleton - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, - src/PreScanDVIReader.cpp, src/PreScanDVIReader.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/StreamReader.cpp, - src/StreamReader.h: - pre-process DVI file to collect required data not present in the page - ranges to be converted - - * src/BasicDVIReader.h, src/DVIReader.cpp, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/dvisvgm.cpp: - moved call of executePreamble() and executePostamble() from DVIToSVG to - DVIReader - - * src/BasicDVIReader.cpp, src/BasicDVIReader.h, src/DVIReader.cpp, - src/DVIReader.h, src/Makefile.am: - moved basic funtionality of DVIReader to base class BasicDVIReader - -2014-06-03 Martin Gieseking - - * src/PsSpecialHandler.cpp: - fixed incorrect extent values shown when applying a preview bbox - (bp->pt) - - * rpm/Makefile.am: - removed outdated project folder 'rpm' - - * src/DVIReader.cpp, src/DVIReader.h: - removed redundant variable DVIReader::_prevBop - -2014-06-01 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h: - removed redundant code from DVIReader::evalCommand() - - * src/EPSFile.cpp, src/GFReader.cpp: - replaced relative variant of seekg() by absolute one where possible - -2014-05-31 Martin Gieseking - - * src/DVIReader.cpp, src/StreamReader.h, src/VFReader.cpp: - renamed some methods of class StreamReader - - * src/DVIReader.cpp, src/StreamReader.cpp, src/StreamReader.h, - src/VFReader.cpp: - removed StreamReader::in() - - * src/DVIReader.cpp, src/VFReader.cpp: - few code adjustments - -2014-05-29 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h: - simplified DVIReader::executePage; removed DVIReader::executePages - - * src/DVIReader.cpp, src/DVIReader.h, src/dvisvgm.cpp: - simplified computation of progress ratio - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h: - removed DVIReader::_totalPages; use number of BOP offsets instead - - * src/DVIReader.cpp, src/DVIReader.h, src/StreamReader.h: - collect all DVI BOP offsets to reach them quickly - -2014-05-22 Martin Gieseking - - * src/Makefile.am: - Makefiles: put source files on separate lines - - * src/Makefile.am, src/RangeMap.h, src/ToUnicodeMap.cpp, - src/ToUnicodeMap.h, tests/Makefile.am, tests/ToUnicodeMapTest.cpp: - added class ToUnicodeMap to handle mappings from character indexes to - unicode points - - * src/DVIToSVG.cpp, src/Makefile.am, src/NumericRanges.h, - src/PageRanges.cpp, src/PageRanges.h, tests/PageRagesTest.cpp: - extracted functionality of class PageRanges to separate class - NumericRanges - - * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/Font.h, - src/FontEngine.cpp, src/FontEngine.h, src/Makefile.am: - replaced class CharMap with more generic class RangeMap - - * src/RangeMap.cpp: - fixed right joins of touching ranges in a RangeMap - - * src/CMap.cpp, src/CMap.h, src/Makefile.am, src/RangeMap.cpp, - src/RangeMap.h, tests/Makefile.am, tests/RangeMapTest.cpp: - extracted class RangeMap previously implemented as part of SegmentedCMap - - * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/FontEngine.cpp, - src/FontEngine.h: - removed redundant method CharMap::invert() - -2014-04-30 Martin Gieseking - - * src/CharMapID.cpp, src/CharMapID.h, src/DVIReader.cpp, src/Font.cpp, - src/Font.h, src/FontEngine.cpp, src/FontEngine.h: - try to add unicode mappings missing in a font's cmap table - -2014-04-29 Martin Gieseking - - * src/SVGTree.cpp: - don't add unnecessary element 'missing-glyph' to SVG files - -2014-04-24 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/options.xml: - renamed argument of option --linkmark from 'type' to 'style' - -2014-04-22 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.6 - -2014-04-21 Martin Gieseking - - * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/EPSToSVG.cpp: - removed date and machine triplet from generated SVG files - -2014-04-18 Martin Gieseking - - * doc/dvisvgm.txt.in, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h: - added optional selection of line/box colors to option --linkmark - -2014-04-17 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/options.xml: - changed default argument of option --linkmark to 'box' - - * src/DVIReader.h, src/DVIToSVGActions.h, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/SpecialActions.h: - only split hyperlink boxes on line breaks - - * src/CommandLine.h, src/DVIToSVG.cpp, src/EPSToSVG.cpp: - don't link GS messages unnecessarily if HAVE_LIBGS is defined - -2014-04-16 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/SVGTree.cpp, src/SVGTree.h, src/dvisvgm.cpp, src/options.xml: - added command-line option --zoom - - * src/Ghostscript.cpp, src/dvisvgm.cpp: - moved lookup of MiKTeX's GS DLL to get_libgs() - - * doc/dvisvgm.txt.in, src/Ghostscript.cpp: - if libgs is loaded during runtime, look for libgs.so.X instead of - libgs.so - - * src/DLLoader.cpp: - prevent calling dlopen() if the length of the string argument is 0 - -2014-04-11 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.5.3 - - * src/CMap.cpp, src/CmdLineParserBase.cpp, src/ColorSpecialHandler.cpp, - src/DVIReader.cpp, src/DVIToSVGActions.cpp, src/Doxyfile, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EPSFile.cpp, src/EmSpecialHandler.cpp, src/FileFinder.cpp, - src/FileSystem.cpp, src/Font.cpp, src/FontCache.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontMap.cpp, src/GraphicPath.h, - src/PSInterpreter.cpp, src/PageRanges.cpp, src/PsSpecialHandler.cpp, - src/SVGTree.cpp, src/SVGTree.h, src/SpecialManager.cpp, src/Subfont.cpp, - src/TFM.cpp, src/TpicSpecialHandler.cpp, src/XMLDocument.cpp, - src/XMLNode.cpp, src/dvisvgm.cpp: - fixed issues in the doxygen documentation - -2014-04-09 Martin Gieseking - - * src/BoundingBox.h, src/DVIActions.cpp, src/DVIActions.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/DvisvgmSpecialHandler.cpp, src/EPSToSVG.cpp, - src/EmSpecialHandler.cpp, src/Font.h, src/FontManager.cpp, - src/GFGlyphTracer.cpp, src/GFReader.cpp, src/GFTracer.cpp, - src/GFTracer.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, - src/Makefile.am, src/PSPattern.cpp, src/PSPreviewFilter.cpp, - src/PSPreviewFilter.h, src/PageSize.cpp, src/PageSize.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/TFM.cpp, src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, - src/VFReader.cpp: - switched internal computations from TeX points (pt) to PS points (bp) - - * src/DVIToSVGActions.cpp: - equalize implementations of moveToX and moveToY - -2014-02-05 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h: - ensure updating the SVG cursor position when executing DVI command - set_rule - -2014-01-13 Martin Gieseking - - * src/Ghostscript.cpp: - check if library given by --libgs is actually a GS library - -2014-01-10 Martin Gieseking - - * NEWS: - updated NEWS - -2014-01-03 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.5.2 - - * src/FileFinder.cpp: - return 'unknown' if MiKTeX version can't be retrieved - - * src/Directory.cpp: - initialize Directory member variables (Win only) - - * src/FileFinder.cpp: - catch exceptions thrown by MiKTeXCom object - -2014-01-02 Martin Gieseking - - * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, - src/CMapReader.cpp, src/CMapReader.h, src/CRC32.cpp, src/CRC32.h, - src/Calculator.cpp, src/Calculator.h, src/CharMap.cpp, src/CharMap.h, - src/CharMapID.cpp, src/CharMapID.h, src/Character.h, - src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, - src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EPSFile.cpp, src/EPSFile.h, src/EPSToSVG.cpp, src/EPSToSVG.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/EncFile.cpp, - src/EncFile.h, src/FileFinder.cpp, src/FileFinder.h, src/FilePath.cpp, - src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, - src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, - src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, - src/FontMetrics.cpp, src/FontMetrics.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, - src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, - src/InputReader.cpp, src/InputReader.h, src/JFM.cpp, src/JFM.h, - src/Length.cpp, src/Length.h, src/Makefile.am, src/Makefile.old, - src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, - src/Message.cpp, src/Message.h, src/MessageException.h, - src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/MiKTeXCom.cpp, - src/MiKTeXCom.h, src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, - src/PSFilter.h, src/PSInterpreter.cpp, src/PSInterpreter.h, - src/PSPattern.cpp, src/PSPattern.h, src/PSPreviewFilter.cpp, - src/PSPreviewFilter.h, src/PageRanges.cpp, src/PageRanges.h, - src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/PdfSpecialHandler.cpp, - src/PdfSpecialHandler.h, src/Process.cpp, src/Process.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGOutputBase.h, - src/SVGTree.cpp, src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, - src/SignalHandler.cpp, src/SignalHandler.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, - src/StreamWriter.h, src/Subfont.cpp, src/Subfont.h, src/System.cpp, - src/System.h, src/TFM.cpp, src/TFM.h, src/Terminal.cpp, src/Terminal.h, - src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, src/VFActions.h, - src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, - src/options.dtd, src/options.xml, src/psdefs.cpp, src/psdefs.ps, - src/types.h, tests/BoundingBoxTest.cpp, tests/CMapReaderTest.cpp, - tests/CMapTest.cpp, tests/CRC32Test.cpp, tests/CalculatorTest.cpp, - tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, - tests/CommandLineTest.cpp, tests/DirectoryTest.cpp, - tests/FileFinderTest.cpp, tests/FilePathTest.cpp, - tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, - tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, - tests/LengthTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, - tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, - tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, - tests/PageSizeTest.cpp, tests/PairTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, - tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, - tests/SubfontTest.cpp, tests/TypesTest.cpp, tests/VectorStreamTest.cpp, - tests/check-conv, tests/create-makefile, tests/normalize.xsl: - updated year in copyright statements to 2014 - -2013-12-29 Martin Gieseking - - * src/FontCache.cpp: - catch potential StreamReaderException - - * src/Directory.cpp, src/Directory.h, src/FontMap.cpp, - tests/DirectoryTest.cpp: - changed directory entry types from char to enums - - * src/Font.cpp: - check if units per EM are not 0 to prevent divisions by zero - -2013-12-18 Martin Gieseking - - * src/DVIReader.cpp, src/Directory.cpp, src/GFReader.cpp: - added missing initializations of member variables - - * src/FontCache.cpp, src/SpecialManager.cpp: - restore stream format flags - - * src/DvisvgmSpecialHandler.cpp, src/FontCache.cpp: - ensure null pointer checks before dereferencing - - * src/DVIReader.cpp: - check if denominator of DVI unit is non-zero - - * src/Matrix.cpp: - ensure return value of istream::get() is assigned to int vars - - * src/FontCache.cpp: - avoid accessing strings constructed from temporaries - - * src/BoundingBox.cpp: - explicitely initialize BoundingBox fields - -2013-11-16 Martin Gieseking - - * src/DVIReader.cpp, src/SVGTree.cpp, src/SVGTree.h: - don't let global font colors interfere with color specials - -2013-10-29 Martin Gieseking - - * NEWS: - updated NEWS - -2013-10-28 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.5.1 - - * src/DVIReader.cpp: - temporarily reactivated processing of font definitions located in the - postamble - - * src/FileSystem.cpp, src/MetafontWrapper.cpp: - added explicit casts from ifstream to bool - - * src/Bitmap.cpp, src/Color.cpp, src/JFM.cpp, src/Matrix.cpp: - added missing #includes of header file - -2013-10-27 Martin Gieseking - - * src/DVIToSVG.cpp: - suppress output of logical page number if it equals physical page number - -2013-10-16 Martin Gieseking - - * src/PSPreviewFilter.cpp, src/PsSpecialHandler.cpp: - ensure proper evaluation of tightpage data if multiple pages are - processed - -2013-10-12 Martin Gieseking - - * src/Color.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - added 'const' to read-only methods - - * src/InputBuffer.h: - don't check unsigned variables for negative values - -2013-09-21 Martin Gieseking - - * src/DVIToSVG.cpp: - changed warning message that appears if PS support has been disabled - permanently - - * src/DVIToSVG.cpp, src/Ghostscript.h, src/dvisvgm.cpp: - added missing guards and functions to prevent compilation errors if - DISABLE_GS is set - - * src/FontCache.cpp, src/FontCache.h: - renamed FontCache::VERSION to FontCache::FORMAT_VERSION - -2013-09-01 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.5 - - * src/DLLoader.h, src/Directory.h: - moved #define NOMINMAX to Windows config.h - - * src/BgColorSpecialHandler.cpp, src/Bitmap.cpp, src/BoundingBox.cpp, - src/CMap.cpp, src/CMapManager.cpp, src/CMapReader.cpp, src/CRC32.cpp, - src/Calculator.cpp, src/CharMap.cpp, src/CmdLineParserBase.cpp, - src/Color.cpp, src/ColorSpecialHandler.cpp, src/CommandLine.cpp, - src/CommandLine.h, src/DLLoader.cpp, src/DVIActions.cpp, - src/DVIReader.cpp, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, - src/Directory.cpp, src/DvisvgmSpecialHandler.cpp, src/EPSFile.cpp, - src/EPSToSVG.cpp, src/EmSpecialHandler.cpp, src/EncFile.cpp, - src/FileFinder.cpp, src/FilePath.cpp, src/FileSystem.cpp, src/Font.cpp, - src/FontCache.cpp, src/FontEncoding.cpp, src/FontEngine.cpp, - src/FontManager.cpp, src/FontMap.cpp, src/FontMetrics.cpp, - src/GFGlyphTracer.cpp, src/GFReader.cpp, src/GFTracer.cpp, - src/Ghostscript.cpp, src/Ghostscript.h, src/HtmlSpecialHandler.cpp, - src/InputBuffer.cpp, src/InputReader.cpp, src/JFM.cpp, src/Length.cpp, - src/MapLine.cpp, src/Matrix.cpp, src/Message.cpp, - src/MetafontWrapper.cpp, src/MiKTeXCom.cpp, src/NoPsSpecialHandler.cpp, - src/PSInterpreter.cpp, src/PSPattern.cpp, src/PSPreviewFilter.cpp, - src/PageRanges.cpp, src/PageSize.cpp, src/PdfSpecialHandler.cpp, - src/Process.cpp, src/PsSpecialHandler.cpp, src/SVGTree.cpp, - src/SignalHandler.cpp, src/SpecialManager.cpp, src/StreamReader.cpp, - src/StreamWriter.cpp, src/Subfont.cpp, src/System.cpp, src/TFM.cpp, - src/Terminal.cpp, src/TpicSpecialHandler.cpp, src/VFReader.cpp, - src/XMLDocument.cpp, src/XMLNode.cpp, src/XMLString.cpp, src/dvisvgm.cpp: - include config.h at the top of every translation unit - -2013-08-30 Martin Gieseking - - * doc/dvisvgm.txt.in: - updated manpage - - * src/Font.cpp, src/Font.h, src/XMLString.cpp: - replaced entity references by corresponding UTF-8 characters; use - correct unicode points rather than DVI charcodes - - * src/DVIReader.cpp, src/DVIReader.h, src/Font.cpp, src/Font.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontManager.h, src/FontStyle.h, src/SVGTree.cpp, src/dvisvgm.cpp: - added support for XDV (DVI format 5) files - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontMetrics.h, src/JFM.h, - src/SVGTree.cpp, src/SVGTree.h, src/TFM.h, src/dvisvgm.cpp: - added support for DVI format 3 (pTeX, vertical mode) - - * src/FontMetrics.h, src/JFM.cpp, src/JFM.h, src/TFM.h: - added retrieval of vertical mode flag to class FontMetrics - -2013-08-29 Martin Gieseking - - * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/Font.h, - src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontManager.cpp, src/Makefile.am: - replaced local std::map tables used in Font classes with new class - CharMap - -2013-08-22 Martin Gieseking - - * src/XMLString.cpp: - replace very small floating point numbers by 0 - -2013-08-20 Martin Gieseking - - * src/FileFinder.cpp: - suppress error messages from makeFOO tools - -2013-08-13 Martin Gieseking - - * src/Font.cpp, src/Font.h, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h: - moved assignment of base font map to Font class - - * src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, - src/EncFile.h, src/Font.cpp, src/Font.h, src/FontEncoding.cpp, - src/FontEncoding.h, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h: - derive EncodingPair from FontEncoding - -2013-08-11 Martin Gieseking - - * src/dvisvgm.cpp: - fix number of dashes printed by -V1 - - * configure.ac, src/FileFinder.cpp: - check if the kpathsea library is C++-safe (patch by Peter Breitenlohner) - -2013-08-08 Martin Gieseking - - * src/Matrix.cpp, src/Matrix.h: - renamed Matrix skewing methods - -2013-08-04 Martin Gieseking - - * src/Ghostscript.h, src/PSPreviewFilter.cpp, src/PsSpecialHandler.cpp: - added missing variable initializations - - * src/Font.cpp, src/Font.h, src/FontEngine.cpp, src/FontManager.cpp, - src/FontMap.cpp, src/FontMap.h, src/FontStyle.h, src/Makefile.am: - store pointers to font map and encoding in Font objects to speed up - looking them up - -2013-08-03 Martin Gieseking - - * src/CMapManager.cpp, src/CMapManager.h, src/FontManager.cpp: - avoid const_cast in CMapManager - -2013-08-02 Martin Gieseking - - * src/CMap.h, src/CMapManager.cpp: - properly handle 'unicode' encoding entries set in font map - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp: - disable font processing while scanning PS header specials - -2013-08-01 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.4 - - * NEWS: - updated NEWS - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.h, src/EPSToSVG.h, - src/Matrix.cpp, src/Matrix.h, src/PsSpecialHandler.cpp, - src/SpecialActions.h, src/dvisvgm.cpp: - apply page transformations to width, height, and depth of preview bbox - - * src/DVIToSVG.cpp: - removed redundant #include statements - - * src/DVIToSVG.cpp, src/Makefile.am, src/SVGTree.cpp, - src/XMLDocTypeNode.h: - removed DOCTYPE declaration from generated files as suggested by the SVG - specification - - * src/XMLDocument.cpp, src/XMLString.cpp: - changed encoding of SVG files from ISO-8859-1 to UTF-8 - -2013-07-31 Martin Gieseking - - * src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, src/CMapReader.cpp, - src/CharMapID.cpp, src/CharMapID.h, src/Font.cpp, src/Font.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontMap.cpp, src/FontMap.h, src/Makefile.am: - try to decode characters of non-CID fonts that have a CMap assigned in - the fontmap - - * src/CMap.cpp, src/CMap.h, src/CMapReader.cpp, src/CMapReader.h, - tests/CMapReaderTest.cpp, tests/CMapTest.cpp, tests/Makefile.am: - added evaluation of base font (bf) sections in CMap files - - * src/Font.cpp, src/Font.h, src/FontMetric.cpp, src/FontMetric.h, - src/FontMetrics.cpp, src/FontMetrics.h, src/Makefile.am, src/TFM.h: - renamed class FontMetric to FontMetrics - - * src/FileFinder.cpp, src/Font.cpp, src/Font.h, src/FontManager.cpp: - added support for OTF fonts - - * src/CMap.cpp, src/CMap.h, src/Character.h, src/EncFile.h, src/Font.cpp, - src/Font.h, src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, - src/Makefile.am, tests/CMapTest.cpp: - added Character class to handle character names, codes, and indexes - consistently - - * src/CMap.cpp, src/CMap.h, src/CMapManager.h, src/EncFile.cpp, - src/EncFile.h, src/FileFinder.cpp, src/Font.cpp, src/Font.h, - src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontManager.cpp, src/Makefile.am, - tests/CMapTest.cpp: - derive .enc encoding vectors and CMaps from common base class - FontEncoding - - * src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, - src/CMapReader.cpp, src/CMapReader.h, src/FontManager.cpp, - src/Makefile.am, tests/CMapTest.cpp, tests/Makefile.am: - added classes to handle CMap files - -2013-07-27 Martin Gieseking - - * doc/dvisvgm.txt.in, src/DVIActions.h, src/DVIReader.cpp, - src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/EPSToSVG.cpp, src/Makefile.am, src/PSFilter.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PSPreviewFilter.cpp, src/PSPreviewFilter.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h: - added evaluation of bounding box information created by preview package - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp: - added funtion to execute PS code snippets and retrieve their results - - * src/BgColorSpecialHandler.h, src/DVIToSVG.cpp, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h: - ensure that PS header code is evaluated before the page/body code; also - execute bop-hook and eop-hook - - * src/JFM.cpp: - fixed retrieval of char indexes if a JFM contains entries of chartype 0 - only - -2013-07-23 Martin Gieseking - - * src/FontMap.cpp: - check for EOF prior to try to parse another mapline - - * src/psdefs.cpp, src/psdefs.ps: - PS handler: call newpath before executing charpath in operator show - - * src/EPSToSVG.cpp: - print warning message if height or width of EPS bbox is 0 - -2013-07-18 Martin Gieseking - - * src/psdefs.cpp, src/psdefs.ps: - replaced PS operator prval with =only in psdefs - -2013-07-17 Martin Gieseking - - * src/psdefs.cpp, src/psdefs.ps: - properly store PS operator applyscalevals in systemdict - - * src/DVIToSVG.cpp: - ensure catching PSExceptions while processing PS header specials to - prevent segfaults - -2013-07-14 Martin Gieseking - - * src/FileFinder.cpp, src/FileFinder.h: - FileFinder: added lookup of cmap files - - * src/Process.cpp, src/Process.h: - extended Process::run() to grab the output written to stdout - -2013-07-08 Martin Gieseking - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp: - command-line parser: changed type of argument mode from char to enum - -2013-06-17 Martin Gieseking - - * src/FileFinder.cpp: - removed redundant 'using namespace std' - -2013-06-03 Martin Gieseking - - * doc/dvisvgm.txt.in, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/dvisvgm.cpp: - extend option --linkmark to highlight linked areas by a given background - color - -2013-06-01 Martin Gieseking - - * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, - src/ColorSpecialHandler.h, src/SpecialActions.h, - tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, tests/Makefile.am: - use Color class in ColorSpecialHandler rather than local code; added - ColorTest - -2013-05-22 Martin Gieseking - - * src/dvisvgm.cpp: - added a missing (underlining) hyphen to the output of -V1 - -2013-05-13 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.3 - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/HtmlSpecialHandler.cpp, src/dvisvgm.cpp, src/options.xml: - added option --linkmark to select the highlighing variant for hyperlinks - - * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/HtmlSpecialHandler.cpp, - src/HtmlSpecialHandler.h, src/Makefile.am, src/SpecialManager.cpp: - added support of hyperref specials - - * src/FileFinder.cpp, src/MiKTeXCom.cpp, src/MiKTeXCom.h, src/dvisvgm.cpp: - try to load the Ghostscript library that comes with MiKTeX - - * src/Font.cpp, src/FontMetric.cpp, src/FontMetric.h, src/JFM.cpp, - src/JFM.h, src/Makefile.am, src/StreamReader.h, src/TFM.cpp, src/TFM.h: - added support for Japanese font metric (JFM) files - - * src/Font.cpp, src/Font.h, src/FontManager.h, src/FontMetric.cpp, - src/FontMetric.h, src/Makefile.am, src/TFM.cpp, src/TFM.h: - handle invalid TFM files properly - -2013-05-02 Martin Gieseking - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, - src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: - added page number parameter to DVIEndPageListener::dviEndPage() - - * src/EmSpecialHandler.h, src/NoPsSpecialHandler.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.h: - moved DVI listener methods to dedicated listener interface classes - - * src/HtmlSpecialHandler.h: - dropped old HtmlSpecialHandler.h that should had been removed long time - ago - - * src/InputReader.cpp, src/InputReader.h: - added optional parameter 'quotechar' to InputReader::parseAttributes() - - * src/DVIToSVGActions.h, src/EPSToSVG.h, src/SpecialActions.h: - provide the context push/pop methods of class SVGTree to special - handlers - - * src/SVGTree.cpp, src/SVGTree.h: - added methods to push and pop 'context elements' to a page that wrap - parts of the page contents - - * AUTHORS, Makefile.am, README, configure.ac, potracelib/Makefile.am, - potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: - removed bundled potrace library - -2013-05-01 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/Terminal.cpp, src/Terminal.h: - disable cursor when showing the progress indicator (Windows only) - -2013-04-26 Martin Gieseking - - * src/DVIToSVG.cpp: - don't link NoPsSpecialHandler if HAVE_LIBGS - -2013-04-25 Martin Gieseking - - * src/FontEncoding.cpp: - fixed bracketing bug that prevented lookup of fontmap files - -2013-04-24 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.2.2 - - * src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, - src/Calculator.h, src/Matrix.cpp, src/Matrix.h, src/MessageException.h, - src/PageSize.cpp, src/PageSize.h, src/StreamReader.cpp, - src/StreamReader.h, src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, - src/XMLDocument.cpp, src/XMLDocument.h: - added missing underscores to private member variables - -2013-04-23 Martin Gieseking - - * src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.h, - src/CmdLineParserBase.h, src/DVIToSVGActions.cpp, src/Message.cpp, - src/VFReader.cpp: - added missing member initializations to some classes - - * src/DVIToSVG.cpp, src/EPSToSVG.cpp, src/dvisvgm.cpp: - avoid output of empty parentheses if TARGET_SYSTEM is not set - -2013-04-20 Martin Gieseking - - * src/DVIToSVG.cpp, src/Makefile.am, src/NoPsSpecialHandler.cpp, - src/NoPsSpecialHandler.h, src/SpecialManager.cpp: - print a warning message if PS specials are found but ignored - -2013-04-15 Martin Gieseking - - * src/FileFinder.cpp, src/dvisvgm.cpp: - catch MessageException if MiKTeX version can't be obtained - -2013-04-09 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.2.1 - - * tests/Makefile.am, tests/create-makefile: - updated tests/Makefile.am to honor system potracelib if present - -2013-04-08 Martin Gieseking - - * src/PageRanges.h: - dropped unused variable PageRanges::_max - - * src/CmdLineParserBase.h, src/InputReader.h: - changed 'struct InputReader' to 'class InputReader' - - * doc/dvisvgm.txt.in, src/Color.cpp, src/Color.h, src/DVIToSVGActions.cpp: - allow the background color special to insert white rectancles - -2013-04-04 Martin Gieseking - - * src/XMLNode.cpp, src/XMLNode.h: - unhide derived method XMLDeclarationNode::append - -2013-03-10 Martin Gieseking - - * Makefile.am, configure.ac: - don't build bundled potracelib if system library is used (patch by - Alexis Ballier) - -2013-03-03 Martin Gieseking - - * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: - updated bundled potrace library to version 1.11 - -2013-03-02 Martin Gieseking - - * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/decompose.h, potracelib/lists.h, potracelib/progress.h, - potracelib/trace.c, potracelib/trace.h, src/EPSFile.cpp, - src/EPSToSVG.cpp, src/EPSToSVG.h, src/PSPattern.cpp, src/PSPattern.h, - src/SVGOutputBase.h: - converted DOS line endings - -2013-02-28 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.2 - - * src/psdefs.cpp, src/psdefs.ps: - improved processing of PS operator "show" - - * tests/MapLineTest.cpp: - prevent MapLineTest from failing if file UGBK.sfd is not available - - * src/Makefile.am, src/PSInterpreter.cpp, src/psdefs.cpp, src/psdefs.ps, - src/psdefs.psc: - make psdefs a separate compilation unit - - * src/Makefile.am, src/PSInterpreter.cpp, src/PSInterpreter.h, - src/PSPattern.cpp, src/PSPattern.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc, - tests/PSInterpreterTest.cpp: - PS handler: added support of tiling patterns - -2013-02-21 Martin Gieseking - - * src/XMLNode.cpp, src/XMLNode.h: - added methods to lookup attribute values and selected descendant XML - nodes - -2013-02-19 Martin Gieseking - - * src/FilePath.cpp: - adapt path separators on Windows systems to get the correct output path - - * src/PSInterpreter.cpp, src/PSInterpreter.h: - added PSInterpreter::limit() to limit the number of bytes to be - processed - -2013-02-11 Martin Gieseking - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, - src/CommandLine.h: - applied a few refactorings to the command-line parser - -2013-02-07 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, - src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, src/options.xml: - added optional parameter to option --help to specify output format - -2013-02-06 Martin Gieseking - - * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/CommandLine.cpp, - src/CommandLine.h, src/EmSpecialHandler.cpp, src/GraphicPath.h, - src/Matrix.cpp, src/PsSpecialHandler.cpp, src/TpicSpecialHandler.cpp, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/options.xml: - added option --precision to set the number of decimal places applied to - attribute values - -2013-01-30 Martin Gieseking - - * src/CommandLine.cpp: - fixed alignment of --help text - -2013-01-21 Martin Gieseking - - * NEWS, README: - updated NEWS and README - - * configure.ac, src/Doxyfile: - set version to 1.1 - - * src/CommandLine.cpp, src/Font.cpp, src/Font.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, - src/MapLine.cpp, src/MapLine.h, tests/MapLineTest.cpp: - implemented evaluation of font style options given in a mapline - - * src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, src/MapLine.h: - replaced FontMap entries by pointers; initialize entries with MapLine - objects - - * src/DVIReader.cpp, src/DVIToSVG.cpp, src/FileFinder.cpp, src/Font.cpp, - src/Font.h, src/FontEncoding.cpp, src/FontEngine.cpp, src/FontEngine.h, - src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, src/Makefile.am, - src/MapLine.cpp, src/MapLine.h, src/Subfont.cpp, src/Subfont.h, - tests/FontMapTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, - tests/SubfontTest.cpp, tests/create-makefile, tests/sample.sfd: - added support for subfont definitions and multi-font (.ttc) files - -2013-01-20 Martin Gieseking - - * src/FontEngine.cpp, src/FontEngine.h: - removed unneeded code related to font sizes from class FontEngine - -2013-01-16 Martin Gieseking - - * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/FontMap.cpp, src/FontMap.h, - src/Makefile.am, src/PdfSpecialHandler.cpp, src/PdfSpecialHandler.h: - added PdfSpecialHandler to evaluate pdf:mapline and pdf:mapfile specials - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/FontMap.cpp, src/FontMap.h, src/dvisvgm.cpp, src/options.xml: - renamed option --map-file to --fontmap; allow multiple mapfiles and - modes - -2013-01-10 Martin Gieseking - - * src/Font.cpp, src/FontEncoding.cpp: - fixed a string exception that occurred when an encoding file or an entry - in the encoding table is unavailable - -2013-01-06 Martin Gieseking - - * src/FileFinder.cpp, src/FileFinder.h, src/FontEncoding.cpp, - src/FontEncoding.h: - removed font encoding methods from FileFinder - -2013-01-02 Martin Gieseking - - * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, - src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, - src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, - src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, - src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, - src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, - src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, - src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, - src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/MiKTeXCom.cpp, src/MiKTeXCom.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PageRanges.cpp, src/PageRanges.h, - src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/Process.cpp, - src/Process.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/SVGTree.cpp, src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, - src/SignalHandler.cpp, src/SignalHandler.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, - src/StreamWriter.h, src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, - src/Terminal.cpp, src/Terminal.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, - src/options.dtd, src/options.xml, src/psdefs.ps, src/psdefs.psc, - src/types.h, tests/BoundingBoxTest.cpp, tests/CRC32Test.cpp, - tests/CalculatorTest.cpp, tests/ColorSpecialTest.cpp, - tests/CommandLineTest.cpp, tests/DirectoryTest.cpp, - tests/FileFinderTest.cpp, tests/FilePathTest.cpp, - tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, - tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, - tests/LengthTest.cpp, tests/Makefile.am, tests/MatrixTest.cpp, - tests/MessageExceptionTest.cpp, tests/PSInterpreterTest.cpp, - tests/PageRagesTest.cpp, tests/PageSizeTest.cpp, tests/PairTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, - tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, - tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/create-makefile: - updated year in copyright statements to 2013 - -2012-12-23 Martin Gieseking - - * src/FileFinder.cpp, src/Message.cpp, src/dvisvgm.cpp: - reduced scope of some variables - - * src/CmdLineParserBase.h, src/Directory.cpp, src/GFReader.cpp, - src/PsSpecialHandler.cpp: - initialize uninitialized member variables - - * src/FileFinder.cpp, src/MiKTeXCom.cpp, src/Process.cpp: - avoid creating copies of exception objects - - * src/FontCache.cpp, src/PsSpecialHandler.cpp, src/TpicSpecialHandler.cpp: - check emptiness of containers with empty() instead of size() - -2012-12-12 Martin Gieseking - - * src/SpecialManager.cpp: - clear all corresponding containers when calling - SpecialHandler::unregisterHandlers() - - * src/FontCache.cpp: - replaced 'char' with 'glyph' in font cache listing - -2012-12-03 Martin Gieseking - - * src/Ghostscript.cpp: - added explicit cast to avoid signed/unsigned comparison warning - -2012-12-02 Martin Gieseking - - * doc/dvisvgm.txt.in, src/Ghostscript.cpp: - use gsdll64.dll for 64-bit builds; added info about gsdll64.dll to - manpage - - * src/FileFinder.cpp, src/FontEngine.cpp, src/Makefile.am, - src/MiKTeXCom.cpp, src/MiKTeXCom.h: - moved MiKTeX COM code to separate class - - * src/MiKTeX209-session_i.c: - add additiona files required to build dvisvgm with MinGW - - * src/macros.h: - removed SHOW() from macros.h - - * tests/FileSystemTest.cpp, tests/GFReaderTest.cpp: - ensure that tests work properly on Windows - - * src/FilePath.cpp, tests/FilePathTest.cpp: - strip drive letter if it's not set (Windows only) - -2012-11-23 Martin Gieseking - - * src/PSInterpreter.cpp, src/psdefs.ps, src/psdefs.psc: - print operand stack in case of a PS error - - * src/Ghostscript.cpp, src/Ghostscript.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/dvisvgm.cpp: - print an error message if the execution of PS code fails - -2012-11-22 Martin Gieseking - - * src/Message.cpp: - handle wrapping of messages containing newlines correctly - -2012-11-21 Martin Gieseking - - * src/DLLoader.cpp, src/DLLoader.h, src/Ghostscript.cpp: - renamed DLLoader::loadFunction() to DLLoader::loadSymbol() - -2012-11-19 Martin Gieseking - - * src/Font.cpp, src/Font.h, src/FontManager.cpp: - print warning if font checksums don't match - - * src/FontEngine.cpp, src/FontEngine.h: - renamed FontEngine::fname to FontEngine::_fontname - -2012-11-16 Martin Gieseking - - * src/Directory.h: - undefine macro max() to avoid compilation problems on Windows - -2012-11-15 Martin Gieseking - - * src/FileFinder.cpp, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, - tests/FontMapTest.cpp: - adapted code to use new MapLine class; introduced support of map line - modes - - * src/Makefile.am, src/MapLine.cpp, src/MapLine.h, tests/Makefile.am, - tests/MapLineTest.cpp: - added new class MapLine to parse and evaluate a single line of a map - file - - * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp: - moved initialization of FontMap from FileFinder to dvisvgm.cpp - - * src/FileFinder.cpp, src/FileFinder.h, src/FontMap.cpp, src/FontMap.h, - tests/FontMapTest.cpp: - made class FontMap a singleton - -2012-11-14 Martin Gieseking - - * src/DVIToSVG.cpp: - prevent compilation error when using a C++11 compiler (patch by Peter - Breitenlohner) - - * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp, - tests/FileFinderTest.cpp, tests/FontManagerTest.cpp: - initialize second parameter of kpse_set_program_name() correctly - - * src/FileFinder.cpp: - initialize Ghostscript when compiled for TeX Live Win32 (patch by Peter - Breitenlohner) - -2012-11-11 Martin Gieseking - - * src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, - src/InputReader.h, src/PsSpecialHandler.cpp, - tests/StreamInputBufferTest.cpp: - some refactorings of class InputReader; added InputReader::find() - -2012-10-24 Martin Gieseking - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/dvisvgm.cpp: - don't show warning about disabled PS support in list of special handlers - -2012-09-27 Martin Gieseking - - * doc/Makefile.am: - remove manpage when calling 'make distclean' - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.0.12 - -2012-09-20 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - removed Ghostscript info from ps entry in list of special handlers - - * src/DVIToSVG.cpp: - show warning if processing of PS specials is disabled - -2012-06-06 Martin Gieseking - - * src/gfprint.mak: - fixed bugs in gfprint, and added gfprint.mak for easier builds - -2012-04-17 Martin Gieseking - - * doc/Makefile.am: - keep manpage when calling 'make clean' or 'make distclean' - -2012-04-04 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/SVGTree.cpp, src/SVGTree.h, - tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, - tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: - scale point units in the SVG files to big points (bp) - -2012-04-02 Martin Gieseking - - * src/Matrix.cpp, src/Matrix.h, tests/MatrixTest.cpp: - added Matrix::invert() and det() - -2012-03-29 Martin Gieseking - - * src/Matrix.cpp, src/Matrix.h, tests/MatrixTest.cpp: - added start index parameter to Matrix::set(vector<>) - -2012-03-21 Martin Gieseking - - * src/psdefs.ps, src/psdefs.psc: - evaluate PS operators rectclip, rectfill, and rectstroke - -2012-03-09 Martin Gieseking - - * NEWS: - updated NEWS - - * src/dvisvgm.cpp: - added Ghostscript to library list printed by --version=yes - - * src/Ghostscript.cpp, src/Ghostscript.h: - added optional parameter to Ghostscript::revision() to retrieve the - revision number only - -2012-03-08 Martin Gieseking - - * configure.ac, src/Doxyfile: - set version to 1.0.11 - -2012-03-07 Martin Gieseking - - * src/DVIToSVGActions.cpp: - correct location of a rule's bounding box (lp bug #948713) - -2012-02-24 Martin Gieseking - - * doc/dvisvgm.txt.in: - fixed a couple of mistakes and formatting flaws in the manpage - -2012-02-17 Martin Gieseking - - * README: - updated information about bug reporting - -2012-01-26 Martin Gieseking - - * src/CmdLineParserBase.h, src/DVIActions.h, src/DVIReader.h, - src/DVIToSVGActions.h, src/FontEngine.h, src/FontManager.h, - src/MetafontWrapper.h, src/SVGTree.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.h, src/TFM.h, src/VFReader.h: - adapt forward declarations of classes and structs to their corresponding - definition (SF bug #3480013) - -2012-01-09 Martin Gieseking - - * src/TpicSpecialHandler.cpp: - added some more comments to methods of class TpicSpecialHandler - - * src/InputReader.cpp, tests/StreamInputBufferTest.cpp: - fixed parsing of negative floating point numbers starting with '-0.' (SF - bug #3471097) - -2012-01-06 Martin Gieseking - - * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, - src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, - src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, - src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, - src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, - src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, - src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, - src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, - src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageRanges.cpp, - src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/Process.cpp, src/Process.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/SVGTree.cpp, src/SVGTree.h, - src/SWFWriter.cpp, src/SWFWriter.h, src/SignalHandler.cpp, - src/SignalHandler.h, src/SpecialActions.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/StreamReader.cpp, - src/StreamReader.h, src/StreamWriter.cpp, src/StreamWriter.h, - src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, src/Terminal.cpp, - src/Terminal.h, src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, - src/VFActions.h, src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, - src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, - src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, - src/dvisvgm.cpp, src/macros.h, src/options.dtd, src/options.xml, - src/psdefs.ps, src/psdefs.psc, src/types.h, tests/BoundingBoxTest.cpp, - tests/CRC32Test.cpp, tests/CalculatorTest.cpp, - tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, - tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, - tests/FilePathTest.cpp, tests/FileSystemTest.cpp, - tests/FontManagerTest.cpp, tests/FontMapTest.cpp, tests/GFReaderTest.cpp, - tests/GraphicPathTest.cpp, tests/LengthTest.cpp, tests/Makefile.am, - tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, - tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, - tests/PageSizeTest.cpp, tests/PairTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, - tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, - tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/check-conv, - tests/create-makefile: - updated year in copyright statements - -2011-12-18 Martin Gieseking - - * NEWS: - updated NEWS - - * configure.ac, src/Doxyfile: - set version to 1.0.10 - - * tests/Makefile.am, tests/create-makefile: - link tests with -lpthread (required by gtest on Ubuntu) - -2011-12-17 Martin Gieseking - - * doc/dvisvgm.txt.in: - added documentation on environment variable DVISVGM_COLORS to manpage - - * src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/GlyphTracerMessages.h, - src/Message.cpp, src/Message.h, src/MetafontWrapper.cpp, - src/Terminal.cpp, src/Terminal.h, src/dvisvgm.cpp: - allow users to customize the message colors - -2011-11-22 Martin Gieseking - - * src/GraphicPath.h: - added some more comments to the methods of GraphicPath - -2011-11-18 Martin Gieseking - - * configure.ac: - move linker flag -lfreetype from LDFLAGS to LIBS to avoid linking - problems - -2011-10-28 Martin Gieseking - - * src/SVGTree.cpp: - avoid possible collisions of glyph IDs - - * src/FontMap.cpp: - removed unused variable eval_prefix in helper function read_entry() - -2011-10-13 Martin Gieseking - - * NEWS: - updated NEWS - -2011-10-10 Martin Gieseking - - * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontManager.h: - extended class FontManager to handle external fonts - - * src/ExternalFont.cpp, src/ExternalFont.h, src/Makefile.am: - added class ExternalFont - -2011-10-09 Martin Gieseking - - * configure.ac, src/FontDB.cpp, src/FontDB.h, src/Makefile.am: - added class FontDB - - * src/DirectoryTree.cpp, src/DirectoryTree.h, src/Makefile.am, - tests/DirectoryTreeTest.cpp, tests/Makefile.am: - added class DirectoryTree - - * src/Directory.h: - dropped method Directory::getEntry() - - * src/FilePath.cpp: - added some missing comments to methods of class FilePath - -2011-10-07 Martin Gieseking - - * src/Process.cpp: - exclude definition of split_paramstr() from Windows builds as it's not - used there - - * src/Process.cpp: - added missing include to Process.cpp - -2011-10-03 Martin Gieseking - - * doc/Makefile.am: - add metadata/pdfmarks to pdf version of manpage - -2011-09-30 Martin Gieseking - - * src/InputReader.cpp, src/InputReader.h, tests/StreamInputBufferTest.cpp: - added InputReader::getUntil() to simplify parsing of an input stream - - * src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, - src/options.xml: - added command-line option --query - -2011-09-06 Martin Gieseking - - * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: - updated bundled potrace library to version 1.10 - -2011-06-04 Martin Gieseking - - * src/FileFinder.cpp, src/MetafontWrapper.cpp: - fixed segfault occured in TeX Live Win32 caused by mf.exe being - unavailable (SF bug #3308473) - - * configure.ac, src/Doxyfile: - set version to 1.0.9dev - -2011-05-31 Martin Gieseking - - * src/PsSpecialHandler.cpp: - explicitly cast double to int in call of ClippingStack::dup()/pop() - - * NEWS, configure.ac, src/Doxyfile: - set version to 1.0.8; updated NEWS - -2011-05-27 Martin Gieseking - - * tests/check-conv, tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: - updated conversion tests - -2011-05-23 Martin Gieseking - - * src/Font.cpp, src/Makefile.am, src/MetafontWrapper.cpp, - src/MetafontWrapper.h, src/Process.cpp, src/Process.h, - src/SignalHandler.cpp: - replaced call of system() with Process::run() and kill child process if - necessary - -2011-05-22 Martin Gieseking - - * src/MetafontWrapper.cpp: - dropped '--halt-on-error' in Metafont call to process buggy mf files - completely - - * src/FileFinder.cpp: - MiKTeX: maketfm and makemf have been renamed to miktex-maketfm and - miktex-makemf - -2011-05-19 Martin Gieseking - - * src/DLLoader.h: - added #undef NOMINMAX before (re)defining it - -2011-05-12 Martin Gieseking - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc, - tests/PSInterpreterTest.cpp: - PS handler: implemented evaluation of save, restore, and grestoreall - -2011-05-07 Martin Gieseking - - * src/PsSpecialHandler.cpp: - fixed potential segfault caused by invisible zero-length paths - - * src/PsSpecialHandler.cpp: - add definitions in literal PS headers to dictionary TeXDict - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVGActions.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialActions.h: - fixed interaction between PS and DVI drawing position - - * configure.ac, src/Doxyfile: - set version to 1.0.8dev - -2011-05-06 Martin Gieseking - - * fedora/dvisvgm-gs.patch, fedora/dvisvgm-potrace.patch, - fedora/dvisvgm.spec: - removed directories 'fedora' and 'homepage' - - * NEWS, README, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.7; updated NEWS and README - -2011-05-05 Martin Gieseking - - * doc/dvisvgm.txt.in: - added info about dvips rounding issues to manpage - - * src/DVIToSVGActions.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/psdefs.ps, src/psdefs.psc: - PS handler: added missing unit conversions (pt vs. bp) - - * src/PsSpecialHandler.h: - corrected scaling formula applied to PS line properties - - * src/PSInterpreter.cpp, src/PsSpecialHandler.cpp: - separate PS snippets by newline characters to leave preceding comments - -2011-05-04 Martin Gieseking - - * src/Length.h: - undefine macro IN - - * src/Ghostscript.cpp, src/Ghostscript.h, src/PSInterpreter.cpp, - src/PSInterpreter.h: - avoid 'this' pointer in initialazation list of - PSInterpreter::PSInterpreter() - - * src/PsSpecialHandler.cpp: - don't call Ghostscript::revision() in initialization of static variable - -2011-05-03 Martin Gieseking - - * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: - tpic special 'ip' must not draw the outline of the polygon but only fill - its interior - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/macros.h, src/psdefs.ps, src/psdefs.psc, - tests/PSInterpreterTest.cpp: - improved handling of pure PostScript specials - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, - src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, - src/SpecialManager.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h: - replaced methods for DVI position alterations with translation semantics - -2011-05-02 Martin Gieseking - - * src/psdefs.ps, src/psdefs.psc: - PS handler: recognize save/restore operators - -2011-04-30 Martin Gieseking - - * src/psdefs.ps, src/psdefs.psc: - catch PS error /nocurrentpoint in operator 'setpos' properly - - * src/SpecialManager.cpp: - register special prefix ps:: properly - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.7dev - -2011-04-16 Martin Gieseking - - * NEWS, README, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.6; updated NEWS and README - -2011-04-14 Martin Gieseking - - * src/DVIReader.cpp, src/Font.cpp, src/GFReader.cpp, src/Makefile.am, - src/MetafontWrapper.cpp, src/PSInterpreter.cpp, src/SignalHandler.cpp, - src/SignalHandler.h, src/TFM.cpp, src/dvisvgm.cpp: - added class SignalHandler for CTRL-C signals - - * src/DVIToSVGActions.cpp, src/MessageException.h, src/dvisvgm.cpp, - tests/Makefile.am, tests/MessageExceptionTest.cpp: - derived MessageException from std::exception and replaced getMessage() - with what() - -2011-04-13 Martin Gieseking - - * src/XMLNode.cpp, src/XMLNode.h: - prepended member variables of the XMLNode classes with underscore - -2011-04-09 Martin Gieseking - - * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp, - tests/FileFinderTest.cpp: - dropped class FileFinder::Impl and simplified FileFinder interface - -2011-03-15 Martin Gieseking - - * src/DVIReader.cpp: - throw DVI exception if set_char/put_char is executed without preceding - font selection - -2011-03-12 Martin Gieseking - - * pull-wiki: - updated rsync parameters in 'pull-wiki' - -2011-03-04 Martin Gieseking - - * src/CRC32.cpp, src/StreamWriter.cpp: - added missing 'const' to type casts (Peter Breitenlohner) - - * potracelib/potracelib.c, potracelib/potracelib.h: - changed return type of potrace_version() to 'const char *' in order to - avoid compiler warning - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.6dev - -2011-02-28 Martin Gieseking - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.5, updated NEWS - - * src/Ghostscript.cpp: - fixed formatting of GS version number - - * doc/dvisvgm.txt.in, src/FontCache.cpp, src/FontCache.h, src/dvisvgm.cpp: - added code to remove outdated and corrupted cache files - -2011-02-21 Martin Gieseking - - * tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, - tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: - updated conversion test files - - * src/SVGTree.cpp: - added missing unit in height/width attribute of svg root element - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/GraphicPath.h, src/SVGTree.cpp, src/SVGTree.h, src/dvisvgm.cpp, - src/options.xml, tests/CommandLineTest.cpp: - added option to replace use elements with paths - -2011-02-16 Martin Gieseking - - * src/InputBuffer.h: - reference to scanned string in StringInputBuffer is constant now - -2011-02-10 Martin Gieseking - - * src/FontCache.cpp, src/FontCache.h: - added CRC32 checks to cache files - - * src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, - src/StreamWriter.h, tests/Makefile.am, tests/StreamReaderTest.cpp, - tests/StreamWriterTest.cpp: - added CRC32 computation methods to StreamReader and StreamWriter - - * src/CRC32.cpp, src/CRC32.h, src/Makefile.am, tests/CRC32Test.cpp, - tests/Makefile.am: - added class CRC32 and corresponding tests - - * src/FileSystem.cpp, src/FileSystem.h, src/dvisvgm.cpp, - tests/FileSystemTest.cpp: - merged FileSystem::move() into FileSystem::copy() - -2011-01-31 Martin Gieseking - - * src/CmdLineParserBase.cpp: - print character instead of ascii value in message of command-line parser - -2011-01-30 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/FileFinder.cpp, src/FileFinder.h, src/FontEngine.cpp, - src/FontEngine.h, src/dvisvgm.cpp, src/options.xml: - added optional argument to --version - -2011-01-28 Martin Gieseking - - * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: - updated bundled potrace library to version 1.9 - -2011-01-17 Martin Gieseking - - * doc/dvisvgm.txt.in, src/dvisvgm.cpp: - moved cache files to subfolder ($HOME/.dvisvgm/cache) - -2011-01-04 Martin Gieseking - - * tests/Makefile.am, tests/PSInterpreterTest.cpp: - added basic tests for class PSInterpreter - - * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/Calculator.cpp, src/Calculator.h, src/CmdLineParserBase.cpp, - src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, - src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, - src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, - src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, - src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, - src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, - src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageRanges.cpp, - src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, - src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, - src/StreamWriter.h, src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, - src/Terminal.cpp, src/Terminal.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, - src/options.dtd, src/options.xml, src/psdefs.ps, src/psdefs.psc, - src/types.h, tests/BoundingBoxTest.cpp, tests/CalculatorTest.cpp, - tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, - tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, - tests/FilePathTest.cpp, tests/FontManagerTest.cpp, tests/FontMapTest.cpp, - tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, tests/LengthTest.cpp, - tests/Makefile.am, tests/MatrixTest.cpp, tests/PageRagesTest.cpp, - tests/PageSizeTest.cpp, tests/PairTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, - tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/check-conv, - tests/create-makefile: - updated year in copyright info - -2010-12-18 Martin Gieseking - - * doc/dvisvgm.txt.in: - minor update to the manpage - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.4; updated NEWS - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: - PS handler: added missing scaling of linewidths and dash distances - - * src/PsSpecialHandler.cpp: - fixed scaling issue in PS positioning - -2010-12-16 Martin Gieseking - - * src/FileFinder.cpp: - updated to MiKTeX 2.8 SDK - -2010-08-18 Martin Gieseking - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.4dev - - * src/FontEngine.cpp: - fixed FreeType version check (patch by Paul Vojta) - -2010-08-11 Martin Gieseking - - * tests/Makefile.am, tests/PairTest.cpp: - added PairTest - -2010-08-05 Martin Gieseking - - * NEWS, doc/dvisvgm.txt.in: - updated manpage and NEWS - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.3 - -2010-08-04 Martin Gieseking - - * src/BoundingBox.cpp, src/BoundingBox.h, src/Matrix.cpp, src/Matrix.h, - src/PsSpecialHandler.cpp: - revamped PsSpecialHandler::psfile() to fix a transformation issue (SF - bug #3037372) - -2010-07-28 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp: - added check of DVI format version - -2010-07-26 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - restore transformation matrix after execution of psfile - -2010-07-13 Martin Gieseking - - * src/Directory.cpp, src/Directory.h, src/GFReader.cpp, src/GFReader.h: - added leading underscore to variables of GFReader - - * src/GraphicPath.h, src/PsSpecialHandler.h: - fixed missing initialization of GraphicPath iterator - - * src/Terminal.cpp: - replaced \e with \x1B - - * src/InputBuffer.h: - added missing namespace prefix - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.3dev - -2010-06-22 Martin Gieseking - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.2 - - * src/gzstream.cpp, src/gzstream.h: - fixed class variable issue introduced by previous AIX patch - -2010-06-18 Martin Gieseking - - * src/Bitmap.cpp, tests/DirectoryTest.cpp, tests/GFReaderTest.cpp, - tests/Makefile.am, tests/cmr10.600gf, tests/create-makefile: - added GFReaderTest; updated DirectoryTest - -2010-06-17 Martin Gieseking - - * src/types.h, tests/Makefile.am, tests/TypesTest.cpp: - added TypesTest - - * src/Message.cpp, src/Message.h: - renamed MessageStream::putchar() to MessageStream::putChar() to avoid - name clashes - - * src/Bitmap.cpp, src/Calculator.cpp, src/CmdLineParserBase.cpp, - src/Color.cpp, src/ColorSpecialHandler.cpp, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVGActions.cpp, src/DvisvgmSpecialHandler.cpp, - src/EmSpecialHandler.cpp, src/FontCache.cpp, src/FontEncoding.cpp, - src/GFGlyphTracer.cpp, src/Pair.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/TFM.cpp, src/TFM.h: - fixed some type conversion warnings - -2010-06-16 Martin Gieseking - - * potracelib/curve.c, potracelib/curve.h, potracelib/decompose.c: - renamed internal potrace functions path_new() and path_free() to prevent - linker conflicts on OS X - - * configure.ac, src/CmdLineParserBase.h, src/FileFinder.h, - src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, - src/FontEngine.cpp, src/GFGlyphTracer.h, src/MetafontWrapper.cpp, - src/gzstream.cpp: - applied latest TL patches from Peter Breitenlohner and Karl Berry - -2010-06-14 Martin Gieseking - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.2dev - -2010-06-11 Martin Gieseking - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.1 - - * src/Message.cpp: - suppress ANSI color code by default - -2010-06-09 Martin Gieseking - - * src/psdefs.ps, src/psdefs.psc: - fixed recursion issue in PS operator charpath - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0.1dev - -2010-06-08 Martin Gieseking - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h: - fixed PS destructor issue (SF bug #3013392) - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0 - - * doc/Makefile.am, doc/dvisvgm.txt.in: - documented option --help and --version in manpage - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/DVIActions.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/Makefile.am, src/Message.cpp, src/Message.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/SpecialActions.h, src/System.cpp, src/System.h, src/dvisvgm.cpp, - src/options.xml: - added percentage-based progress indicator - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h: - added method to compute length of DVI command - - * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: - evaluate Ghostscript operator .setopacityalpha - - * src/Font.cpp: - print error message if Metafont failed - - * configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, src/CommandLine.cpp, - src/CommandLine.h, src/DVIActions.h, src/DVIToSVG.cpp, src/GFTracer.cpp, - src/GlyphTracerMessages.h, src/Makefile.am, src/Message.cpp, - src/Message.h, src/MetafontWrapper.cpp, src/Terminal.cpp, src/Terminal.h, - src/dvisvgm.cpp, src/options.xml: - improved output of messages including optional colorization - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, - src/PageRanges.cpp, src/PageRanges.h, src/StreamCounter.h, - src/dvisvgm.cpp, src/options.xml, tests/BoundingBoxTest.cpp, - tests/CommandLineTest.cpp, tests/Makefile.am, tests/PageRagesTest.cpp, - tests/StreamCounterTest.cpp: - added conversion of multiple pages - - * src/InputBuffer.h, tests/ColorSpecialTest.cpp, - tests/StreamInputBufferTest.cpp: - added InputBuffer::invalidate() - - * src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, - src/Makefile.am, tests/FilePathTest.cpp, tests/Makefile.am: - added class FilePath - - * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/DvisvgmSpecialHandler.cpp, - src/EmSpecialHandler.cpp, src/PsSpecialHandler.cpp, src/SpecialActions.h, - src/SpecialManager.cpp, src/TpicSpecialHandler.cpp: - added special for creating local bounding boxes - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 1.0dev - - * configure.ac, doc/Makefile.am, src/Makefile.am: - cleaned up configuration scripts - -2010-05-09 Martin Gieseking - - * configure.ac: - fixed whitespace issue in CPPFLAGS and LDFLAGS - -2010-05-04 Martin Gieseking - - * tests/FileFinderTest.cpp, tests/FontManagerTest.cpp, tests/check-conv: - fixed segfaults in tests - - * configure.ac: - fixed kpathsea check; use pkg-config to check freetype availability - -2010-04-22 Martin Gieseking - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.9.1 - - * tests/check-conv, tests/frktest-wf-cmp.svg, tests/sample-wf-cmp.svg: - adapted conversion tests to new output format - - * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h: - print page count and page number of DVI page being processed - - * src/SVGTree.cpp: - fixed broken validity when using SVG fonts - - * src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/SVGTree.cpp, src/SVGTree.h, src/XMLNode.cpp, src/XMLNode.h: - ignore unused fonts in CSS styles list - - * src/CommandLine.cpp, src/options.xml: - output of option --help: replaced '(default: FOO)' by '[FOO]' - -2010-04-20 Martin Gieseking - - * src/FontEncoding.cpp: - fixed memory bug in FontEncoding::encoding() - -2010-04-11 Martin Gieseking - - * src/DVIToSVGActions.cpp: - replaced wrong font pointer that could lead to segfaults - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.9.1dev - -2010-03-25 Martin Gieseking - - * fedora/dvisvgm.spec: - updated spec file - -2010-03-24 Martin Gieseking - - * transfer-cs: - added extension .patch to exported changesets - - * tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, - tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: - updated conversion tests - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.9 - - * src/FontCache.cpp, src/GFGlyphTracer.cpp, src/GFReader.cpp: - variable _fontname is now correctly set in class FontCache - - * src/CmdLineParserBase.cpp, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, - src/FontEngine.cpp, src/GlyphTracerMessages.h, src/Message.cpp, - src/Message.h, src/MetafontWrapper.cpp, src/dvisvgm.cpp: - added class MessageStream, updated message output - - * src/FontCache.cpp, src/Makefile.am, src/StreamWriter.cpp, - src/StreamWriter.h, src/TFM.cpp: - replaced local stream IO functions by StreamReader/StreamWriter methods - - * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, - src/CommandLine.cpp, src/CommandLine.h, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, - src/GlyphTracerMessages.h, src/Makefile.am, src/dvisvgm.cpp, - src/options.xml: - added command-line option --exact - - * src/Font.cpp, src/Font.h, src/dvisvgm.cpp: - moved some methods from PhysicalFontImpl to PysicalFont - -2010-03-18 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/Font.cpp, src/Font.h, src/dvisvgm.cpp, src/options.xml: - added command-line option --keep - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/Font.cpp, src/Font.h, - src/dvisvgm.cpp, src/options.xml, tests/CommandLineTest.cpp: - reactivated option --trace-all, and added optional argument 'retrace' to - it - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h: - added evaluation of boolean and char arguments to the command-line - parser - - * src/DVIToSVG.cpp, src/Font.cpp, src/Font.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/SVGTree.cpp, src/SVGTree.h: - added class GFGlyphTracer::Callback providing an interface used to print - status information about the tracer - - * src/DVIToSVG.cpp, src/SVGTree.cpp: - moved creation of SVG 'use' elements from class DVIToSVG to class - SVGTree - -2010-03-17 Martin Gieseking - - * src/BoundingBox.cpp, src/Calculator.cpp, src/Matrix.cpp, - src/PSInterpreter.cpp, src/PSInterpreter.h: - fixed a couple of comments - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/Font.cpp, - src/Font.h, src/FontEmitter.h, src/GFGlyphTracer.h, src/Makefile.am, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, - src/SVGTree.h, src/dvisvgm.cpp, tests/Makefile.am, tests/check-conv, - tests/create-makefile: - removed emitter classes; incorporated their functionality into SVGTree - and PhysicalFontImpl - - * src/FontCache.cpp, src/FontCache.h: - added method FontCache::write(const char *dir) that updates the cache - file of the current font - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/FontManager.cpp, src/FontManager.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, - src/SVGTree.h, src/VFReader.h, tests/FontManagerTest.cpp: - made FontManager a singleton - - * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, - src/Makefile.am, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, - src/SVGTree.h: - removed class CharmapTranslator - - * src/GFReader.cpp, src/GFReader.h: - replaced GFReader messages by exceptions - -2010-02-26 Martin Gieseking - - * src/Font.cpp, src/FontCache.cpp, src/FontCache.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h: - refactorings of GF tracer class; removed transferGlyph() - -2010-02-21 Martin Gieseking - - * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/Font.cpp, - src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEngine.cpp, - src/FontEngine.h, src/Glyph.cpp, src/Glyph.h, src/Makefile.am, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h: - removed class Glyph and incorporated its functionality into Font class - -2010-02-05 Martin Gieseking - - * src/DVIToSVG.cpp: - added evaluation of literal PS headers to PSHeaderActions - -2010-02-04 Martin Gieseking - - * src/psdefs.ps, src/psdefs.psc: - removed PS error handler nocurrentpoint - -2010-02-02 Martin Gieseking - - * fedora/dvisvgm.spec: - updated homepage and spec file - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - version updated to 0.8.8 - -2010-02-01 Martin Gieseking - - * tests/check-conv: - skip conversion checks by default - -2010-01-31 Martin Gieseking - - * tests/normalize.xsl: - some improvements to normalize.xsl - - * tests/Makefile.am, tests/check-conv, tests/create-makefile, - tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, tests/frktest.dvi, - tests/normalize.xsl, tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg, - tests/sample.dvi: - added tests to check conversion results - -2010-01-29 Martin Gieseking - - * src/GraphicPath.h: - fixed scaling bug in computation of glyph paths when using -n - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, - src/CommandLine.h: - removed CmdLineParserBase::numOptions() - -2010-01-24 Martin Gieseking - - * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/FontCache.h, src/dvisvgm.cpp, src/options.dtd, src/options.xml: - added command-line option --libgs - -2010-01-18 Martin Gieseking - - * src/CommandLine.cpp, src/options.dtd, src/options.xml: - added DTD for options.xml - -2010-01-17 Martin Gieseking - - * src/Ghostscript.cpp: - fixed typo in variable name - - * NEWS: - updated NEWS - - * doc/dvisvgm.txt.in, src/FileFinder.cpp, src/Ghostscript.cpp, - src/Ghostscript.h, src/dvisvgm.cpp: - environment variable LIBGS can now be used to set the name of the GS - shared library - - * Makefile.am, README, configure.ac, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, - src/CharmapTranslator.h, src/CmdLineParserBase.cpp, - src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, - src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, - src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, - src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontManager.cpp, src/FontManager.h, - src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.cpp, - src/Glyph.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, - src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, - src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageSize.cpp, - src/PageSize.h, src/Pair.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, - src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, - src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, - src/options.xml, src/psdefs.ps, src/psdefs.psc, src/types.h, - tests/BoundingBoxTest.cpp, tests/CalculatorTest.cpp, - tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, - tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, - tests/FontManagerTest.cpp, tests/FontMapTest.cpp, - tests/GraphicPathTest.cpp, tests/LengthTest.cpp, tests/Makefile.am, - tests/MatrixTest.cpp, tests/PageSizeTest.cpp, - tests/SplittedCharInputBufferTest.cpp, tests/StreamCounterTest.cpp, - tests/StreamInputBufferTest.cpp, tests/VectorStreamTest.cpp, - tests/create-makefile: - updated boilerplates - - * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, - src/DVIToSVG.cpp, tests/BoundingBoxTest.cpp, tests/Makefile.am: - added support for enlarging the minimal bbox by a given amount. - - * configure.ac: - updated type of kpathsea_version_string (patch by lomov_vl) - -2009-12-16 Martin Gieseking - - * src/InputReader.cpp: - fixed bug in InputReader::parseUInt() - -2009-12-15 Martin Gieseking - - * configure.ac, src/dvisvgm.cpp: - appied get_time patch sent by Peter Breitenlohner - -2009-12-02 Martin Gieseking - - * src/BoundingBox.h, src/Calculator.h, src/CharmapTranslator.h, - src/DVIReader.h, src/DVIToSVG.h, src/DVIToSVGActions.h, src/Font.h, - src/FontEngine.h, src/FontManager.h, src/FontMap.h, src/GFGlyphTracer.h, - src/GFReader.h, src/MessageException.h, src/MetafontWrapper.h, - src/PageSize.h, src/SVGTree.cpp, src/SVGTree.h, src/StreamReader.h, - src/VFActions.h, src/VFReader.h, src/XMLDocTypeNode.h, src/XMLDocument.h, - src/XMLNode.h, src/XMLString.h: - removed using statements from header files - -2009-11-25 Martin Gieseking - - * src/FontCache.cpp, src/FontCache.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, - src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFTracer.cpp, - src/Glyph.cpp, src/Glyph.h, src/GraphicPath.h, src/Makefile.am, - src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp, - tests/GraphicPathTest.cpp: - removed FEGlyphCommands and replaced separate glyph class implementation - by class GraphicPath - -2009-11-23 Martin Gieseking - - * src/DVIToSVG.cpp: - avoid scaling by 1 in use elements - -2009-11-18 Martin Gieseking - - * src/DLLoader.cpp, src/DLLoader.h: - fixed line endings - - * src/Ghostscript.cpp, src/Ghostscript.h: - replaced #if HAVE_LIBGS by #if defined(HAVE_LIBGS) - - * src/DVIToSVG.cpp, src/Ghostscript.cpp, src/Ghostscript.h: - replaced #if !DISABLE_GS by #if !defined(DISABLE_GS) (Peter - Breitenlohner) - -2009-11-17 Martin Gieseking - - * NEWS: - updated NEWS - - * src/dvisvgm.cpp: - don't use email adress PACKAGE_BUGREPORT for copyright notice - - * src/CmdLineParserBase.h, src/GraphicPath.h, src/InputReader.h, - src/Makefile.am, src/PSInterpreter.h, src/SpecialManager.h: - added missing virtual destructors to avoid warnings - - * src/InputReader.cpp: - added missing initialization value (Peter Breitenlohner) - - * src/Color.cpp, src/ColorSpecialHandler.cpp, src/FontManager.cpp, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/TpicSpecialHandler.cpp: - added explicit casts to avoid compiler warnings (Peter Breitenlohner) - - * potracelib/potracelib.c, potracelib/potracelib.h: - replaced outdated string constant type char* by const char* in - potrace_version() - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.8.8dev - -2009-11-10 Martin Gieseking - - * fedora/dvisvgm.spec: - updated spec file - -2009-11-09 Martin Gieseking - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.8.7 - - * NEWS, src/Color.cpp, src/Color.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/SVGTree.cpp: - PS handler: colors set by color specials are now considered properly - - * src/DVIToSVG.cpp, src/dvisvgm.cpp: - added total number of pages to message text - -2009-11-06 Martin Gieseking - - * NEWS, src/PsSpecialHandler.cpp: - fixed path scaling issue in PS handler - - * NEWS, doc/dvisvgm.txt.in: - updated NEWS and manpage - - * src/GraphicPath.h, src/PsSpecialHandler.cpp: - PS handler: replace zero-length paths by dots - -2009-10-29 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/Font.cpp, src/Font.h: - fixed positioning of italic characters - -2009-10-18 Martin Gieseking - - * src/Font.cpp, src/TFM.cpp, src/TFM.h: - added italic correction values to character widths - -2009-10-16 Martin Gieseking - - * configure.ac, src/Doxyfile: - increased version to 0.8.7dev - - * tests/Makefile.am, tests/create-makefile: - added script to create tests/Makefile.am - -2009-10-13 Martin Gieseking - - * README, tests/CalculatorTest.cpp, tests/CalculatorTest.h, - tests/ColorSpecialTest.cpp, tests/ColorSpecialTest.h, - tests/CommandLineTest.cpp, tests/CommandLineTest.h, - tests/DirectoryTest.cpp, tests/DirectoryTest.h, tests/FileFinderTest.cpp, - tests/FileFinderTest.h, tests/FontManagerTest.cpp, - tests/FontManagerTest.h, tests/FontMapTest.cpp, tests/FontMapTest.h, - tests/GraphicPathTest.cpp, tests/GraphicPathTest.h, tests/LengthTest.cpp, - tests/LengthTest.h, tests/Makefile.am, tests/MatrixTest.cpp, - tests/MatrixTest.h, tests/PageSizeTest.cpp, tests/PageSizeTest.h, - tests/SplittedCharInputBufferTest.cpp, - tests/SplittedCharInputBufferTest.h, tests/StreamCounterTest.cpp, - tests/StreamCounterTest.h, tests/StreamInputBufferTest.cpp, - tests/StreamInputBufferTest.h, tests/VectorStreamTest.cpp, - tests/VectorStreamTest.h: - replaced cxxtest by googletest - - * doc/Makefile.am: - added missing dvi suffix in Makefile target dvi-pdf - - * fedora/dvisvgm.spec: - updated spec file - - * doc/Makefile.am, doc/dvisvgm.txt.in: - removed outdated post-processing of manpage - -2009-10-12 Martin Gieseking - - * src/FontInfo.cpp, src/FontInfo.h, src/FontTracer.h, src/PSObject.cpp, - src/PSObject.h, src/PSState.cpp, src/PSState.h, src/global.cpp, - src/global.h: - removed unused source files - - * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, - src/CharmapTranslator.h, src/CmdLineParserBase.cpp, - src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DLLoader.cpp, - src/DLLoader.h, src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, - src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, - src/EmSpecialHandler.h, src/FileFinder.cpp, src/FileFinder.h, - src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, - src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, - src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, - src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, - src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/Ghostscript.cpp, - src/Ghostscript.h, src/GraphicPath.h, src/InputBuffer.cpp, - src/InputBuffer.h, src/InputReader.cpp, src/InputReader.h, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageSize.cpp, - src/PageSize.h, src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, - src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, - src/SpecialManager.h, src/StreamCounter.h, src/StreamReader.cpp, - src/StreamReader.h, src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/macros.h, src/types.h: - code cleanup - -2009-10-11 Martin Gieseking - - * NEWS: - NEWS updated - - * src/DVIToSVG.cpp, src/DvisvgmSpecialHandler.cpp, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, - src/SVGTree.h: - suppress empty style and transformation elements - - * transfer-cs: - improved transfer-cs - -2009-10-10 Martin Gieseking - - * src/PsSpecialHandler.cpp: - scale clipping paths by 72.27/72 - -2009-10-09 Martin Gieseking - - * src/Makefile.am: - fixed Makefile - - * src/Length.cpp, src/Length.h, tests/LengthTest.h: - fixed unit conversion bug - - * doc/dvisvgm.txt.in: - fixed formatting of manual page - - * transfer-cs: - added script to transfer changesets to dvisvgm-pub - - * autogen.sh, prepare: - prepare script replaced by autogen.sh - - * src/Bitmap.h: - fixed bit shift overflow in Bitmap class occured on 64-bit systems - -2009-10-08 Martin Gieseking - - * src/dvisvgm.cpp: - fixed uncaught PageSizeException - - * src/MetafontWrapper.cpp: - fixed file permissions - - * NEWS, src/GraphicPath.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h: - PS clipping path sequences and intersections are now handled correctly - - * NEWS, doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/CommandLine.cpp, - src/CommandLine.h, src/DVIToSVG.cpp, src/DVIToSVG.h, src/dvisvgm.cpp, - src/options.xml, tests/CommandLineTest.h, tests/Makefile.am: - cmdline parameter --bbox can now be used to set the absolute bounding - box - -2009-10-07 Martin Gieseking - - * src/BoundingBox.cpp, src/BoundingBox.h, src/Length.cpp, src/Length.h, - src/Makefile.am, tests/LengthTest.h: - class Length provides length unit calculations - - * NEWS, doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, - src/DvisvgmSpecialHandler.cpp: - added the special variant 'dvisvgm:bbox abs' and 'dvisvgm:bbox fix' - -2009-10-06 Martin Gieseking - - * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - set version to 0.8.6 - - * src/BoundingBox.cpp, src/BoundingBox.h, src/GraphicPath.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: - fixed some PS bounding box and positioning issues introduced by previous - changesets - -2009-10-05 Martin Gieseking - - * NEWS, src/PsSpecialHandler.cpp: - fixed another positioning bug reported by John Bowman - - * src/PsSpecialHandler.cpp: - convert PS path coordinated to TeX point units - -2009-10-04 Martin Gieseking - - * src/GraphicPath.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - corrected positioning bug introduced with previous PS positioning fix - -2009-10-02 Martin Gieseking - - * doc/Makefile.am, doc/dvisvgm.txt.in: - generate pdf manpage directly with groff; adapted manpage source to work - with latest asciidoc - -2009-10-01 Martin Gieseking - - * doc/Makefile.am, doc/dvisvgm.txt.in: - replaced backticks in manpage by apostrophes; updated date on homepage - -2009-09-30 Martin Gieseking - - * Makefile.am, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - increased version number to 0.8.5 - - * LGPL-2.1.txt, NEWS, README: - updated README and NEWS, and added file with LGPL license text - - * doc/dvisvgm.txt.in: - added dvisvgm:raw example to man page - -2009-09-17 Martin Gieseking - - * doc/dvisvgm.txt.in: - minor changes of the documentation - - * fedora/dvisvgm.spec: - updated spec file and fixed typo on website - - * src/PsSpecialHandler.h: - increased the default linewidth to 0.5 - - * NEWS: - added cretdit to John Bowman for sending a patch for the already fixed - clipping bug - -2009-09-11 Martin Gieseking - - * src/FileSystem.cpp, src/MetafontWrapper.cpp: - Windows: Metafont is now called via CreateProcess() - - * NEWS, doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/SpecialManager.cpp, - src/SpecialManager.h, src/dvisvgm.cpp, src/options.xml: - added option --progress for enabling a progress indicator (feature #22) - - * NEWS, src/CmdLineParserBase.cpp, src/FontCache.cpp, - src/SVGFontTraceEmitter.cpp: - fixed memory bug in tracer module (issue #21) - -2009-09-10 Martin Gieseking - - * src/FileSystem.cpp, src/FontCache.cpp: - fixed Windows-related bug in FileSystem::collect - - * NEWS, doc/dvisvgm.txt.in, src/FileSystem.cpp, src/FileSystem.h, - src/FontCache.cpp, src/FontCache.h, src/dvisvgm.cpp: - option --cache prints additional information about the cached fonts - (feature #7) - - * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DVIToSVG.cpp, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h: - refactored prefixes methods of the SpecialHandlers (ticket #20) - -2009-09-06 Martin Gieseking - - * NEWS, README: - updated NEWS and README - -2009-09-04 Martin Gieseking - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, - src/InputBuffer.h, src/InputReader.h, src/psdefs.psc, - tests/CommandLineTest.h: - improved the command line parser to make it more POSIX-compliant - (feature #17) - - * src/dvisvgm.cpp: - fixed evaluation of option --help - - * src/BoundingBox.cpp, src/BoundingBox.h, src/PsSpecialHandler.cpp: - linewidths are now considered properly in computation of bounding box - (issue #13) - - * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: - increased version number to 0.8.4 - -2009-09-01 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/psdefs.ps, src/psdefs.psc: - fixed flattened clipping path bug (issue #11) - -2009-08-31 Martin Gieseking - - * src/Makefile.am: - added error checks; disallow numeric optional arguments w/o default - value - -2009-08-28 Martin Gieseking - - * NEWS, src/PSInterpreter.cpp, src/PsSpecialHandler.cpp, src/dvisvgm.cpp, - src/psdefs.ps, src/psdefs.psc: - added evaluation of PS 'show' operator in order to evaluate PSTricks - Type 3 fonts properly - -2009-08-27 Martin Gieseking - - * NEWS, configure.ac, doc/dvisvgm.txt.in, src/CmdLineParserBase.cpp, - src/CommandLine.cpp, src/Doxyfile, src/dvisvgm.cpp, src/getopt.c, - src/getopt.h, src/getopt1.c, src/options.xml: - replaced option --cache=? by --cache; increased version number to 0.8.3 - -2009-08-26 Martin Gieseking - - * NEWS, configure.ac, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/PsSpecialHandler.cpp, - src/SpecialManager.cpp, src/SpecialManager.h: - PS prologue files referenced in first page are now always loaded - - * configure.ac, fedora/dvisvgm.spec, src/Ghostscript.cpp, - src/Ghostscript.h, src/Makefile.am: - improved Ghostscript and potrace linking checks to simplify usage of - external devel files - - * fedora/dvisvgm-0.8.1-potrace.patch, fedora/dvisvgm-gs.patch, - fedora/dvisvgm-potrace.patch, fedora/dvisvgm.spec: - updated Fedora files - -2009-08-24 Martin Gieseking - - * src/CommandLine.cpp, src/CommandLine.h: - speed up printing help by using puts() instead of C++ streams - -2009-08-21 Martin Gieseking - - * NEWS, configure.ac, src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, - src/Doxyfile: - increased version number to 0.8.2 - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Makefile.am, - src/dvisvgm.cpp, src/options.xml, tests/CommandLineTest.h, - tests/Makefile.am: - improved CmdLineParserBase and replaced gengetopt-based parser - - * src/FontMap.cpp: - fixed memory bug in FontMap - -2009-08-20 Martin Gieseking - - * COPYING: - added copy of file COPYING - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h: - finished cmdline parser - - * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/options.xml: - added files for replacement of gengetopt (not active yet) - - * src/InputReader.cpp, src/InputReader.h: - added method parseUInt() - -2009-08-17 Martin Gieseking - - * COPYING, LICENSE, Makefile.am, README, doc/dvisvgm.txt.in, - src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, - src/CharmapTranslator.h, src/Color.cpp, src/Color.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DLLoader.cpp, - src/DLLoader.h, src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Directory.cpp, - src/Directory.h, src/DvisvgmSpecialHandler.cpp, - src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, - src/EmSpecialHandler.h, src/FileFinder.cpp, src/FileFinder.h, - src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, - src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, - src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, - src/FontInfo.h, src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, - src/FontMap.h, src/FontTracer.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, - src/GraphicPath.h, src/HtmlSpecialHandler.h, src/InputBuffer.cpp, - src/InputBuffer.h, src/InputReader.cpp, src/InputReader.h, - src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSInterpreter.cpp, src/PSInterpreter.h, src/PSObject.cpp, - src/PSObject.h, src/PSState.cpp, src/PSState.h, src/PageSize.cpp, - src/PageSize.h, src/Pair.h, src/PsSpecialHandler.cpp, - src/PsSpecialHandler.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, - src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, - src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/global.cpp, - src/global.h, src/inttypes.h, src/macros.h, src/psdefs.ps, - src/psdefs.psc, src/types.h, tests/CalculatorTest.h, - tests/ColorSpecialTest.h, tests/DirectoryTest.h, tests/FileFinderTest.h, - tests/FontManagerTest.h, tests/FontMapTest.h, tests/GraphicPathTest.h, - tests/MatrixTest.h, tests/PageSizeTest.h, - tests/SplittedCharInputBufferTest.h, tests/StreamCounterTest.h, - tests/StreamInputBufferTest.h, tests/VectorStreamTest.h: - changed license to GPL version 3 or later - - * tests/Makefile.am: - added include path to fix broken distcheck - -2009-08-10 Martin Gieseking - - * tests/Makefile.am: - added generated file test-all.cpp to CLEANFILES - - * Makefile.am, configure.ac, src/Makefile.am, src/tests/CalculatorTest.h, - src/tests/ColorSpecialTest.h, src/tests/DirectoryTest.h, - src/tests/FileFinderTest.h, src/tests/FontManagerTest.h, - src/tests/FontMapTest.h, src/tests/GraphicPathTest.h, - src/tests/MatrixTest.h, src/tests/PageSizeTest.h, - src/tests/SplittedCharInputBufferTest.h, src/tests/StreamCounterTest.h, - src/tests/StreamInputBufferTest.h, src/tests/VectorStreamTest.h, - src/tests/dvipdfm_test.map, src/tests/dvips_test.map, - tests/CalculatorTest.h, tests/ColorSpecialTest.h, tests/DirectoryTest.h, - tests/FileFinderTest.h, tests/FontManagerTest.h, tests/FontMapTest.h, - tests/GraphicPathTest.h, tests/Makefile.am, tests/MatrixTest.h, - tests/PageSizeTest.h, tests/SplittedCharInputBufferTest.h, - tests/StreamCounterTest.h, tests/StreamInputBufferTest.h, - tests/VectorStreamTest.h, tests/dvipdfm_test.map, tests/dvips_test.map: - moved tests from src/tests to ./tests - - * fedora/dvisvgm-0.8.1-potrace.patch, fedora/dvisvgm.spec, - rpm/dvisvgm.spec: - added spec file and patch for Fedora builds - -2009-08-02 Martin Gieseking - - * LICENSE, Makefile.am, rpm/dvisvgm.spec, rpm/dvisvgm.spec.in, - src/Ghostscript.cpp: - modified package to be compatible with prerequisites of Fedora - -2009-07-30 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/Ghostscript.cpp, src/Ghostscript.h, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: - added Ghostscript revision info to output of dvisvgm -l - - * configure.ac, src/DVIToSVG.cpp: - added target triplet to version string in SVG output - -2009-07-29 Martin Gieseking - - * src/psdefs.psc: - added vim tag to psdefs.psc - -2009-07-28 Martin Gieseking - - * src/psdefs.psc: - cleaned up VC++ build files; added batch file to generate cmdline.c; - added generated file psdefs.psc for convenience - - * NEWS, src/FileSystem.cpp, src/FontEngine.cpp, src/FontManager.cpp, - src/Ghostscript.cpp, src/PageSize.cpp, src/dvisvgm.cpp: - fixed bug related to unsigned/size_t mismatch on x64 systems - - * NEWS, configure.ac, src/Doxyfile: - updated version number to 0.8.1 - - * src/PsSpecialHandler.cpp: - added evaluation of more psfile parameters; fixed psfile bounding box - bug - -2009-07-27 Martin Gieseking - - * src/DVIReader.h, src/InputBuffer.cpp, src/InputBuffer.h, - src/InputReader.cpp, src/InputReader.h, src/Matrix.cpp, src/Matrix.h, - src/PSInterpreter.h: - replaced size_t parameters by unsigned - - * NEWS, README: - fixed typos; updated homepage/manpage - - * src/DLLoader.cpp, src/InputReader.cpp, src/PSInterpreter.cpp: - changes to make VC happy; fixed potential memory bug - -2009-07-23 Martin Gieseking - - * src/PSInterpreter.cpp: - some clean-ups - -2009-07-22 Martin Gieseking - - * src/TpicSpecialHandler.cpp: - fixed reintroduced bug in TPIC handler - - * NEWS, README, doc/dvisvgm.txt.in, src/BoundingBox.cpp, - src/BoundingBox.h, src/GraphicPath.h, src/PSInterpreter.cpp, - src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/psdefs.ps: - fixed clipping bug; updated homepage, README, NEWS - -2009-07-20 Martin Gieseking - - * src/PsSpecialHandler.cpp, src/SVGTree.cpp: - fixed bbox bug; added missing file - - * src/DvisvgmSpecialHandler.cpp, src/InputBuffer.cpp, src/InputReader.cpp, - src/InputReader.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, - src/psdefs.ps, src/tests/StreamInputBufferTest.h: - implemented psfile special; fixed some bugs - -2009-06-01 Martin Gieseking - - * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, - src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h: - transplanted changes to SpecialHandlers from branch 'pages' - - * src/GFTracer.cpp: - transplanted changes to GFTracer from branch 'pages' - - * src/VFReader.cpp: - transplanted changes to VFReader from branch 'pages' - - * src/FileSystem.cpp, src/FileSystem.h: - transplanted changes to FileSystem from branch 'pages' - - * src/DVIReader.cpp, src/DVIReader.h: - transplanted changes to DVIReader from branch 'pages' - - * src/Bitmap.cpp, src/Bitmap.h: - transplanted changes to Bitmap from branch 'pages' - - * src/InputBuffer.cpp, src/InputBuffer.h, src/Makefile.am: - transplanted changes to InputBuffer from branch 'pages' - -2009-04-24 Martin Gieseking - - * src/FontCache.h: - increased version of font cache files to ensure their recreation due to - the previously fixed shorthand path command bug - - * NEWS, configure.ac, src/Doxyfile: - increased version number to 0.7.3 - - * src/TpicSpecialHandler.cpp: - fixed TPIC handler bug that could caused unwanted color fills of - ellipses due to a missing call of reset() - -2009-04-02 Martin Gieseking - - * configure.ac, doc/dvisvgm.txt.in, src/MetafontWrapper.cpp, - src/dvisvgm.cpp: - prepared release 0.7.2 (removed inclusions of debug.h, adapted homepage - and manpage) - -2009-03-25 Martin Gieseking - - * src/Doxyfile: - added doxygen files - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/FontGlyph.cpp, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp: - replaced Metafont magnification variable and its setters by a public - class variable - -2009-03-24 Martin Gieseking - - * src/FontGlyph.cpp: - fixed memory bug in Glyph::optimizeCommands() - - * src/FontGlyph.cpp: - fixed potential bug in Glyph::optimizeCommands() - - * NEWS, src/FontCache.cpp, src/FontGlyph.cpp, src/FontGlyph.h, - src/GFGlyphTracer.cpp, src/Pair.h, src/SVGFontEmitter.cpp: - use of shorthand path commands has been implemented - -2009-03-20 Martin Gieseking - - * src/FontCache.cpp: - cache files are being compressed now to reduce the file size - -2009-03-19 Martin Gieseking - - * src/FontCache.cpp, src/SVGFontTraceEmitter.cpp: - don't read existing cache file if --trace-all is given (trace complete - font and then write cache file instead) - - * NEWS, doc/dvisvgm.txt.in, src/FontEmitter.h, src/GFGlyphTracer.cpp, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp, - src/options.ggo: - added option --trace-all that forces tracing of all glyphs of all - currently used bitmap fonts - -2009-03-18 Martin Gieseking - - * src/DVIToSVG.cpp, src/TFM.cpp, src/TFM.h: - added firstChar()/lastChar() to TFM class, removed unnecessary mag - member variable and its setter - - * src/FontCache.cpp: - fixed bug in read/write functions of FontCache - -2009-03-17 Martin Gieseking - - * src/FontCache.cpp: - reduced size of cache file format by using variable integer sizes - - * doc/dvisvgm.txt.in, src/dvisvgm.cpp: - added option variant --cache=? to display the default cache directory - - * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/FileSystem.cpp, - src/FileSystem.h, src/FontCache.cpp, src/FontCache.h, src/FontGlyph.h, - src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/Makefile.am, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp: - completed font caching support - -2009-03-16 Martin Gieseking - - * NEWS, configure.ac, doc/dvisvgm.txt.in, src/DVIToSVG.cpp, - src/FileSystem.cpp, src/FileSystem.h, src/FontCache.cpp, src/FontCache.h, - src/FontGlyph.cpp, src/FontGlyph.h, src/GFGlyphTracer.cpp, - src/GFGlyphTracer.h, src/GFTracer.cpp, src/options.ggo: - first additions to support font caching; not working yet - -2009-03-11 Martin Gieseking - - * src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/FontEmitter.h, src/SVGFontEmitter.cpp, - src/SVGFontEmitter.h, src/SVGFontTraceEmitter.cpp, - src/SVGFontTraceEmitter.h: - improved font embedding algorithm in case of --no-fonts (identical - glyphs in different sizes are now referenced rather than duplicated) - -2009-03-10 Martin Gieseking - - * NEWS, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/Font.h, - src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp: - all glyph sizes are now computed correctly in conjuction with option - --no-fonts - -2009-03-09 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp: - fixed transformation bug (transformations are now applied properly to - the page) - - * src/types.h: - minor changes to homepage and .hgignore - - * src/BgColorSpecialHandler.cpp, src/SpecialManager.cpp, - src/TpicSpecialHandler.cpp: - adapted Code to make VC happy - -2009-03-08 Martin Gieseking - - * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h: - added missing background color handler - - * NEWS, README, src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/DvisvgmSpecialHandler.cpp, src/EmSpecialHandler.cpp, src/Makefile.am, - src/TpicSpecialHandler.cpp: - added bgcolor support, updated homepage, fixed color handler bug - -2009-03-06 Martin Gieseking - - * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: - implemented splines of tpic specials - - * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: - implemented arc drawing of tpic special set - -2009-03-03 Martin Gieseking - - * doc/dvisvgm.txt.in, src/DvisvgmSpecialHandler.cpp, - src/DvisvgmSpecialHandler.h: - minor code improvements; comments added - - * doc/Makefile.am, doc/dvisvgm.txt.in, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/DvisvgmSpecialHandler.cpp, - src/DvisvgmSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, - src/SpecialActions.h: - implemented the dvisvgm specials raw, image, and bbox - - * src/BoundingBox.cpp, src/BoundingBox.h, src/Color.cpp, - src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DVIActions.h, - src/DVIBBoxActions.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/EmSpecialHandler.cpp, - src/Makefile.am, src/SpecialActions.h, src/SpecialHandler.h, - src/TpicSpecialHandler.cpp: - improved computation of the bounding box (works with specials now); - added dummy function for background color assignments - -2009-02-26 Martin Gieseking - - * doc/Makefile.am, doc/dvisvgm.txt.in: - improved manpage - - * doc/Makefile.am, doc/dvisvgm.txt, doc/dvisvgm.txt.in: - removed generated file, added dvisvgm.txt.in - -2009-02-25 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/DvisvgmSpecialHandler.cpp, src/EmSpecialHandler.cpp, - src/SpecialActions.h, src/TpicSpecialHandler.cpp: - renamed appendInPage() to appendToPage - -2009-02-24 Martin Gieseking - - * NEWS, doc/dvisvgm.1.in, src/TpicSpecialHandler.cpp: - few additions to tpic handler - - * NEWS, src/Color.cpp, src/Color.h, src/DVIToSVGActions.cpp, - src/Makefile.am, src/Pair.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.cpp, - src/TpicSpecialHandler.h: - first tpic implementations; not complete yet - - * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/DVIToSVGActions.cpp, src/DvisvgmSpecialHandler.cpp, - src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, - src/EmSpecialHandler.h, src/HtmlSpecialHandler.h, src/Makefile.am, - src/SpecialColorHandler.cpp, src/SpecialColorHandler.h, - src/SpecialDvisvgmHandler.cpp, src/SpecialDvisvgmHandler.h, - src/SpecialEmHandler.cpp, src/SpecialEmHandler.h, src/SpecialHandler.h, - src/SpecialHtmlHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/tests/ColorSpecialTest.h: - improved SpecialHandler is now able to handle unprefixed specials - -2009-02-23 Martin Gieseking - - * NEWS, configure.ac, doc/dvisvgm.1.in, src/DVIBBoxActions.h, - src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/FontEmitter.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/XMLNode.cpp, - src/XMLNode.h, src/dvisvgm.cpp, src/options.ggo, - src/tests/ColorSpecialTest.h: - added option --no-fonts wich uses path elements instead of fonts - -2009-02-20 Martin Gieseking - - * NEWS, doc/dvisvgm.1.in, src/Color.cpp, src/Color.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, - src/SpecialActions.h, src/SpecialColorHandler.cpp, - src/SpecialDvisvgmHandler.cpp, src/SpecialDvisvgmHandler.h, - src/SpecialEmHandler.cpp, src/SpecialEmHandler.h, - src/SpecialHtmlHandler.h, src/VerbSpecialHandler.cpp, - src/VerbSpecialHandler.h: - fixed bug in color handler, added skeletons of dvisvgm/hyperref special - handlers - -2009-02-18 Martin Gieseking - - * NEWS, src/SpecialActions.h, src/tests/ColorSpecialTest.h: - adapted color test to new interface, added emtex info - - * src/Color.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/Makefile.am, src/SpecialActions.h, src/SpecialColorHandler.cpp, - src/SpecialEmHandler.cpp: - added color support to emTeX specials, removed Color class - -2009-02-17 Martin Gieseking - - * src/DVIReader.cpp: - made DVICommand local to executeCommand, removed unnecessary if - statement - -2009-02-15 Martin Gieseking - - * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, - src/SpecialActions.h, src/SpecialManager.cpp, src/VerbSpecialHandler.cpp, - src/VerbSpecialHandler.h, src/XMLString.cpp, src/XMLString.h: - added special handler for verbatim output - -2009-02-14 Martin Gieseking - - * NEWS, configure.ac: - prepared release of version 0.7 - - * doc/dvisvgm.1.in, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/dvisvgm.cpp, src/options.ggo: - added option --no-style - - * NEWS, configure.ac: - increased version number to 0.6.2, updated NEWS - - * src/dvisvgm.cpp: - fixed incorrect behavior of option -V/--version - - * src/Color.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h: - finished color support - -2009-02-13 Martin Gieseking - - * src/ColorSpecialHandler.cpp, src/Makefile.am, - src/tests/ColorSpecialTest.h: - added tests for ColorSpecialHandler - - * prepare: - updated administrative files - - * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, - src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, - src/SpecialManager.h: - color specials are now processed by DVIToSVGActions, but don't create - any results yet - - * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h: - reverted to previous version, removed dependency on Color class - - * hgauthors, prepare: - added administrative files - - * Makefile.am, configure.ac, src/tests/DirectoryTest.h: - removed rpm support - - * src/types.h: - replaced static definition of sized integers by template program - -2009-02-10 Martin Gieseking - - * src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/Makefile.am: - replaced RGB arrays by Color class - -2009-02-09 Martin Gieseking - - * src/TransformationMatrix.cpp: - made y-coordinate of cmdline-option -t optional - -2009-02-06 Martin Gieseking - - * src/FileFinder.cpp: - changed lookup order of font maps - - * doc/dvisvgm.1.in, src/ColorSpecialHandler.h, src/DVIToSVG.cpp, - src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, - src/dvisvgm.cpp, src/options.ggo: - added option --list-specials that lists all registered special handlers - -2009-02-05 Martin Gieseking - - * src/DVIToSVGActions.cpp: - replaced special ignore list evaluation algorithm - - * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/dvisvgm.cpp, src/options.ggo: - added optional prefix list to commandline option --no-specials - - * src/extract-colors.php: - added php-script that extracts color definitions from color.pro - -2009-02-04 Martin Gieseking - - * src/FontMap.cpp: - added output of font encoding in write method - - * src/FileFinder.cpp: - added option for additional loading of user maps - -2009-02-03 Martin Gieseking - - * map/cork-lm.map: - removed deprecated map subdirectory - - * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp: - option -m/--map-file is now evaluated properly - - * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/SpecialHandler.h, - src/SpecialManager.cpp, src/SpecialManager.h, src/options.ggo: - more color special implementation (color constants), still not ready - -2009-02-02 Martin Gieseking - - * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h: - some refactorings in color handler - - * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/Makefile.am, - src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h: - added special support skeletons; not working yet - - * NEWS, src/FileFinder.cpp: - fixed buggy call of maketfm/makemf in Windows version - -2009-01-30 Martin Gieseking - - * NEWS, src/DVIReader.cpp, src/DVIReader.h: - fixed magnification bug - - * src/dvisvgm.cpp: - prevented writing zero-length svg files; simplified main code by using - auto pointers - -2009-01-29 Martin Gieseking - - * src/FileFinder.cpp: - adapted Windows version to new release - -2009-01-28 Martin Gieseking - - * NEWS, configure.ac, doc/dvisvgm.1.in: - adapted configuration and documentation to new dvips map file support - - * src/FileFinder.cpp, src/FontMap.cpp, src/FontMap.h, - src/tests/FontMapTest.h, src/tests/dvips_test.map: - FontMap now supports dvips and dvipdfm maps - - * src/Calculator.cpp, src/DVIToSVG.cpp, src/FontEncoding.cpp, - src/FontMap.cpp, src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp: - replaced comparisions with "" with calls of empty() - - * src/FontMap.cpp, src/Makefile.am, src/tests/FontMapTest.h, - src/tests/dvipdfm_test.map, src/tests/dvips_test.map: - extensions to FontMap almost complete but not finished yet - - * src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h: - improved GFTracer to support unscaled results - - * src/dvisvgm.cpp: - use new initialisation of FileFinder - - * src/FileFinder.cpp, src/FileFinder.h, src/Makefile.am, - src/tests/DirectoryTest.h, src/tests/FileFinderTest.h, - src/tests/FontManagerTest.h, src/tests/KPSFileFinderTest.h: - refactored FileFinder (implementation as singleton) - -2009-01-27 Martin Gieseking - - * src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFTracer.cpp, - src/GFTracer.h, src/Makefile.am, src/SVGFontTraceEmitter.cpp, - src/SVGFontTraceEmitter.h: - made GFTracer a generic class with template methods - -2009-01-26 Martin Gieseking - - * src/InputBuffer.h: - fixed incompatible types bug - - * src/Bitmap.cpp, src/Bitmap.h, src/GFReader.cpp, src/GFReader.h, - src/GFTracer.cpp, src/Makefile.am: - improvements to GF handling, first skeletton of gf->metapost (gfprint) - -2009-01-25 Martin Gieseking - - * src/FontMap.cpp: - basic dvips font map support, not complete yet - - * src/CharmapTranslator.cpp, src/DVIToSVG.cpp, src/FileFinder.cpp, - src/FileFinder.h, src/Font.cpp, src/FontEncoding.cpp, - src/FontManager.cpp, src/KPSFileFinder.cpp, src/KPSFileFinder.h, - src/Makefile.am, src/MetafontWrapper.cpp, src/TFM.cpp, src/dvisvgm.cpp: - renamed KPSFileFinder to FileFinder - - * src/FontMap.cpp, src/FontMap.h: - started redesign of FontMap, not complete yet - - * src/InputBuffer.cpp, src/InputBuffer.h: - added missing include - -2009-01-23 Martin Gieseking - - * doc/Makefile.am, doc/dvisvgm.1.in: - manpage updates - -2009-01-22 Martin Gieseking - - * configure.ac: - added test whether dvipdfm.map is available - - * doc/dvisvgm.1.in, rpm/dvisvgm.spec.in, src/Bitmap.cpp, src/Bitmap.h, - src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, - src/Calculator.h, src/CharmapTranslator.cpp, src/CharmapTranslator.h, - src/DVIActions.cpp, src/DVIActions.h, src/DVIBBoxActions.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Directory.cpp, - src/Directory.h, src/FileFinder.cpp, src/FileFinder.h, - src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, - src/FontEmitter.h, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, - src/FontInfo.cpp, src/FontInfo.h, src/FontManager.cpp, src/FontManager.h, - src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/InputBuffer.cpp, - src/InputBuffer.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, - src/Makefile.am, src/Makefile.orig, src/Matrix.cpp, src/Matrix.h, - src/Message.cpp, src/Message.h, src/MessageException.h, - src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, - src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, - src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, - src/TFM.cpp, src/TFM.h, src/TransformationMatrix.cpp, - src/TransformationMatrix.h, src/VFActions.h, src/VFReader.cpp, - src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, - src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, - src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/global.cpp, - src/global.h, src/macros.h, src/options.ggo, src/types.h: - updated file header comments - - * src/tests/CalculatorTest.h, src/tests/DirectoryTest.h, - src/tests/FontManagerTest.h, src/tests/FontMapTest.h, - src/tests/KPSFileFinderTest.h, src/tests/PageSizeTest.h, - src/tests/StreamCounterTest.h, src/tests/VectorStreamTest.h: - updated tests - - * Makefile.am, NEWS, README, configure.ac, potracelib/Makefile.am: - updated version info to 0.6 - - * src/KPSFileFinder.cpp: - fixed throwing of COM exception - - * src/DVIReader.cpp, src/FontManager.cpp, src/KPSFileFinder.cpp: - memory leak fixed - - * src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/dvisvgm.cpp: - added support for MiKTeX' new COM interface - - * src/FontMap.cpp: - forgot to remove address operator - -2009-01-21 Martin Gieseking - - * src/Calculator.cpp, src/DVIReader.cpp, src/DVIToSVGActions.cpp, - src/Directory.cpp, src/FontEncoding.cpp, src/FontEngine.cpp, - src/FontManager.cpp, src/FontMap.cpp, src/KPSFileFinder.cpp, - src/MetafontWrapper.cpp, src/PageSize.cpp, src/StreamReader.cpp, - src/TFM.cpp, src/TransformationMatrix.cpp, src/VFReader.cpp, - src/XMLDocument.cpp, src/XMLNode.cpp: - added in/out attributes to parameter documentation - - * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/FontEncoding.cpp, src/FontGlyph.cpp: - fixed bugs in handling of font encodings and virtual fonts - -2009-01-20 Martin Gieseking - - * src/SVGFontEmitter.cpp: - fixed memory bug - - * src/FontEngine.cpp, src/FontEngine.h, src/SVGFontEmitter.cpp: - fixed glyph positioning bug occured in conjunction with font encoding - - * src/DVIReader.cpp, src/DVIToSVG.cpp, src/Font.h, src/FontEncoding.cpp, - src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontGlyph.cpp, src/FontGlyph.h, src/FontManager.cpp, - src/FontManager.h, src/InputBuffer.cpp, src/InputBuffer.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h: - first working version with font encoding support - -2009-01-19 Martin Gieseking - - * src/DVIReader.cpp, src/FontEncoding.cpp, src/FontEncoding.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, - src/FontManager.h, src/FontMap.cpp: - partly working mapping support, but yet too slow - - * src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, - src/FontEngine.h, src/FontManager.cpp, src/FontManager.h, - src/FontMap.cpp, src/FontMap.h, src/KPSFileFinder.cpp, - src/KPSFileFinder.h: - more encoding implementations, not complete yet - -2009-01-16 Martin Gieseking - - * src/TransformationMatrix.cpp: - fixed bug in argument assignment of transformation command M - -2009-01-15 Martin Gieseking - - * src/TransformationMatrix.cpp: - removed a dangerous loop remained from previous code - -2009-01-14 Martin Gieseking - - * src/KPSFileFinder.cpp: - added enc-file support - - * src/dvisvgm.cpp: - updated copyright string - - * src/FileSystem.cpp, src/FileSystem.h: - const string parameters - - * src/FontEncoding.cpp, src/FontEncoding.h, src/InputBuffer.cpp, - src/InputBuffer.h, src/Makefile.am: - added basic skeleton for handling of font encodings - - * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: - updated libpotrace to version 1.8 - -2009-01-13 Martin Gieseking - - * src/CharmapTranslator.cpp: - fixed crash on loading corrupt pfb-files - -2008-06-18 Martin Gieseking - - * src/Makefile.am: - adapted to latest gengetopt version - -2008-04-07 Martin Gieseking - - * src/DVIReader.cpp: - minor change - -2007-03-26 Martin Gieseking - - * src/DVIActions.cpp, src/DVIReader.cpp, src/DVIReader.h, - src/FontManager.cpp, src/tests/FontManagerTest.h: - few minor changes - - * NEWS, src/CharmapTranslator.cpp, src/CharmapTranslator.h, - src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.h, - src/FontManager.cpp, src/Makefile.am, src/SVGFontTraceEmitter.cpp, - src/SVGFontTraceEmitter.h: - redesigned DVIActions and CharmapTranslator - -2007-03-25 Martin Gieseking - - * src/DVIReader.cpp, src/DVIReader.h, src/VFActions.h: - minor fixes - - * src/DVIActions.cpp, src/DVIActions.h, src/DVIBBoxActions.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, - src/FontManager.cpp, src/FontManager.h, src/StreamReader.cpp, - src/StreamReader.h, src/VFActions.h, src/VFReader.cpp, src/VFReader.h, - src/VectorStream.h: - first working version 0.5, release candidate 1 - -2007-03-23 Martin Gieseking - - * src/DVIReader.cpp, src/FontManager.cpp, src/FontManager.h, - src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/VFReader.cpp: - more vf implementations, not complete yet - -2007-03-22 Martin Gieseking - - * src/DVIReader.cpp, src/Font.cpp, src/Font.h, src/FontManager.cpp, - src/VFActions.h, src/VFReader.cpp, src/VFReader.h: - more vf implementations - - * NEWS, doc/Makefile.in, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/FileSystem.cpp, src/FileSystem.h, - src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile.am, - src/dvisvgm.cpp, src/tests/DirectoryTest.h, src/tests/FontManagerTest.h: - reintegrated font map initialization into KPSFileFinderm adapted some - tests - -2007-03-21 Martin Gieseking - - * src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/dvisvgm.cpp: - implemented options -n and -m - - * src/Directory.cpp, src/Directory.h, src/KPSFileFinder.cpp, - src/KPSFileFinder.h, src/dvisvgm.cpp: - completed MiKTeX font map file look-up, fixed bug in Directory class - - * src/Calculator.cpp, src/DVIReader.cpp, src/Directory.cpp, src/Font.h, - src/FontManager.cpp, src/Makefile, src/Makefile.am, src/Makefile.in, - src/MetafontWrapper.cpp, src/VFReader.cpp, src/VectorStream.h, - src/test-all.cpp, src/tests/VectorStreamTest.h: - removed redundant code and commented code fragments, added - VectorInputStream class - - * AUTHORS, Makefile.am, README, potracelib/Makefile.am, - rpm/dvisvgm.spec.in, src/Directory.cpp, src/Directory.h, - src/KPSFileFinder.cpp, src/Makefile, src/Makefile.am, src/Makefile.in, - src/SVGFontTraceEmitter.cpp, src/test-all.cpp, src/tests/DirectoryTest.h: - implemented Directory class for Linux, added DirectoryTest - -2007-03-20 Martin Gieseking - - * src/Directory.cpp, src/Directory.h, src/FileSystem.cpp, src/FontMap.cpp, - src/FontMap.h, src/KPSFileFinder.cpp: - more changes for MiKTeX support - - * NEWS, doc/Makefile, doc/Makefile.in, doc/dvisvgm.1.in, - src/DVIReader.cpp, src/DVIToSVG.cpp, src/Font.cpp, src/Font.h, - src/FontManager.cpp, src/KPSFileFinder.cpp, src/Makefile, - src/Makefile.am, src/Makefile.in, src/VFReader.cpp, src/dvisvgm.cpp, - src/test-all.cpp, src/tests/KPSFileFinderTest.h: - added KPSFileFinderTest, added EmptyFont, fixed compilation error - -2007-03-19 Martin Gieseking - - * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontMap.cpp, - src/FontMap.h, src/KPSFileFinder.cpp: - made sources comaptible with MikTeX - - * src/KPSFileFinder.cpp: - bug fixed, font maps work now - - * src/CharmapTranslator.cpp, src/DVIToSVG.cpp, src/FontManager.cpp, - src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, - src/Makefile.am, src/Makefile.in, src/MetafontWrapper.cpp, src/TFM.cpp: - added mktexFOO support and font map lookups to KPSFileFinder - -2007-03-16 Martin Gieseking - - * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontMap.cpp, - src/FontMap.h, src/KPSFileFinder.cpp, src/Makefile, src/Makefile.am, - src/Makefile.in, src/StreamReader.cpp, src/TFM.cpp, src/options.ggo, - src/tests/FontMapTest.h: - more coding in the font department, not finished yet - -2007-03-09 Martin Gieseking - - * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/Font.cpp, - src/FontInfo.cpp, src/FontManager.cpp, src/GFTracer.cpp, - src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, - src/Makefile.am, src/Makefile.in, src/MetafontWrapper.cpp, - src/MetafontWrapper.h, src/SVGFontTraceEmitter.cpp, - src/SVGFontTraceEmitter.h, src/StreamReader.cpp, src/StreamReader.h, - src/TFM.cpp, src/TFM.h, src/VFReader.cpp, src/VFReader.h, - src/dvisvgm.cpp, src/options.ggo, src/test-all.cpp: - refactorings: extracted StreamReader class, replaced generic FileFinder - support by KPSFileFinder calls - -2007-03-08 Martin Gieseking - - * src/DVIReader.cpp, src/DVIToSVGActions.cpp, src/Font.h, src/Makefile, - src/Makefile.am, src/Makefile.in, src/Makefile.orig, src/VFActions.h, - src/VFReader.cpp, src/VFReader.h, src/dvisvgm.cpp: - plugged VFReader and its actions into the code (not usable yet) - - * src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, src/Font.cpp, src/Font.h, - src/Makefile.orig, src/StreamCounter.h, src/dvisvgm.cpp: - fixed memory bug - - * doc/dvisvgm.1, src/FontEngine.h, src/Makefile.orig, src/dvisvgm.cpp, - src/tests/FontManagerTest.h: - minor changes - - * COPYING, Makefile, Makefile.am, Makefile.in, Martins_svg_neu.svg, NEWS, - aclocal.m4, cmdline.c, config.guess, config.h, config.h.in, - config.status, config.sub, configure.ac, depcomp, doc/Makefile, - doc/dvisvgm.1, doc/dvisvgm.1.in, gpl.txt, install-sh, missing, - src/FontManager.cpp, src/FontManager.h, src/Makefile.am, - src/VFReader.cpp, src/tests/FontManagerTest.h, stamp-h1, table.txt: - removed some garbage from the repository, added initial FontManagerTest - - * src/DVIActions.h, src/DVIBBoxActions.h, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, src/FontManager.cpp, - src/FontManager.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, - src/Makefile, src/Makefile.am, src/Makefile.in, src/Message.cpp, - src/dvisvgm.cpp, src/macros.h, src/test-all.cpp: - first unstable version with redesigned font handling - -2007-03-07 Martin Gieseking - - * src/Font.cpp, src/Font.h: - added Font classes (not yet error-free) - -2007-03-06 Martin Gieseking - - * src/DVIReader.h, src/DVIToSVG.cpp, src/FontManager.cpp, - src/FontManager.h: - added FontManager skeleton, fixed bug in makehead - -2007-03-03 Martin Gieseking - - * src/DVIReader.cpp, src/FontManager.cpp, src/VFReader.cpp: - added some more skeleton code - -2007-03-02 Martin Gieseking - - * src/DVIReader.cpp, src/Makefile, src/Makefile.in, src/VFReader.cpp, - src/VFReader.h, src/options.ggo: - added skeleton of VFReader - -2007-01-10 Martin Gieseking - - * INSTALL, Makefile.am, NEWS, README, configure.ac, doc/Makefile, - doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, - gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, - gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, - gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, - gzstream/version, map/cork-lm.map, mkwindist.pl, potracelib/Makefile.am, - potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h, - rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, rpm/dvisvgm.spec, - rpm/dvisvgm.spec.in: - moved sources - -2007-01-09 Martin Gieseking - - * map/cork-lm.map, rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, - rpm/dvisvgm.spec, rpm/dvisvgm.spec.in: - moved files to trunk - - * INSTALL, Makefile.am, NEWS, README, configure.ac, doc/Makefile, - doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, - gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, - gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, - gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, - gzstream/version, mkwindist.pl, potracelib/Makefile.am, - potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, - potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, - potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, - potracelib/progress.h, potracelib/trace.c, potracelib/trace.h, - rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, rpm/dvisvgm.spec, - rpm/dvisvgm.spec.in, src/A, src/Bitmap.cpp, src/Bitmap.h, - src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, - src/Calculator.h, src/CharmapTranslator.cpp, src/CharmapTranslator.h, - src/DVIActions.h, src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, - src/DVIBBoxReader.h, src/DVIReader.cpp, src/DVIReader.h, - src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, - src/DVIToSVGActions.h, src/FileFinder.cpp, src/FileFinder.h, - src/FileSystem.cpp, src/FileSystem.h, src/FontEmitter.h, - src/FontEngine.cpp, src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, - src/FontInfo.cpp, src/FontInfo.h, src/FontMap.cpp, src/FontMap.h, - src/FontTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, - src/GFTracer.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, - src/Makefile.am, src/Makefile.in, src/Makefile.orig, src/Matrix.cpp, - src/Matrix.h, src/Message.cpp, src/Message.h, src/MessageException.h, - src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, - src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, - src/StreamCounter.h, src/TFM.cpp, src/TFM.h, - src/TransformationMatrix.cpp, src/TransformationMatrix.h, - src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, - src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, - src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp, src/getopt.c, - src/getopt.h, src/getopt1.c, src/global.cpp, src/global.h, - src/gzstream.cpp, src/gzstream.h, src/macros.h, src/miktex-core.def, - src/miktex-kps.def, src/miktex-kps.h, src/options.ggo, src/test-all.cpp, - src/tests/CalculatorTest.h, src/tests/PageSizeTest.h, - src/tests/StreamCounterTest.h, src/types.h: - moved files to trunk subfolder - -2007-01-05 Martin Gieseking - - * Makefile, Makefile.am, Makefile.in, README, config.status, configure.ac, - potracelib/Makefile.am, potracelib/bitops.h, potracelib/flate.c, - potracelib/flate.h, src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, - src/BoundingBox.h, src/Calculator.cpp, src/Calculator.h, - src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIActions.h, - src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, - src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, - src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, - src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, - src/KPSFileFinder.h, src/Makefile.am, src/Matrix.cpp, src/Matrix.h, - src/Message.cpp, src/Message.h, src/MessageException.h, - src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, - src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, - src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, - src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, - src/StreamCounter.h, src/TFM.cpp, src/TFM.h, - src/TransformationMatrix.cpp, src/TransformationMatrix.h, - src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, - src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, - src/dvisvgm.cpp, src/global.cpp, src/global.h, src/macros.h, - src/test-all.cpp, src/types.h: - minor modifications - -2007-01-03 Martin Gieseking - - * configure: - removed configure from repository - - * Makefile, Makefile.am, Makefile.in, config.h, config.h.in, - config.status, configure, configure.ac, doc/Makefile, - potracelib/Makefile.am, potracelib/auxiliary.h, potracelib/bitmap.h, - potracelib/bitops.h, potracelib/curve.c, potracelib/curve.h, - potracelib/decompose.c, potracelib/decompose.h, potracelib/flate.c, - potracelib/flate.h, potracelib/lists.h, potracelib/potracelib.c, - potracelib/potracelib.h, potracelib/progress.h, potracelib/trace.c, - potracelib/trace.h, src/Makefile, src/Makefile.am, src/Makefile.in: - added potracelib to distribution - - * NEWS, mkwindist.pl, src/KPSFileFinder.cpp: - updated homepage - -2006-12-31 Martin Gieseking - - * src/KPSFileFinder.cpp: - fixed namepsace bug - - * Makefile, config.status, configure, configure.ac, doc/Makefile, - doc/dvisvgm.1, src/FileSystem.cpp, src/FontEngine.cpp, - src/KPSFileFinder.cpp, src/Makefile, src/dvisvgm.cpp, src/test-all.cpp: - some minor fixes - - * NEWS, configure.ac, src/DVIToSVG.cpp, src/FileSystem.cpp, - src/FontEngine.cpp, src/GFTracer.cpp, src/KPSFileFinder.cpp, - src/Makefile.orig, src/Matrix.h, src/Message.cpp, src/PageSize.cpp, - src/TransformationMatrix.cpp, src/dvisvgm.cpp: - updated to MikTeX 2.5 support - -2006-08-01 Martin Gieseking - - * configure.ac: - enabled svn keyword expansion - - * Makefile, Makefile.in, NEWS, aclocal.m4, autom4te.cache/output.0, - autom4te.cache/requests, autom4te.cache/traces.0, config.h, config.log, - config.status, configure, configure.ac, doc/Makefile, doc/Makefile.in, - doc/dvisvgm.1, src/FontEngine.cpp, src/Makefile, src/Makefile.in, - src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp: - added support for freetype version >= 2.1.1 - -2006-04-12 Martin Gieseking - - * src/lshort-cm.dvi, src/lshort-cm.svg, src/lshort-cm.svgz, - src/lshort.dvi, src/lshort.svg, src/lshort.svgz: - removed files that need not be version controlled - - * src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, - src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, - src/CharmapTranslator.h, src/DVIActions.h, src/DVIBBoxActions.h, - src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, src/DVIReader.cpp, - src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, - src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, - src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, - src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, - src/KPSFileFinder.h, src/Message.cpp, src/Message.h, - src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, - src/PSObject.cpp, src/PSObject.h, src/PageSize.cpp, src/PageSize.h, - src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, - src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, - src/StreamCounter.h, src/TFM.cpp, src/TFM.h, - src/TransformationMatrix.cpp, src/TransformationMatrix.h, - src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, - src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, - src/dvisvgm.cpp, src/global.cpp, src/global.h, src/macros.h, - src/test-all.cpp, src/tests/CalculatorTest.h, src/tests/PageSizeTest.h, - src/tests/StreamCounterTest.h, src/types.h: - changed keyword tags - - * COPYING, INSTALL, Makefile, Makefile.am, Makefile.in, - Martins_svg_neu.svg, NEWS, README, aclocal.m4, autom4te.cache/output.0, - autom4te.cache/requests, autom4te.cache/traces.0, cmdline.c, - config.guess, config.h, config.h.in, config.log, config.status, - config.sub, configure, configure.ac, depcomp, doc/Makefile, - doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, - gpl.txt, gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, - gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, - gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, - gzstream/version, install-sh, map/cork-lm.map, missing, mkwindist.pl, - src/A, src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, - src/BoundingBox.h, src/Calculator.cpp, src/Calculator.h, - src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIActions.h, - src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, - src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, - src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, - src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, - src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, - src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, - src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, - src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, - src/KPSFileFinder.h, src/Makefile, src/Makefile.am, src/Makefile.in, - src/Makefile.orig, src/Matrix.cpp, src/Matrix.h, src/Message.cpp, - src/Message.h, src/MessageException.h, src/MetafontWrapper.cpp, - src/MetafontWrapper.h, src/PSInterpreter.cpp, src/PSInterpreter.h, - src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, src/PSState.h, - src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/SVGFontEmitter.cpp, - src/SVGFontEmitter.h, src/SVGFontTraceEmitter.cpp, - src/SVGFontTraceEmitter.h, src/StreamCounter.h, src/TFM.cpp, src/TFM.h, - src/TransformationMatrix.cpp, src/TransformationMatrix.h, - src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, - src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, - src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp, src/getopt.c, - src/getopt.h, src/getopt1.c, src/global.cpp, src/global.h, - src/gzstream.cpp, src/gzstream.h, src/lshort-cm.dvi, src/lshort-cm.svg, - src/lshort-cm.svgz, src/lshort.dvi, src/lshort.svg, src/lshort.svgz, - src/macros.h, src/miktex-core.def, src/miktex-kps.def, src/miktex-kps.h, - src/options.ggo, src/test-all.cpp, src/tests/CalculatorTest.h, - src/tests/PageSizeTest.h, src/tests/StreamCounterTest.h, src/types.h, - stamp-h1, table.txt: - initial import - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/INSTALL b/Build/source/texk/dvisvgm/dvisvgm-1.11/INSTALL deleted file mode 100644 index a4b34144dcf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/INSTALL +++ /dev/null @@ -1,229 +0,0 @@ -Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/LGPL-2.1.txt b/Build/source/texk/dvisvgm/dvisvgm-1.11/LGPL-2.1.txt deleted file mode 100644 index 602bfc94635..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/LGPL-2.1.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.11/Makefile.am deleted file mode 100644 index b219497ebca..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## This file is part of dvisvgm -## Copyright (C) 2005-2015 Martin Gieseking -## -## Process this file with automake. - -AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = COPYING LGPL-2.1.txt -SUBDIRS = clipper xxHash src tests doc - -if CODE_COVERAGE_ENABLED -lcov_dir=$(top_builddir)/lcov -lcov_file=$(lcov_dir)/lcov.info - -lcov-report: - @mkdir -p $(lcov_dir) - lcov --capture --directory . --no-external -o $(lcov_file) - lcov --remove $(lcov_file) "gzstream.*" -o $(lcov_file) - genhtml --title "dvisvgm" --num-spaces 2 --legend -o $(lcov_dir) $(lcov_file) - -lcov-clean: - @rm -rf $(lcov_dir) - @find . -name "*.gcda" -exec rm {} \; - lcov --zerocounters --directory . - -coverage: lcov-clean check lcov-report -endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/NEWS b/Build/source/texk/dvisvgm/dvisvgm-1.11/NEWS deleted file mode 100644 index e3c2998d6da..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/NEWS +++ /dev/null @@ -1,425 +0,0 @@ -dvisvgm-1.11 (2015-09-21) -- improved mapping of unknown characters to Unicode -- improved handling of text elements in conjunction with \specials (patch by Till Tantau) -- fixed an issue that could lead to (invalid) U+0000 codepoints -- prevent creating invalid XML by quoting xlink:title attributes properly -- documentation: updated links to new website address - -dvisvgm-1.10 (2015-07-15) -- added support for the new XDV format 6 created by XeTeX 0.99992 -- improved mapping of PostScript character names to Unicode points - -dvisvgm-1.9.2 (2015-04-08) -- avoid retracing of fonts if option --no-fonts and --trace-all=y are given -- skip tracer messages if no glyphs have been traced -- extended the build system to generate code coverage reports -- improved some tests of the test suite -- some general code refactorings and improvements - -dvisvgm-1.9.1 (2015-02-28) -- extended --output pattern syntax by arithmetic expressions and width specifiers -- improved formatting of manpage -- fixed Clang build issue (patch by Peter Breitenlohner) -- fixed a build issue occurred with old MinGW compilers -- code cleanup and refactorings - -dvisvgm-1.9 (2014-12-29) -- added partial implementation of PostScript operator 'shfill' to create color - gradient fills (supported shading types: free-form triangular, lattice-form - triangular, Coons, and tensor-product patch meshes) -- added options --grad-segments, --grad-overlap, and --grad-simplify to control - the approximation of color gradients -- added option --no-merge to create separate text elements for each character - (patch by Khaled Hosny) -- added a simple progress counter to the EPS to SVG converter -- added opt2cpp.py as a free replacement for my non-free opt2cpp.xsl script - (thanks to Khaled Hosny for the implementation and for providing it for free) -- added lookup of Ghostscript library in the Windows registry -- fixed validity check of DVI files -- fixed interaction of color specials and PostScript color operators -- several code refactorings and improvements - -dvisvgm-1.8.1 (2014-08-29) -- unreferenced clipPath elements are now removed from the SVG files -- fixed side-effects caused by unexpected bop/eop operators in - PS specials (LP bug #1350688) -- few improvements to configure.ac (patches by Khaled Hosny) -- removed redundant code - -dvisvgm-1.8 (2014-07-29) -- added option --clipjoin which tells dvisvgm to compute intersections - of clipping paths itself and not to delegate this task to the SVG renderer -- added option --relative to create relative rather than absolute path commands -- added evaluation of PS operator 'clippath' which copies the current clipping - path into the graphics path -- fixed PS operator 'show' to prevent the creation of unintended path overlays -- fixed memory leak in class FontEngine (patch by Khaled Hosny) -- fixed unintended throwing of a DVIException when dvisvgm is called with - option --list-specials -- Cygwin builds of dvisvgm now look for the proper filename of the Ghostscript DLL - -dvisvgm-1.7 (2014-06-18) -- all DVI files are pre-processed now to allow the implementation of - advanced features that rely on data not available on the pages being - converted -- added support for internal hyperref links across pages -- added \special command dvisvgm:rawdef to insert raw SVG fragments to - the section -- added the new \special commands dvisvgm:rawset, dvisvgm:endrawset, and - dvisvgm:rawput to assign and access a sequence of SVG fragments via an - identifier (LP feature request #1215878) -- removed redundant elements from SVG files -- fixed support of external fonts containing characters not mapped by the - embedded unicode tables (LP bug #1276689) -- fixed incorrect extent values shown in conjunction with the preview package -- many refactorings and code improvements - -dvisvgm-1.6 (2014-04-22) -- added option --zoom to "visually" scale the generated SVG graphics while - preserving the original size and position values of the graphic objects -- extended argument syntax of option --linkmark to allow to select the - box/line color -- changed default link marker from 'line' to 'box' -- changed link markers to be only split on line breaks while extended in all - other cases -- if libgs is not directly linked to the binary, dvisvgm now looks for - libgs.so.X instead of libgs.so (supported GS ABIs: X = 7, 8, 9) -- removed time stamp and machine triplet from generated SVG files -- some code improvements and refactorings - -dvisvgm-1.5.3 (2014-04-11) -- improved positioning of PostScript graphics -- fixed positioning of DVI rules/rectangles -- switched internal computations from TeX points (pt) to PostScript points (bp) - -dvisvgm-1.5.2 (2014-01-10) -- fixed handling of global font colors and color specials -- several code improvements - -dvisvgm-1.5.1 (2013-10-29) -- fixed processing of bounding box data created by the preview package -- fixed processing of font definitions across DVI pages -- fixed compilation issues occurred if processing of PS specials is disabled -- don't print the logical page number if it's equal to the physical one -- some minor code improvements - -dvisvgm-1.5 (2013-09-02) -- added support for DVI format 3 as created by pTeX in vertical/tate mode -- added support for DVI format 5 (XDV) as created by XeTeX -- replaced numeric entity references by corresponding UTF-8 characters in - generated SVG files -- added px unit to font-size attributes as used in the stylesheet section - to ensure correct computation of font sizes (LP bug #1215857) -- various code refactorings - -dvisvgm-1.4 (2013-08-02) -- added basic support for CMap files and CID-based fonts -- added character mapping from CIDs to char codes based on the encoding tables of a non-CID font -- added support for OTF fonts -- added evaluation of bounding box data generated by the preview package -- extended option --linkmark to mark hyperlinked areas with an arbitrary background color -- PS handler: improved evaluation of PS header specials -- PS handler: improved evaluation of operator 'show' -- removed DOCTYPE declaration from generated SVG files -- removed encoding attribute from xml declaration (replaces ISO-8859-1 with UTF-8) -- various code improvements and refactorings - -dvisvgm-1.3 (2013-05-13) -- added support for hyperref specials -- added command-line option --linkmarker to select the way how to mark hyperlinked areas -- dvisvgm builds for MiKTeX now try to access the Ghostscript DLL provided by MiKTeX so that - it's no longer necessary to install Ghostscript separately -- improved the handling of TFM files to avoid failures in case of malformed files -- added evaluation of Japanese Font Metric (JFM) files -- the bundled potrace library has been removed from the source tarball as it's easy to build - the latest releases from the original sources available at http://potrace.sourceforge.net -- several code refactorings - -dvisvgm-1.2.2 (2013-04-26) -- fixed a bug that prevented the lookup of fontmap files -- avoid throwing an exception but print a warning message if MiKTeX is not available -- print a warning message if PostScript specials are found but ignored -- added information about "dvisvgm -E" to the --help text and to the manpage -- various code refactorings and cleanups - -dvisvgm-1.2.1 (2013-04-09) -- updated bundled potrace library to version 1.11 -- avoid building bundled potracelib if system library is present (patch by Alexis Ballier) -- allow background color specials to create white background rectangles -- code refactorings and cleanup - -dvisvgm-1.2 (2013-03-01) -- PostScript handler: added support of tiling patterns -- PostScript handler: added support for EPS files with binary headers/footers -- added option --eps to directly convert EPS files to SVG -- added option --precision to select the number of decimal places used in the generated SVG files -- added an optional argument to --help to choose a display variant -- fixed the text alignment of the --help output -- improved handling of PostScript operator "show" -- choose the correct output location if the input file argument contains path specifiers (Windows only) - -dvisvgm-1.1 (2013-01-22) -- added evaluation of pdf:mapline and pdf:mapfile specials -- added evaluation of subfont file definitions (.sfd files) -- added support for TTC (TrueType collection) fonts -- added evaluation of font style parameters given in a font map definition -- renamed option --map-file to --fontmap -- the new option --fontmap allows multiple mapfile arguments and optional mode specifiers -- if a PostScript error occurs, dvisvgm prints an error message together with the - PS operand stack, as generated by Ghostscript -- if font checksums don't match, dvisvgm prints a warning now -- avoid throwing exceptions if referenced encoding files are not available -- added support for 64bit Windows builds -- removed compilation error when using a C++11 compiler (patch by Peter Breitenlohner) -- some code refactorings and improvements - -dvisvgm-1.0.12 (2012-09-27) -- print a message if the processing of PostScript specials is disabled -- the resulting SVG is now scaled to bp ("big point" units) properly -- added the evaluation of PS operators rectclip, rectfill, and rectstroke -- ignore dvips operator bop if present in a PS special -- fixed processing of special strings that contain newline characters - -dvisvgm-1.0.11 (2012-03-09) -- added Ghostscript to library list printed by --version=yes -- fixed a bug in the number parser that could lead to displaced objects (SF bug #3471097) -- corrected the computation of bounding boxes of DVI rules (lp bug #948713) -- improved code compatibility to make dvisvgm compile with clang++ (patch by Vladimir Lomov) -- fixed formatting issues in the manual page -- updated information about bug reporting (tracker moved to Launchpad) - -dvisvgm-1.0.10 (2011-12-18) -- introduced environment variable DVISVGM_COLORS to allow user-defined message colors -- fixed linking issue concerning libfreetype -- fixed potential clashes of character IDs - -dvisvgm-1.0.9 (2011-10-13) -- fixed segfault occurred in TeX Live Win32 caused by mf.exe being unavailable - (thanks to Akira Kakuto for tracking down the issue) -- updated bundled potrace library to version 1.10 -- some minor code improvements - -dvisvgm-1.0.8 (2011-05-31) -- PS handler: added evaluation of PS operators save, restore, and grestoreall -- PS handler: fixed potential segfault caused by invisible zero-length paths -- fixed computation of current drawing position influenced by PS and DVI actions -- don't stop Metafont conversions on errors any longer in order to convert - buggy MF fonts properly - -dvisvgm-1.0.7 (2011-05-06) -- improved overall handling of PS specials -- fixed broken PS special subset 'ps::' -- fixed scaling of PS line properties (width, dash distance, etc.) -- fixed semantics of TPIC special 'ip' (doesn't draw polygon outlines any longer) - -dvisvgm-1.0.6 (2011-04-21) -- fixed segfault occurred if a (malformed) DVI file calls set_char/put_char - without preceding font definition -- added CTRL-C handler -- MiKTeX support updated to version 2.9 -- some code refactorings - -dvisvgm-1.0.5 (2011-03-01) -- added optional integer argument to option -n to disable generation of elements -- added missing unit to width/height attributes of svg root element (SF bug #3185773) -- added integrity check to font cache files -- updated bundled potrace library to version 1.9 -- fixed a couple of minor issues - -dvisvgm-1.0.4 (2010-12-18) -- added missing line width/dash pattern scaling to PS handler -- fixed scaling issue in PS positioning -- fixed compilation issue related to FreeType 2.4.0 - -dvisvgm-1.0.3 (2010-08-06) -- applied some more portability patches for TeX Live -- fixed a potential memory issue -- fixed a transformation issue regarding special 'psfile' (SF bug #3037372) - -dvisvgm-1.0.2 (2010-06-22) -- applied latest TeX Live portability patches sent by Peter Breitenlohner and Karl Berry -- fixed a potrace name clash occurred on Mac OS X Tiger -- fixed putchar() name clash occurred on Solaris -- fixed a couple of conversion warnings -- updated the test suite - -dvisvgm-1.0.1 (2010-06-11) -- fixed a memory issue in the PS handler that could lead to a segfault (SF bug #3013392) -- fixed a recursion issue in the PS handler -- suppress ANSI color code when terminating - -dvisvgm-1.0 (2010-06-08) -- conversion of multiple pages (must be enabled explicitly, see option --pages) -- added transparency support to the PS handler -- improved conversion results of the PS handler -- added support for computation of local bounding boxes -- optional colorization of dvisvgm messages (option --color) -- improved progress indicator (option --progress) -- a couple of improvements of the build system - -dvisvgm-0.9.1 (2010-04-23) -- CSS style definitions omit unnecessary fonts now -- SVG validity was broken when using font elements -- fixed two memory issues that could lead to segfaults - -dvisvgm-0.9 (2010-03-25) -- added option --exact and corresponding algorithms to compute the exact - bounding boxes of characters -- added option --keep that prevents deleting temporary font files -- extended option --trace-all by an optional boolean argument controlling - the re-tracing of glyphs -- fixed bug in evaluation of embedded PS headers -- several code refactorings - -dvisvgm-0.8.8 (2010-02-02) -- added option --libgs and evaluation of environment variable LIBGS - to overwrite the expected file name of the GS shared library - (only available if dvisvgm isn't linked against libgs and GS support - isn't completely disabled) -- option --bbox can now be used to enlarge the minimal bounding box by - a given amount -- fixed bug in evaluation of option --page -- applied patches sent by Peter Breitenlohner to prepare the integration of - dvisvgm into TeX Live -- some code refactorings - -dvisvgm-0.8.7 (2009-11-09) -- fixed a bounding box issue concerning italic corrections -- PS handler: zero-length paths are now drawn as dots -- PS handler: fixed a path positioning issue -- PS handler: colors set by color specials are now considered properly -- added macro {?nl} to be used with special dvisvgm:raw - -dvisvgm-0.8.6 (2009-10-13) -- renamed command-line option --bbox-format to --bbox -- option --bbox can now be used to set an arbitrary bounding box -- added the two special variants "dvisvgm:bbox abs" and "dvisvgm:bbox fix" -- PS clipping path sequences and intersections are now handled correctly -- fixed a PS bounding box bug -- fixed a couple of PS positioning issues reported by John Bowman -- fixed a bit shift overflow in the font tracer occurred on 64-bit systems - -dvisvgm-0.8.5 (2009-10-01) -- added an optional depth parameter to special dvisvgm:raw -- updated the man page -- added LGPL license text needed for the gzstream wrapper classes - -dvisvgm-0.8.4 (2009-09-17) -- improved the command-line parser to be more POSIX-compliant -- added a simple progress indicator for time-consuming special operations -- option --cache prints more information about the cached fonts -- fixed a clipping bug in the PostScript handler - (thanks to John Bowman for also providing a patch for this issue) -- fixed a bug in computation of the PS bounding box -- fixed a memory bug in the GF tracer module - -dvisvgm-0.8.3 (2009-08-28) -- added basic evaluation of the PostScript "show" operator - (handles PSTricks Type 3 fonts properly now) -- improved checks for Ghostscript and potrace library in configure script -- external Ghostscript and potrace development files are used if available -- PostScript header/prologue files are now loaded regardless of converted page -- replaced command-line option variant --cache=? by --cache - -dvisvgm-0.8.2 (2009-08-24) -- changed license of dvisvgm to GPL version 3 or later -- replaced getopt-based command-line parser by own implementation - in order to simplify future internationalizations -- fixed memory bug in fontmap reader - -dvisvgm-0.8.1 (2009-08-02) -- added evaluation of more psfile parameters -- fixed computation of bounding box in psfile special -- fixed compilation errors and a conversion bug occurred on x64 systems - -dvisvgm-0.8 (2009-07-27) -- experimental evaluation of PostScript specials has been added (requires - a recent version of the Ghostscript shared library libgs.so or gsdll32.dll) -- several code improvements and refactorings -- fixed compilation bug occurred when using GCC 4.4.x - -dvisvgm-0.7.3 (2009-04-24) -- fixed bug in font map reader that could cause a segmentation fault -- fixed bug in creation of shorthand path drawing commands -- fixed bug in TPIC special handler - -dvisvgm-0.7.2 (2009-04-02) -- font caching has been added (speeds up embedding of bitmap fonts) -- added option --trace-all that enables tracing of all glyphs of all - bitmap fonts used in the current DVI file. Even glyphs that are currently - not needed are considered. This avoids multiple calls of Metafont for the - same fonts. In combination with the new caching functionality this can - drastically increase the speed of successive dvisvgm calls. -- if option --no-fonts is used, all glyph sizes are now computed correctly -- use shorthand path commands in SVG fonts if possible - -dvisvgm-0.7.1 (2009-03-09) -- evaluation of a subset of emTeX specials has been added -- specials for embedding of raw SVG snippets have been added -- evaluation of TPIC specials has been added -- added background color support -- added option -n, --no-fonts that replaces fonts by paths - (enables applications w/o SVG font support to render dvisvgm's output properly) -- moved defs to top of SVG file to make Firefox's SVG renderer happy -- fixed bug in color handler - -dvisvgm-0.7 (2009-02-16) -- basic support for evaluation of specials has been added -- evaluation of color specials has been added -- renamed command-line option -S to --no-specials and inverted previous behavior -- selected special sets can be disabled by optional arguments to --no-specials - (currently only color specials) -- added option --no-style (see manpage for further details) -- added optional '+' flag to option --map-file (see manpage for further details) -- fixed \magnificaton bug (dvi magnification factor is now applied properly) -- fixed buggy call of maketfm/makemf in Windows/MiKTeX version -- fixed buggy evaluation of command-line argument -m/--map-file -- several internal code improvements - -dvisvgm-0.6.1 (2009-01-29) -- added support for dvips map files -- removed dependency on dvipdfm's map file (now ps2pk.map, psfonts.map or dvipdfm.map is used by default) -- fixed compilation bug #2535497 -- some internal refactorings - -dvisvgm-0.6 (2009-01-23) -- added support for varying font encodings -- updated MiKTeX support using its COM interface -- fixed incomplete handling of nested virtual fonts -- fixed a font handling bug that could cause segmentation faults -- fixed bug in matrix transformation code -- updated bundled potrace library to version 1.8 - -dvisvgm-0.5 (2007-03-26) -- redesigned and improved font handling -- added support for virtual fonts -- evaluation of dvipdfm's map file to find font files with differing - names (e.g. cork-lmr10 => lmr10) -- automatic invocation of mktexmf etc. in case of missing font files (tfm, mf) -- command-line option -m has been renamed to -M -- added command-line options -m/--map-file and -n/--no-mktexmf -- memory bug in StreamCounter class has been fixed -- added sources of Peter Selinger's potrace library (part of potrace, http://potrace.sourceforge.net) - to simplify the build process - -dvisvgm-0.4.3 (2007-01-03) -- problem with changed freetype API (freetype version >= 2.2.1) has been fixed -- updated MiKTeX support to version 2.5 -- minor code improvements -- some unit tests based on CxxTest (http://cxxtest.sourceforge.net) have been added - -dvisvgm-0.4.2 (2005-09-22) -- added SVG transformation options -- some bugfixes in command line frontend and TFM handling -- code refactorings to improve modularity and extensibility - -dvisvgm-0.4.1 (2005-09-02) -- added option -b to specify the bounding box -- added a manual page - -dvisvgm-0.4 (2005-08-24) -- Added a glyph tracing module that vectorizes Metafont's bitmap output - if no corresponding Type 1 font file is available. - -dvisvgm-0.3 (2005-08-10) -- Initial public release with basic conversion functionality. diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/README b/Build/source/texk/dvisvgm/dvisvgm-1.11/README deleted file mode 100644 index 0420c2fd68f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/README +++ /dev/null @@ -1,117 +0,0 @@ -dvisvgm -- A DVI to SVG converter - -DESCRIPTION - - dvisvgm is a utility for TeX/LaTeX users. It converts DVI and EPS files to - the XML-based scalable vector graphics format SVG. - - -DEPENDENCIES - - dvisvgm relies on the following free libraries: - * Clipper (http://www.angusj.com/delphi/clipper.php) - To compute the intersections of two curved paths, dvisvgm flattens the paths - to polygons, intersects them using Clipper, and reconstructs the curves - afterwards. - - * FreeType 2 (http://www.freetype.org) - This library is used to extract the glyph outlines from vector fonts - (PFB, OTF, TTF). - - * Ghostscript (http://www.ghostscript.com) - The PostScript special handler requires the Ghostscript library - libgs.so (Linux) or gsdll32.dll/gsdll64.dll (Windows) to be installed. - If the configure script finds the corresponding Ghostscript development - files on the system, it directly links against libgs.so.N, where N is the - library's ABI version. Otherwise, the library is looked up at runtime, - and PostScript support is enabled only if libgs.so can be found. Due to - incompatible changes of the Ghostscript API, dvisvgm requires Ghostscript 8.31 - or later. - - * kpathsea (https://tug.org/kpathsea) - This library is part of the Web2C package and is usually installed in - conjunction with a TeX distribution. kpathsea provides functions for - searching files in the large texmf tree. Please ensure that you use the - kpathsea version coming with or matching your TeX system. - - * potracelib (http://potrace.sourceforge.net) - Peter Selinger's bitmap tracing library is utilized to vectorize Metafont's - bitmap output. - - * xxHash (https://github.com/Cyan4973/xxHash) - The xxHash library provides a fast hash algorithm. dvisvgm uses it to - create unique integer values from PostScript character names in order to - store them in a compact way together with their Unicode points. A recent - version of xxHash is bundled with the dvisvgm sources. - - * zlib (http://www.zlib.org) - Compressed SVG files are produced by using functions of this library and the - Gzstream wrapper classes (http://www.cs.unc.edu/Research/compgeom/gzstream) - which are licensed under LGPL version 2.1 (or optionally any later version) - and should be included with this package. - - If you want to build and run the test suite located in the tests subdirectory, - you also need the googletest libraries (http://code.google.com/p/googletest). - - -COMPILATION - - Quick installation info: - * type "./configure" - * type "make" - * type "make install" as root (or "sudo make install") - - For generic configuration instructions see the file INSTALL. - - The configure script should recognize all necessary parameters. - If a library is installed but not detected, specify its location - as commandline parameter of configure, e.g. - ./configure --with-freetype=/usr/local/freetype - (all available options can be displayed with ./configure --help) - - The tracer module calls Metafont in case of lacking TFM or PFB files - via a system call. Please ensure that Metafont is installed and - reachable through the search path. - - If you don't like compiling the sources yourself, you can - download pre-compiled executables for Windows and MiKTeX - from the project website instead (see below). - - -USAGE - Information about the command-line interface and the available options can be - found in the manual page. - - -ADDITIONAL INFORMATION - This package is available from CTAN (dviware/dvisvgm) and can be downloaded - from the project website as well: - - http://dvisvgm.bplaced.net - - Here you can find the sources, pre-compiled binaries and further additional - information about the converter and related topics. - - If you've found a bug, please let me know. You can either send me an email or - preferably use the bug tracker at GitHub (https://github.com/mgieseki/dvisvgm). - - -COPYRIGHT - - Copyright (C) 2005-2015 Martin Gieseking - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as 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 . - - See the file COPYING for details. - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/Makefile.am deleted file mode 100644 index 2da73955400..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -noinst_LIBRARIES = libclipper.a -libclipper_a_SOURCES = clipper.cpp clipper.hpp -AM_CXXFLAGS = -Wall - -clipper.cpp: clipper.hpp - -@CODE_COVERAGE_RULES@ - -CLEANFILES = *.gcda *.gcno diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.cpp deleted file mode 100644 index 89b7e8e683d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.cpp +++ /dev/null @@ -1,4457 +0,0 @@ -/******************************************************************************* -* * -* Author : Angus Johnson * -* Version : 6.2.1 * -* Date : 31 October 2014 * -* Website : http://www.angusj.com * -* Copyright : Angus Johnson 2010-2014 * -* * -* License: * -* Use, modification & distribution is subject to Boost Software License Ver 1. * -* http://www.boost.org/LICENSE_1_0.txt * -* * -* Attributions: * -* The code in this library is an extension of Bala Vatti's clipping algorithm: * -* "A generic solution to polygon clipping" * -* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * -* http://portal.acm.org/citation.cfm?id=129906 * -* * -* Computer graphics and geometric modeling: implementation and algorithms * -* By Max K. Agoston * -* Springer; 1 edition (January 4, 2005) * -* http://books.google.com/books?q=vatti+clipping+agoston * -* * -* See also: * -* "Polygon Offsetting by Computing Winding Numbers" * -* Paper no. DETC2005-85513 pp. 565-575 * -* ASME 2005 International Design Engineering Technical Conferences * -* and Computers and Information in Engineering Conference (IDETC/CIE2005) * -* September 24-28, 2005 , Long Beach, California, USA * -* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * -* * -*******************************************************************************/ - -/******************************************************************************* -* * -* This is a translation of the Delphi Clipper library and the naming style * -* used has retained a Delphi flavour. * -* * -*******************************************************************************/ - -#include "clipper.hpp" -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ClipperLib { - -static double const pi = 3.141592653589793238; -static double const two_pi = pi *2; -static double const def_arc_tolerance = 0.25; - -enum Direction { dRightToLeft, dLeftToRight }; - -static int const Unassigned = -1; //edge not currently 'owning' a solution -static int const Skip = -2; //edge that would otherwise close a path - -#define HORIZONTAL (-1.0E+40) -#define TOLERANCE (1.0e-20) -#define NEAR_ZERO(val) (((val) > -TOLERANCE) && ((val) < TOLERANCE)) - -struct TEdge { - IntPoint Bot; - IntPoint Curr; - IntPoint Top; - IntPoint Delta; - double Dx; - PolyType PolyTyp; - EdgeSide Side; - int WindDelta; //1 or -1 depending on winding direction - int WindCnt; - int WindCnt2; //winding count of the opposite polytype - int OutIdx; - TEdge *Next; - TEdge *Prev; - TEdge *NextInLML; - TEdge *NextInAEL; - TEdge *PrevInAEL; - TEdge *NextInSEL; - TEdge *PrevInSEL; -}; - -struct IntersectNode { - TEdge *Edge1; - TEdge *Edge2; - IntPoint Pt; -}; - -struct LocalMinimum { - cInt Y; - TEdge *LeftBound; - TEdge *RightBound; -}; - -struct OutPt; - -struct OutRec { - int Idx; - bool IsHole; - bool IsOpen; - OutRec *FirstLeft; //see comments in clipper.pas - PolyNode *PolyNd; - OutPt *Pts; - OutPt *BottomPt; -}; - -struct OutPt { - int Idx; - IntPoint Pt; - OutPt *Next; - OutPt *Prev; -}; - -struct Join { - OutPt *OutPt1; - OutPt *OutPt2; - IntPoint OffPt; -}; - -struct LocMinSorter -{ - inline bool operator()(const LocalMinimum& locMin1, const LocalMinimum& locMin2) - { - return locMin2.Y < locMin1.Y; - } -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline cInt Round(double val) -{ - if ((val < 0)) return static_cast(val - 0.5); - else return static_cast(val + 0.5); -} -//------------------------------------------------------------------------------ - -inline cInt Abs(cInt val) -{ - return val < 0 ? -val : val; -} - -//------------------------------------------------------------------------------ -// PolyTree methods ... -//------------------------------------------------------------------------------ - -void PolyTree::Clear() -{ - for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i) - delete AllNodes[i]; - AllNodes.resize(0); - Childs.resize(0); -} -//------------------------------------------------------------------------------ - -PolyNode* PolyTree::GetFirst() const -{ - if (!Childs.empty()) - return Childs[0]; - else - return 0; -} -//------------------------------------------------------------------------------ - -int PolyTree::Total() const -{ - int result = (int)AllNodes.size(); - //with negative offsets, ignore the hidden outer polygon ... - if (result > 0 && Childs[0] != AllNodes[0]) result--; - return result; -} - -//------------------------------------------------------------------------------ -// PolyNode methods ... -//------------------------------------------------------------------------------ - -PolyNode::PolyNode(): Childs(), Parent(0), Index(0), m_IsOpen(false) -{ -} -//------------------------------------------------------------------------------ - -int PolyNode::ChildCount() const -{ - return (int)Childs.size(); -} -//------------------------------------------------------------------------------ - -void PolyNode::AddChild(PolyNode& child) -{ - unsigned cnt = (unsigned)Childs.size(); - Childs.push_back(&child); - child.Parent = this; - child.Index = cnt; -} -//------------------------------------------------------------------------------ - -PolyNode* PolyNode::GetNext() const -{ - if (!Childs.empty()) - return Childs[0]; - else - return GetNextSiblingUp(); -} -//------------------------------------------------------------------------------ - -PolyNode* PolyNode::GetNextSiblingUp() const -{ - if (!Parent) //protects against PolyTree.GetNextSiblingUp() - return 0; - else if (Index == Parent->Childs.size() - 1) - return Parent->GetNextSiblingUp(); - else - return Parent->Childs[Index + 1]; -} -//------------------------------------------------------------------------------ - -bool PolyNode::IsHole() const -{ - bool result = true; - PolyNode* node = Parent; - while (node) - { - result = !result; - node = node->Parent; - } - return result; -} -//------------------------------------------------------------------------------ - -bool PolyNode::IsOpen() const -{ - return m_IsOpen; -} -//------------------------------------------------------------------------------ - -#ifndef use_int32 - -//------------------------------------------------------------------------------ -// Int128 class (enables safe math on signed 64bit integers) -// eg Int128 val1((long64)9223372036854775807); //ie 2^63 -1 -// Int128 val2((long64)9223372036854775807); -// Int128 val3 = val1 * val2; -// val3.AsString => "85070591730234615847396907784232501249" (8.5e+37) -//------------------------------------------------------------------------------ - -class Int128 -{ - public: - ulong64 lo; - long64 hi; - - Int128(long64 _lo = 0) - { - lo = (ulong64)_lo; - if (_lo < 0) hi = -1; else hi = 0; - } - - - Int128(const Int128 &val): lo(val.lo), hi(val.hi){} - - Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){} - - Int128& operator = (const long64 &val) - { - lo = (ulong64)val; - if (val < 0) hi = -1; else hi = 0; - return *this; - } - - bool operator == (const Int128 &val) const - {return (hi == val.hi && lo == val.lo);} - - bool operator != (const Int128 &val) const - { return !(*this == val);} - - bool operator > (const Int128 &val) const - { - if (hi != val.hi) - return hi > val.hi; - else - return lo > val.lo; - } - - bool operator < (const Int128 &val) const - { - if (hi != val.hi) - return hi < val.hi; - else - return lo < val.lo; - } - - bool operator >= (const Int128 &val) const - { return !(*this < val);} - - bool operator <= (const Int128 &val) const - { return !(*this > val);} - - Int128& operator += (const Int128 &rhs) - { - hi += rhs.hi; - lo += rhs.lo; - if (lo < rhs.lo) hi++; - return *this; - } - - Int128 operator + (const Int128 &rhs) const - { - Int128 result(*this); - result+= rhs; - return result; - } - - Int128& operator -= (const Int128 &rhs) - { - *this += -rhs; - return *this; - } - - Int128 operator - (const Int128 &rhs) const - { - Int128 result(*this); - result -= rhs; - return result; - } - - Int128 operator-() const //unary negation - { - if (lo == 0) - return Int128(-hi, 0); - else - return Int128(~hi, ~lo + 1); - } - - operator double() const - { - const double shift64 = 18446744073709551616.0; //2^64 - if (hi < 0) - { - if (lo == 0) return (double)hi * shift64; - else return -(double)(~lo + ~hi * shift64); - } - else - return (double)(lo + hi * shift64); - } - -}; -//------------------------------------------------------------------------------ - -Int128 Int128Mul (long64 lhs, long64 rhs) -{ - bool negate = (lhs < 0) != (rhs < 0); - - if (lhs < 0) lhs = -lhs; - ulong64 int1Hi = ulong64(lhs) >> 32; - ulong64 int1Lo = ulong64(lhs & 0xFFFFFFFF); - - if (rhs < 0) rhs = -rhs; - ulong64 int2Hi = ulong64(rhs) >> 32; - ulong64 int2Lo = ulong64(rhs & 0xFFFFFFFF); - - //nb: see comments in clipper.pas - ulong64 a = int1Hi * int2Hi; - ulong64 b = int1Lo * int2Lo; - ulong64 c = int1Hi * int2Lo + int1Lo * int2Hi; - - Int128 tmp; - tmp.hi = long64(a + (c >> 32)); - tmp.lo = long64(c << 32); - tmp.lo += long64(b); - if (tmp.lo < b) tmp.hi++; - if (negate) tmp = -tmp; - return tmp; -}; -#endif - -//------------------------------------------------------------------------------ -// Miscellaneous global functions -//------------------------------------------------------------------------------ - -bool Orientation(const Path &poly) -{ - return Area(poly) >= 0; -} -//------------------------------------------------------------------------------ - -double Area(const Path &poly) -{ - int size = (int)poly.size(); - if (size < 3) return 0; - - double a = 0; - for (int i = 0, j = size -1; i < size; ++i) - { - a += ((double)poly[j].X + poly[i].X) * ((double)poly[j].Y - poly[i].Y); - j = i; - } - return -a * 0.5; -} -//------------------------------------------------------------------------------ - -double Area(const OutRec &outRec) -{ - OutPt *op = outRec.Pts; - if (!op) return 0; - double a = 0; - do { - a += (double)(op->Prev->Pt.X + op->Pt.X) * (double)(op->Prev->Pt.Y - op->Pt.Y); - op = op->Next; - } while (op != outRec.Pts); - return a * 0.5; -} -//------------------------------------------------------------------------------ - -bool PointIsVertex(const IntPoint &Pt, OutPt *pp) -{ - OutPt *pp2 = pp; - do - { - if (pp2->Pt == Pt) return true; - pp2 = pp2->Next; - } - while (pp2 != pp); - return false; -} -//------------------------------------------------------------------------------ - -int PointInPolygon (const IntPoint &pt, const Path &path) -{ - //returns 0 if false, +1 if true, -1 if pt ON polygon boundary - //See "The Point in Polygon Problem for Arbitrary Polygons" by Hormann & Agathos - //http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.5498&rep=rep1&type=pdf - int result = 0; - size_t cnt = path.size(); - if (cnt < 3) return 0; - IntPoint ip = path[0]; - for(size_t i = 1; i <= cnt; ++i) - { - IntPoint ipNext = (i == cnt ? path[0] : path[i]); - if (ipNext.Y == pt.Y) - { - if ((ipNext.X == pt.X) || (ip.Y == pt.Y && - ((ipNext.X > pt.X) == (ip.X < pt.X)))) return -1; - } - if ((ip.Y < pt.Y) != (ipNext.Y < pt.Y)) - { - if (ip.X >= pt.X) - { - if (ipNext.X > pt.X) result = 1 - result; - else - { - double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) - - (double)(ipNext.X - pt.X) * (ip.Y - pt.Y); - if (!d) return -1; - if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result; - } - } else - { - if (ipNext.X > pt.X) - { - double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) - - (double)(ipNext.X - pt.X) * (ip.Y - pt.Y); - if (!d) return -1; - if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result; - } - } - } - ip = ipNext; - } - return result; -} -//------------------------------------------------------------------------------ - -int PointInPolygon (const IntPoint &pt, OutPt *op) -{ - //returns 0 if false, +1 if true, -1 if pt ON polygon boundary - int result = 0; - OutPt* startOp = op; - for(;;) - { - if (op->Next->Pt.Y == pt.Y) - { - if ((op->Next->Pt.X == pt.X) || (op->Pt.Y == pt.Y && - ((op->Next->Pt.X > pt.X) == (op->Pt.X < pt.X)))) return -1; - } - if ((op->Pt.Y < pt.Y) != (op->Next->Pt.Y < pt.Y)) - { - if (op->Pt.X >= pt.X) - { - if (op->Next->Pt.X > pt.X) result = 1 - result; - else - { - double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) - - (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y); - if (!d) return -1; - if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result; - } - } else - { - if (op->Next->Pt.X > pt.X) - { - double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) - - (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y); - if (!d) return -1; - if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result; - } - } - } - op = op->Next; - if (startOp == op) break; - } - return result; -} -//------------------------------------------------------------------------------ - -bool Poly2ContainsPoly1(OutPt *OutPt1, OutPt *OutPt2) -{ - OutPt* op = OutPt1; - do - { - //nb: PointInPolygon returns 0 if false, +1 if true, -1 if pt on polygon - int res = PointInPolygon(op->Pt, OutPt2); - if (res >= 0) return res > 0; - op = op->Next; - } - while (op != OutPt1); - return true; -} -//---------------------------------------------------------------------- - -bool SlopesEqual(const TEdge &e1, const TEdge &e2, bool UseFullInt64Range) -{ -#ifndef use_int32 - if (UseFullInt64Range) - return Int128Mul(e1.Delta.Y, e2.Delta.X) == Int128Mul(e1.Delta.X, e2.Delta.Y); - else -#endif - return e1.Delta.Y * e2.Delta.X == e1.Delta.X * e2.Delta.Y; -} -//------------------------------------------------------------------------------ - -bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, - const IntPoint pt3, bool UseFullInt64Range) -{ -#ifndef use_int32 - if (UseFullInt64Range) - return Int128Mul(pt1.Y-pt2.Y, pt2.X-pt3.X) == Int128Mul(pt1.X-pt2.X, pt2.Y-pt3.Y); - else -#endif - return (pt1.Y-pt2.Y)*(pt2.X-pt3.X) == (pt1.X-pt2.X)*(pt2.Y-pt3.Y); -} -//------------------------------------------------------------------------------ - -bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, - const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range) -{ -#ifndef use_int32 - if (UseFullInt64Range) - return Int128Mul(pt1.Y-pt2.Y, pt3.X-pt4.X) == Int128Mul(pt1.X-pt2.X, pt3.Y-pt4.Y); - else -#endif - return (pt1.Y-pt2.Y)*(pt3.X-pt4.X) == (pt1.X-pt2.X)*(pt3.Y-pt4.Y); -} -//------------------------------------------------------------------------------ - -inline bool IsHorizontal(TEdge &e) -{ - return e.Delta.Y == 0; -} -//------------------------------------------------------------------------------ - -inline double GetDx(const IntPoint pt1, const IntPoint pt2) -{ - return (pt1.Y == pt2.Y) ? - HORIZONTAL : (double)(pt2.X - pt1.X) / (pt2.Y - pt1.Y); -} -//--------------------------------------------------------------------------- - -inline void SetDx(TEdge &e) -{ - e.Delta.X = (e.Top.X - e.Bot.X); - e.Delta.Y = (e.Top.Y - e.Bot.Y); - - if (e.Delta.Y == 0) e.Dx = HORIZONTAL; - else e.Dx = (double)(e.Delta.X) / e.Delta.Y; -} -//--------------------------------------------------------------------------- - -inline void SwapSides(TEdge &Edge1, TEdge &Edge2) -{ - EdgeSide Side = Edge1.Side; - Edge1.Side = Edge2.Side; - Edge2.Side = Side; -} -//------------------------------------------------------------------------------ - -inline void SwapPolyIndexes(TEdge &Edge1, TEdge &Edge2) -{ - int OutIdx = Edge1.OutIdx; - Edge1.OutIdx = Edge2.OutIdx; - Edge2.OutIdx = OutIdx; -} -//------------------------------------------------------------------------------ - -inline cInt TopX(TEdge &edge, const cInt currentY) -{ - return ( currentY == edge.Top.Y ) ? - edge.Top.X : edge.Bot.X + Round(edge.Dx *(currentY - edge.Bot.Y)); -} -//------------------------------------------------------------------------------ - -void IntersectPoint(TEdge &Edge1, TEdge &Edge2, IntPoint &ip) -{ -#ifdef use_xyz - ip.Z = 0; -#endif - - double b1, b2; - if (Edge1.Dx == Edge2.Dx) - { - ip.Y = Edge1.Curr.Y; - ip.X = TopX(Edge1, ip.Y); - return; - } - else if (Edge1.Delta.X == 0) - { - ip.X = Edge1.Bot.X; - if (IsHorizontal(Edge2)) - ip.Y = Edge2.Bot.Y; - else - { - b2 = Edge2.Bot.Y - (Edge2.Bot.X / Edge2.Dx); - ip.Y = Round(ip.X / Edge2.Dx + b2); - } - } - else if (Edge2.Delta.X == 0) - { - ip.X = Edge2.Bot.X; - if (IsHorizontal(Edge1)) - ip.Y = Edge1.Bot.Y; - else - { - b1 = Edge1.Bot.Y - (Edge1.Bot.X / Edge1.Dx); - ip.Y = Round(ip.X / Edge1.Dx + b1); - } - } - else - { - b1 = Edge1.Bot.X - Edge1.Bot.Y * Edge1.Dx; - b2 = Edge2.Bot.X - Edge2.Bot.Y * Edge2.Dx; - double q = (b2-b1) / (Edge1.Dx - Edge2.Dx); - ip.Y = Round(q); - if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx)) - ip.X = Round(Edge1.Dx * q + b1); - else - ip.X = Round(Edge2.Dx * q + b2); - } - - if (ip.Y < Edge1.Top.Y || ip.Y < Edge2.Top.Y) - { - if (Edge1.Top.Y > Edge2.Top.Y) - ip.Y = Edge1.Top.Y; - else - ip.Y = Edge2.Top.Y; - if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx)) - ip.X = TopX(Edge1, ip.Y); - else - ip.X = TopX(Edge2, ip.Y); - } - //finally, don't allow 'ip' to be BELOW curr.Y (ie bottom of scanbeam) ... - if (ip.Y > Edge1.Curr.Y) - { - ip.Y = Edge1.Curr.Y; - //use the more vertical edge to derive X ... - if (std::fabs(Edge1.Dx) > std::fabs(Edge2.Dx)) - ip.X = TopX(Edge2, ip.Y); else - ip.X = TopX(Edge1, ip.Y); - } -} -//------------------------------------------------------------------------------ - -void ReversePolyPtLinks(OutPt *pp) -{ - if (!pp) return; - OutPt *pp1, *pp2; - pp1 = pp; - do { - pp2 = pp1->Next; - pp1->Next = pp1->Prev; - pp1->Prev = pp2; - pp1 = pp2; - } while( pp1 != pp ); -} -//------------------------------------------------------------------------------ - -void DisposeOutPts(OutPt*& pp) -{ - if (pp == 0) return; - pp->Prev->Next = 0; - while( pp ) - { - OutPt *tmpPp = pp; - pp = pp->Next; - delete tmpPp; - } -} -//------------------------------------------------------------------------------ - -inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt) -{ - std::memset(e, 0, sizeof(TEdge)); - e->Next = eNext; - e->Prev = ePrev; - e->Curr = Pt; - e->OutIdx = Unassigned; -} -//------------------------------------------------------------------------------ - -void InitEdge2(TEdge& e, PolyType Pt) -{ - if (e.Curr.Y >= e.Next->Curr.Y) - { - e.Bot = e.Curr; - e.Top = e.Next->Curr; - } else - { - e.Top = e.Curr; - e.Bot = e.Next->Curr; - } - SetDx(e); - e.PolyTyp = Pt; -} -//------------------------------------------------------------------------------ - -TEdge* RemoveEdge(TEdge* e) -{ - //removes e from double_linked_list (but without removing from memory) - e->Prev->Next = e->Next; - e->Next->Prev = e->Prev; - TEdge* result = e->Next; - e->Prev = 0; //flag as removed (see ClipperBase.Clear) - return result; -} -//------------------------------------------------------------------------------ - -inline void ReverseHorizontal(TEdge &e) -{ - //swap horizontal edges' Top and Bottom x's so they follow the natural - //progression of the bounds - ie so their xbots will align with the - //adjoining lower edge. [Helpful in the ProcessHorizontal() method.] - std::swap(e.Top.X, e.Bot.X); -#ifdef use_xyz - std::swap(e.Top.Z, e.Bot.Z); -#endif -} -//------------------------------------------------------------------------------ - -void SwapPoints(IntPoint &pt1, IntPoint &pt2) -{ - IntPoint tmp = pt1; - pt1 = pt2; - pt2 = tmp; -} -//------------------------------------------------------------------------------ - -bool GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, - IntPoint pt2b, IntPoint &pt1, IntPoint &pt2) -{ - //precondition: segments are Collinear. - if (Abs(pt1a.X - pt1b.X) > Abs(pt1a.Y - pt1b.Y)) - { - if (pt1a.X > pt1b.X) SwapPoints(pt1a, pt1b); - if (pt2a.X > pt2b.X) SwapPoints(pt2a, pt2b); - if (pt1a.X > pt2a.X) pt1 = pt1a; else pt1 = pt2a; - if (pt1b.X < pt2b.X) pt2 = pt1b; else pt2 = pt2b; - return pt1.X < pt2.X; - } else - { - if (pt1a.Y < pt1b.Y) SwapPoints(pt1a, pt1b); - if (pt2a.Y < pt2b.Y) SwapPoints(pt2a, pt2b); - if (pt1a.Y < pt2a.Y) pt1 = pt1a; else pt1 = pt2a; - if (pt1b.Y > pt2b.Y) pt2 = pt1b; else pt2 = pt2b; - return pt1.Y > pt2.Y; - } -} -//------------------------------------------------------------------------------ - -bool FirstIsBottomPt(const OutPt* btmPt1, const OutPt* btmPt2) -{ - OutPt *p = btmPt1->Prev; - while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Prev; - double dx1p = std::fabs(GetDx(btmPt1->Pt, p->Pt)); - p = btmPt1->Next; - while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Next; - double dx1n = std::fabs(GetDx(btmPt1->Pt, p->Pt)); - - p = btmPt2->Prev; - while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Prev; - double dx2p = std::fabs(GetDx(btmPt2->Pt, p->Pt)); - p = btmPt2->Next; - while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Next; - double dx2n = std::fabs(GetDx(btmPt2->Pt, p->Pt)); - return (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n); -} -//------------------------------------------------------------------------------ - -OutPt* GetBottomPt(OutPt *pp) -{ - OutPt* dups = 0; - OutPt* p = pp->Next; - while (p != pp) - { - if (p->Pt.Y > pp->Pt.Y) - { - pp = p; - dups = 0; - } - else if (p->Pt.Y == pp->Pt.Y && p->Pt.X <= pp->Pt.X) - { - if (p->Pt.X < pp->Pt.X) - { - dups = 0; - pp = p; - } else - { - if (p->Next != pp && p->Prev != pp) dups = p; - } - } - p = p->Next; - } - if (dups) - { - //there appears to be at least 2 vertices at BottomPt so ... - while (dups != p) - { - if (!FirstIsBottomPt(p, dups)) pp = dups; - dups = dups->Next; - while (dups->Pt != pp->Pt) dups = dups->Next; - } - } - return pp; -} -//------------------------------------------------------------------------------ - -bool Pt2IsBetweenPt1AndPt3(const IntPoint pt1, - const IntPoint pt2, const IntPoint pt3) -{ - if ((pt1 == pt3) || (pt1 == pt2) || (pt3 == pt2)) - return false; - else if (pt1.X != pt3.X) - return (pt2.X > pt1.X) == (pt2.X < pt3.X); - else - return (pt2.Y > pt1.Y) == (pt2.Y < pt3.Y); -} -//------------------------------------------------------------------------------ - -bool HorzSegmentsOverlap(cInt seg1a, cInt seg1b, cInt seg2a, cInt seg2b) -{ - if (seg1a > seg1b) std::swap(seg1a, seg1b); - if (seg2a > seg2b) std::swap(seg2a, seg2b); - return (seg1a < seg2b) && (seg2a < seg1b); -} - -//------------------------------------------------------------------------------ -// ClipperBase class methods ... -//------------------------------------------------------------------------------ - -ClipperBase::ClipperBase() //constructor -{ - m_CurrentLM = m_MinimaList.begin(); //begin() == end() here - m_UseFullRange = false; -} -//------------------------------------------------------------------------------ - -ClipperBase::~ClipperBase() //destructor -{ - Clear(); -} -//------------------------------------------------------------------------------ - -void RangeTest(const IntPoint& Pt, bool& useFullRange) -{ - if (useFullRange) - { - if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange) - throw "Coordinate outside allowed range"; - } - else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange) - { - useFullRange = true; - RangeTest(Pt, useFullRange); - } -} -//------------------------------------------------------------------------------ - -TEdge* FindNextLocMin(TEdge* E) -{ - for (;;) - { - while (E->Bot != E->Prev->Bot || E->Curr == E->Top) E = E->Next; - if (!IsHorizontal(*E) && !IsHorizontal(*E->Prev)) break; - while (IsHorizontal(*E->Prev)) E = E->Prev; - TEdge* E2 = E; - while (IsHorizontal(*E)) E = E->Next; - if (E->Top.Y == E->Prev->Bot.Y) continue; //ie just an intermediate horz. - if (E2->Prev->Bot.X < E->Bot.X) E = E2; - break; - } - return E; -} -//------------------------------------------------------------------------------ - -TEdge* ClipperBase::ProcessBound(TEdge* E, bool NextIsForward) -{ - TEdge *Result = E; - TEdge *Horz = 0; - - if (E->OutIdx == Skip) - { - //if edges still remain in the current bound beyond the skip edge then - //create another LocMin and call ProcessBound once more - if (NextIsForward) - { - while (E->Top.Y == E->Next->Bot.Y) E = E->Next; - //don't include top horizontals when parsing a bound a second time, - //they will be contained in the opposite bound ... - while (E != Result && IsHorizontal(*E)) E = E->Prev; - } - else - { - while (E->Top.Y == E->Prev->Bot.Y) E = E->Prev; - while (E != Result && IsHorizontal(*E)) E = E->Next; - } - - if (E == Result) - { - if (NextIsForward) Result = E->Next; - else Result = E->Prev; - } - else - { - //there are more edges in the bound beyond result starting with E - if (NextIsForward) - E = Result->Next; - else - E = Result->Prev; - MinimaList::value_type locMin; - locMin.Y = E->Bot.Y; - locMin.LeftBound = 0; - locMin.RightBound = E; - E->WindDelta = 0; - Result = ProcessBound(E, NextIsForward); - m_MinimaList.push_back(locMin); - } - return Result; - } - - TEdge *EStart; - - if (IsHorizontal(*E)) - { - //We need to be careful with open paths because this may not be a - //true local minima (ie E may be following a skip edge). - //Also, consecutive horz. edges may start heading left before going right. - if (NextIsForward) - EStart = E->Prev; - else - EStart = E->Next; - if (EStart->OutIdx != Skip) - { - if (IsHorizontal(*EStart)) //ie an adjoining horizontal skip edge - { - if (EStart->Bot.X != E->Bot.X && EStart->Top.X != E->Bot.X) - ReverseHorizontal(*E); - } - else if (EStart->Bot.X != E->Bot.X) - ReverseHorizontal(*E); - } - } - - EStart = E; - if (NextIsForward) - { - while (Result->Top.Y == Result->Next->Bot.Y && Result->Next->OutIdx != Skip) - Result = Result->Next; - if (IsHorizontal(*Result) && Result->Next->OutIdx != Skip) - { - //nb: at the top of a bound, horizontals are added to the bound - //only when the preceding edge attaches to the horizontal's left vertex - //unless a Skip edge is encountered when that becomes the top divide - Horz = Result; - while (IsHorizontal(*Horz->Prev)) Horz = Horz->Prev; - if (Horz->Prev->Top.X == Result->Next->Top.X) - { - if (!NextIsForward) Result = Horz->Prev; - } - else if (Horz->Prev->Top.X > Result->Next->Top.X) Result = Horz->Prev; - } - while (E != Result) - { - E->NextInLML = E->Next; - if (IsHorizontal(*E) && E != EStart && - E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E); - E = E->Next; - } - if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Prev->Top.X) - ReverseHorizontal(*E); - Result = Result->Next; //move to the edge just beyond current bound - } else - { - while (Result->Top.Y == Result->Prev->Bot.Y && Result->Prev->OutIdx != Skip) - Result = Result->Prev; - if (IsHorizontal(*Result) && Result->Prev->OutIdx != Skip) - { - Horz = Result; - while (IsHorizontal(*Horz->Next)) Horz = Horz->Next; - if (Horz->Next->Top.X == Result->Prev->Top.X) - { - if (!NextIsForward) Result = Horz->Next; - } - else if (Horz->Next->Top.X > Result->Prev->Top.X) Result = Horz->Next; - } - - while (E != Result) - { - E->NextInLML = E->Prev; - if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X) - ReverseHorizontal(*E); - E = E->Prev; - } - if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X) - ReverseHorizontal(*E); - Result = Result->Prev; //move to the edge just beyond current bound - } - - return Result; -} -//------------------------------------------------------------------------------ - -bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed) -{ -#ifdef use_lines - if (!Closed && PolyTyp == ptClip) - throw clipperException("AddPath: Open paths must be subject."); -#else - if (!Closed) - throw clipperException("AddPath: Open paths have been disabled."); -#endif - - int highI = (int)pg.size() -1; - if (Closed) while (highI > 0 && (pg[highI] == pg[0])) --highI; - while (highI > 0 && (pg[highI] == pg[highI -1])) --highI; - if ((Closed && highI < 2) || (!Closed && highI < 1)) return false; - - //create a new edge array ... - TEdge *edges = new TEdge [highI +1]; - - bool IsFlat = true; - //1. Basic (first) edge initialization ... - try - { - edges[1].Curr = pg[1]; - RangeTest(pg[0], m_UseFullRange); - RangeTest(pg[highI], m_UseFullRange); - InitEdge(&edges[0], &edges[1], &edges[highI], pg[0]); - InitEdge(&edges[highI], &edges[0], &edges[highI-1], pg[highI]); - for (int i = highI - 1; i >= 1; --i) - { - RangeTest(pg[i], m_UseFullRange); - InitEdge(&edges[i], &edges[i+1], &edges[i-1], pg[i]); - } - } - catch(...) - { - delete [] edges; - throw; //range test fails - } - TEdge *eStart = &edges[0]; - - //2. Remove duplicate vertices, and (when closed) collinear edges ... - TEdge *E = eStart, *eLoopStop = eStart; - for (;;) - { - //nb: allows matching start and end points when not Closed ... - if (E->Curr == E->Next->Curr && (Closed || E->Next != eStart)) - { - if (E == E->Next) break; - if (E == eStart) eStart = E->Next; - E = RemoveEdge(E); - eLoopStop = E; - continue; - } - if (E->Prev == E->Next) - break; //only two vertices - else if (Closed && - SlopesEqual(E->Prev->Curr, E->Curr, E->Next->Curr, m_UseFullRange) && - (!m_PreserveCollinear || - !Pt2IsBetweenPt1AndPt3(E->Prev->Curr, E->Curr, E->Next->Curr))) - { - //Collinear edges are allowed for open paths but in closed paths - //the default is to merge adjacent collinear edges into a single edge. - //However, if the PreserveCollinear property is enabled, only overlapping - //collinear edges (ie spikes) will be removed from closed paths. - if (E == eStart) eStart = E->Next; - E = RemoveEdge(E); - E = E->Prev; - eLoopStop = E; - continue; - } - E = E->Next; - if ((E == eLoopStop) || (!Closed && E->Next == eStart)) break; - } - - if ((!Closed && (E == E->Next)) || (Closed && (E->Prev == E->Next))) - { - delete [] edges; - return false; - } - - if (!Closed) - { - m_HasOpenPaths = true; - eStart->Prev->OutIdx = Skip; - } - - //3. Do second stage of edge initialization ... - E = eStart; - do - { - InitEdge2(*E, PolyTyp); - E = E->Next; - if (IsFlat && E->Curr.Y != eStart->Curr.Y) IsFlat = false; - } - while (E != eStart); - - //4. Finally, add edge bounds to LocalMinima list ... - - //Totally flat paths must be handled differently when adding them - //to LocalMinima list to avoid endless loops etc ... - if (IsFlat) - { - if (Closed) - { - delete [] edges; - return false; - } - E->Prev->OutIdx = Skip; - if (E->Prev->Bot.X < E->Prev->Top.X) ReverseHorizontal(*E->Prev); - MinimaList::value_type locMin; - locMin.Y = E->Bot.Y; - locMin.LeftBound = 0; - locMin.RightBound = E; - locMin.RightBound->Side = esRight; - locMin.RightBound->WindDelta = 0; - while (E->Next->OutIdx != Skip) - { - E->NextInLML = E->Next; - if (E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E); - E = E->Next; - } - m_MinimaList.push_back(locMin); - m_edges.push_back(edges); - return true; - } - - m_edges.push_back(edges); - bool leftBoundIsForward; - TEdge* EMin = 0; - - //workaround to avoid an endless loop in the while loop below when - //open paths have matching start and end points ... - if (E->Prev->Bot == E->Prev->Top) E = E->Next; - - for (;;) - { - E = FindNextLocMin(E); - if (E == EMin) break; - else if (!EMin) EMin = E; - - //E and E.Prev now share a local minima (left aligned if horizontal). - //Compare their slopes to find which starts which bound ... - MinimaList::value_type locMin; - locMin.Y = E->Bot.Y; - if (E->Dx < E->Prev->Dx) - { - locMin.LeftBound = E->Prev; - locMin.RightBound = E; - leftBoundIsForward = false; //Q.nextInLML = Q.prev - } else - { - locMin.LeftBound = E; - locMin.RightBound = E->Prev; - leftBoundIsForward = true; //Q.nextInLML = Q.next - } - locMin.LeftBound->Side = esLeft; - locMin.RightBound->Side = esRight; - - if (!Closed) locMin.LeftBound->WindDelta = 0; - else if (locMin.LeftBound->Next == locMin.RightBound) - locMin.LeftBound->WindDelta = -1; - else locMin.LeftBound->WindDelta = 1; - locMin.RightBound->WindDelta = -locMin.LeftBound->WindDelta; - - E = ProcessBound(locMin.LeftBound, leftBoundIsForward); - if (E->OutIdx == Skip) E = ProcessBound(E, leftBoundIsForward); - - TEdge* E2 = ProcessBound(locMin.RightBound, !leftBoundIsForward); - if (E2->OutIdx == Skip) E2 = ProcessBound(E2, !leftBoundIsForward); - - if (locMin.LeftBound->OutIdx == Skip) - locMin.LeftBound = 0; - else if (locMin.RightBound->OutIdx == Skip) - locMin.RightBound = 0; - m_MinimaList.push_back(locMin); - if (!leftBoundIsForward) E = E2; - } - return true; -} -//------------------------------------------------------------------------------ - -bool ClipperBase::AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed) -{ - bool result = false; - for (Paths::size_type i = 0; i < ppg.size(); ++i) - if (AddPath(ppg[i], PolyTyp, Closed)) result = true; - return result; -} -//------------------------------------------------------------------------------ - -void ClipperBase::Clear() -{ - DisposeLocalMinimaList(); - for (EdgeList::size_type i = 0; i < m_edges.size(); ++i) - { - //for each edge array in turn, find the first used edge and - //check for and remove any hiddenPts in each edge in the array. - TEdge* edges = m_edges[i]; - delete [] edges; - } - m_edges.clear(); - m_UseFullRange = false; - m_HasOpenPaths = false; -} -//------------------------------------------------------------------------------ - -void ClipperBase::Reset() -{ - m_CurrentLM = m_MinimaList.begin(); - if (m_CurrentLM == m_MinimaList.end()) return; //ie nothing to process - std::sort(m_MinimaList.begin(), m_MinimaList.end(), LocMinSorter()); - - //reset all edges ... - for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm) - { - TEdge* e = lm->LeftBound; - if (e) - { - e->Curr = e->Bot; - e->Side = esLeft; - e->OutIdx = Unassigned; - } - - e = lm->RightBound; - if (e) - { - e->Curr = e->Bot; - e->Side = esRight; - e->OutIdx = Unassigned; - } - } -} -//------------------------------------------------------------------------------ - -void ClipperBase::DisposeLocalMinimaList() -{ - m_MinimaList.clear(); - m_CurrentLM = m_MinimaList.begin(); -} -//------------------------------------------------------------------------------ - -void ClipperBase::PopLocalMinima() -{ - if (m_CurrentLM == m_MinimaList.end()) return; - ++m_CurrentLM; -} -//------------------------------------------------------------------------------ - -IntRect ClipperBase::GetBounds() -{ - IntRect result; - MinimaList::iterator lm = m_MinimaList.begin(); - if (lm == m_MinimaList.end()) - { - result.left = result.top = result.right = result.bottom = 0; - return result; - } - result.left = lm->LeftBound->Bot.X; - result.top = lm->LeftBound->Bot.Y; - result.right = lm->LeftBound->Bot.X; - result.bottom = lm->LeftBound->Bot.Y; - while (lm != m_MinimaList.end()) - { - result.bottom = std::max(result.bottom, lm->LeftBound->Bot.Y); - TEdge* e = lm->LeftBound; - for (;;) { - TEdge* bottomE = e; - while (e->NextInLML) - { - if (e->Bot.X < result.left) result.left = e->Bot.X; - if (e->Bot.X > result.right) result.right = e->Bot.X; - e = e->NextInLML; - } - result.left = std::min(result.left, e->Bot.X); - result.right = std::max(result.right, e->Bot.X); - result.left = std::min(result.left, e->Top.X); - result.right = std::max(result.right, e->Top.X); - result.top = std::min(result.top, e->Top.Y); - if (bottomE == lm->LeftBound) e = lm->RightBound; - else break; - } - ++lm; - } - return result; -} - -//------------------------------------------------------------------------------ -// TClipper methods ... -//------------------------------------------------------------------------------ - -Clipper::Clipper(int initOptions) : ClipperBase() //constructor -{ - m_ActiveEdges = 0; - m_SortedEdges = 0; - m_ExecuteLocked = false; - m_UseFullRange = false; - m_ReverseOutput = ((initOptions & ioReverseSolution) != 0); - m_StrictSimple = ((initOptions & ioStrictlySimple) != 0); - m_PreserveCollinear = ((initOptions & ioPreserveCollinear) != 0); - m_HasOpenPaths = false; -#ifdef use_xyz - m_ZFill = 0; -#endif -} -//------------------------------------------------------------------------------ - -Clipper::~Clipper() //destructor -{ - Clear(); -} -//------------------------------------------------------------------------------ - -#ifdef use_xyz -void Clipper::ZFillFunction(ZFillCallback zFillFunc) -{ - m_ZFill = zFillFunc; -} -//------------------------------------------------------------------------------ -#endif - -void Clipper::Reset() -{ - ClipperBase::Reset(); - m_Scanbeam = ScanbeamList(); - m_ActiveEdges = 0; - m_SortedEdges = 0; - for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm) - InsertScanbeam(lm->Y); -} -//------------------------------------------------------------------------------ - -bool Clipper::Execute(ClipType clipType, Paths &solution, - PolyFillType subjFillType, PolyFillType clipFillType) -{ - if( m_ExecuteLocked ) return false; - if (m_HasOpenPaths) - throw clipperException("Error: PolyTree struct is need for open path clipping."); - m_ExecuteLocked = true; - solution.resize(0); - m_SubjFillType = subjFillType; - m_ClipFillType = clipFillType; - m_ClipType = clipType; - m_UsingPolyTree = false; - bool succeeded = ExecuteInternal(); - if (succeeded) BuildResult(solution); - DisposeAllOutRecs(); - m_ExecuteLocked = false; - return succeeded; -} -//------------------------------------------------------------------------------ - -bool Clipper::Execute(ClipType clipType, PolyTree& polytree, - PolyFillType subjFillType, PolyFillType clipFillType) -{ - if( m_ExecuteLocked ) return false; - m_ExecuteLocked = true; - m_SubjFillType = subjFillType; - m_ClipFillType = clipFillType; - m_ClipType = clipType; - m_UsingPolyTree = true; - bool succeeded = ExecuteInternal(); - if (succeeded) BuildResult2(polytree); - DisposeAllOutRecs(); - m_ExecuteLocked = false; - return succeeded; -} -//------------------------------------------------------------------------------ - -void Clipper::FixHoleLinkage(OutRec &outrec) -{ - //skip OutRecs that (a) contain outermost polygons or - //(b) already have the correct owner/child linkage ... - if (!outrec.FirstLeft || - (outrec.IsHole != outrec.FirstLeft->IsHole && - outrec.FirstLeft->Pts)) return; - - OutRec* orfl = outrec.FirstLeft; - while (orfl && ((orfl->IsHole == outrec.IsHole) || !orfl->Pts)) - orfl = orfl->FirstLeft; - outrec.FirstLeft = orfl; -} -//------------------------------------------------------------------------------ - -bool Clipper::ExecuteInternal() -{ - bool succeeded = true; - try { - Reset(); - if (m_CurrentLM == m_MinimaList.end()) return true; - cInt botY = PopScanbeam(); - do { - InsertLocalMinimaIntoAEL(botY); - ClearGhostJoins(); - ProcessHorizontals(false); - if (m_Scanbeam.empty()) break; - cInt topY = PopScanbeam(); - succeeded = ProcessIntersections(topY); - if (!succeeded) break; - ProcessEdgesAtTopOfScanbeam(topY); - botY = topY; - } while (!m_Scanbeam.empty() || m_CurrentLM != m_MinimaList.end()); - } - catch(...) - { - succeeded = false; - } - - if (succeeded) - { - //fix orientations ... - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - { - OutRec *outRec = m_PolyOuts[i]; - if (!outRec->Pts || outRec->IsOpen) continue; - if ((outRec->IsHole ^ m_ReverseOutput) == (Area(*outRec) > 0)) - ReversePolyPtLinks(outRec->Pts); - } - - if (!m_Joins.empty()) JoinCommonEdges(); - - //unfortunately FixupOutPolygon() must be done after JoinCommonEdges() - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - { - OutRec *outRec = m_PolyOuts[i]; - if (outRec->Pts && !outRec->IsOpen) - FixupOutPolygon(*outRec); - } - - if (m_StrictSimple) DoSimplePolygons(); - } - - ClearJoins(); - ClearGhostJoins(); - return succeeded; -} -//------------------------------------------------------------------------------ - -void Clipper::InsertScanbeam(const cInt Y) -{ - //if (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) return;// avoid duplicates. - m_Scanbeam.push(Y); -} -//------------------------------------------------------------------------------ - -cInt Clipper::PopScanbeam() -{ - const cInt Y = m_Scanbeam.top(); - m_Scanbeam.pop(); - while (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) { m_Scanbeam.pop(); } // Pop duplicates. - return Y; -} -//------------------------------------------------------------------------------ - -void Clipper::DisposeAllOutRecs(){ - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - DisposeOutRec(i); - m_PolyOuts.clear(); -} -//------------------------------------------------------------------------------ - -void Clipper::DisposeOutRec(PolyOutList::size_type index) -{ - OutRec *outRec = m_PolyOuts[index]; - if (outRec->Pts) DisposeOutPts(outRec->Pts); - delete outRec; - m_PolyOuts[index] = 0; -} -//------------------------------------------------------------------------------ - -void Clipper::SetWindingCount(TEdge &edge) -{ - TEdge *e = edge.PrevInAEL; - //find the edge of the same polytype that immediately preceeds 'edge' in AEL - while (e && ((e->PolyTyp != edge.PolyTyp) || (e->WindDelta == 0))) e = e->PrevInAEL; - if (!e) - { - edge.WindCnt = (edge.WindDelta == 0 ? 1 : edge.WindDelta); - edge.WindCnt2 = 0; - e = m_ActiveEdges; //ie get ready to calc WindCnt2 - } - else if (edge.WindDelta == 0 && m_ClipType != ctUnion) - { - edge.WindCnt = 1; - edge.WindCnt2 = e->WindCnt2; - e = e->NextInAEL; //ie get ready to calc WindCnt2 - } - else if (IsEvenOddFillType(edge)) - { - //EvenOdd filling ... - if (edge.WindDelta == 0) - { - //are we inside a subj polygon ... - bool Inside = true; - TEdge *e2 = e->PrevInAEL; - while (e2) - { - if (e2->PolyTyp == e->PolyTyp && e2->WindDelta != 0) - Inside = !Inside; - e2 = e2->PrevInAEL; - } - edge.WindCnt = (Inside ? 0 : 1); - } - else - { - edge.WindCnt = edge.WindDelta; - } - edge.WindCnt2 = e->WindCnt2; - e = e->NextInAEL; //ie get ready to calc WindCnt2 - } - else - { - //nonZero, Positive or Negative filling ... - if (e->WindCnt * e->WindDelta < 0) - { - //prev edge is 'decreasing' WindCount (WC) toward zero - //so we're outside the previous polygon ... - if (Abs(e->WindCnt) > 1) - { - //outside prev poly but still inside another. - //when reversing direction of prev poly use the same WC - if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt; - //otherwise continue to 'decrease' WC ... - else edge.WindCnt = e->WindCnt + edge.WindDelta; - } - else - //now outside all polys of same polytype so set own WC ... - edge.WindCnt = (edge.WindDelta == 0 ? 1 : edge.WindDelta); - } else - { - //prev edge is 'increasing' WindCount (WC) away from zero - //so we're inside the previous polygon ... - if (edge.WindDelta == 0) - edge.WindCnt = (e->WindCnt < 0 ? e->WindCnt - 1 : e->WindCnt + 1); - //if wind direction is reversing prev then use same WC - else if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt; - //otherwise add to WC ... - else edge.WindCnt = e->WindCnt + edge.WindDelta; - } - edge.WindCnt2 = e->WindCnt2; - e = e->NextInAEL; //ie get ready to calc WindCnt2 - } - - //update WindCnt2 ... - if (IsEvenOddAltFillType(edge)) - { - //EvenOdd filling ... - while (e != &edge) - { - if (e->WindDelta != 0) - edge.WindCnt2 = (edge.WindCnt2 == 0 ? 1 : 0); - e = e->NextInAEL; - } - } else - { - //nonZero, Positive or Negative filling ... - while ( e != &edge ) - { - edge.WindCnt2 += e->WindDelta; - e = e->NextInAEL; - } - } -} -//------------------------------------------------------------------------------ - -bool Clipper::IsEvenOddFillType(const TEdge& edge) const -{ - if (edge.PolyTyp == ptSubject) - return m_SubjFillType == pftEvenOdd; else - return m_ClipFillType == pftEvenOdd; -} -//------------------------------------------------------------------------------ - -bool Clipper::IsEvenOddAltFillType(const TEdge& edge) const -{ - if (edge.PolyTyp == ptSubject) - return m_ClipFillType == pftEvenOdd; else - return m_SubjFillType == pftEvenOdd; -} -//------------------------------------------------------------------------------ - -bool Clipper::IsContributing(const TEdge& edge) const -{ - PolyFillType pft, pft2; - if (edge.PolyTyp == ptSubject) - { - pft = m_SubjFillType; - pft2 = m_ClipFillType; - } else - { - pft = m_ClipFillType; - pft2 = m_SubjFillType; - } - - switch(pft) - { - case pftEvenOdd: - //return false if a subj line has been flagged as inside a subj polygon - if (edge.WindDelta == 0 && edge.WindCnt != 1) return false; - break; - case pftNonZero: - if (Abs(edge.WindCnt) != 1) return false; - break; - case pftPositive: - if (edge.WindCnt != 1) return false; - break; - default: //pftNegative - if (edge.WindCnt != -1) return false; - } - - switch(m_ClipType) - { - case ctIntersection: - switch(pft2) - { - case pftEvenOdd: - case pftNonZero: - return (edge.WindCnt2 != 0); - case pftPositive: - return (edge.WindCnt2 > 0); - default: - return (edge.WindCnt2 < 0); - } - break; - case ctUnion: - switch(pft2) - { - case pftEvenOdd: - case pftNonZero: - return (edge.WindCnt2 == 0); - case pftPositive: - return (edge.WindCnt2 <= 0); - default: - return (edge.WindCnt2 >= 0); - } - break; - case ctDifference: - if (edge.PolyTyp == ptSubject) - switch(pft2) - { - case pftEvenOdd: - case pftNonZero: - return (edge.WindCnt2 == 0); - case pftPositive: - return (edge.WindCnt2 <= 0); - default: - return (edge.WindCnt2 >= 0); - } - else - switch(pft2) - { - case pftEvenOdd: - case pftNonZero: - return (edge.WindCnt2 != 0); - case pftPositive: - return (edge.WindCnt2 > 0); - default: - return (edge.WindCnt2 < 0); - } - break; - case ctXor: - if (edge.WindDelta == 0) //XOr always contributing unless open - switch(pft2) - { - case pftEvenOdd: - case pftNonZero: - return (edge.WindCnt2 == 0); - case pftPositive: - return (edge.WindCnt2 <= 0); - default: - return (edge.WindCnt2 >= 0); - } - else - return true; - break; - default: - return true; - } -} -//------------------------------------------------------------------------------ - -OutPt* Clipper::AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt) -{ - OutPt* result; - TEdge *e, *prevE; - if (IsHorizontal(*e2) || ( e1->Dx > e2->Dx )) - { - result = AddOutPt(e1, Pt); - e2->OutIdx = e1->OutIdx; - e1->Side = esLeft; - e2->Side = esRight; - e = e1; - if (e->PrevInAEL == e2) - prevE = e2->PrevInAEL; - else - prevE = e->PrevInAEL; - } else - { - result = AddOutPt(e2, Pt); - e1->OutIdx = e2->OutIdx; - e1->Side = esRight; - e2->Side = esLeft; - e = e2; - if (e->PrevInAEL == e1) - prevE = e1->PrevInAEL; - else - prevE = e->PrevInAEL; - } - - if (prevE && prevE->OutIdx >= 0 && - (TopX(*prevE, Pt.Y) == TopX(*e, Pt.Y)) && - SlopesEqual(*e, *prevE, m_UseFullRange) && - (e->WindDelta != 0) && (prevE->WindDelta != 0)) - { - OutPt* outPt = AddOutPt(prevE, Pt); - AddJoin(result, outPt, e->Top); - } - return result; -} -//------------------------------------------------------------------------------ - -void Clipper::AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt) -{ - AddOutPt( e1, Pt ); - if (e2->WindDelta == 0) AddOutPt(e2, Pt); - if( e1->OutIdx == e2->OutIdx ) - { - e1->OutIdx = Unassigned; - e2->OutIdx = Unassigned; - } - else if (e1->OutIdx < e2->OutIdx) - AppendPolygon(e1, e2); - else - AppendPolygon(e2, e1); -} -//------------------------------------------------------------------------------ - -void Clipper::AddEdgeToSEL(TEdge *edge) -{ - //SEL pointers in PEdge are reused to build a list of horizontal edges. - //However, we don't need to worry about order with horizontal edge processing. - if( !m_SortedEdges ) - { - m_SortedEdges = edge; - edge->PrevInSEL = 0; - edge->NextInSEL = 0; - } - else - { - edge->NextInSEL = m_SortedEdges; - edge->PrevInSEL = 0; - m_SortedEdges->PrevInSEL = edge; - m_SortedEdges = edge; - } -} -//------------------------------------------------------------------------------ - -void Clipper::CopyAELToSEL() -{ - TEdge* e = m_ActiveEdges; - m_SortedEdges = e; - while ( e ) - { - e->PrevInSEL = e->PrevInAEL; - e->NextInSEL = e->NextInAEL; - e = e->NextInAEL; - } -} -//------------------------------------------------------------------------------ - -void Clipper::AddJoin(OutPt *op1, OutPt *op2, const IntPoint OffPt) -{ - Join* j = new Join; - j->OutPt1 = op1; - j->OutPt2 = op2; - j->OffPt = OffPt; - m_Joins.push_back(j); -} -//------------------------------------------------------------------------------ - -void Clipper::ClearJoins() -{ - for (JoinList::size_type i = 0; i < m_Joins.size(); i++) - delete m_Joins[i]; - m_Joins.resize(0); -} -//------------------------------------------------------------------------------ - -void Clipper::ClearGhostJoins() -{ - for (JoinList::size_type i = 0; i < m_GhostJoins.size(); i++) - delete m_GhostJoins[i]; - m_GhostJoins.resize(0); -} -//------------------------------------------------------------------------------ - -void Clipper::AddGhostJoin(OutPt *op, const IntPoint OffPt) -{ - Join* j = new Join; - j->OutPt1 = op; - j->OutPt2 = 0; - j->OffPt = OffPt; - m_GhostJoins.push_back(j); -} -//------------------------------------------------------------------------------ - -void Clipper::InsertLocalMinimaIntoAEL(const cInt botY) -{ - while (m_CurrentLM != m_MinimaList.end() && (m_CurrentLM->Y == botY)) - { - TEdge* lb = m_CurrentLM->LeftBound; - TEdge* rb = m_CurrentLM->RightBound; - PopLocalMinima(); - OutPt *Op1 = 0; - if (!lb) - { - //nb: don't insert LB into either AEL or SEL - InsertEdgeIntoAEL(rb, 0); - SetWindingCount(*rb); - if (IsContributing(*rb)) - Op1 = AddOutPt(rb, rb->Bot); - } - else if (!rb) - { - InsertEdgeIntoAEL(lb, 0); - SetWindingCount(*lb); - if (IsContributing(*lb)) - Op1 = AddOutPt(lb, lb->Bot); - InsertScanbeam(lb->Top.Y); - } - else - { - InsertEdgeIntoAEL(lb, 0); - InsertEdgeIntoAEL(rb, lb); - SetWindingCount( *lb ); - rb->WindCnt = lb->WindCnt; - rb->WindCnt2 = lb->WindCnt2; - if (IsContributing(*lb)) - Op1 = AddLocalMinPoly(lb, rb, lb->Bot); - InsertScanbeam(lb->Top.Y); - } - - if (rb) - { - if(IsHorizontal(*rb)) AddEdgeToSEL(rb); - else InsertScanbeam( rb->Top.Y ); - } - - if (!lb || !rb) continue; - - //if any output polygons share an edge, they'll need joining later ... - if (Op1 && IsHorizontal(*rb) && - m_GhostJoins.size() > 0 && (rb->WindDelta != 0)) - { - for (JoinList::size_type i = 0; i < m_GhostJoins.size(); ++i) - { - Join* jr = m_GhostJoins[i]; - //if the horizontal Rb and a 'ghost' horizontal overlap, then convert - //the 'ghost' join to a real join ready for later ... - if (HorzSegmentsOverlap(jr->OutPt1->Pt.X, jr->OffPt.X, rb->Bot.X, rb->Top.X)) - AddJoin(jr->OutPt1, Op1, jr->OffPt); - } - } - - if (lb->OutIdx >= 0 && lb->PrevInAEL && - lb->PrevInAEL->Curr.X == lb->Bot.X && - lb->PrevInAEL->OutIdx >= 0 && - SlopesEqual(*lb->PrevInAEL, *lb, m_UseFullRange) && - (lb->WindDelta != 0) && (lb->PrevInAEL->WindDelta != 0)) - { - OutPt *Op2 = AddOutPt(lb->PrevInAEL, lb->Bot); - AddJoin(Op1, Op2, lb->Top); - } - - if(lb->NextInAEL != rb) - { - - if (rb->OutIdx >= 0 && rb->PrevInAEL->OutIdx >= 0 && - SlopesEqual(*rb->PrevInAEL, *rb, m_UseFullRange) && - (rb->WindDelta != 0) && (rb->PrevInAEL->WindDelta != 0)) - { - OutPt *Op2 = AddOutPt(rb->PrevInAEL, rb->Bot); - AddJoin(Op1, Op2, rb->Top); - } - - TEdge* e = lb->NextInAEL; - if (e) - { - while( e != rb ) - { - //nb: For calculating winding counts etc, IntersectEdges() assumes - //that param1 will be to the Right of param2 ABOVE the intersection ... - IntersectEdges(rb , e , lb->Curr); //order important here - e = e->NextInAEL; - } - } - } - - } -} -//------------------------------------------------------------------------------ - -void Clipper::DeleteFromAEL(TEdge *e) -{ - TEdge* AelPrev = e->PrevInAEL; - TEdge* AelNext = e->NextInAEL; - if( !AelPrev && !AelNext && (e != m_ActiveEdges) ) return; //already deleted - if( AelPrev ) AelPrev->NextInAEL = AelNext; - else m_ActiveEdges = AelNext; - if( AelNext ) AelNext->PrevInAEL = AelPrev; - e->NextInAEL = 0; - e->PrevInAEL = 0; -} -//------------------------------------------------------------------------------ - -void Clipper::DeleteFromSEL(TEdge *e) -{ - TEdge* SelPrev = e->PrevInSEL; - TEdge* SelNext = e->NextInSEL; - if( !SelPrev && !SelNext && (e != m_SortedEdges) ) return; //already deleted - if( SelPrev ) SelPrev->NextInSEL = SelNext; - else m_SortedEdges = SelNext; - if( SelNext ) SelNext->PrevInSEL = SelPrev; - e->NextInSEL = 0; - e->PrevInSEL = 0; -} -//------------------------------------------------------------------------------ - -#ifdef use_xyz -void Clipper::SetZ(IntPoint& pt, TEdge& e1, TEdge& e2) -{ - if (pt.Z != 0 || !m_ZFill) return; - else if (pt == e1.Bot) pt.Z = e1.Bot.Z; - else if (pt == e1.Top) pt.Z = e1.Top.Z; - else if (pt == e2.Bot) pt.Z = e2.Bot.Z; - else if (pt == e2.Top) pt.Z = e2.Top.Z; - else (*m_ZFill)(e1.Bot, e1.Top, e2.Bot, e2.Top, pt); -} -//------------------------------------------------------------------------------ -#endif - -void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &Pt) -{ - bool e1Contributing = ( e1->OutIdx >= 0 ); - bool e2Contributing = ( e2->OutIdx >= 0 ); - -#ifdef use_xyz - SetZ(Pt, *e1, *e2); -#endif - -#ifdef use_lines - //if either edge is on an OPEN path ... - if (e1->WindDelta == 0 || e2->WindDelta == 0) - { - //ignore subject-subject open path intersections UNLESS they - //are both open paths, AND they are both 'contributing maximas' ... - if (e1->WindDelta == 0 && e2->WindDelta == 0) return; - - //if intersecting a subj line with a subj poly ... - else if (e1->PolyTyp == e2->PolyTyp && - e1->WindDelta != e2->WindDelta && m_ClipType == ctUnion) - { - if (e1->WindDelta == 0) - { - if (e2Contributing) - { - AddOutPt(e1, Pt); - if (e1Contributing) e1->OutIdx = Unassigned; - } - } - else - { - if (e1Contributing) - { - AddOutPt(e2, Pt); - if (e2Contributing) e2->OutIdx = Unassigned; - } - } - } - else if (e1->PolyTyp != e2->PolyTyp) - { - //toggle subj open path OutIdx on/off when Abs(clip.WndCnt) == 1 ... - if ((e1->WindDelta == 0) && abs(e2->WindCnt) == 1 && - (m_ClipType != ctUnion || e2->WindCnt2 == 0)) - { - AddOutPt(e1, Pt); - if (e1Contributing) e1->OutIdx = Unassigned; - } - else if ((e2->WindDelta == 0) && (abs(e1->WindCnt) == 1) && - (m_ClipType != ctUnion || e1->WindCnt2 == 0)) - { - AddOutPt(e2, Pt); - if (e2Contributing) e2->OutIdx = Unassigned; - } - } - return; - } -#endif - - //update winding counts... - //assumes that e1 will be to the Right of e2 ABOVE the intersection - if ( e1->PolyTyp == e2->PolyTyp ) - { - if ( IsEvenOddFillType( *e1) ) - { - int oldE1WindCnt = e1->WindCnt; - e1->WindCnt = e2->WindCnt; - e2->WindCnt = oldE1WindCnt; - } else - { - if (e1->WindCnt + e2->WindDelta == 0 ) e1->WindCnt = -e1->WindCnt; - else e1->WindCnt += e2->WindDelta; - if ( e2->WindCnt - e1->WindDelta == 0 ) e2->WindCnt = -e2->WindCnt; - else e2->WindCnt -= e1->WindDelta; - } - } else - { - if (!IsEvenOddFillType(*e2)) e1->WindCnt2 += e2->WindDelta; - else e1->WindCnt2 = ( e1->WindCnt2 == 0 ) ? 1 : 0; - if (!IsEvenOddFillType(*e1)) e2->WindCnt2 -= e1->WindDelta; - else e2->WindCnt2 = ( e2->WindCnt2 == 0 ) ? 1 : 0; - } - - PolyFillType e1FillType, e2FillType, e1FillType2, e2FillType2; - if (e1->PolyTyp == ptSubject) - { - e1FillType = m_SubjFillType; - e1FillType2 = m_ClipFillType; - } else - { - e1FillType = m_ClipFillType; - e1FillType2 = m_SubjFillType; - } - if (e2->PolyTyp == ptSubject) - { - e2FillType = m_SubjFillType; - e2FillType2 = m_ClipFillType; - } else - { - e2FillType = m_ClipFillType; - e2FillType2 = m_SubjFillType; - } - - cInt e1Wc, e2Wc; - switch (e1FillType) - { - case pftPositive: e1Wc = e1->WindCnt; break; - case pftNegative: e1Wc = -e1->WindCnt; break; - default: e1Wc = Abs(e1->WindCnt); - } - switch(e2FillType) - { - case pftPositive: e2Wc = e2->WindCnt; break; - case pftNegative: e2Wc = -e2->WindCnt; break; - default: e2Wc = Abs(e2->WindCnt); - } - - if ( e1Contributing && e2Contributing ) - { - if ((e1Wc != 0 && e1Wc != 1) || (e2Wc != 0 && e2Wc != 1) || - (e1->PolyTyp != e2->PolyTyp && m_ClipType != ctXor) ) - { - AddLocalMaxPoly(e1, e2, Pt); - } - else - { - AddOutPt(e1, Pt); - AddOutPt(e2, Pt); - SwapSides( *e1 , *e2 ); - SwapPolyIndexes( *e1 , *e2 ); - } - } - else if ( e1Contributing ) - { - if (e2Wc == 0 || e2Wc == 1) - { - AddOutPt(e1, Pt); - SwapSides(*e1, *e2); - SwapPolyIndexes(*e1, *e2); - } - } - else if ( e2Contributing ) - { - if (e1Wc == 0 || e1Wc == 1) - { - AddOutPt(e2, Pt); - SwapSides(*e1, *e2); - SwapPolyIndexes(*e1, *e2); - } - } - else if ( (e1Wc == 0 || e1Wc == 1) && (e2Wc == 0 || e2Wc == 1)) - { - //neither edge is currently contributing ... - - cInt e1Wc2, e2Wc2; - switch (e1FillType2) - { - case pftPositive: e1Wc2 = e1->WindCnt2; break; - case pftNegative : e1Wc2 = -e1->WindCnt2; break; - default: e1Wc2 = Abs(e1->WindCnt2); - } - switch (e2FillType2) - { - case pftPositive: e2Wc2 = e2->WindCnt2; break; - case pftNegative: e2Wc2 = -e2->WindCnt2; break; - default: e2Wc2 = Abs(e2->WindCnt2); - } - - if (e1->PolyTyp != e2->PolyTyp) - { - AddLocalMinPoly(e1, e2, Pt); - } - else if (e1Wc == 1 && e2Wc == 1) - switch( m_ClipType ) { - case ctIntersection: - if (e1Wc2 > 0 && e2Wc2 > 0) - AddLocalMinPoly(e1, e2, Pt); - break; - case ctUnion: - if ( e1Wc2 <= 0 && e2Wc2 <= 0 ) - AddLocalMinPoly(e1, e2, Pt); - break; - case ctDifference: - if (((e1->PolyTyp == ptClip) && (e1Wc2 > 0) && (e2Wc2 > 0)) || - ((e1->PolyTyp == ptSubject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) - AddLocalMinPoly(e1, e2, Pt); - break; - case ctXor: - AddLocalMinPoly(e1, e2, Pt); - } - else - SwapSides( *e1, *e2 ); - } -} -//------------------------------------------------------------------------------ - -void Clipper::SetHoleState(TEdge *e, OutRec *outrec) -{ - bool IsHole = false; - TEdge *e2 = e->PrevInAEL; - while (e2) - { - if (e2->OutIdx >= 0 && e2->WindDelta != 0) - { - IsHole = !IsHole; - if (! outrec->FirstLeft) - outrec->FirstLeft = m_PolyOuts[e2->OutIdx]; - } - e2 = e2->PrevInAEL; - } - if (IsHole) outrec->IsHole = true; -} -//------------------------------------------------------------------------------ - -OutRec* GetLowermostRec(OutRec *outRec1, OutRec *outRec2) -{ - //work out which polygon fragment has the correct hole state ... - if (!outRec1->BottomPt) - outRec1->BottomPt = GetBottomPt(outRec1->Pts); - if (!outRec2->BottomPt) - outRec2->BottomPt = GetBottomPt(outRec2->Pts); - OutPt *OutPt1 = outRec1->BottomPt; - OutPt *OutPt2 = outRec2->BottomPt; - if (OutPt1->Pt.Y > OutPt2->Pt.Y) return outRec1; - else if (OutPt1->Pt.Y < OutPt2->Pt.Y) return outRec2; - else if (OutPt1->Pt.X < OutPt2->Pt.X) return outRec1; - else if (OutPt1->Pt.X > OutPt2->Pt.X) return outRec2; - else if (OutPt1->Next == OutPt1) return outRec2; - else if (OutPt2->Next == OutPt2) return outRec1; - else if (FirstIsBottomPt(OutPt1, OutPt2)) return outRec1; - else return outRec2; -} -//------------------------------------------------------------------------------ - -bool Param1RightOfParam2(OutRec* outRec1, OutRec* outRec2) -{ - do - { - outRec1 = outRec1->FirstLeft; - if (outRec1 == outRec2) return true; - } while (outRec1); - return false; -} -//------------------------------------------------------------------------------ - -OutRec* Clipper::GetOutRec(int Idx) -{ - OutRec* outrec = m_PolyOuts[Idx]; - while (outrec != m_PolyOuts[outrec->Idx]) - outrec = m_PolyOuts[outrec->Idx]; - return outrec; -} -//------------------------------------------------------------------------------ - -void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) -{ - //get the start and ends of both output polygons ... - OutRec *outRec1 = m_PolyOuts[e1->OutIdx]; - OutRec *outRec2 = m_PolyOuts[e2->OutIdx]; - - OutRec *holeStateRec; - if (Param1RightOfParam2(outRec1, outRec2)) - holeStateRec = outRec2; - else if (Param1RightOfParam2(outRec2, outRec1)) - holeStateRec = outRec1; - else - holeStateRec = GetLowermostRec(outRec1, outRec2); - - //get the start and ends of both output polygons and - //join e2 poly onto e1 poly and delete pointers to e2 ... - - OutPt* p1_lft = outRec1->Pts; - OutPt* p1_rt = p1_lft->Prev; - OutPt* p2_lft = outRec2->Pts; - OutPt* p2_rt = p2_lft->Prev; - - EdgeSide Side; - //join e2 poly onto e1 poly and delete pointers to e2 ... - if( e1->Side == esLeft ) - { - if( e2->Side == esLeft ) - { - //z y x a b c - ReversePolyPtLinks(p2_lft); - p2_lft->Next = p1_lft; - p1_lft->Prev = p2_lft; - p1_rt->Next = p2_rt; - p2_rt->Prev = p1_rt; - outRec1->Pts = p2_rt; - } else - { - //x y z a b c - p2_rt->Next = p1_lft; - p1_lft->Prev = p2_rt; - p2_lft->Prev = p1_rt; - p1_rt->Next = p2_lft; - outRec1->Pts = p2_lft; - } - Side = esLeft; - } else - { - if( e2->Side == esRight ) - { - //a b c z y x - ReversePolyPtLinks(p2_lft); - p1_rt->Next = p2_rt; - p2_rt->Prev = p1_rt; - p2_lft->Next = p1_lft; - p1_lft->Prev = p2_lft; - } else - { - //a b c x y z - p1_rt->Next = p2_lft; - p2_lft->Prev = p1_rt; - p1_lft->Prev = p2_rt; - p2_rt->Next = p1_lft; - } - Side = esRight; - } - - outRec1->BottomPt = 0; - if (holeStateRec == outRec2) - { - if (outRec2->FirstLeft != outRec1) - outRec1->FirstLeft = outRec2->FirstLeft; - outRec1->IsHole = outRec2->IsHole; - } - outRec2->Pts = 0; - outRec2->BottomPt = 0; - outRec2->FirstLeft = outRec1; - - int OKIdx = e1->OutIdx; - int ObsoleteIdx = e2->OutIdx; - - e1->OutIdx = Unassigned; //nb: safe because we only get here via AddLocalMaxPoly - e2->OutIdx = Unassigned; - - TEdge* e = m_ActiveEdges; - while( e ) - { - if( e->OutIdx == ObsoleteIdx ) - { - e->OutIdx = OKIdx; - e->Side = Side; - break; - } - e = e->NextInAEL; - } - - outRec2->Idx = outRec1->Idx; -} -//------------------------------------------------------------------------------ - -OutRec* Clipper::CreateOutRec() -{ - OutRec* result = new OutRec; - result->IsHole = false; - result->IsOpen = false; - result->FirstLeft = 0; - result->Pts = 0; - result->BottomPt = 0; - result->PolyNd = 0; - m_PolyOuts.push_back(result); - result->Idx = (int)m_PolyOuts.size()-1; - return result; -} -//------------------------------------------------------------------------------ - -OutPt* Clipper::AddOutPt(TEdge *e, const IntPoint &pt) -{ - bool ToFront = (e->Side == esLeft); - if( e->OutIdx < 0 ) - { - OutRec *outRec = CreateOutRec(); - outRec->IsOpen = (e->WindDelta == 0); - OutPt* newOp = new OutPt; - outRec->Pts = newOp; - newOp->Idx = outRec->Idx; - newOp->Pt = pt; - newOp->Next = newOp; - newOp->Prev = newOp; - if (!outRec->IsOpen) - SetHoleState(e, outRec); - e->OutIdx = outRec->Idx; - return newOp; - } else - { - OutRec *outRec = m_PolyOuts[e->OutIdx]; - //OutRec.Pts is the 'Left-most' point & OutRec.Pts.Prev is the 'Right-most' - OutPt* op = outRec->Pts; - - if (ToFront && (pt == op->Pt)) return op; - else if (!ToFront && (pt == op->Prev->Pt)) return op->Prev; - - OutPt* newOp = new OutPt; - newOp->Idx = outRec->Idx; - newOp->Pt = pt; - newOp->Next = op; - newOp->Prev = op->Prev; - newOp->Prev->Next = newOp; - op->Prev = newOp; - if (ToFront) outRec->Pts = newOp; - return newOp; - } -} -//------------------------------------------------------------------------------ - -void Clipper::ProcessHorizontals(bool IsTopOfScanbeam) -{ - TEdge* horzEdge = m_SortedEdges; - while(horzEdge) - { - DeleteFromSEL(horzEdge); - ProcessHorizontal(horzEdge, IsTopOfScanbeam); - horzEdge = m_SortedEdges; - } -} -//------------------------------------------------------------------------------ - -inline bool IsMinima(TEdge *e) -{ - return e && (e->Prev->NextInLML != e) && (e->Next->NextInLML != e); -} -//------------------------------------------------------------------------------ - -inline bool IsMaxima(TEdge *e, const cInt Y) -{ - return e && e->Top.Y == Y && !e->NextInLML; -} -//------------------------------------------------------------------------------ - -inline bool IsIntermediate(TEdge *e, const cInt Y) -{ - return e->Top.Y == Y && e->NextInLML; -} -//------------------------------------------------------------------------------ - -TEdge *GetMaximaPair(TEdge *e) -{ - TEdge* result = 0; - if ((e->Next->Top == e->Top) && !e->Next->NextInLML) - result = e->Next; - else if ((e->Prev->Top == e->Top) && !e->Prev->NextInLML) - result = e->Prev; - - if (result && (result->OutIdx == Skip || - //result is false if both NextInAEL & PrevInAEL are nil & not horizontal ... - (result->NextInAEL == result->PrevInAEL && !IsHorizontal(*result)))) - return 0; - return result; -} -//------------------------------------------------------------------------------ - -void Clipper::SwapPositionsInAEL(TEdge *Edge1, TEdge *Edge2) -{ - //check that one or other edge hasn't already been removed from AEL ... - if (Edge1->NextInAEL == Edge1->PrevInAEL || - Edge2->NextInAEL == Edge2->PrevInAEL) return; - - if( Edge1->NextInAEL == Edge2 ) - { - TEdge* Next = Edge2->NextInAEL; - if( Next ) Next->PrevInAEL = Edge1; - TEdge* Prev = Edge1->PrevInAEL; - if( Prev ) Prev->NextInAEL = Edge2; - Edge2->PrevInAEL = Prev; - Edge2->NextInAEL = Edge1; - Edge1->PrevInAEL = Edge2; - Edge1->NextInAEL = Next; - } - else if( Edge2->NextInAEL == Edge1 ) - { - TEdge* Next = Edge1->NextInAEL; - if( Next ) Next->PrevInAEL = Edge2; - TEdge* Prev = Edge2->PrevInAEL; - if( Prev ) Prev->NextInAEL = Edge1; - Edge1->PrevInAEL = Prev; - Edge1->NextInAEL = Edge2; - Edge2->PrevInAEL = Edge1; - Edge2->NextInAEL = Next; - } - else - { - TEdge* Next = Edge1->NextInAEL; - TEdge* Prev = Edge1->PrevInAEL; - Edge1->NextInAEL = Edge2->NextInAEL; - if( Edge1->NextInAEL ) Edge1->NextInAEL->PrevInAEL = Edge1; - Edge1->PrevInAEL = Edge2->PrevInAEL; - if( Edge1->PrevInAEL ) Edge1->PrevInAEL->NextInAEL = Edge1; - Edge2->NextInAEL = Next; - if( Edge2->NextInAEL ) Edge2->NextInAEL->PrevInAEL = Edge2; - Edge2->PrevInAEL = Prev; - if( Edge2->PrevInAEL ) Edge2->PrevInAEL->NextInAEL = Edge2; - } - - if( !Edge1->PrevInAEL ) m_ActiveEdges = Edge1; - else if( !Edge2->PrevInAEL ) m_ActiveEdges = Edge2; -} -//------------------------------------------------------------------------------ - -void Clipper::SwapPositionsInSEL(TEdge *Edge1, TEdge *Edge2) -{ - if( !( Edge1->NextInSEL ) && !( Edge1->PrevInSEL ) ) return; - if( !( Edge2->NextInSEL ) && !( Edge2->PrevInSEL ) ) return; - - if( Edge1->NextInSEL == Edge2 ) - { - TEdge* Next = Edge2->NextInSEL; - if( Next ) Next->PrevInSEL = Edge1; - TEdge* Prev = Edge1->PrevInSEL; - if( Prev ) Prev->NextInSEL = Edge2; - Edge2->PrevInSEL = Prev; - Edge2->NextInSEL = Edge1; - Edge1->PrevInSEL = Edge2; - Edge1->NextInSEL = Next; - } - else if( Edge2->NextInSEL == Edge1 ) - { - TEdge* Next = Edge1->NextInSEL; - if( Next ) Next->PrevInSEL = Edge2; - TEdge* Prev = Edge2->PrevInSEL; - if( Prev ) Prev->NextInSEL = Edge1; - Edge1->PrevInSEL = Prev; - Edge1->NextInSEL = Edge2; - Edge2->PrevInSEL = Edge1; - Edge2->NextInSEL = Next; - } - else - { - TEdge* Next = Edge1->NextInSEL; - TEdge* Prev = Edge1->PrevInSEL; - Edge1->NextInSEL = Edge2->NextInSEL; - if( Edge1->NextInSEL ) Edge1->NextInSEL->PrevInSEL = Edge1; - Edge1->PrevInSEL = Edge2->PrevInSEL; - if( Edge1->PrevInSEL ) Edge1->PrevInSEL->NextInSEL = Edge1; - Edge2->NextInSEL = Next; - if( Edge2->NextInSEL ) Edge2->NextInSEL->PrevInSEL = Edge2; - Edge2->PrevInSEL = Prev; - if( Edge2->PrevInSEL ) Edge2->PrevInSEL->NextInSEL = Edge2; - } - - if( !Edge1->PrevInSEL ) m_SortedEdges = Edge1; - else if( !Edge2->PrevInSEL ) m_SortedEdges = Edge2; -} -//------------------------------------------------------------------------------ - -TEdge* GetNextInAEL(TEdge *e, Direction dir) -{ - return dir == dLeftToRight ? e->NextInAEL : e->PrevInAEL; -} -//------------------------------------------------------------------------------ - -void GetHorzDirection(TEdge& HorzEdge, Direction& Dir, cInt& Left, cInt& Right) -{ - if (HorzEdge.Bot.X < HorzEdge.Top.X) - { - Left = HorzEdge.Bot.X; - Right = HorzEdge.Top.X; - Dir = dLeftToRight; - } else - { - Left = HorzEdge.Top.X; - Right = HorzEdge.Bot.X; - Dir = dRightToLeft; - } -} -//------------------------------------------------------------------------ - -/******************************************************************************* -* Notes: Horizontal edges (HEs) at scanline intersections (ie at the Top or * -* Bottom of a scanbeam) are processed as if layered. The order in which HEs * -* are processed doesn't matter. HEs intersect with other HE Bot.Xs only [#] * -* (or they could intersect with Top.Xs only, ie EITHER Bot.Xs OR Top.Xs), * -* and with other non-horizontal edges [*]. Once these intersections are * -* processed, intermediate HEs then 'promote' the Edge above (NextInLML) into * -* the AEL. These 'promoted' edges may in turn intersect [%] with other HEs. * -*******************************************************************************/ - -void Clipper::ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam) -{ - Direction dir; - cInt horzLeft, horzRight; - - GetHorzDirection(*horzEdge, dir, horzLeft, horzRight); - - TEdge* eLastHorz = horzEdge, *eMaxPair = 0; - while (eLastHorz->NextInLML && IsHorizontal(*eLastHorz->NextInLML)) - eLastHorz = eLastHorz->NextInLML; - if (!eLastHorz->NextInLML) - eMaxPair = GetMaximaPair(eLastHorz); - - for (;;) - { - bool IsLastHorz = (horzEdge == eLastHorz); - TEdge* e = GetNextInAEL(horzEdge, dir); - while(e) - { - //Break if we've got to the end of an intermediate horizontal edge ... - //nb: Smaller Dx's are to the right of larger Dx's ABOVE the horizontal. - if (e->Curr.X == horzEdge->Top.X && horzEdge->NextInLML && - e->Dx < horzEdge->NextInLML->Dx) break; - - TEdge* eNext = GetNextInAEL(e, dir); //saves eNext for later - - if ((dir == dLeftToRight && e->Curr.X <= horzRight) || - (dir == dRightToLeft && e->Curr.X >= horzLeft)) - { - //so far we're still in range of the horizontal Edge but make sure - //we're at the last of consec. horizontals when matching with eMaxPair - if(e == eMaxPair && IsLastHorz) - { - - if (horzEdge->OutIdx >= 0) - { - OutPt* op1 = AddOutPt(horzEdge, horzEdge->Top); - TEdge* eNextHorz = m_SortedEdges; - while (eNextHorz) - { - if (eNextHorz->OutIdx >= 0 && - HorzSegmentsOverlap(horzEdge->Bot.X, - horzEdge->Top.X, eNextHorz->Bot.X, eNextHorz->Top.X)) - { - OutPt* op2 = AddOutPt(eNextHorz, eNextHorz->Bot); - AddJoin(op2, op1, eNextHorz->Top); - } - eNextHorz = eNextHorz->NextInSEL; - } - AddGhostJoin(op1, horzEdge->Bot); - AddLocalMaxPoly(horzEdge, eMaxPair, horzEdge->Top); - } - DeleteFromAEL(horzEdge); - DeleteFromAEL(eMaxPair); - return; - } - else if(dir == dLeftToRight) - { - IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y); - IntersectEdges(horzEdge, e, Pt); - } - else - { - IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y); - IntersectEdges( e, horzEdge, Pt); - } - SwapPositionsInAEL( horzEdge, e ); - } - else if( (dir == dLeftToRight && e->Curr.X >= horzRight) || - (dir == dRightToLeft && e->Curr.X <= horzLeft) ) break; - e = eNext; - } //end while - - if (horzEdge->NextInLML && IsHorizontal(*horzEdge->NextInLML)) - { - UpdateEdgeIntoAEL(horzEdge); - if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Bot); - GetHorzDirection(*horzEdge, dir, horzLeft, horzRight); - } else - break; - } //end for (;;) - - if(horzEdge->NextInLML) - { - if(horzEdge->OutIdx >= 0) - { - OutPt* op1 = AddOutPt( horzEdge, horzEdge->Top); - if (isTopOfScanbeam) AddGhostJoin(op1, horzEdge->Bot); - UpdateEdgeIntoAEL(horzEdge); - if (horzEdge->WindDelta == 0) return; - //nb: HorzEdge is no longer horizontal here - TEdge* ePrev = horzEdge->PrevInAEL; - TEdge* eNext = horzEdge->NextInAEL; - if (ePrev && ePrev->Curr.X == horzEdge->Bot.X && - ePrev->Curr.Y == horzEdge->Bot.Y && ePrev->WindDelta != 0 && - (ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y && - SlopesEqual(*horzEdge, *ePrev, m_UseFullRange))) - { - OutPt* op2 = AddOutPt(ePrev, horzEdge->Bot); - AddJoin(op1, op2, horzEdge->Top); - } - else if (eNext && eNext->Curr.X == horzEdge->Bot.X && - eNext->Curr.Y == horzEdge->Bot.Y && eNext->WindDelta != 0 && - eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y && - SlopesEqual(*horzEdge, *eNext, m_UseFullRange)) - { - OutPt* op2 = AddOutPt(eNext, horzEdge->Bot); - AddJoin(op1, op2, horzEdge->Top); - } - } - else - UpdateEdgeIntoAEL(horzEdge); - } - else - { - if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Top); - DeleteFromAEL(horzEdge); - } -} -//------------------------------------------------------------------------------ - -void Clipper::UpdateEdgeIntoAEL(TEdge *&e) -{ - if( !e->NextInLML ) throw - clipperException("UpdateEdgeIntoAEL: invalid call"); - - e->NextInLML->OutIdx = e->OutIdx; - TEdge* AelPrev = e->PrevInAEL; - TEdge* AelNext = e->NextInAEL; - if (AelPrev) AelPrev->NextInAEL = e->NextInLML; - else m_ActiveEdges = e->NextInLML; - if (AelNext) AelNext->PrevInAEL = e->NextInLML; - e->NextInLML->Side = e->Side; - e->NextInLML->WindDelta = e->WindDelta; - e->NextInLML->WindCnt = e->WindCnt; - e->NextInLML->WindCnt2 = e->WindCnt2; - e = e->NextInLML; - e->Curr = e->Bot; - e->PrevInAEL = AelPrev; - e->NextInAEL = AelNext; - if (!IsHorizontal(*e)) InsertScanbeam(e->Top.Y); -} -//------------------------------------------------------------------------------ - -bool Clipper::ProcessIntersections(const cInt topY) -{ - if( !m_ActiveEdges ) return true; - try { - BuildIntersectList(topY); - size_t IlSize = m_IntersectList.size(); - if (IlSize == 0) return true; - if (IlSize == 1 || FixupIntersectionOrder()) ProcessIntersectList(); - else return false; - } - catch(...) - { - m_SortedEdges = 0; - DisposeIntersectNodes(); - throw clipperException("ProcessIntersections error"); - } - m_SortedEdges = 0; - return true; -} -//------------------------------------------------------------------------------ - -void Clipper::DisposeIntersectNodes() -{ - for (size_t i = 0; i < m_IntersectList.size(); ++i ) - delete m_IntersectList[i]; - m_IntersectList.clear(); -} -//------------------------------------------------------------------------------ - -void Clipper::BuildIntersectList(const cInt topY) -{ - if ( !m_ActiveEdges ) return; - - //prepare for sorting ... - TEdge* e = m_ActiveEdges; - m_SortedEdges = e; - while( e ) - { - e->PrevInSEL = e->PrevInAEL; - e->NextInSEL = e->NextInAEL; - e->Curr.X = TopX( *e, topY ); - e = e->NextInAEL; - } - - //bubblesort ... - bool isModified; - do - { - isModified = false; - e = m_SortedEdges; - while( e->NextInSEL ) - { - TEdge *eNext = e->NextInSEL; - IntPoint Pt; - if(e->Curr.X > eNext->Curr.X) - { - IntersectPoint(*e, *eNext, Pt); - IntersectNode * newNode = new IntersectNode; - newNode->Edge1 = e; - newNode->Edge2 = eNext; - newNode->Pt = Pt; - m_IntersectList.push_back(newNode); - - SwapPositionsInSEL(e, eNext); - isModified = true; - } - else - e = eNext; - } - if( e->PrevInSEL ) e->PrevInSEL->NextInSEL = 0; - else break; - } - while ( isModified ); - m_SortedEdges = 0; //important -} -//------------------------------------------------------------------------------ - - -void Clipper::ProcessIntersectList() -{ - for (size_t i = 0; i < m_IntersectList.size(); ++i) - { - IntersectNode* iNode = m_IntersectList[i]; - { - IntersectEdges( iNode->Edge1, iNode->Edge2, iNode->Pt); - SwapPositionsInAEL( iNode->Edge1 , iNode->Edge2 ); - } - delete iNode; - } - m_IntersectList.clear(); -} -//------------------------------------------------------------------------------ - -bool IntersectListSort(IntersectNode* node1, IntersectNode* node2) -{ - return node2->Pt.Y < node1->Pt.Y; -} -//------------------------------------------------------------------------------ - -inline bool EdgesAdjacent(const IntersectNode &inode) -{ - return (inode.Edge1->NextInSEL == inode.Edge2) || - (inode.Edge1->PrevInSEL == inode.Edge2); -} -//------------------------------------------------------------------------------ - -bool Clipper::FixupIntersectionOrder() -{ - //pre-condition: intersections are sorted Bottom-most first. - //Now it's crucial that intersections are made only between adjacent edges, - //so to ensure this the order of intersections may need adjusting ... - CopyAELToSEL(); - std::sort(m_IntersectList.begin(), m_IntersectList.end(), IntersectListSort); - size_t cnt = m_IntersectList.size(); - for (size_t i = 0; i < cnt; ++i) - { - if (!EdgesAdjacent(*m_IntersectList[i])) - { - size_t j = i + 1; - while (j < cnt && !EdgesAdjacent(*m_IntersectList[j])) j++; - if (j == cnt) return false; - std::swap(m_IntersectList[i], m_IntersectList[j]); - } - SwapPositionsInSEL(m_IntersectList[i]->Edge1, m_IntersectList[i]->Edge2); - } - return true; -} -//------------------------------------------------------------------------------ - -void Clipper::DoMaxima(TEdge *e) -{ - TEdge* eMaxPair = GetMaximaPair(e); - if (!eMaxPair) - { - if (e->OutIdx >= 0) - AddOutPt(e, e->Top); - DeleteFromAEL(e); - return; - } - - TEdge* eNext = e->NextInAEL; - while(eNext && eNext != eMaxPair) - { - IntersectEdges(e, eNext, e->Top); - SwapPositionsInAEL(e, eNext); - eNext = e->NextInAEL; - } - - if(e->OutIdx == Unassigned && eMaxPair->OutIdx == Unassigned) - { - DeleteFromAEL(e); - DeleteFromAEL(eMaxPair); - } - else if( e->OutIdx >= 0 && eMaxPair->OutIdx >= 0 ) - { - if (e->OutIdx >= 0) AddLocalMaxPoly(e, eMaxPair, e->Top); - DeleteFromAEL(e); - DeleteFromAEL(eMaxPair); - } -#ifdef use_lines - else if (e->WindDelta == 0) - { - if (e->OutIdx >= 0) - { - AddOutPt(e, e->Top); - e->OutIdx = Unassigned; - } - DeleteFromAEL(e); - - if (eMaxPair->OutIdx >= 0) - { - AddOutPt(eMaxPair, e->Top); - eMaxPair->OutIdx = Unassigned; - } - DeleteFromAEL(eMaxPair); - } -#endif - else throw clipperException("DoMaxima error"); -} -//------------------------------------------------------------------------------ - -void Clipper::ProcessEdgesAtTopOfScanbeam(const cInt topY) -{ - TEdge* e = m_ActiveEdges; - while( e ) - { - //1. process maxima, treating them as if they're 'bent' horizontal edges, - // but exclude maxima with horizontal edges. nb: e can't be a horizontal. - bool IsMaximaEdge = IsMaxima(e, topY); - - if(IsMaximaEdge) - { - TEdge* eMaxPair = GetMaximaPair(e); - IsMaximaEdge = (!eMaxPair || !IsHorizontal(*eMaxPair)); - } - - if(IsMaximaEdge) - { - TEdge* ePrev = e->PrevInAEL; - DoMaxima(e); - if( !ePrev ) e = m_ActiveEdges; - else e = ePrev->NextInAEL; - } - else - { - //2. promote horizontal edges, otherwise update Curr.X and Curr.Y ... - if (IsIntermediate(e, topY) && IsHorizontal(*e->NextInLML)) - { - UpdateEdgeIntoAEL(e); - if (e->OutIdx >= 0) - AddOutPt(e, e->Bot); - AddEdgeToSEL(e); - } - else - { - e->Curr.X = TopX( *e, topY ); - e->Curr.Y = topY; - } - - if (m_StrictSimple) - { - TEdge* ePrev = e->PrevInAEL; - if ((e->OutIdx >= 0) && (e->WindDelta != 0) && ePrev && (ePrev->OutIdx >= 0) && - (ePrev->Curr.X == e->Curr.X) && (ePrev->WindDelta != 0)) - { - IntPoint pt = e->Curr; -#ifdef use_xyz - SetZ(pt, *ePrev, *e); -#endif - OutPt* op = AddOutPt(ePrev, pt); - OutPt* op2 = AddOutPt(e, pt); - AddJoin(op, op2, pt); //StrictlySimple (type-3) join - } - } - - e = e->NextInAEL; - } - } - - //3. Process horizontals at the Top of the scanbeam ... - ProcessHorizontals(true); - - //4. Promote intermediate vertices ... - e = m_ActiveEdges; - while(e) - { - if(IsIntermediate(e, topY)) - { - OutPt* op = 0; - if( e->OutIdx >= 0 ) - op = AddOutPt(e, e->Top); - UpdateEdgeIntoAEL(e); - - //if output polygons share an edge, they'll need joining later ... - TEdge* ePrev = e->PrevInAEL; - TEdge* eNext = e->NextInAEL; - if (ePrev && ePrev->Curr.X == e->Bot.X && - ePrev->Curr.Y == e->Bot.Y && op && - ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y && - SlopesEqual(*e, *ePrev, m_UseFullRange) && - (e->WindDelta != 0) && (ePrev->WindDelta != 0)) - { - OutPt* op2 = AddOutPt(ePrev, e->Bot); - AddJoin(op, op2, e->Top); - } - else if (eNext && eNext->Curr.X == e->Bot.X && - eNext->Curr.Y == e->Bot.Y && op && - eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y && - SlopesEqual(*e, *eNext, m_UseFullRange) && - (e->WindDelta != 0) && (eNext->WindDelta != 0)) - { - OutPt* op2 = AddOutPt(eNext, e->Bot); - AddJoin(op, op2, e->Top); - } - } - e = e->NextInAEL; - } -} -//------------------------------------------------------------------------------ - -void Clipper::FixupOutPolygon(OutRec &outrec) -{ - //FixupOutPolygon() - removes duplicate points and simplifies consecutive - //parallel edges by removing the middle vertex. - OutPt *lastOK = 0; - outrec.BottomPt = 0; - OutPt *pp = outrec.Pts; - - for (;;) - { - if (pp->Prev == pp || pp->Prev == pp->Next ) - { - DisposeOutPts(pp); - outrec.Pts = 0; - return; - } - - //test for duplicate points and collinear edges ... - if ((pp->Pt == pp->Next->Pt) || (pp->Pt == pp->Prev->Pt) || - (SlopesEqual(pp->Prev->Pt, pp->Pt, pp->Next->Pt, m_UseFullRange) && - (!m_PreserveCollinear || - !Pt2IsBetweenPt1AndPt3(pp->Prev->Pt, pp->Pt, pp->Next->Pt)))) - { - lastOK = 0; - OutPt *tmp = pp; - pp->Prev->Next = pp->Next; - pp->Next->Prev = pp->Prev; - pp = pp->Prev; - delete tmp; - } - else if (pp == lastOK) break; - else - { - if (!lastOK) lastOK = pp; - pp = pp->Next; - } - } - outrec.Pts = pp; -} -//------------------------------------------------------------------------------ - -int PointCount(OutPt *Pts) -{ - if (!Pts) return 0; - int result = 0; - OutPt* p = Pts; - do - { - result++; - p = p->Next; - } - while (p != Pts); - return result; -} -//------------------------------------------------------------------------------ - -void Clipper::BuildResult(Paths &polys) -{ - polys.reserve(m_PolyOuts.size()); - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - { - if (!m_PolyOuts[i]->Pts) continue; - Path pg; - OutPt* p = m_PolyOuts[i]->Pts->Prev; - int cnt = PointCount(p); - if (cnt < 2) continue; - pg.reserve(cnt); - for (int i = 0; i < cnt; ++i) - { - pg.push_back(p->Pt); - p = p->Prev; - } - polys.push_back(pg); - } -} -//------------------------------------------------------------------------------ - -void Clipper::BuildResult2(PolyTree& polytree) -{ - polytree.Clear(); - polytree.AllNodes.reserve(m_PolyOuts.size()); - //add each output polygon/contour to polytree ... - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) - { - OutRec* outRec = m_PolyOuts[i]; - int cnt = PointCount(outRec->Pts); - if ((outRec->IsOpen && cnt < 2) || (!outRec->IsOpen && cnt < 3)) continue; - FixHoleLinkage(*outRec); - PolyNode* pn = new PolyNode(); - //nb: polytree takes ownership of all the PolyNodes - polytree.AllNodes.push_back(pn); - outRec->PolyNd = pn; - pn->Parent = 0; - pn->Index = 0; - pn->Contour.reserve(cnt); - OutPt *op = outRec->Pts->Prev; - for (int j = 0; j < cnt; j++) - { - pn->Contour.push_back(op->Pt); - op = op->Prev; - } - } - - //fixup PolyNode links etc ... - polytree.Childs.reserve(m_PolyOuts.size()); - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) - { - OutRec* outRec = m_PolyOuts[i]; - if (!outRec->PolyNd) continue; - if (outRec->IsOpen) - { - outRec->PolyNd->m_IsOpen = true; - polytree.AddChild(*outRec->PolyNd); - } - else if (outRec->FirstLeft && outRec->FirstLeft->PolyNd) - outRec->FirstLeft->PolyNd->AddChild(*outRec->PolyNd); - else - polytree.AddChild(*outRec->PolyNd); - } -} -//------------------------------------------------------------------------------ - -void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2) -{ - //just swap the contents (because fIntersectNodes is a single-linked-list) - IntersectNode inode = int1; //gets a copy of Int1 - int1.Edge1 = int2.Edge1; - int1.Edge2 = int2.Edge2; - int1.Pt = int2.Pt; - int2.Edge1 = inode.Edge1; - int2.Edge2 = inode.Edge2; - int2.Pt = inode.Pt; -} -//------------------------------------------------------------------------------ - -inline bool E2InsertsBeforeE1(TEdge &e1, TEdge &e2) -{ - if (e2.Curr.X == e1.Curr.X) - { - if (e2.Top.Y > e1.Top.Y) - return e2.Top.X < TopX(e1, e2.Top.Y); - else return e1.Top.X > TopX(e2, e1.Top.Y); - } - else return e2.Curr.X < e1.Curr.X; -} -//------------------------------------------------------------------------------ - -bool GetOverlap(const cInt a1, const cInt a2, const cInt b1, const cInt b2, - cInt& Left, cInt& Right) -{ - if (a1 < a2) - { - if (b1 < b2) {Left = std::max(a1,b1); Right = std::min(a2,b2);} - else {Left = std::max(a1,b2); Right = std::min(a2,b1);} - } - else - { - if (b1 < b2) {Left = std::max(a2,b1); Right = std::min(a1,b2);} - else {Left = std::max(a2,b2); Right = std::min(a1,b1);} - } - return Left < Right; -} -//------------------------------------------------------------------------------ - -inline void UpdateOutPtIdxs(OutRec& outrec) -{ - OutPt* op = outrec.Pts; - do - { - op->Idx = outrec.Idx; - op = op->Prev; - } - while(op != outrec.Pts); -} -//------------------------------------------------------------------------------ - -void Clipper::InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge) -{ - if(!m_ActiveEdges) - { - edge->PrevInAEL = 0; - edge->NextInAEL = 0; - m_ActiveEdges = edge; - } - else if(!startEdge && E2InsertsBeforeE1(*m_ActiveEdges, *edge)) - { - edge->PrevInAEL = 0; - edge->NextInAEL = m_ActiveEdges; - m_ActiveEdges->PrevInAEL = edge; - m_ActiveEdges = edge; - } - else - { - if(!startEdge) startEdge = m_ActiveEdges; - while(startEdge->NextInAEL && - !E2InsertsBeforeE1(*startEdge->NextInAEL , *edge)) - startEdge = startEdge->NextInAEL; - edge->NextInAEL = startEdge->NextInAEL; - if(startEdge->NextInAEL) startEdge->NextInAEL->PrevInAEL = edge; - edge->PrevInAEL = startEdge; - startEdge->NextInAEL = edge; - } -} -//---------------------------------------------------------------------- - -OutPt* DupOutPt(OutPt* outPt, bool InsertAfter) -{ - OutPt* result = new OutPt; - result->Pt = outPt->Pt; - result->Idx = outPt->Idx; - if (InsertAfter) - { - result->Next = outPt->Next; - result->Prev = outPt; - outPt->Next->Prev = result; - outPt->Next = result; - } - else - { - result->Prev = outPt->Prev; - result->Next = outPt; - outPt->Prev->Next = result; - outPt->Prev = result; - } - return result; -} -//------------------------------------------------------------------------------ - -bool JoinHorz(OutPt* op1, OutPt* op1b, OutPt* op2, OutPt* op2b, - const IntPoint Pt, bool DiscardLeft) -{ - Direction Dir1 = (op1->Pt.X > op1b->Pt.X ? dRightToLeft : dLeftToRight); - Direction Dir2 = (op2->Pt.X > op2b->Pt.X ? dRightToLeft : dLeftToRight); - if (Dir1 == Dir2) return false; - - //When DiscardLeft, we want Op1b to be on the Left of Op1, otherwise we - //want Op1b to be on the Right. (And likewise with Op2 and Op2b.) - //So, to facilitate this while inserting Op1b and Op2b ... - //when DiscardLeft, make sure we're AT or RIGHT of Pt before adding Op1b, - //otherwise make sure we're AT or LEFT of Pt. (Likewise with Op2b.) - if (Dir1 == dLeftToRight) - { - while (op1->Next->Pt.X <= Pt.X && - op1->Next->Pt.X >= op1->Pt.X && op1->Next->Pt.Y == Pt.Y) - op1 = op1->Next; - if (DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next; - op1b = DupOutPt(op1, !DiscardLeft); - if (op1b->Pt != Pt) - { - op1 = op1b; - op1->Pt = Pt; - op1b = DupOutPt(op1, !DiscardLeft); - } - } - else - { - while (op1->Next->Pt.X >= Pt.X && - op1->Next->Pt.X <= op1->Pt.X && op1->Next->Pt.Y == Pt.Y) - op1 = op1->Next; - if (!DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next; - op1b = DupOutPt(op1, DiscardLeft); - if (op1b->Pt != Pt) - { - op1 = op1b; - op1->Pt = Pt; - op1b = DupOutPt(op1, DiscardLeft); - } - } - - if (Dir2 == dLeftToRight) - { - while (op2->Next->Pt.X <= Pt.X && - op2->Next->Pt.X >= op2->Pt.X && op2->Next->Pt.Y == Pt.Y) - op2 = op2->Next; - if (DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next; - op2b = DupOutPt(op2, !DiscardLeft); - if (op2b->Pt != Pt) - { - op2 = op2b; - op2->Pt = Pt; - op2b = DupOutPt(op2, !DiscardLeft); - }; - } else - { - while (op2->Next->Pt.X >= Pt.X && - op2->Next->Pt.X <= op2->Pt.X && op2->Next->Pt.Y == Pt.Y) - op2 = op2->Next; - if (!DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next; - op2b = DupOutPt(op2, DiscardLeft); - if (op2b->Pt != Pt) - { - op2 = op2b; - op2->Pt = Pt; - op2b = DupOutPt(op2, DiscardLeft); - }; - }; - - if ((Dir1 == dLeftToRight) == DiscardLeft) - { - op1->Prev = op2; - op2->Next = op1; - op1b->Next = op2b; - op2b->Prev = op1b; - } - else - { - op1->Next = op2; - op2->Prev = op1; - op1b->Prev = op2b; - op2b->Next = op1b; - } - return true; -} -//------------------------------------------------------------------------------ - -bool Clipper::JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2) -{ - OutPt *op1 = j->OutPt1, *op1b; - OutPt *op2 = j->OutPt2, *op2b; - - //There are 3 kinds of joins for output polygons ... - //1. Horizontal joins where Join.OutPt1 & Join.OutPt2 are a vertices anywhere - //along (horizontal) collinear edges (& Join.OffPt is on the same horizontal). - //2. Non-horizontal joins where Join.OutPt1 & Join.OutPt2 are at the same - //location at the Bottom of the overlapping segment (& Join.OffPt is above). - //3. StrictSimple joins where edges touch but are not collinear and where - //Join.OutPt1, Join.OutPt2 & Join.OffPt all share the same point. - bool isHorizontal = (j->OutPt1->Pt.Y == j->OffPt.Y); - - if (isHorizontal && (j->OffPt == j->OutPt1->Pt) && - (j->OffPt == j->OutPt2->Pt)) - { - //Strictly Simple join ... - if (outRec1 != outRec2) return false; - op1b = j->OutPt1->Next; - while (op1b != op1 && (op1b->Pt == j->OffPt)) - op1b = op1b->Next; - bool reverse1 = (op1b->Pt.Y > j->OffPt.Y); - op2b = j->OutPt2->Next; - while (op2b != op2 && (op2b->Pt == j->OffPt)) - op2b = op2b->Next; - bool reverse2 = (op2b->Pt.Y > j->OffPt.Y); - if (reverse1 == reverse2) return false; - if (reverse1) - { - op1b = DupOutPt(op1, false); - op2b = DupOutPt(op2, true); - op1->Prev = op2; - op2->Next = op1; - op1b->Next = op2b; - op2b->Prev = op1b; - j->OutPt1 = op1; - j->OutPt2 = op1b; - return true; - } else - { - op1b = DupOutPt(op1, true); - op2b = DupOutPt(op2, false); - op1->Next = op2; - op2->Prev = op1; - op1b->Prev = op2b; - op2b->Next = op1b; - j->OutPt1 = op1; - j->OutPt2 = op1b; - return true; - } - } - else if (isHorizontal) - { - //treat horizontal joins differently to non-horizontal joins since with - //them we're not yet sure where the overlapping is. OutPt1.Pt & OutPt2.Pt - //may be anywhere along the horizontal edge. - op1b = op1; - while (op1->Prev->Pt.Y == op1->Pt.Y && op1->Prev != op1b && op1->Prev != op2) - op1 = op1->Prev; - while (op1b->Next->Pt.Y == op1b->Pt.Y && op1b->Next != op1 && op1b->Next != op2) - op1b = op1b->Next; - if (op1b->Next == op1 || op1b->Next == op2) return false; //a flat 'polygon' - - op2b = op2; - while (op2->Prev->Pt.Y == op2->Pt.Y && op2->Prev != op2b && op2->Prev != op1b) - op2 = op2->Prev; - while (op2b->Next->Pt.Y == op2b->Pt.Y && op2b->Next != op2 && op2b->Next != op1) - op2b = op2b->Next; - if (op2b->Next == op2 || op2b->Next == op1) return false; //a flat 'polygon' - - cInt Left, Right; - //Op1 --> Op1b & Op2 --> Op2b are the extremites of the horizontal edges - if (!GetOverlap(op1->Pt.X, op1b->Pt.X, op2->Pt.X, op2b->Pt.X, Left, Right)) - return false; - - //DiscardLeftSide: when overlapping edges are joined, a spike will created - //which needs to be cleaned up. However, we don't want Op1 or Op2 caught up - //on the discard Side as either may still be needed for other joins ... - IntPoint Pt; - bool DiscardLeftSide; - if (op1->Pt.X >= Left && op1->Pt.X <= Right) - { - Pt = op1->Pt; DiscardLeftSide = (op1->Pt.X > op1b->Pt.X); - } - else if (op2->Pt.X >= Left&& op2->Pt.X <= Right) - { - Pt = op2->Pt; DiscardLeftSide = (op2->Pt.X > op2b->Pt.X); - } - else if (op1b->Pt.X >= Left && op1b->Pt.X <= Right) - { - Pt = op1b->Pt; DiscardLeftSide = op1b->Pt.X > op1->Pt.X; - } - else - { - Pt = op2b->Pt; DiscardLeftSide = (op2b->Pt.X > op2->Pt.X); - } - j->OutPt1 = op1; j->OutPt2 = op2; - return JoinHorz(op1, op1b, op2, op2b, Pt, DiscardLeftSide); - } else - { - //nb: For non-horizontal joins ... - // 1. Jr.OutPt1.Pt.Y == Jr.OutPt2.Pt.Y - // 2. Jr.OutPt1.Pt > Jr.OffPt.Y - - //make sure the polygons are correctly oriented ... - op1b = op1->Next; - while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Next; - bool Reverse1 = ((op1b->Pt.Y > op1->Pt.Y) || - !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange)); - if (Reverse1) - { - op1b = op1->Prev; - while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Prev; - if ((op1b->Pt.Y > op1->Pt.Y) || - !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange)) return false; - }; - op2b = op2->Next; - while ((op2b->Pt == op2->Pt) && (op2b != op2))op2b = op2b->Next; - bool Reverse2 = ((op2b->Pt.Y > op2->Pt.Y) || - !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange)); - if (Reverse2) - { - op2b = op2->Prev; - while ((op2b->Pt == op2->Pt) && (op2b != op2)) op2b = op2b->Prev; - if ((op2b->Pt.Y > op2->Pt.Y) || - !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange)) return false; - } - - if ((op1b == op1) || (op2b == op2) || (op1b == op2b) || - ((outRec1 == outRec2) && (Reverse1 == Reverse2))) return false; - - if (Reverse1) - { - op1b = DupOutPt(op1, false); - op2b = DupOutPt(op2, true); - op1->Prev = op2; - op2->Next = op1; - op1b->Next = op2b; - op2b->Prev = op1b; - j->OutPt1 = op1; - j->OutPt2 = op1b; - return true; - } else - { - op1b = DupOutPt(op1, true); - op2b = DupOutPt(op2, false); - op1->Next = op2; - op2->Prev = op1; - op1b->Prev = op2b; - op2b->Next = op1b; - j->OutPt1 = op1; - j->OutPt2 = op1b; - return true; - } - } -} -//---------------------------------------------------------------------- - -static OutRec* ParseFirstLeft(OutRec* FirstLeft) -{ - while (FirstLeft && !FirstLeft->Pts) - FirstLeft = FirstLeft->FirstLeft; - return FirstLeft; -} -//------------------------------------------------------------------------------ - -void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) -{ - //tests if NewOutRec contains the polygon before reassigning FirstLeft - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - { - OutRec* outRec = m_PolyOuts[i]; - if (!outRec->Pts || !outRec->FirstLeft) continue; - OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft); - if (firstLeft == OldOutRec) - { - if (Poly2ContainsPoly1(outRec->Pts, NewOutRec->Pts)) - outRec->FirstLeft = NewOutRec; - } - } -} -//---------------------------------------------------------------------- - -void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) -{ - //reassigns FirstLeft WITHOUT testing if NewOutRec contains the polygon - for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) - { - OutRec* outRec = m_PolyOuts[i]; - if (outRec->FirstLeft == OldOutRec) outRec->FirstLeft = NewOutRec; - } -} -//---------------------------------------------------------------------- - -void Clipper::JoinCommonEdges() -{ - for (JoinList::size_type i = 0; i < m_Joins.size(); i++) - { - Join* join = m_Joins[i]; - - OutRec *outRec1 = GetOutRec(join->OutPt1->Idx); - OutRec *outRec2 = GetOutRec(join->OutPt2->Idx); - - if (!outRec1->Pts || !outRec2->Pts) continue; - - //get the polygon fragment with the correct hole state (FirstLeft) - //before calling JoinPoints() ... - OutRec *holeStateRec; - if (outRec1 == outRec2) holeStateRec = outRec1; - else if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2; - else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1; - else holeStateRec = GetLowermostRec(outRec1, outRec2); - - if (!JoinPoints(join, outRec1, outRec2)) continue; - - if (outRec1 == outRec2) - { - //instead of joining two polygons, we've just created a new one by - //splitting one polygon into two. - outRec1->Pts = join->OutPt1; - outRec1->BottomPt = 0; - outRec2 = CreateOutRec(); - outRec2->Pts = join->OutPt2; - - //update all OutRec2.Pts Idx's ... - UpdateOutPtIdxs(*outRec2); - - //We now need to check every OutRec.FirstLeft pointer. If it points - //to OutRec1 it may need to point to OutRec2 instead ... - if (m_UsingPolyTree) - for (PolyOutList::size_type j = 0; j < m_PolyOuts.size() - 1; j++) - { - OutRec* oRec = m_PolyOuts[j]; - if (!oRec->Pts || ParseFirstLeft(oRec->FirstLeft) != outRec1 || - oRec->IsHole == outRec1->IsHole) continue; - if (Poly2ContainsPoly1(oRec->Pts, join->OutPt2)) - oRec->FirstLeft = outRec2; - } - - if (Poly2ContainsPoly1(outRec2->Pts, outRec1->Pts)) - { - //outRec2 is contained by outRec1 ... - outRec2->IsHole = !outRec1->IsHole; - outRec2->FirstLeft = outRec1; - - //fixup FirstLeft pointers that may need reassigning to OutRec1 - if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); - - if ((outRec2->IsHole ^ m_ReverseOutput) == (Area(*outRec2) > 0)) - ReversePolyPtLinks(outRec2->Pts); - - } else if (Poly2ContainsPoly1(outRec1->Pts, outRec2->Pts)) - { - //outRec1 is contained by outRec2 ... - outRec2->IsHole = outRec1->IsHole; - outRec1->IsHole = !outRec2->IsHole; - outRec2->FirstLeft = outRec1->FirstLeft; - outRec1->FirstLeft = outRec2; - - //fixup FirstLeft pointers that may need reassigning to OutRec1 - if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2); - - if ((outRec1->IsHole ^ m_ReverseOutput) == (Area(*outRec1) > 0)) - ReversePolyPtLinks(outRec1->Pts); - } - else - { - //the 2 polygons are completely separate ... - outRec2->IsHole = outRec1->IsHole; - outRec2->FirstLeft = outRec1->FirstLeft; - - //fixup FirstLeft pointers that may need reassigning to OutRec2 - if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2); - } - - } else - { - //joined 2 polygons together ... - - outRec2->Pts = 0; - outRec2->BottomPt = 0; - outRec2->Idx = outRec1->Idx; - - outRec1->IsHole = holeStateRec->IsHole; - if (holeStateRec == outRec2) - outRec1->FirstLeft = outRec2->FirstLeft; - outRec2->FirstLeft = outRec1; - - //fixup FirstLeft pointers that may need reassigning to OutRec1 - if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); - } - } -} - -//------------------------------------------------------------------------------ -// ClipperOffset support functions ... -//------------------------------------------------------------------------------ - -DoublePoint GetUnitNormal(const IntPoint &pt1, const IntPoint &pt2) -{ - if(pt2.X == pt1.X && pt2.Y == pt1.Y) - return DoublePoint(0, 0); - - double Dx = (double)(pt2.X - pt1.X); - double dy = (double)(pt2.Y - pt1.Y); - double f = 1 *1.0/ std::sqrt( Dx*Dx + dy*dy ); - Dx *= f; - dy *= f; - return DoublePoint(dy, -Dx); -} - -//------------------------------------------------------------------------------ -// ClipperOffset class -//------------------------------------------------------------------------------ - -ClipperOffset::ClipperOffset(double miterLimit, double arcTolerance) -{ - this->MiterLimit = miterLimit; - this->ArcTolerance = arcTolerance; - m_lowest.X = -1; -} -//------------------------------------------------------------------------------ - -ClipperOffset::~ClipperOffset() -{ - Clear(); -} -//------------------------------------------------------------------------------ - -void ClipperOffset::Clear() -{ - for (int i = 0; i < m_polyNodes.ChildCount(); ++i) - delete m_polyNodes.Childs[i]; - m_polyNodes.Childs.clear(); - m_lowest.X = -1; -} -//------------------------------------------------------------------------------ - -void ClipperOffset::AddPath(const Path& path, JoinType joinType, EndType endType) -{ - int highI = (int)path.size() - 1; - if (highI < 0) return; - PolyNode* newNode = new PolyNode(); - newNode->m_jointype = joinType; - newNode->m_endtype = endType; - - //strip duplicate points from path and also get index to the lowest point ... - if (endType == etClosedLine || endType == etClosedPolygon) - while (highI > 0 && path[0] == path[highI]) highI--; - newNode->Contour.reserve(highI + 1); - newNode->Contour.push_back(path[0]); - int j = 0, k = 0; - for (int i = 1; i <= highI; i++) - if (newNode->Contour[j] != path[i]) - { - j++; - newNode->Contour.push_back(path[i]); - if (path[i].Y > newNode->Contour[k].Y || - (path[i].Y == newNode->Contour[k].Y && - path[i].X < newNode->Contour[k].X)) k = j; - } - if (endType == etClosedPolygon && j < 2) - { - delete newNode; - return; - } - m_polyNodes.AddChild(*newNode); - - //if this path's lowest pt is lower than all the others then update m_lowest - if (endType != etClosedPolygon) return; - if (m_lowest.X < 0) - m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k); - else - { - IntPoint ip = m_polyNodes.Childs[(int)m_lowest.X]->Contour[(int)m_lowest.Y]; - if (newNode->Contour[k].Y > ip.Y || - (newNode->Contour[k].Y == ip.Y && - newNode->Contour[k].X < ip.X)) - m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k); - } -} -//------------------------------------------------------------------------------ - -void ClipperOffset::AddPaths(const Paths& paths, JoinType joinType, EndType endType) -{ - for (Paths::size_type i = 0; i < paths.size(); ++i) - AddPath(paths[i], joinType, endType); -} -//------------------------------------------------------------------------------ - -void ClipperOffset::FixOrientations() -{ - //fixup orientations of all closed paths if the orientation of the - //closed path with the lowermost vertex is wrong ... - if (m_lowest.X >= 0 && - !Orientation(m_polyNodes.Childs[(int)m_lowest.X]->Contour)) - { - for (int i = 0; i < m_polyNodes.ChildCount(); ++i) - { - PolyNode& node = *m_polyNodes.Childs[i]; - if (node.m_endtype == etClosedPolygon || - (node.m_endtype == etClosedLine && Orientation(node.Contour))) - ReversePath(node.Contour); - } - } else - { - for (int i = 0; i < m_polyNodes.ChildCount(); ++i) - { - PolyNode& node = *m_polyNodes.Childs[i]; - if (node.m_endtype == etClosedLine && !Orientation(node.Contour)) - ReversePath(node.Contour); - } - } -} -//------------------------------------------------------------------------------ - -void ClipperOffset::Execute(Paths& solution, double delta) -{ - solution.clear(); - FixOrientations(); - DoOffset(delta); - - //now clean up 'corners' ... - Clipper clpr; - clpr.AddPaths(m_destPolys, ptSubject, true); - if (delta > 0) - { - clpr.Execute(ctUnion, solution, pftPositive, pftPositive); - } - else - { - IntRect r = clpr.GetBounds(); - Path outer(4); - outer[0] = IntPoint(r.left - 10, r.bottom + 10); - outer[1] = IntPoint(r.right + 10, r.bottom + 10); - outer[2] = IntPoint(r.right + 10, r.top - 10); - outer[3] = IntPoint(r.left - 10, r.top - 10); - - clpr.AddPath(outer, ptSubject, true); - clpr.ReverseSolution(true); - clpr.Execute(ctUnion, solution, pftNegative, pftNegative); - if (solution.size() > 0) solution.erase(solution.begin()); - } -} -//------------------------------------------------------------------------------ - -void ClipperOffset::Execute(PolyTree& solution, double delta) -{ - solution.Clear(); - FixOrientations(); - DoOffset(delta); - - //now clean up 'corners' ... - Clipper clpr; - clpr.AddPaths(m_destPolys, ptSubject, true); - if (delta > 0) - { - clpr.Execute(ctUnion, solution, pftPositive, pftPositive); - } - else - { - IntRect r = clpr.GetBounds(); - Path outer(4); - outer[0] = IntPoint(r.left - 10, r.bottom + 10); - outer[1] = IntPoint(r.right + 10, r.bottom + 10); - outer[2] = IntPoint(r.right + 10, r.top - 10); - outer[3] = IntPoint(r.left - 10, r.top - 10); - - clpr.AddPath(outer, ptSubject, true); - clpr.ReverseSolution(true); - clpr.Execute(ctUnion, solution, pftNegative, pftNegative); - //remove the outer PolyNode rectangle ... - if (solution.ChildCount() == 1 && solution.Childs[0]->ChildCount() > 0) - { - PolyNode* outerNode = solution.Childs[0]; - solution.Childs.reserve(outerNode->ChildCount()); - solution.Childs[0] = outerNode->Childs[0]; - solution.Childs[0]->Parent = outerNode->Parent; - for (int i = 1; i < outerNode->ChildCount(); ++i) - solution.AddChild(*outerNode->Childs[i]); - } - else - solution.Clear(); - } -} -//------------------------------------------------------------------------------ - -void ClipperOffset::DoOffset(double delta) -{ - m_destPolys.clear(); - m_delta = delta; - - //if Zero offset, just copy any CLOSED polygons to m_p and return ... - if (NEAR_ZERO(delta)) - { - m_destPolys.reserve(m_polyNodes.ChildCount()); - for (int i = 0; i < m_polyNodes.ChildCount(); i++) - { - PolyNode& node = *m_polyNodes.Childs[i]; - if (node.m_endtype == etClosedPolygon) - m_destPolys.push_back(node.Contour); - } - return; - } - - //see offset_triginometry3.svg in the documentation folder ... - if (MiterLimit > 2) m_miterLim = 2/(MiterLimit * MiterLimit); - else m_miterLim = 0.5; - - double y; - if (ArcTolerance <= 0.0) y = def_arc_tolerance; - else if (ArcTolerance > std::fabs(delta) * def_arc_tolerance) - y = std::fabs(delta) * def_arc_tolerance; - else y = ArcTolerance; - //see offset_triginometry2.svg in the documentation folder ... - double steps = pi / std::acos(1 - y / std::fabs(delta)); - if (steps > std::fabs(delta) * pi) - steps = std::fabs(delta) * pi; //ie excessive precision check - m_sin = std::sin(two_pi / steps); - m_cos = std::cos(two_pi / steps); - m_StepsPerRad = steps / two_pi; - if (delta < 0.0) m_sin = -m_sin; - - m_destPolys.reserve(m_polyNodes.ChildCount() * 2); - for (int i = 0; i < m_polyNodes.ChildCount(); i++) - { - PolyNode& node = *m_polyNodes.Childs[i]; - m_srcPoly = node.Contour; - - int len = (int)m_srcPoly.size(); - if (len == 0 || (delta <= 0 && (len < 3 || node.m_endtype != etClosedPolygon))) - continue; - - m_destPoly.clear(); - if (len == 1) - { - if (node.m_jointype == jtRound) - { - double X = 1.0, Y = 0.0; - for (cInt j = 1; j <= steps; j++) - { - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[0].X + X * delta), - Round(m_srcPoly[0].Y + Y * delta))); - double X2 = X; - X = X * m_cos - m_sin * Y; - Y = X2 * m_sin + Y * m_cos; - } - } - else - { - double X = -1.0, Y = -1.0; - for (int j = 0; j < 4; ++j) - { - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[0].X + X * delta), - Round(m_srcPoly[0].Y + Y * delta))); - if (X < 0) X = 1; - else if (Y < 0) Y = 1; - else X = -1; - } - } - m_destPolys.push_back(m_destPoly); - continue; - } - //build m_normals ... - m_normals.clear(); - m_normals.reserve(len); - for (int j = 0; j < len - 1; ++j) - m_normals.push_back(GetUnitNormal(m_srcPoly[j], m_srcPoly[j + 1])); - if (node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon) - m_normals.push_back(GetUnitNormal(m_srcPoly[len - 1], m_srcPoly[0])); - else - m_normals.push_back(DoublePoint(m_normals[len - 2])); - - if (node.m_endtype == etClosedPolygon) - { - int k = len - 1; - for (int j = 0; j < len; ++j) - OffsetPoint(j, k, node.m_jointype); - m_destPolys.push_back(m_destPoly); - } - else if (node.m_endtype == etClosedLine) - { - int k = len - 1; - for (int j = 0; j < len; ++j) - OffsetPoint(j, k, node.m_jointype); - m_destPolys.push_back(m_destPoly); - m_destPoly.clear(); - //re-build m_normals ... - DoublePoint n = m_normals[len -1]; - for (int j = len - 1; j > 0; j--) - m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y); - m_normals[0] = DoublePoint(-n.X, -n.Y); - k = 0; - for (int j = len - 1; j >= 0; j--) - OffsetPoint(j, k, node.m_jointype); - m_destPolys.push_back(m_destPoly); - } - else - { - int k = 0; - for (int j = 1; j < len - 1; ++j) - OffsetPoint(j, k, node.m_jointype); - - IntPoint pt1; - if (node.m_endtype == etOpenButt) - { - int j = len - 1; - pt1 = IntPoint((cInt)Round(m_srcPoly[j].X + m_normals[j].X * - delta), (cInt)Round(m_srcPoly[j].Y + m_normals[j].Y * delta)); - m_destPoly.push_back(pt1); - pt1 = IntPoint((cInt)Round(m_srcPoly[j].X - m_normals[j].X * - delta), (cInt)Round(m_srcPoly[j].Y - m_normals[j].Y * delta)); - m_destPoly.push_back(pt1); - } - else - { - int j = len - 1; - k = len - 2; - m_sinA = 0; - m_normals[j] = DoublePoint(-m_normals[j].X, -m_normals[j].Y); - if (node.m_endtype == etOpenSquare) - DoSquare(j, k); - else - DoRound(j, k); - } - - //re-build m_normals ... - for (int j = len - 1; j > 0; j--) - m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y); - m_normals[0] = DoublePoint(-m_normals[1].X, -m_normals[1].Y); - - k = len - 1; - for (int j = k - 1; j > 0; --j) OffsetPoint(j, k, node.m_jointype); - - if (node.m_endtype == etOpenButt) - { - pt1 = IntPoint((cInt)Round(m_srcPoly[0].X - m_normals[0].X * delta), - (cInt)Round(m_srcPoly[0].Y - m_normals[0].Y * delta)); - m_destPoly.push_back(pt1); - pt1 = IntPoint((cInt)Round(m_srcPoly[0].X + m_normals[0].X * delta), - (cInt)Round(m_srcPoly[0].Y + m_normals[0].Y * delta)); - m_destPoly.push_back(pt1); - } - else - { - k = 1; - m_sinA = 0; - if (node.m_endtype == etOpenSquare) - DoSquare(0, 1); - else - DoRound(0, 1); - } - m_destPolys.push_back(m_destPoly); - } - } -} -//------------------------------------------------------------------------------ - -void ClipperOffset::OffsetPoint(int j, int& k, JoinType jointype) -{ - //cross product ... - m_sinA = (m_normals[k].X * m_normals[j].Y - m_normals[j].X * m_normals[k].Y); - if (std::fabs(m_sinA * m_delta) < 1.0) - { - //dot product ... - double cosA = (m_normals[k].X * m_normals[j].X + m_normals[j].Y * m_normals[k].Y ); - if (cosA > 0) // angle => 0 degrees - { - m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta), - Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta))); - return; - } - //else angle => 180 degrees - } - else if (m_sinA > 1.0) m_sinA = 1.0; - else if (m_sinA < -1.0) m_sinA = -1.0; - - if (m_sinA * m_delta < 0) - { - m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta), - Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta))); - m_destPoly.push_back(m_srcPoly[j]); - m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[j].X * m_delta), - Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta))); - } - else - switch (jointype) - { - case jtMiter: - { - double r = 1 + (m_normals[j].X * m_normals[k].X + - m_normals[j].Y * m_normals[k].Y); - if (r >= m_miterLim) DoMiter(j, k, r); else DoSquare(j, k); - break; - } - case jtSquare: DoSquare(j, k); break; - case jtRound: DoRound(j, k); break; - } - k = j; -} -//------------------------------------------------------------------------------ - -void ClipperOffset::DoSquare(int j, int k) -{ - double dx = std::tan(std::atan2(m_sinA, - m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y) / 4); - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[j].X + m_delta * (m_normals[k].X - m_normals[k].Y * dx)), - Round(m_srcPoly[j].Y + m_delta * (m_normals[k].Y + m_normals[k].X * dx)))); - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[j].X + m_delta * (m_normals[j].X + m_normals[j].Y * dx)), - Round(m_srcPoly[j].Y + m_delta * (m_normals[j].Y - m_normals[j].X * dx)))); -} -//------------------------------------------------------------------------------ - -void ClipperOffset::DoMiter(int j, int k, double r) -{ - double q = m_delta / r; - m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + (m_normals[k].X + m_normals[j].X) * q), - Round(m_srcPoly[j].Y + (m_normals[k].Y + m_normals[j].Y) * q))); -} -//------------------------------------------------------------------------------ - -void ClipperOffset::DoRound(int j, int k) -{ - double a = std::atan2(m_sinA, - m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y); - int steps = std::max((int)Round(m_StepsPerRad * std::fabs(a)), 1); - - double X = m_normals[k].X, Y = m_normals[k].Y, X2; - for (int i = 0; i < steps; ++i) - { - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[j].X + X * m_delta), - Round(m_srcPoly[j].Y + Y * m_delta))); - X2 = X; - X = X * m_cos - m_sin * Y; - Y = X2 * m_sin + Y * m_cos; - } - m_destPoly.push_back(IntPoint( - Round(m_srcPoly[j].X + m_normals[j].X * m_delta), - Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta))); -} - -//------------------------------------------------------------------------------ -// Miscellaneous public functions -//------------------------------------------------------------------------------ - -void Clipper::DoSimplePolygons() -{ - PolyOutList::size_type i = 0; - while (i < m_PolyOuts.size()) - { - OutRec* outrec = m_PolyOuts[i++]; - OutPt* op = outrec->Pts; - if (!op || outrec->IsOpen) continue; - do //for each Pt in Polygon until duplicate found do ... - { - OutPt* op2 = op->Next; - while (op2 != outrec->Pts) - { - if ((op->Pt == op2->Pt) && op2->Next != op && op2->Prev != op) - { - //split the polygon into two ... - OutPt* op3 = op->Prev; - OutPt* op4 = op2->Prev; - op->Prev = op4; - op4->Next = op; - op2->Prev = op3; - op3->Next = op2; - - outrec->Pts = op; - OutRec* outrec2 = CreateOutRec(); - outrec2->Pts = op2; - UpdateOutPtIdxs(*outrec2); - if (Poly2ContainsPoly1(outrec2->Pts, outrec->Pts)) - { - //OutRec2 is contained by OutRec1 ... - outrec2->IsHole = !outrec->IsHole; - outrec2->FirstLeft = outrec; - if (m_UsingPolyTree) FixupFirstLefts2(outrec2, outrec); - } - else - if (Poly2ContainsPoly1(outrec->Pts, outrec2->Pts)) - { - //OutRec1 is contained by OutRec2 ... - outrec2->IsHole = outrec->IsHole; - outrec->IsHole = !outrec2->IsHole; - outrec2->FirstLeft = outrec->FirstLeft; - outrec->FirstLeft = outrec2; - if (m_UsingPolyTree) FixupFirstLefts2(outrec, outrec2); - } - else - { - //the 2 polygons are separate ... - outrec2->IsHole = outrec->IsHole; - outrec2->FirstLeft = outrec->FirstLeft; - if (m_UsingPolyTree) FixupFirstLefts1(outrec, outrec2); - } - op2 = op; //ie get ready for the Next iteration - } - op2 = op2->Next; - } - op = op->Next; - } - while (op != outrec->Pts); - } -} -//------------------------------------------------------------------------------ - -void ReversePath(Path& p) -{ - std::reverse(p.begin(), p.end()); -} -//------------------------------------------------------------------------------ - -void ReversePaths(Paths& p) -{ - for (Paths::size_type i = 0; i < p.size(); ++i) - ReversePath(p[i]); -} -//------------------------------------------------------------------------------ - -void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType) -{ - Clipper c; - c.StrictlySimple(true); - c.AddPath(in_poly, ptSubject, true); - c.Execute(ctUnion, out_polys, fillType, fillType); -} -//------------------------------------------------------------------------------ - -void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType) -{ - Clipper c; - c.StrictlySimple(true); - c.AddPaths(in_polys, ptSubject, true); - c.Execute(ctUnion, out_polys, fillType, fillType); -} -//------------------------------------------------------------------------------ - -void SimplifyPolygons(Paths &polys, PolyFillType fillType) -{ - SimplifyPolygons(polys, polys, fillType); -} -//------------------------------------------------------------------------------ - -inline double DistanceSqrd(const IntPoint& pt1, const IntPoint& pt2) -{ - double Dx = ((double)pt1.X - pt2.X); - double dy = ((double)pt1.Y - pt2.Y); - return (Dx*Dx + dy*dy); -} -//------------------------------------------------------------------------------ - -double DistanceFromLineSqrd( - const IntPoint& pt, const IntPoint& ln1, const IntPoint& ln2) -{ - //The equation of a line in general form (Ax + By + C = 0) - //given 2 points (x¹,y¹) & (x²,y²) is ... - //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0 - //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹ - //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²) - //see http://en.wikipedia.org/wiki/Perpendicular_distance - double A = double(ln1.Y - ln2.Y); - double B = double(ln2.X - ln1.X); - double C = A * ln1.X + B * ln1.Y; - C = A * pt.X + B * pt.Y - C; - return (C * C) / (A * A + B * B); -} -//--------------------------------------------------------------------------- - -bool SlopesNearCollinear(const IntPoint& pt1, - const IntPoint& pt2, const IntPoint& pt3, double distSqrd) -{ - //this function is more accurate when the point that's geometrically - //between the other 2 points is the one that's tested for distance. - //ie makes it more likely to pick up 'spikes' ... - if (Abs(pt1.X - pt2.X) > Abs(pt1.Y - pt2.Y)) - { - if ((pt1.X > pt2.X) == (pt1.X < pt3.X)) - return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd; - else if ((pt2.X > pt1.X) == (pt2.X < pt3.X)) - return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd; - else - return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd; - } - else - { - if ((pt1.Y > pt2.Y) == (pt1.Y < pt3.Y)) - return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd; - else if ((pt2.Y > pt1.Y) == (pt2.Y < pt3.Y)) - return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd; - else - return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd; - } -} -//------------------------------------------------------------------------------ - -bool PointsAreClose(IntPoint pt1, IntPoint pt2, double distSqrd) -{ - double Dx = (double)pt1.X - pt2.X; - double dy = (double)pt1.Y - pt2.Y; - return ((Dx * Dx) + (dy * dy) <= distSqrd); -} -//------------------------------------------------------------------------------ - -OutPt* ExcludeOp(OutPt* op) -{ - OutPt* result = op->Prev; - result->Next = op->Next; - op->Next->Prev = result; - result->Idx = 0; - return result; -} -//------------------------------------------------------------------------------ - -void CleanPolygon(const Path& in_poly, Path& out_poly, double distance) -{ - //distance = proximity in units/pixels below which vertices - //will be stripped. Default ~= sqrt(2). - - size_t size = in_poly.size(); - - if (size == 0) - { - out_poly.clear(); - return; - } - - OutPt* outPts = new OutPt[size]; - for (size_t i = 0; i < size; ++i) - { - outPts[i].Pt = in_poly[i]; - outPts[i].Next = &outPts[(i + 1) % size]; - outPts[i].Next->Prev = &outPts[i]; - outPts[i].Idx = 0; - } - - double distSqrd = distance * distance; - OutPt* op = &outPts[0]; - while (op->Idx == 0 && op->Next != op->Prev) - { - if (PointsAreClose(op->Pt, op->Prev->Pt, distSqrd)) - { - op = ExcludeOp(op); - size--; - } - else if (PointsAreClose(op->Prev->Pt, op->Next->Pt, distSqrd)) - { - ExcludeOp(op->Next); - op = ExcludeOp(op); - size -= 2; - } - else if (SlopesNearCollinear(op->Prev->Pt, op->Pt, op->Next->Pt, distSqrd)) - { - op = ExcludeOp(op); - size--; - } - else - { - op->Idx = 1; - op = op->Next; - } - } - - if (size < 3) size = 0; - out_poly.resize(size); - for (size_t i = 0; i < size; ++i) - { - out_poly[i] = op->Pt; - op = op->Next; - } - delete [] outPts; -} -//------------------------------------------------------------------------------ - -void CleanPolygon(Path& poly, double distance) -{ - CleanPolygon(poly, poly, distance); -} -//------------------------------------------------------------------------------ - -void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance) -{ - for (Paths::size_type i = 0; i < in_polys.size(); ++i) - CleanPolygon(in_polys[i], out_polys[i], distance); -} -//------------------------------------------------------------------------------ - -void CleanPolygons(Paths& polys, double distance) -{ - CleanPolygons(polys, polys, distance); -} -//------------------------------------------------------------------------------ - -void Minkowski(const Path& poly, const Path& path, - Paths& solution, bool isSum, bool isClosed) -{ - int delta = (isClosed ? 1 : 0); - size_t polyCnt = poly.size(); - size_t pathCnt = path.size(); - Paths pp; - pp.reserve(pathCnt); - if (isSum) - for (size_t i = 0; i < pathCnt; ++i) - { - Path p; - p.reserve(polyCnt); - for (size_t j = 0; j < poly.size(); ++j) - p.push_back(IntPoint(path[i].X + poly[j].X, path[i].Y + poly[j].Y)); - pp.push_back(p); - } - else - for (size_t i = 0; i < pathCnt; ++i) - { - Path p; - p.reserve(polyCnt); - for (size_t j = 0; j < poly.size(); ++j) - p.push_back(IntPoint(path[i].X - poly[j].X, path[i].Y - poly[j].Y)); - pp.push_back(p); - } - - solution.clear(); - solution.reserve((pathCnt + delta) * (polyCnt + 1)); - for (size_t i = 0; i < pathCnt - 1 + delta; ++i) - for (size_t j = 0; j < polyCnt; ++j) - { - Path quad; - quad.reserve(4); - quad.push_back(pp[i % pathCnt][j % polyCnt]); - quad.push_back(pp[(i + 1) % pathCnt][j % polyCnt]); - quad.push_back(pp[(i + 1) % pathCnt][(j + 1) % polyCnt]); - quad.push_back(pp[i % pathCnt][(j + 1) % polyCnt]); - if (!Orientation(quad)) ReversePath(quad); - solution.push_back(quad); - } -} -//------------------------------------------------------------------------------ - -void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed) -{ - Minkowski(pattern, path, solution, true, pathIsClosed); - Clipper c; - c.AddPaths(solution, ptSubject, true); - c.Execute(ctUnion, solution, pftNonZero, pftNonZero); -} -//------------------------------------------------------------------------------ - -void TranslatePath(const Path& input, Path& output, IntPoint delta) -{ - //precondition: input != output - output.resize(input.size()); - for (size_t i = 0; i < input.size(); ++i) - output[i] = IntPoint(input[i].X + delta.X, input[i].Y + delta.Y); -} -//------------------------------------------------------------------------------ - -void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed) -{ - Clipper c; - for (size_t i = 0; i < paths.size(); ++i) - { - Paths tmp; - Minkowski(pattern, paths[i], tmp, true, pathIsClosed); - c.AddPaths(tmp, ptSubject, true); - if (pathIsClosed) - { - Path tmp2; - TranslatePath(paths[i], tmp2, pattern[0]); - c.AddPath(tmp2, ptClip, true); - } - } - c.Execute(ctUnion, solution, pftNonZero, pftNonZero); -} -//------------------------------------------------------------------------------ - -void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution) -{ - Minkowski(poly1, poly2, solution, false, true); - Clipper c; - c.AddPaths(solution, ptSubject, true); - c.Execute(ctUnion, solution, pftNonZero, pftNonZero); -} -//------------------------------------------------------------------------------ - -enum NodeType {ntAny, ntOpen, ntClosed}; - -void AddPolyNodeToPaths(const PolyNode& polynode, NodeType nodetype, Paths& paths) -{ - bool match = true; - if (nodetype == ntClosed) match = !polynode.IsOpen(); - else if (nodetype == ntOpen) return; - - if (!polynode.Contour.empty() && match) - paths.push_back(polynode.Contour); - for (int i = 0; i < polynode.ChildCount(); ++i) - AddPolyNodeToPaths(*polynode.Childs[i], nodetype, paths); -} -//------------------------------------------------------------------------------ - -void PolyTreeToPaths(const PolyTree& polytree, Paths& paths) -{ - paths.resize(0); - paths.reserve(polytree.Total()); - AddPolyNodeToPaths(polytree, ntAny, paths); -} -//------------------------------------------------------------------------------ - -void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths) -{ - paths.resize(0); - paths.reserve(polytree.Total()); - AddPolyNodeToPaths(polytree, ntClosed, paths); -} -//------------------------------------------------------------------------------ - -void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths) -{ - paths.resize(0); - paths.reserve(polytree.Total()); - //Open paths are top level only, so ... - for (int i = 0; i < polytree.ChildCount(); ++i) - if (polytree.Childs[i]->IsOpen()) - paths.push_back(polytree.Childs[i]->Contour); -} -//------------------------------------------------------------------------------ - -std::ostream& operator <<(std::ostream &s, const IntPoint &p) -{ - s << "(" << p.X << "," << p.Y << ")"; - return s; -} -//------------------------------------------------------------------------------ - -std::ostream& operator <<(std::ostream &s, const Path &p) -{ - if (p.empty()) return s; - Path::size_type last = p.size() -1; - for (Path::size_type i = 0; i < last; i++) - s << "(" << p[i].X << "," << p[i].Y << "), "; - s << "(" << p[last].X << "," << p[last].Y << ")\n"; - return s; -} -//------------------------------------------------------------------------------ - -std::ostream& operator <<(std::ostream &s, const Paths &p) -{ - for (Paths::size_type i = 0; i < p.size(); i++) - s << p[i]; - s << "\n"; - return s; -} -//------------------------------------------------------------------------------ - -} //ClipperLib namespace diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.hpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.hpp deleted file mode 100644 index 566289f82b1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/clipper/clipper.hpp +++ /dev/null @@ -1,429 +0,0 @@ -/******************************************************************************* -* * -* Author : Angus Johnson * -* Version : 6.2.1 * -* Date : 31 October 2014 * -* Website : http://www.angusj.com * -* Copyright : Angus Johnson 2010-2014 * -* * -* License: * -* Use, modification & distribution is subject to Boost Software License Ver 1. * -* http://www.boost.org/LICENSE_1_0.txt * -* * -* Attributions: * -* The code in this library is an extension of Bala Vatti's clipping algorithm: * -* "A generic solution to polygon clipping" * -* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * -* http://portal.acm.org/citation.cfm?id=129906 * -* * -* Computer graphics and geometric modeling: implementation and algorithms * -* By Max K. Agoston * -* Springer; 1 edition (January 4, 2005) * -* http://books.google.com/books?q=vatti+clipping+agoston * -* * -* See also: * -* "Polygon Offsetting by Computing Winding Numbers" * -* Paper no. DETC2005-85513 pp. 565-575 * -* ASME 2005 International Design Engineering Technical Conferences * -* and Computers and Information in Engineering Conference (IDETC/CIE2005) * -* September 24-28, 2005 , Long Beach, California, USA * -* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * -* * -*******************************************************************************/ - -#ifndef clipper_hpp -#define clipper_hpp - -#define CLIPPER_VERSION "6.2.1" - -//use_int32: When enabled 32bit ints are used instead of 64bit ints. This -//improve performance but coordinate values are limited to the range +/- 46340 -//#define use_int32 - -//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance. -#define use_xyz - -//use_lines: Enables line clipping. Adds a very minor cost to performance. -#define use_lines - -//use_deprecated: Enables temporary support for the obsolete functions -//#define use_deprecated - -#include -#include -#include -#include -#include -#include -#include -#include -#include "../src/types.h" - -namespace ClipperLib { - -enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor }; -enum PolyType { ptSubject, ptClip }; -//By far the most widely used winding rules for polygon filling are -//EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32) -//Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL) -//see http://glprogramming.com/red/chapter11.html -enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }; - -struct ZLabel { - ZLabel () : id(0), t(0) {} - ZLabel (Int32 ii) : id(ii), t(0) {} - ZLabel (Int32 ii, double tt) : id(ii), t(tt) {} - bool operator == (const ZLabel &l) const {return id == l.id;} - Int32 id; - double t; -}; - -inline std::ostream& operator << (std::ostream &os, const ZLabel &l) { - return os << l.id << ':' << l.t; -} - -struct ZType { - ZType (UInt64 v) : label1(v >> 32), label2(v & 0xffffffff) {} - ZType (Int32 id1, Int32 id2) : label1(id1), label2(id2) {} - ZType (const ZLabel &l1, const ZLabel &l2) : label1(l1), label2(l2) {} - const ZLabel& minLabel () const {return (label1.id < label2.id) ? label1 : label2;} - const ZLabel& maxLabel () const {return (label1.id > label2.id) ? label1 : label2;} - - const ZLabel& otherLabel (const ZLabel &l) const { - return (l.id == label1.id && l.t == label1.t) ? label2 : label1; - } - - bool operator == (const ZType &p) const {return minLabel() == p.minLabel() && maxLabel() == p.maxLabel();} - operator UInt64 () const {return (UInt64(label1.id) << 32) & label2.id;} - ZLabel label1, label2; -}; - -inline std::ostream& operator << (std::ostream &os, const ZType &z) { - return os << '[' << z.label1 << '|' << z.label2 << ']'; -} - -#ifdef use_int32 - typedef int cInt; - static cInt const loRange = 0x7FFF; - static cInt const hiRange = 0x7FFF; -#else - typedef signed long long cInt; - static cInt const loRange = 0x3FFFFFFF; - static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL; - typedef signed long long long64; //used by Int128 class - typedef unsigned long long ulong64; - -#endif - -struct IntPoint { - cInt X; - cInt Y; -#ifdef use_xyz - ZType Z; - IntPoint(cInt x = 0, cInt y = 0, ZType z = 0): X(x), Y(y), Z(z) {}; -#else - IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {}; -#endif - - friend inline bool operator== (const IntPoint& a, const IntPoint& b) - { - return a.X == b.X && a.Y == b.Y; - } - friend inline bool operator!= (const IntPoint& a, const IntPoint& b) - { - return a.X != b.X || a.Y != b.Y; - } -}; -//------------------------------------------------------------------------------ - -typedef std::vector< IntPoint > Path; -typedef std::vector< Path > Paths; - -inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;} -inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;} - -std::ostream& operator <<(std::ostream &s, const IntPoint &p); -std::ostream& operator <<(std::ostream &s, const Path &p); -std::ostream& operator <<(std::ostream &s, const Paths &p); - -struct DoublePoint -{ - double X; - double Y; - DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {} - DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {} -}; -//------------------------------------------------------------------------------ - -#ifdef use_xyz -typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt); -#endif - -enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4}; -enum JoinType {jtSquare, jtRound, jtMiter}; -enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound}; - -class PolyNode; -typedef std::vector< PolyNode* > PolyNodes; - -class PolyNode -{ -public: - PolyNode(); - virtual ~PolyNode(){}; - Path Contour; - PolyNodes Childs; - PolyNode* Parent; - PolyNode* GetNext() const; - bool IsHole() const; - bool IsOpen() const; - int ChildCount() const; -private: - unsigned Index; //node index in Parent.Childs - bool m_IsOpen; - JoinType m_jointype; - EndType m_endtype; - PolyNode* GetNextSiblingUp() const; - void AddChild(PolyNode& child); - friend class Clipper; //to access Index - friend class ClipperOffset; -}; - -class PolyTree: public PolyNode -{ -public: - ~PolyTree(){Clear();}; - PolyNode* GetFirst() const; - void Clear(); - int Total() const; -private: - PolyNodes AllNodes; - friend class Clipper; //to access AllNodes -}; - -bool Orientation(const Path &poly); -double Area(const Path &poly); -int PointInPolygon(const IntPoint &pt, const Path &path); - -void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); -void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); -void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); - -void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415); -void CleanPolygon(Path& poly, double distance = 1.415); -void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); -void CleanPolygons(Paths& polys, double distance = 1.415); - -void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed); -void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed); -void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution); - -void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); -void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths); -void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths); - -void ReversePath(Path& p); -void ReversePaths(Paths& p); - -struct IntRect { cInt left; cInt top; cInt right; cInt bottom; }; - -//enums that are used internally ... -enum EdgeSide { esLeft = 1, esRight = 2}; - -//forward declarations (for stuff used internally) ... -struct TEdge; -struct IntersectNode; -struct LocalMinimum; -struct Scanbeam; -struct OutPt; -struct OutRec; -struct Join; - -typedef std::vector < OutRec* > PolyOutList; -typedef std::vector < TEdge* > EdgeList; -typedef std::vector < Join* > JoinList; -typedef std::vector < IntersectNode* > IntersectList; - -//------------------------------------------------------------------------------ - -//ClipperBase is the ancestor to the Clipper class. It should not be -//instantiated directly. This class simply abstracts the conversion of sets of -//polygon coordinates into edge objects that are stored in a LocalMinima list. -class ClipperBase -{ -public: - ClipperBase(); - virtual ~ClipperBase(); - bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed); - bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed); - virtual void Clear(); - IntRect GetBounds(); - bool PreserveCollinear() {return m_PreserveCollinear;}; - void PreserveCollinear(bool value) {m_PreserveCollinear = value;}; -protected: - void DisposeLocalMinimaList(); - TEdge* AddBoundsToLML(TEdge *e, bool IsClosed); - void PopLocalMinima(); - virtual void Reset(); - TEdge* ProcessBound(TEdge* E, bool IsClockwise); - void DoMinimaLML(TEdge* E1, TEdge* E2, bool IsClosed); - TEdge* DescendToMin(TEdge *&E); - void AscendToMax(TEdge *&E, bool Appending, bool IsClosed); - - typedef std::vector MinimaList; - MinimaList::iterator m_CurrentLM; - MinimaList m_MinimaList; - - bool m_UseFullRange; - EdgeList m_edges; - bool m_PreserveCollinear; - bool m_HasOpenPaths; -}; -//------------------------------------------------------------------------------ - -class Clipper : public virtual ClipperBase -{ -public: - Clipper(int initOptions = 0); - ~Clipper(); - bool Execute(ClipType clipType, - Paths &solution, - PolyFillType subjFillType = pftEvenOdd, - PolyFillType clipFillType = pftEvenOdd); - bool Execute(ClipType clipType, - PolyTree &polytree, - PolyFillType subjFillType = pftEvenOdd, - PolyFillType clipFillType = pftEvenOdd); - bool ReverseSolution() {return m_ReverseOutput;}; - void ReverseSolution(bool value) {m_ReverseOutput = value;}; - bool StrictlySimple() {return m_StrictSimple;}; - void StrictlySimple(bool value) {m_StrictSimple = value;}; - //set the callback function for z value filling on intersections (otherwise Z is 0) -#ifdef use_xyz - void ZFillFunction(ZFillCallback zFillFunc); -#endif -protected: - void Reset(); - virtual bool ExecuteInternal(); -private: - PolyOutList m_PolyOuts; - JoinList m_Joins; - JoinList m_GhostJoins; - IntersectList m_IntersectList; - ClipType m_ClipType; - typedef std::priority_queue ScanbeamList; - ScanbeamList m_Scanbeam; - TEdge *m_ActiveEdges; - TEdge *m_SortedEdges; - bool m_ExecuteLocked; - PolyFillType m_ClipFillType; - PolyFillType m_SubjFillType; - bool m_ReverseOutput; - bool m_UsingPolyTree; - bool m_StrictSimple; -#ifdef use_xyz - ZFillCallback m_ZFill; //custom callback -#endif - void SetWindingCount(TEdge& edge); - bool IsEvenOddFillType(const TEdge& edge) const; - bool IsEvenOddAltFillType(const TEdge& edge) const; - void InsertScanbeam(const cInt Y); - cInt PopScanbeam(); - void InsertLocalMinimaIntoAEL(const cInt botY); - void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge); - void AddEdgeToSEL(TEdge *edge); - void CopyAELToSEL(); - void DeleteFromSEL(TEdge *e); - void DeleteFromAEL(TEdge *e); - void UpdateEdgeIntoAEL(TEdge *&e); - void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); - bool IsContributing(const TEdge& edge) const; - bool IsTopHorz(const cInt XPos); - void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); - void DoMaxima(TEdge *e); - void ProcessHorizontals(bool IsTopOfScanbeam); - void ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam); - void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); - OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); - OutRec* GetOutRec(int idx); - void AppendPolygon(TEdge *e1, TEdge *e2); - void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt); - OutRec* CreateOutRec(); - OutPt* AddOutPt(TEdge *e, const IntPoint &pt); - void DisposeAllOutRecs(); - void DisposeOutRec(PolyOutList::size_type index); - bool ProcessIntersections(const cInt topY); - void BuildIntersectList(const cInt topY); - void ProcessIntersectList(); - void ProcessEdgesAtTopOfScanbeam(const cInt topY); - void BuildResult(Paths& polys); - void BuildResult2(PolyTree& polytree); - void SetHoleState(TEdge *e, OutRec *outrec); - void DisposeIntersectNodes(); - bool FixupIntersectionOrder(); - void FixupOutPolygon(OutRec &outrec); - bool IsHole(TEdge *e); - bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl); - void FixHoleLinkage(OutRec &outrec); - void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt); - void ClearJoins(); - void ClearGhostJoins(); - void AddGhostJoin(OutPt *op, const IntPoint offPt); - bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2); - void JoinCommonEdges(); - void DoSimplePolygons(); - void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); - void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); -#ifdef use_xyz - void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2); -#endif -}; -//------------------------------------------------------------------------------ - -class ClipperOffset -{ -public: - ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25); - ~ClipperOffset(); - void AddPath(const Path& path, JoinType joinType, EndType endType); - void AddPaths(const Paths& paths, JoinType joinType, EndType endType); - void Execute(Paths& solution, double delta); - void Execute(PolyTree& solution, double delta); - void Clear(); - double MiterLimit; - double ArcTolerance; -private: - Paths m_destPolys; - Path m_srcPoly; - Path m_destPoly; - std::vector m_normals; - double m_delta, m_sinA, m_sin, m_cos; - double m_miterLim, m_StepsPerRad; - IntPoint m_lowest; - PolyNode m_polyNodes; - - void FixOrientations(); - void DoOffset(double delta); - void OffsetPoint(int j, int& k, JoinType jointype); - void DoSquare(int j, int k); - void DoMiter(int j, int k, double r); - void DoRound(int j, int k); -}; -//------------------------------------------------------------------------------ - -class clipperException : public std::exception -{ - public: - clipperException(const char* description): m_descr(description) {} - virtual ~clipperException() throw() {} - virtual const char* what() const throw() {return m_descr.c_str();} - private: - std::string m_descr; -}; -//------------------------------------------------------------------------------ - -} //ClipperLib namespace - -#endif //clipper_hpp - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/config.h.in b/Build/source/texk/dvisvgm/dvisvgm-1.11/config.h.in deleted file mode 100644 index fcd8cf41872..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/config.h.in +++ /dev/null @@ -1,169 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if the `closedir' function returns void instead of `int'. */ -#undef CLOSEDIR_VOID - -/* Set to 1 if PostScript support should be disabled */ -#undef DISABLE_GS - -/* Define to 1 if `TIOCGWINSZ' requires . */ -#undef GWINSZ_IN_SYS_IOCTL - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `gs' library (-lgs). */ -#undef HAVE_LIBGS - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define to 1 if you have the `kpathsea' library (-lkpathsea). */ -#undef HAVE_LIBKPATHSEA - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `potrace' library (-lpotrace). */ -#undef HAVE_LIBPOTRACE - -/* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#undef HAVE_STAT_EMPTY_STRING_BUG - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if the kpathsea headers are not C++ safe. */ -#undef KPSE_CXX_UNSAFE - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* The machine triplet of the target system */ -#undef TARGET_SYSTEM - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Version number of package */ -#undef VERSION - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to `unsigned int' if does not define. */ -#undef size_t diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-1.11/configure.ac deleted file mode 100644 index fb791c817b3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/configure.ac +++ /dev/null @@ -1,176 +0,0 @@ -# This file is part of dvisvgm -# Copyright (C) 2005-2015 Martin Gieseking -# -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT([dvisvgm],[1.11],[martin.gieseking@uos.de]) -DATE="September 2015" -AC_CONFIG_SRCDIR(src) -AC_CONFIG_HEADER(config.h) -AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_HOST -AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE - -AH_TEMPLATE([TARGET_SYSTEM], [The machine triplet of the target system]) -AC_DEFINE_UNQUOTED([TARGET_SYSTEM], ["$target"]) - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC - -AC_PROG_RANLIB -AC_LANG(C) - -AC_CHECK_FUNCS([ftime gettimeofday]) -AC_CHECK_HEADERS([sys/time.h sys/timeb.h]) -AC_HEADER_TIOCGWINSZ - -AC_CHECK_HEADER([kpathsea/kpathsea.h], , - [AC_MSG_ERROR([please install the kpathsea development package])]) -AC_CHECK_LIB(kpathsea, kpse_find_file, , - [AC_MSG_ERROR([libkpathsea not found, please install the corresponding package first])]) - -AC_MSG_CHECKING([kpathsea version]) -AC_RUN_IFELSE([AC_LANG_SOURCE([#include - #include - int main() { - FILE *f; - f = fopen("kpseversion", "w"); - if(!f) exit(1); - fprintf(f, "%s\n", KPSEVERSION); - fclose(f); - exit(0); - }])], - [kpseversion=`cat kpseversion|sed 's/kpathsea version //'`], [kpseversion=], [kpseversion=unknown]) -AC_MSG_RESULT("$kpseversion") -rm -f kpseversion -if test -z "$kpseversion"; then - AC_MSG_ERROR([Could not compile a simple kpathsea program -- check your installation]) -fi - - -# Check how to link potracelib -HAVE_LIBPOTRACE=1 -AC_CHECK_HEADER([potracelib.h], - [AC_CHECK_LIB(m, sqrt) # required to pass potrace check - AC_CHECK_LIB(potrace, potrace_trace, , HAVE_LIBPOTRACE=0)], HAVE_LIBPOTRACE=0) - -if test "$HAVE_LIBPOTRACE" -eq 0; then - AC_MSG_ERROR([potrace library not found]) -fi - - -# Check how to link Ghostscript -HAVE_LIBGS=1 -AC_CHECK_HEADER([ghostscript/iapi.h], - AC_CHECK_LIB(gs, gsapi_new_instance, , HAVE_LIBGS=0), HAVE_LIBGS=0) - -if test "$HAVE_LIBGS" -eq 0; then - AC_CHECK_LIB(dl, dlopen, , - [AC_DEFINE(DISABLE_GS, 1, [Set to 1 if PostScript support is to be disabled]) - AC_MSG_WARN(PostScript support disabled)]) -else - # query Ghostscript version - AC_MSG_CHECKING([Ghostscript version]) - AC_RUN_IFELSE([AC_LANG_SOURCE([#include - #include - int main () { - gsapi_revision_t r; - if (gsapi_revision(&r, sizeof(gsapi_revision_t)) == 0) { - FILE *f; - f = fopen("gsversion", "w"); - if (!f) exit(1); - fprintf(f, "%ld\n", r.revision); - fclose(f); - exit(0); - } - }])], - [gsversion=`cat gsversion`], [gsversion=], [gsversion=unknown]) - AC_MSG_RESULT("$gsversion") - rm -f gsversion - if test "$gsversion" -lt 831; then - # current Ghostscript API was introduced in version 8.31 - # older versions are not supported - LIBS=`echo $LIBS | sed "s/-lgs //" $LIBS` - AC_DEFINE(DISABLE_GS, 1, [Set to 1 if PostScript support should be disabled]) - AC_MSG_WARN([Ghostscript version < 8.31 found; PostScript support disabled]) - fi -fi - -# Check for pkg-config -PKG_PROG_PKG_CONFIG - -# Check for libraries. -PKG_CHECK_MODULES([FREETYPE], [freetype2]) - -AC_CHECK_LIB(z, gzopen) - -# Check for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_CHECK_HEADERS([libintl.h stdlib.h string.h strings.h unistd.h]) - -# Check for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_STRUCT_TM - -# Check for library functions. -AC_FUNC_CLOSEDIR_VOID -AC_FUNC_ERROR_AT_LINE -AC_FUNC_MALLOC -AC_FUNC_STAT -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([memset strcasecmp strtol]) - -# add options for selection of "optional" library locations -# currently these libraries are mandatory; the --with-foo options -# are used to specify the locations explicitely - -AC_ARG_WITH(zlib,[ --with-zlib=DIR location of the zlib library], - [if test "$withval" != no; then - if test "$withval" != yes; then - ZLIB_DIR=$withval - fi - fi]) - -if test "$withval" != no; then - if test -n "$ZLIB_DIR"; then - ZLIB_CFLAGS="-I$ZLIB_DIR -I$ZLIB_DIR/include" - ZLIB_LIBS="-L$ZLIB_DIR/lib" - fi -fi - -AC_SUBST([ZLIB_CFLAGS]) -AC_SUBST([ZLIB_LIBS]) - -# Check if the kpathsea headers are C++ safe -AC_MSG_CHECKING([if the kpathsea headers are C++ safe]) -AC_LANG_PUSH([C++]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[printf("%s\n", concat("one", "two"))]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_DEFINE([KPSE_CXX_UNSAFE], 1, - [Define to 1 if the kpathsea headers are not C++ safe.])]) -AC_LANG_POP([C++]) - -AX_CODE_COVERAGE -AS_IF([ test "$enable_code_coverage" = "yes" ], [ - # disable optimization - changequote({,}) - CFLAGS=`echo $CFLAGS | sed 's/-O[1-9s]//g'` - CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[1-9s]//g'` - changequote([,]) -]) - -AC_SUBST(DATE) -AC_SUBST(AM_CPPFLAGS) -AC_SUBST(AM_LDFLAGS) -AC_CONFIG_FILES([Makefile clipper/Makefile xxHash/Makefile src/Makefile tests/Makefile doc/dvisvgm.txt doc/Makefile]) -AC_OUTPUT - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/Makefile.am deleted file mode 100644 index 3acae1631c4..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -## This file is part of dvisvgm -## Copyright (C) 2005-2015 Martin Gieseking -## -## Process this file with automake. - -man_MANS = dvisvgm.1 -EXTRA_DIST = $(man_MANS) conf-dblatex-man.xsl conf-dblatex-pdf.xsl tweak-dblatex-pdf.xsl - -CONF_DBLATEX_MAN = $(top_srcdir)/doc/conf-dblatex-man.xsl -CONF_DBLATEX_PDF = $(top_srcdir)/doc/conf-dblatex-pdf.xsl -TWEAK_DBLATEX_PDF = $(top_srcdir)/doc/tweak-dblatex-pdf.xsl - -DB_VARS = man.endnotes.list.enabled=0 man.endnotes.are.numbered=0 man.authors.section.enabled=0 - -dvisvgm.1: dvisvgm.xml $(CONF_DBLATEX_MAN) - if [ `type -p xmlto` ]; then \ - xmlto -m $(CONF_DBLATEX_MAN) $(addprefix --stringparam , $(DB_VARS)) man $<; \ - fi - -dvisvgm.pdf: dvisvgm.xml $(CONF_DBLATEX_PDF) $(TWEAK_DBLATEX_PDF) - mv $< $<.tmp - xsltproc -o $< $(TWEAK_DBLATEX_PDF) $<.tmp - dblatex -bxetex --texstyle=./dvisvgm.sty -p $(CONF_DBLATEX_PDF) $< - mv $<.tmp $< - -dvi-pdf: dvisvgm.dvi - dvipdfm $< - rm -f $< - -dvisvgm.dvi: dvisvgm.1 - groff -Tdvi -mandoc ./$< >$@ - -dvisvgm.html: dvisvgm.xml - xsltproc -o $@ db2html.xsl $< - -dvisvgm.epub: dvisvgm.xml - a2x -dmanpage -fmanpage -L -a icons $<; - -dvisvgm.xml: dvisvgm.txt - if [ `type -p asciidoc` ]; then \ - asciidoc -a icons -a 'iconsdir=.' -a badges -a 'revnumber=@VERSION@' --unsafe -bdocbook -dmanpage $<; \ - sed -i "s#\(\)#$(shell stat -c %y $<)\n\1#" $@; \ - fi - -epub: dvisvgm.epub -html: dvisvgm.html -man: dvisvgm.1 -pdf: dvisvgm.pdf - -clean: - rm -f dvisvgm.pdf dvisvgm.html dvisvgm.xml dvisvgm.txt dvisvgm.dvi dvisvgm.epub - -distclean-local: - rm -f dvisvgm.pdf dvisvgm.html dvisvgm.xml dvisvgm.txt dvisvgm.dvi dvisvgm.epub dvisvgm.1 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-man.xsl b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-man.xsl deleted file mode 100644 index 23283210027..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-man.xsl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \fB - - \fR - - - - - - (\m[blue] - - \m[]) - - \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-pdf.xsl b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-pdf.xsl deleted file mode 100644 index 2a8aeec290a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/conf-dblatex-pdf.xsl +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - \setmainfont{Source Sans Pro} - \setsansfont{Source Sans Pro} - \setmonofont{Source Code Pro} - - - 0 - 0 - caution - note - tabular - 0 - 1 - - - basicstyle=\ttfamily\small,backgroundcolor=\color[gray]{0.9},columns=fullflexible,frame=single - - - - - - - - - - - - - - - - \tableofcontents - - 2 - 1 - - - - - - - - 2 - 1 - - - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.1 deleted file mode 100644 index c9e24b6aa1f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.1 +++ /dev/null @@ -1,1233 +0,0 @@ -'\" t -.\" Title: dvisvgm -.\" Author: Martin Gieseking -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/18/2015 -.\" Manual: dvisvgm Manual -.\" Source: dvisvgm 1.11 -.\" Language: English -.\" -.TH "DVISVGM" "1" "09/18/2015" "dvisvgm 1\&.11" "dvisvgm Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -dvisvgm \- converts DVI and EPS files to the XML\-based SVG format -.SH "SYNOPSIS" -.sp -\fBdvisvgm\fR [ \fIoptions\fR ] \fIfile\fR [\&.dvi] -.sp -\fBdvisvgm\fR \-E [ \fIoptions\fR ] \fIfile\fR [\&.eps] -.SH "DESCRIPTION" -.sp -The command\-line utility \fBdvisvgm\fR converts DVI files, as generated by TeX/LaTeX, to the XML\-based scalable vector graphics format SVG\&. It supports the classic DVI format 2 as well as format 3 (created by pTeX in vertical mode), and the XeTeX formats 5 and 6 which are also known as XDV\&. Besides the basic DVI commands, dvisvgm also evaluates many so\-called \fIspecials\fR which heavily extend the capabilities of the DVI format\&. For a more detailed overview, see section \fBSupported Specials\fR below\&. -.sp -Since the current SVG standard 1\&.1 doesn\(cqt specify multi\-page graphics, dvisvgm creates separate SVG files for each DVI page\&. Because of compatibility reasons, only the first page is converted by default\&. In order to select a different page or arbitrary page sequences, use option \fB\-p\fR which is described below\&. -.sp -SVG is a vector\-based graphics format and therefore dvisvgm tries to convert the glyph outlines of all used fonts to scalable path descriptions\&. The fastest way to do that is to extract the path information from font files in PFB, TTF, or OTF format\&. If dvisvgm is able to find such a file, it extracts all necessary outline information about the glyphs from it\&. -.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, \fIfont\fR elements (\fB\fR\&...\fB\fR) are used to embed the font data into the SVG files\&. Unfortunately, only few SVG renderes 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\&. -.SH "OPTIONS" -.PP -\fB\-a, \-\-trace\-all\fR=[\fIretrace\fR] -.RS 4 -This option forces dvisvgm to trace not only the actually needed glyphs but all glyphs of all bitmap fonts used in the DVI file\&. Since the tracing results are stored in the font cache, all following DVI conversions (without option -\fB\-\-trace\-all\fR) where these fonts are involved, will be much faster\&. By default, dvisvgm traces only the actually needed glyphs, and adds them to the cache\&. The boolean option -\fIretrace\fR -determines how to handle glyphs already stored in the cache\&. By default, these glyphs are skipped\&. Setting argument -\fIretrace\fR -to -\fIyes\fR -or -\fItrue\fR -forces dvisvgm to trace the corresponding bitmaps again\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -This option only takes effect if font caching is active\&. Therefore, -\fB\-\-trace\-all\fR -cannot be combined with option -\fB\-\-cache=none\fR\&. -.sp .5v -.RE -.RE -.PP -\fB\-b, \-\-bbox\fR=\fIfmt\fR -.RS 4 -Sets the bounding box of the generated graphic to the specified format\&. The parameter -\fIfmt\fR -takes either one of the format specifiers listed below, or a sequence of four comma\- or whitespace\-separated length values -\fIx1\fR, -\fIy1\fR, -\fIx2\fR -and -\fIy2\fR\&. The latter define two diagonal corners of the bounding box\&. Each length value consists of a floating point number and an optional length unit (pt, bp, cm, mm, in, or pc)\&. If the unit is omitted, TeX points (pt) are assumed\&. -.sp -It\(cqs also possible to give only one length value -\fIl\fR\&. In this case, the minimal bounding box is computed and enlarged by adding (\-\fIl\fR,\-\fIl\fR) to the upper left and (\fIl\fR,\fIl\fR) to the lower right corner\&. -.sp -Alternatively, the following format specifiers are supported: -.PP -\fBInternational DIN/ISO paper sizes\fR -.RS 4 -A\fIn\fR, B\fIn\fR, C\fIn\fR, D\fIn\fR, where -\fIn\fR -is a non\-negative integer, e\&.g\&. A4 or a4 for DIN/ISO A4 format (210mm \(mu 297mm)\&. -.RE -.PP -\fBNorth American paper sizes\fR -.RS 4 -invoice, executive, legal, letter, ledger -.RE -.PP -\fBSpecial bounding box sizes\fR -.RS 4 -.TS -tab(:); -lt lt -lt lt -lt lt. -T{ -\fBdvi\fR -T}:T{ -page size stored in the DVI file -T} -T{ -\fBmin\fR -T}:T{ -computes the minimal/tightest bounding box -T} -T{ -\fBnone\fR -T}:T{ -no bounding box is assigned -T} -.TE -.sp 1 -.RE -.PP -\fBPage orientation\fR -.RS 4 -The default page orientation for DIN/ISO and American paper sizes is -\fIportrait\fR, i\&.e\&. -\fIwidth\fR -< -\fIheight\fR\&. Appending -\fB\-landscape\fR -or simply -\fB\-l\fR -to the format string switches to -\fIlandscape\fR -mode (\fIwidth\fR -> -\fIheight\fR)\&. For symmetry reasons you can also explicitly add -\fB\-portrait\fR -or -\fB\-p\fR -to indicate the default portrait format\&. Note that these suffixes are part of the size string and not separate options\&. Thus, they must directly follow the size specifier without additional blanks\&. Furthermore, the orientation suffixes can\(cqt be used with -\fBdvi\fR, -\fBmin\fR, and -\fBnone\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -Option -\fB\-b, \-\-bbox\fR -only affects the bounding box and does not transform the page content\&. Hence, if you choose a landscape format, the page won\(cqt be rotated\&. -.sp .5v -.RE -.RE -.RE -.PP -\fB\-C, \-\-cache\fR[=\fIdir\fR] -.RS 4 -To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion information in cache files\&. By default, these files are stored in $HOME/\&.dvisvgm/cache\&. If you prefer a different location, use option -\fB\-\-cache\fR -to overwrite the default\&. Furthermore, it is also possible to disable the font caching mechanism completely with option -\fB\-\-cache=none\fR\&. If argument -\fIdir\fR -is omitted, dvisvgm prints the path of the default cache directory together with further information about the stored fonts\&. Additionally, outdated and corrupted cache files are removed\&. -.RE -.PP -\fB\-j, \-\-clipjoin\fR -.RS 4 -This option tells dvisvgm to compute the intersection of clipping paths itself if necessary, and not to delegate this task to the SVG renderer\&. The resulting SVG files are more portable because some SVG renderers don\(cqt support intersections of clipping paths which are defined by -\fIclipPath\fR -elements that contain a -\fIclip\-path\fR -attribute\&. -.RE -.PP -\fB\-\-color\fR -.RS 4 -Enables colorization of messages printed during the conversion process\&. The colors can be customized via the environment variable -\fBDVISVGM_COLORS\fR\&. See the ENVIRONMENT section below for further information\&. -.RE -.PP -\fB\-E, \-\-eps\fR -.RS 4 -If this option is given, dvisvgm does not expect a DVI but an EPS input file, and tries to convert it to SVG\&. In order to do so, a single -\fIpsfile\fR -special command is created and forwarded to the PostScript special handler\&. This option is only available if dvisvgm was built with PostScript support enabled, and requires Ghostscript to be available\&. See option -\fB\-\-libgs\fR -for further information\&. -.RE -.PP -\fB\-e, \-\-exact\fR -.RS 4 -If this option is given, dvisvgm computes the precise bounding box of each character\&. By default, the values stored in a font\(cqs TFM file are used to determine a glyph\(cqs extent\&. As these values are intended to implement optimal character placements and are not designed to represent the exact dimensions, they don\(cqt necessarily correspond with the bounds of the visual glyphs\&. Thus, width and/or height of some glyphs may be larger (or smaller) than the respective TFM values\&. As a result, this can lead to clipped characters at the bounds of the SVG graphics\&. With option -\fB\-\-exact\fR -given, dvisvgm analyzes the actual shape of each character and derives a usually tight bounding box\&. -.RE -.PP -\fB\-m, \-\-fontmap\fR=\fIfilenames\fR -.RS 4 -Loads and evaluates a single or multiple font map files\&. These files are required to resolve font file names and encodings\&. dvisvgm does not provide its own map files but tries to read available ones coming with dvips or dvipdfm\&. If option -\fB\-\-fontmap\fR -is omitted, dvisvgm looks for the default map files -\fIps2pk\&.map\fR, -\fIdvipdfm\&.map\fR, and -\fIpsfonts\&.map\fR -(in this order)\&. Otherwise, the listed files are used\&. Multiple filenames must be separated by commas without leading and/or trailing whitespace\&. The map files are evaluated in the given order\&. By default, redefined mappings do not replace previous ones\&. However, each filename can be preceded by an optional mode specifier (\fB+\fR, -\fB\-\fR, or -\fB=\fR) to change this behavior: -.PP -+mapfile -.RS 4 -Only those entries in the given map file that don\(cqt redefine a font mapping are applied\&. That\(cqs also the default mode if no mode specifier is given\&. -.RE -.PP -\-mapfile -.RS 4 -Ensures that none of the font mappings defined in the given map file are used, i\&.e\&. previously defined mappings for the specified fonts are removed\&. -.RE -.PP -=mapfile -.RS 4 -All mappings defined in the map file are applied\&. Previously defined settings for the same font are replaced\&. -.sp -If the first filename in the filename sequence is preceded by a mode specifier, dvisvgm loads the default font map (see above) and applies the other map files afterwards\&. Otherwise, none of default map files will be loaded automatically\&. -.sp -Examples: -\fB\-\-fontmap=myfile1\&.map,+myfile2\&.map\fR -loads -\fImyfile1\&.map\fR -followed by -\fImyfile2\&.map\fR -where all redefinitions of -\fBmyfile2\&.map\fR -are ignored\&. -\fB\-\-fontmap==myfile1\&.map,\-myfile2\&.map\fR -loads the default map file followed by -\fImyfile1\&.map\fR -and -\fImyfile2\&.map\fR -where all redefinitions of -\fImyfile1\&.map\fR -replace previous entries\&. Afterwards, all definitions for the fonts given in -\fImyfile2\&.map\fR -are removed from the font map tree\&. -.sp -For further information about the map file formats and the mode specifiers, see the manuals of dvips and dvipdfm\&. -.RE -.RE -.PP -\fB\-\-grad\-overlap\fR -.RS 4 -Tells dvisvgm to create overlapping grid segments when approximating color gradient fills (also see option -\fB\-\-grad\-segments\fR -below)\&. By default, adjacent segments don\(cqt overlap but only touch each other like separate tiles\&. Unfortunately, this alignment can lead to visible gaps between the segments because the background influences the color at the boundary of the segments if the SVG renderer uses anti\-aliasing to create smooth contours\&. One way to avoid this and to create seamlessly touching color regions is to enlarge the segments so that they extent into the area of their right and bottom neighbors\&. Since the latter are drawn on top of the overlapping parts, the visible size of all segments keeps unchanged\&. Just the former gaps disappear as the background is now completely covered by the correct colors\&. Currently, dvisvgm computes the overlapping segments separately for each patch of the mesh (a patch mesh may consist of multiple patches of the same type)\&. Therefore, there still might be visible gaps at the seam of two adjacent patches\&. -.RE -.PP -\fB\-\-grad\-segments\fR=\fInumber\fR -.RS 4 -Determines the maximal number of segments per column and row used to approximate gradient color fills\&. Since SVG 1\&.1 only supports a small subset of the shading algorithms available in PostScript, dvisvgm approximates some of them by subdividing the area to be filled into smaller, monochromatic segments\&. Each of these segments gets the average color of the region it covers\&. Thus, increasing the number of segments leads to smaller monochromatic areas and therefore results in a better approximation of the actual color gradient\&. As a drawback, more segments imply bigger SVG files because every segment is represented by a separate path element\&. -.sp -Currently, dvisvgm supports free\- and lattice\-form triangular patch meshes as well as Coons and tensor\-product patch meshes\&. They are approximated by subdividing the area of each patch into a -\fIn\fR\(mu\fIn\fR -grid of smaller segments\&. The maximal number of segments per column and row can be changed with option -\fB\-\-grad\-segments\fR\&. -.RE -.PP -\fB\-\-grad\-simplify\fR=\fIdelta\fR -.RS 4 -If the size of the segments created to approximate gradient color fills falls below the given delta value, dvisvgm reduces their level of detail\&. For example, B\('ezier curves are replaced by straight lines, and triangular segments are combined to tetragons\&. For a small delta these simplifications are usually not noticeable but reduce the size of the generated SVG files\&. -.RE -.PP -\fB\-h, \-\-help\fR[=\fImode\fR] -.RS 4 -Prints a short summary of all available command\-line options\&. The optional -\fImode\fR -parameter is an integer value between 0 and 2\&. It selects the display variant of the help text\&. Mode 0 lists all options divided into categories with section headers\&. This is also the default if dvisvgm is called without parameters\&. Mode 1 lists all options ordered by the short option names, while mode 2 sorts the lines by the long option names\&. -.RE -.PP -\fB\-\-keep\fR -.RS 4 -Disables the removal of temporary files as created by Metafont (usually \&.gf, \&.tfm, and \&.log files)\&. -.RE -.PP -\fB\-\-libgs\fR=\fIfilename\fR -.RS 4 -This option is only available if the Ghostscript library is not directly linked to dvisvgm and if PostScript support was not completely disabled during compilation\&. In this case, dvisvgm tries to load the shared GS library dynamically during runtime\&. By default, it expects the library\(cqs name to be libgs\&.so\&.X (on Unix\-like systems, where X is the ABI version of the library) or gsdll32\&.dll/gsdll64\&.dll (Windows)\&. Option -\fB\-\-libgs\fR -can be used to give a different name\&. Alternatively, it\(cqs also possible to set the GS library name by the environment variable -\fBLIBGS\fR\&. The latter has less precedence than the command\-line option, i\&.e\&. dvisvgm ignores variable -\fBLIBGS\fR -if -\fB\-\-libgs\fR -is given\&. -.RE -.PP -\fB\-L, \-\-linkmark\fR=\fIstyle\fR -.RS 4 -Selects the method how to mark hyperlinked areas\&. The -\fIstyle\fR -argument can take one of the values -\fInone\fR, -\fIbox\fR, and -\fIline\fR, where -\fIbox\fR -is the default, i\&.e\&. a rectangle is drawn around the linked region if option -\fB\-\-linkmark\fR -is omitted\&. Style argument -\fIline\fR -just draws the lower edge of the bounding rectangle, and -\fInone\fR -tells dvisvgm not to add any visible objects to hyperlinks\&. The lines and boxes get the current text color selected\&. In order to apply a different, constant color, a colon followed by a color specifier can be appended to the style string\&. A -\fIcolor specifier\fR -is either a hexadecimal RGB value of the form -\fI#RRGGBB\fR, or a -dvips color name (\m[blue]http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips\m[])\&. -.sp -Moreover, argument -\fIstyle\fR -can take a single color specifier to highlight the linked region by a frameless box filled with that color\&. An optional second color specifier separated by colon selects the frame color\&. -.sp -Examples: -\fBbox:red\fR -or -\fBbox:#ff0000\fR -draws red boxes around the linked areas\&. -\fByellow:blue\fR -creates yellow filled rectangles with blue frames\&. -.RE -.PP -\fB\-l, \-\-list\-specials\fR -.RS 4 -Prints a list of registered special handlers and exits\&. Each handler processes a set of special statements belonging to the same category\&. In most cases, the categories are identified by the prefix of the special statements\&. It\(cqs usually a leading word separated from the rest of the statement by a colon or a blank, e\&.g\&. -\fIcolor\fR -or -\fIps\fR\&. -.RE -.PP -\fB\-M, \-\-mag\fR=\fIfactor\fR -.RS 4 -Sets the magnification factor applied in conjunction with Metafont calls prior tracing the glyphs\&. The larger this value, the better the tracing results\&. Nevertheless, large magnification values can cause Metafont arithmetic errors due to number overflows\&. So, use this option with care\&. The default setting usually produces nice results\&. -.RE -.PP -\fB\-\-no\-merge\fR -.RS 4 -Puts every single character in a separate -\fItext\fR -element with corresponding -\fIx\fR -and -\fIy\fR -attributes\&. By default, new -\fItext\fR -or -\fItspan\fR -elements are only created if a string starts at a location that differs from the regular position defined by the characters\*(Aq advance values\&. -.RE -.PP -\fB\-\-no\-mktexmf\fR -.RS 4 -Suppresses the generation of missing font files\&. If dvisvgm can\(cqt find a font file through the kpathsea lookup mechanism, it calls the external tools mktextfm or mktexmf by\&. This option disables these calls\&. -.RE -.PP -\fB\-n, \-\-no\-fonts\fR[=\fIvariant\fR] -.RS 4 -If this option is given, dvisvgm doesn\(cqt create SVG -\fIfont\fR -elements but uses -\fIpaths\fR -instead\&. The resulting SVG files tend to be larger but they are concurrently more compatible with most applications that don\(cqt support SVG fonts yet\&. The optional argument -\fIvariant\fR -selects the method how to substitute fonts by paths\&. Variant 0 creates -\fIpath\fR -and -\fIuse\fR -elements\&. Variant 1 creates -\fIpath\fR -elements only\&. Option -\fB\-\-no\-fonts\fR -implies -\fB\-\-no\-styles\fR\&. -.RE -.PP -\fB\-c, \-\-scale\fR=\fIsx\fR[,\fIsy\fR] -.RS 4 -Scales the page content horizontally by -\fIsx\fR -and vertically by -\fIsy\fR\&. This option is equivalent to -\fB\-TS\fR\fIsx\fR,\fIsy\fR\&. -.RE -.PP -\fB\-S, \-\-no\-specials\fR[=\fInames\fR] -.RS 4 -Disable processing of special commands embedded in the DVI file\&. If no further parameter is given, all specials are ignored\&. To selectively disable sets of specials, an optional comma\-separated list of names can be appended to this option\&. A -\fIname\fR -is the unique identifier referencing the intended special handler\&. Option -\fB\-\-list\-specials\fR -lists all currently available handlers and their names\&. All unsupported special statements are silently ignored\&. -.RE -.PP -\fB\-\-no\-styles\fR -.RS 4 -By default, dvisvgm creates CSS styles and class attributes to reference fonts because it\(cqs more compact than repeatedly set the complete font information in each text element\&. However, if you prefer direct font references, the default behavior can be disabled with option -\fB\-\-no\-styles\fR\&. -.RE -.PP -\fB\-o, \-\-output\fR=\fIpattern\fR -.RS 4 -Sets the name pattern of the output file\&. Parameter -\fIpattern\fR -is a string that may contain the variables -\fB%f\fR, -\fB%p\fR, and -\fB%P\fR\&. -\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 after the percent sign specifies the minimal number of digits to be written\&. If a particular value is shorter, 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 -gets the same number of digits as -\fB%P\fR\&. -.sp -If you need more control over the numbering, you can use arithmetic expressions as part of a pattern\&. The syntax is -\fB%(expr)\fR -where -\fIexpr\fR -may contain additions, subtractions, multiplications, and integer divisions with common precedence\&. The variables -\fBp\fR -and -\fBP\fR -contain the current page number and the total number of pages, respectively\&. For example, -\fB\-\-output="%f\-%(p\-1)"\fR -creates filenames where the numbering starts with 0 rather than 1\&. -.sp -The default pattern is -\fB%f\-%p\&.svg\fR -if the DVI file consists of more than one page, and -\fB%f\&.svg\fR -otherwise\&. That means, a DVI file -\fIfoo\&.dvi\fR -is converted to -\fIfoo\&.svg\fR -if -\fIfoo\&.dvi\fR -is a single\-page document\&. Otherwise, multiple SVG files -\fIfoo\-01\&.svg\fR, -\fIfoo\-02\&.svg\fR, etc\&. are produced\&. In Windows environments, the percent sign indicates dereferenced environment variables, and must therefore be protected by a second percent sign, e\&.g\&. -\fB\-\-output=%%f\-%%p\fR\&. -.RE -.PP -\fB\-p, \-\-page\fR=\fIranges\fR -.RS 4 -This option sets the pages to be processed\&. Parameter -\fIranges\fR -consists of a comma\-separated list of single page numbers and/or page ranges\&. A page range is a pair of numbers separated by a hyphen, e\&.g\&. 5\-12\&. Thus, a page sequence might look like this: 2\-4,6,9\-12,15\&. It doesn\(cqt matter if a page is given more than once or if page ranges overlap\&. dvisvgm always extracts the page numbers in ascending order and converts them only once\&. In order to stay compatible with previous versions, the default page sequence is 1\&. dvisvgm therefore converts only the first page and not the whole document in case option -\fB\-\-page\fR -is omitted\&. Usually, page ranges consist of two numbers denoting the first and last page to be converted\&. If the conversion is to be started at page 1, or if it should continue up to the last DVI page, the first or second range number can be omitted, respectively\&. Example: -\fB\-\-page=\-10\fR -converts all pages up to page 10, -\fB\-\-page=10\-\fR -converts all pages starting with page 10\&. Please consider that the page values don\(cqt refer to the page numbers printed on the page\&. Instead, the physical page count is expected, where the first page always gets number 1\&. -.RE -.PP -\fB\-d, \-\-precision\fR=\fIdigits\fR -.RS 4 -Specifies the maximal number of decimal places applied to floating\-point attribute values\&. All attribute values written to the generated SVG file(s) are rounded accordingly\&. The parameter -\fIdigits\fR -allows integer values from 0 to 6, where 0 enables the automatic selection of significant decimal places\&. This is also the default value if dvisvgm is called without option -\fB\-\-precision\fR\&. -.RE -.PP -\fB\-P, \-\-progress\fR[=\fIdelay\fR] -.RS 4 -Enables a simple progress indicator shown when time\-consuming operations like PostScript specials are processed\&. The indicator doesn\(cqt appear before the given delay (in seconds) has elapsed\&. The default delay value is 0\&.5 seconds\&. -.RE -.PP -\fB\-r, \-\-rotate\fR=\fIangle\fR -.RS 4 -Rotates the page content clockwise by -\fIangle\fR -degrees around the page center\&. This option is equivalent to -\fB\-TR\fR\fIangle\fR\&. -.RE -.PP -\fB\-R, \-\-relative\fR -.RS 4 -SVG allows to define graphics paths by a sequence of absolute and/or relative commands, i\&.e\&. each command expects either absolute coordinates or coordinates relative to the current drawing position\&. By default, dvisvgm creates paths made up of absolute commands\&. If option -\fB\-\-relative\fR -is given, relative commands are created instead which slightly reduces the size of the SVG files in most cases\&. -.RE -.PP -\fB\-s, \-\-stdout\fR -.RS 4 -Don\(cqt write the SVG output to a file but redirect it to -\fBstdout\fR\&. -.RE -.PP -\fB\-T, \-\-transform\fR=\fIcommands\fR -.RS 4 -Applies a sequence of transformations to the SVG content\&. Each transformation is described by a -\fIcommand\fR -beginning with a capital letter followed by a list of comma\-separated parameters\&. Following transformation commands are supported: -.PP -\fBT\fR \fItx\fR[,\fIty\fR] -.RS 4 -Translates (moves) the page in direction of vector (\fItx\fR,\fIty\fR)\&. If -\fIty\fR -is omitted, -\fIty\fR=0 is assumed\&. The expected unit length of -\fItx\fR -and -\fIty\fR -are TeX points (1pt = 1/72\&.27in)\&. However, there are several constants defined to simplify the unit conversion (see below)\&. -.RE -.PP -\fBS\fR \fIsx\fR[,\fIsy\fR] -.RS 4 -Scales the page horizontally by -\fIsx\fR -and vertically by -\fIsy\fR\&. If -\fIsy\fR -is omitted, -\fIsy\fR=\fIsx\fR -is assumed\&. -.RE -.PP -\fBR\fR \fIangle\fR[,\fIx\fR,\fIy\fR] -.RS 4 -Rotates the page clockwise by -\fIangle\fR -degrees around point (\fIx\fR,\fIy\fR)\&. If the optional arguments -\fIx\fR -and -\fIy\fR -are omitted, the page will be rotated around its center depending on the chosen page format\&. When option -\fB\-bnone\fR -is given, the rotation center is origin (0,0)\&. -.RE -.PP -\fBKX\fR \fIangle\fR -.RS 4 -Skews the page along the -\fIx\fR\-axis by -\fIangle\fR -degrees\&. Argument -\fIangle\fR -can take any value except 90+180\fIk\fR, where -\fIk\fR -is an integer\&. -.RE -.PP -\fBKY\fR \fIangle\fR -.RS 4 -Skews the page along the -\fIy\fR\-axis by -\fIangle\fR -degrees\&. Argument -\fIangle\fR -can take any value except 90+180\fIk\fR, where -\fIk\fR -is an integer\&. -.RE -.PP -\fBFH\fR [\fIy\fR] -.RS 4 -Mirrors (flips) the page at the horizontal line through point (0,\fIy\fR)\&. Omitting the optional argument leads to -\fIy\fR=\fIh\fR/2, where -\fIh\fR -denotes the page height (see -\fIpre\-defined constants\fR -below)\&. -.RE -.PP -\fBFV\fR [\fIx\fR] -.RS 4 -Mirrors (flips) the page at the vertical line through point (\fIx\fR,0)\&. Omitting the optional argument leads to -\fIx\fR=\fIw\fR/2, where -\fIw\fR -denotes the page width (see -\fIpre\-defined constants\fR -below)\&. -.RE -.PP -\fBM\fR \fIm1\fR,\&...,\fIm6\fR -.RS 4 -Applies a transformation described by the 3\(mu3 matrix ((\fIm1\fR,\fIm2\fR,\fIm3\fR),(\fIm4\fR,\fIm5\fR,\fIm6\fR),(0,0,1)), where the inner triples denote the rows\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -All transformation commands of option -\fB\-T, \-\-transform\fR -are applied in the order of their appearance\&. Multiple commands can optionally be separated by spaces\&. In this case the whole transformation string has to be enclosed in double quotes\&. All parameters are expressions of floating point type\&. You can either give plain numbers or arithmetic terms combined by the operators -\fB+\fR -(addition), -\fB\-\fR -(subtraction), -\fB*\fR -(multiplication), -\fB/\fR -(division) or -\fB%\fR -(modulo) with common associativity and precedence rules\&. Parentheses may be used as well\&. -.sp -Additionally, some pre\-defined constants are provided: -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -\fBux\fR -T}:T{ -horizontal position of upper left page corner in TeX point units -T} -T{ -\fBuy\fR -T}:T{ -vertical position of upper left page corner in TeX point units -T} -T{ -\fBh\fR -T}:T{ -page height in TeX point units (0 in case of -\fB\-bnone\fR) -T} -T{ -\fBw\fR -T}:T{ -page width in TeX point units (0 in case of -\fB\-bnone\fR) -T} -.TE -.sp 1 -Furthermore, you can use the length constants -\fBpt\fR, -\fBmm\fR, -\fBcm\fR -and -\fBin\fR, e\&.g\&. -\fB2cm\fR -or -\fB1\&.6in\fR\&. Thus, option -\fB\-TT1in,0R45\fR -moves the page content 1 inch to the right and rotates it by 45 degrees around the page center afterwards\&. -.sp -For single transformations you can also use options -\fB\-c\fR, -\fB\-t\fR -and -\fB\-r\fR\&. Note that the order in which these options are given is not significant, i\&.e\&. you can\(cqt use them to describe transformation sequences\&. They are simply independent shorthand options for common transformations\&. -.sp .5v -.RE -.RE -.RE -.PP -\fB\-t, \-\-translate\fR=\fItx\fR[,\fIty\fR] -.RS 4 -Translates (moves) the page content in direction of vector (\fItx\fR,\fIty\fR)\&. This option is equivalent to -\fB\-TT\fR\fItx\fR,\fIty\fR\&. -.RE -.PP -\fB\-v, \-\-verbosity\fR=\fIlevel\fR -.RS 4 -Controls the type of messages printed during a dvisvgm run: -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -\fB0\fR -T}:T{ -no message output -T} -T{ -\fB1\fR -T}:T{ -error messages only -T} -T{ -\fB2\fR -T}:T{ -warning messages only -T} -T{ -\fB4\fR -T}:T{ -informational messages only -T} -.TE -.sp 1 -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -By adding these values you can combine the categories\&. The default level is 7, i\&.e\&. all messages are printed\&. -.sp .5v -.RE -.RE -.PP -\fB\-V, \-\-version\fR[=\fIextended\fR] -.RS 4 -Prints the version of dvisvgm and exits\&. If the optional argument is set to -\fIyes\fR, the version numbers of the linked libraries are printed as well\&. -.RE -.PP -\fB\-z, \-\-zip\fR[=\fIlevel\fR] -.RS 4 -Creates a compressed SVG file with suffix \&.svgz\&. The optional argument specifies the compression level\&. Valid values are in the range of 1 to 9 (default value is 9)\&. Larger values cause better compression results but take more computation time\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -This option cannot be combined with -\fB\-s, \-\-stdout\fR\&. -.sp .5v -.RE -.RE -.PP -\fB\-Z, \-\-zoom\fR[=\fIfactor\fR] -.RS 4 -Multiplies the -\fIwidth\fR -and -\fIheight\fR -attributes of the SVG root element by argument -\fIfactor\fR -while the coordinate system of the graphic is retained\&. As a result, most SVG viewers zoom the graphics accordingly\&. If a negative zoom factor is given, the -\fIwidth\fR -and -\fIheight\fR -attributes are omitted\&. -.RE -.SH "SUPPORTED SPECIALS" -.sp -dvisvgm supports several sets of \fIspecial commands\fR that can be used to enrich DVI files with additional features, like color, graphics, and hyperlinks\&. The evaluation of special commands is delegated to dedicated handlers\&. Each handler is responsible for all special statements of the same command set, i\&.e\&. commands beginning with the same prefix\&. To get a list of actually provided special handlers, use option \fB\-\-list\-specials\fR (see above)\&. This section gives an overview of the special commands currently supported\&. -.PP -\fBbgcolor\fR -.RS 4 -Special statement for changing the background/page color\&. Since SVG 1\&.1 doesn\(cqt support background colors, dvisvgm inserts a rectangle of the chosen color into the generated SVG document\&. This rectangle always gets the same size as the selected or computed bounding box\&. This background color command is part of the color special set but is handled separately in order to let the user turn it off\&. For an overview of the command syntax, see the documentation of dvips, for instance\&. -.RE -.PP -\fBcolor\fR -.RS 4 -Statements of this command set provide instructions to change the text/paint color\&. For an overview of the exact syntax, see the documentation of dvips, for instance\&. -.RE -.PP -\fBdvisvgm\fR -.RS 4 -dvisvgm offers its own small set of specials\&. The following list gives a brief overview\&. -.PP -\fBdvisvgm:raw\fR \fItext\fR -.RS 4 -Adds an arbitrary sequence of characters to the page section of the SVG document\&. dvisvgm does not perform any validation here, thus the user has to ensure that the resulting SVG is still valid\&. Parameter -\fItext\fR -may contain the expressions -\fB{?x}\fR, -\fB{?y}\fR, and -\fB{?color}\fR -that expand to the current -\fIx\fR -or -\fIy\fR -coordinate and the current color, respectively\&. Furthermore, -\fB{?nl}\fR -expands to a newline character\&. -.RE -.PP -\fBdvisvgm:rawdef\fR \fItext\fR -.RS 4 -This command is similar to -\fBdvisvgm:raw\fR, but puts the raw text into the section of the SVG document currently being generated\&. -.RE -.PP -\fBdvisvgm:rawset\fR \fIname\fR \&... \fBdvisvgm:endrawset\fR -.RS 4 -This pair of specials marks the begin and end of a definition of a named raw SVG fragment\&. All -\fBdvisvgm:raw\fR -and -\fBdvisvgm:rawdef\fR -specials enclosed by -\fBdvisvgm:rawset\fR -and -\fBdvisvgm:endrawset\fR -are not evaluated immediately but jointly stored under the given -\fIname\fR -for later use\&. Once defined, the named fragment can be referenced throughout the DVI file by -\fBdvisvgm:rawput\fR -(see below)\&. The two commands -\fBdvisvgm:rawset\fR -and -\fBdvisvgm:endrawset\fR -must not be nested, i\&.e\&. each call of -\fBdvisvgm:rawset\fR -has to be followed by a corresponding call of -\fBdvisvgm:endrawset\fR -before another -\fBdvisvgm:rawset\fR -may occur\&. Also, the identifier -\fIname\fR -must be unique throughout the DVI file\&. Using -\fBdvisvgm:rawset\fR -multiple times together with the same -\fIname\fR -leads to a warning message\&. -.RE -.PP -\fBdvisvgm:rawput\fR \fIname\fR -.RS 4 -Inserts raw SVG fragments previously stored under the given -\fIname\fR\&. dvisvgm distinguishes between fragments that were specified with -\fBdvisvgm:raw\fR -or -\fBdvisvgm:rawdef\fR, and handles them differently: It inserts all -\fBdvisvgm:raw\fR -parts every time -\fBdvisvgm:rawput\fR -is called, whereas the -\fBdvisvgm:rawdef\fR -portions go to the section of the current SVG document only once\&. -.RE -.PP -\fBdvisvgm:img\fR \fIwidth\fR \fIheight\fR \fIfile\fR -.RS 4 -Creates an image element at the current graphic position referencing the given file\&. JPEG, PNG, and SVG images can be used here\&. However, dvisvgm does not check the file format or the file name suffix\&. The lengths -\fIwidth\fR -and -\fIheight\fR -must be given as plain floating point numbers in TeX point units (1in = 72\&.27pt)\&. -.RE -.PP -\fBdvisvgm:bbox\fR n[ew] \fIname\fR -.RS 4 -Defines or resets a local bounding box called -\fIname\fR\&. The name may consist of letters and digits\&. While processing a DVI page, dvisvgm continuously updates the (global) bounding box of the current page in order to determine the minimal rectangle containing all visible page components (characters, images, drawing elements etc\&.) Additionally to the global bounding box, the user can request an arbitrary number of named local bounding boxes\&. Once defined, these boxes are updated together with the global bounding box starting with the first character that follows the definition\&. Thus, the local boxes can be used to compute the extent of parts of the page\&. This is useful for scenarios where the generated SVG file is post\-processed\&. In conjunction with special dvisvgm:raw, the macro -\fB{?bbox \fR\fB\fIname\fR\fR\fB}\fR -expands to the four values -\fIx\fR, -\fIy\fR, -\fIw\fR, and -\fIh\fR -(separated by spaces) specifying the coordinates of the upper left corner, width, and height of the local box -\fIname\fR\&. If box -\fIname\fR -wasn\(cqt previously defined, all four values equal zero\&. -.RE -.PP -\fBdvisvgm:bbox\fR \fIwidth\fR \fIheight\fR [\fIdepth\fR] -.RS 4 -Updates the bounding box of the current page by embedding a virtual rectangle (\fIx\fR, -\fIy\fR, -\fIwidth\fR, -\fIheight\fR) where the lower left corner is located at the current DVI drawing position (\fIx\fR,\fIy\fR)\&. If the optional parameter -\fIdepth\fR -is specified, dvisvgm embeds a second rectangle (\fIx\fR, -\fIy\fR, -\fIwidth\fR, \-\fIdepth\fR)\&. The lengths -\fIwidth\fR, -\fIheight\fR -and -\fIdepth\fR -must be given as plain floating point numbers in TeX point units (1in = 72\&.27pt)\&. Depending on size and position of the virtual rectangle, this command either enlarges the overall bounding box or leaves it as is\&. It\(cqs not possible to reduce its extent\&. This special should be used in conjunction with -\fBdvisvgm:raw\fR -in order to update the viewport of the page properly\&. -.RE -.PP -\fBdvisvgm:bbox\fR a[bs] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR -.RS 4 -This variant of the bbox special updates the bounding box by embedding a virtual rectangle (\fIx1\fR,\fIy1\fR,\fIx2\fR,\fIy2\fR)\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote two diagonal corners of the rectangle given in TeX point units\&. -.RE -.PP -\fBdvisvgm:bbox\fR f[ix] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR -.RS 4 -This variant of the bbox special assigns an absolute (final) bounding box to the resulting SVG\&. After executing this command, dvisvgm doesn\(cqt further alter the bounding box coordinates, except this special is called again later\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote two diagonal corners of the rectangle given in TeX point units\&. -.sp -The following TeX snippet adds two raw SVG elements to the output and updates the bounding box accordingly: -.sp -.if n \{\ -.RS 4 -.\} -.nf -\especial{dvisvgm:raw } -\especial{dvisvgm:bbox 20 10 10} - -\especial{dvisvgm:raw } -\especial{dvisvgm:bbox abs 10 200 100 250} -.fi -.if n \{\ -.RE -.\} -.RE -.RE -.PP -\fBem\fR -.RS 4 -These specials were introduced with the emTeX distribution by Eberhard Mattes\&. They provide line drawing statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands\&. dvisvgm supports only the line drawing statements and ignores all other em specials silently\&. A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN)\&. -.RE -.PP -\fBhtml\fR -.RS 4 -The hyperref specification defines several variants on how to mark hyperlinked areas in a DVI file\&. dvisvgm supports the plain HyperTeX special constructs as created with hyperref package option -\fIhypertex\fR\&. By default, all linked areas of the document are marked by a rectangle\&. Option -\fB\-\-linkmark\fR -allows to change this behavior\&. See above for further details\&. Information on syntax and semantics of the HyperTeX specials can be found in the hyperref manual\&. -.RE -.PP -\fBpdf\fR -.RS 4 -pdfTeX and dvipdfmx introduced several special commands related to the generation of PDF files\&. Currently, only two of them, -\fIpdf:mapfile\fR -and -\fIpdf:mapline\fR -are supported by dvisvgm\&. These specials allow modifying the font map tree during the processing of DVI files\&. They are used by CTeX, for example\&. dvisvgm supports both, the dvips and dvipdfm font map format\&. For further information on the command syntax and semantics, see the documentation of -\fB\epdfmapfile\fR -in the pdfTeX user manual\&. -.RE -.PP -\fBps\fR -.RS 4 -The famous DVI driver dvips introduced its own set of specials in order to embed PostScript code into DVI files, which greatly improves the capabilities of DVI documents\&. One aim of dvisvgm is to completely evaluate all PostScript snippets and to convert as many of them as possible to SVG\&. In contrast to dvips, dvisvgm uses floating point arithmetics to compute the precise position of each graphic element, i\&.e\&. it doesn\(cqt round the coordinates\&. Therefore, the relative locations of the graphic elements may slightly differ from those computed by dvips\&. -.sp -Since PostScript is a rather complex language, dvisvgm does not try to implement its own PostScript interpreter but relies on -Ghostscript (\m[blue]http://ghostscript.com\m[]) -instead\&. If the Ghostscript library was not linked to the dvisvgm binary, it is looked up and loaded dynamically during runtime\&. In this case, dvisvgm looks for -\fIlibgs\&.so\&.X\fR -on Unix\-like systems (supported ABI versions: 7,8,9), and for -\fIgsdll32\&.dll\fR -or -\fIgsdll64\&.dll\fR -on Windows\&. You can override the default file names with environment variable -\fBLIBGS\fR -or the command\-line option -\fB\-\-libgs\fR\&. The library must be reachable through the ld search path (*nix) or the PATH environment variable (Windows)\&. Alternatively, the absolute file path can be specified\&. If the library cannot be found, dvisvgm disables the processing of PostScript specials and prints a warning message\&. Use option -\fB\-\-list\-specials\fR -to check whether PostScript support is available, i\&.e\&. entry -\fIps\fR -is present\&. -.sp -The PostScript handler also recognizes and evaluates bounding box data generated by the -\fIpreview\fR -package with option -\fItightpage\fR\&. If the data is present in a DVI file, dvisvgm adapts the bounding box of the generated SVG file accordingly, and prints a message showing the width, height, and depth of the box in TeX point units\&. Especially, the depth value can be used to vertically align the SVG graphics with the baseline of surrounding text in HTML or XSL\-FO documents, for example\&. -.RE -.PP -\fBtpic\fR -.RS 4 -The TPIC special set defines instructions for drawing simple geometric objects\&. Some LaTeX packages, like eepic and tplot, use these specials to describe graphics\&. -.RE -.SH "EXAMPLES" -.sp -.if n \{\ -.RS 4 -.\} -.nf -dvisvgm file -.fi -.if n \{\ -.RE -.\} -.sp -Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svg\fR\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -dvisvgm \-z file -.fi -.if n \{\ -.RE -.\} -.sp -Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svgz\fR with default compression level 9\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -dvisvgm \-p5 \-z3 \-ba4\-l \-onewfile file -.fi -.if n \{\ -.RE -.\} -.sp -Converts the fifth page of \fIfile\&.dvi\fR to \fInewfile\&.svgz\fR with compression level 3\&. The bounding box is set to DIN/ISO A4 in landscape format\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -dvisvgm \-\-transform="R20,w/3,2h/5 T1cm,1cm S2,3" file -.fi -.if n \{\ -.RE -.\} -.sp -Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svg\fR where three transformations are applied\&. -.SH "ENVIRONMENT" -.sp -dvisvgm uses the \fBkpathsea\fR library for locating the files that it opens\&. Hence, the environment variables described in the library\(cqs documentation influence the converter\&. -.sp -If dvisvgm was linked without the Ghostscript library, and if PostScript support has not been disabled, the shared Ghostscript library is looked up during runtime via dlopen()\&. The environment variable \fBLIBGS\fR can be used to specify path and file name of the library\&. -.sp -The pre\-compiled Windows versions of dvisvgm require a working installation of MiKTeX 2\&.9 or above\&. dvisvgm does not work together with the portable edition of MiKTeX because it relies on MiKTeX\(cqs COM interface only accessible in a local installation\&. To enable the evaluation of PostScript specials, the original Ghostscript DLL \fIgsdll32\&.dll\fR must be present and reachable through the search path\&. 64\-bit Windows builds require the 64\-bit Ghostscript DLL \fIgsdll64\&.dll\fR\&. Both DLLs come with the corresponding Ghostscript installers available from www\&.ghostscript\&.com\&. -.sp -The environment variable \fBDVISVGM_COLORS\fR specifies the colors used to highlight various parts of dvisvgm\(cqs message output\&. It is only evaluated if option \fB\-\-color\fR is given\&. The value of \fBDVISVGM_COLORS\fR is a list of colon\-separated entries of the form \fIgg\fR=\fIBF\fR, where \fIgg\fR denotes one of the color group indicators listed below, and \fIBF\fR are two hexadecimal digits specifying the background (first digit) and foreground/text color (second digit)\&. The color values are defined as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=gray, 8=bright red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta, D=bright cyan, E=bright gray, F=white\&. Depending on the terminal, the colors may differ\&. Rather than changing both the text and background color, it\(cqs also possible to change only one of them: An asterisk (*) in place of a hexadecimal digit indicates the default text or background color of the terminal\&. -.sp -All malformed entries in the list are silently ignored\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -\fBer\fR -T}:T{ -.sp -error messages -T} -T{ -.sp -\fBwn\fR -T}:T{ -.sp -warning messages -T} -T{ -.sp -\fBpn\fR -T}:T{ -.sp -messages about page numbers -T} -T{ -.sp -\fBps\fR -T}:T{ -.sp -page size messages -T} -T{ -.sp -\fBfw\fR -T}:T{ -.sp -information about the files written -T} -T{ -.sp -\fBsm\fR -T}:T{ -.sp -state messages -T} -T{ -.sp -\fBtr\fR -T}:T{ -.sp -messages of the glyph tracer -T} -T{ -.sp -\fBpi\fR -T}:T{ -.sp -progress indicator -T} -.TE -.sp 1 -.sp -\fBExample:\fR \fBer=01:pi=*5\fR sets the colors of error messages (\fBer\fR) to red (\fB1\fR) on black (\fB0\fR), and those of progress indicators (\fBpi\fR) to cyan (\fB5\fR) on default background (\fB*\fR)\&. -.SH "FILES" -.sp -The location of the following files is determined by the kpathsea library\&. To check the actual kpathsea configuration you can use the \fBkpsewhich\fR utility\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -\fB*\&.enc\fR -T}:T{ -.sp -Font encoding files -T} -T{ -.sp -\fB*\&.fgd\fR -T}:T{ -.sp -Font glyph data files (cache files created by dvisvgm) -T} -T{ -.sp -\fB*\&.map\fR -T}:T{ -.sp -Font map files -T} -T{ -.sp -\fB*\&.mf\fR -T}:T{ -.sp -Metafont input files -T} -T{ -.sp -\fB*\&.pfb\fR -T}:T{ -.sp -PostScript Type 1 font files -T} -T{ -.sp -\fB*\&.pro\fR -T}:T{ -.sp -PostScript header/prologue files -T} -T{ -.sp -\fB*\&.tfm\fR -T}:T{ -.sp -TeX font metric files -T} -T{ -.sp -\fB*\&.ttf\fR -T}:T{ -.sp -TrueType font files -T} -T{ -.sp -\fB*\&.vf\fR -T}:T{ -.sp -Virtual font files -T} -.TE -.sp 1 -.SH "SEE ALSO" -.sp -\fBtex(1), mf(1), mktexmf(1), grodvi(1), potrace(1)\fR, and the \fBkpathsea library\fR info documentation\&. -.SH "RESOURCES" -.PP -Project home page -.RS 4 -\m[blue]\fBhttp://dvisvgm\&.bplaced\&.net\fR\m[] -.RE -.PP -Code repository -.RS 4 -\m[blue]\fBhttps://github\&.com/mgieseki/dvisvgm\fR\m[] -.RE -.SH "BUGS" -.sp -Please report bugs using the bug tracker at GitHub (\m[blue]https://github.com/mgieseki/dvisvgm/issues\m[]) or Launchpad (\m[blue]https://bugs.launchpad.net/dvisvgm\m[])\&. -.SH "AUTHOR" -.sp -Written by Martin Gieseking <\m[blue]\fBmartin\&.gieseking@uos\&.de\fR\m[]> -.SH "COPYING" -.sp -Copyright \(co 2005\-2015 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/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.txt.in b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.txt.in deleted file mode 100644 index 24b888ccea5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/dvisvgm.txt.in +++ /dev/null @@ -1,772 +0,0 @@ -////////////////////////////////////////////////////////////////////////// -// This file is part of dvisvgm -- the DVI to SVG converter // -// Copyright (C) 2005-2015 Martin Gieseking // -// // -// This program is free software; you can redistribute it and/or // -// modify it under the terms of the GNU General Public License as // -// 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 . // -////////////////////////////////////////////////////////////////////////// - -dvisvgm(1) -========== -Martin Gieseking <@PACKAGE_BUGREPORT@> -:man source: dvisvgm -:man version: @VERSION@ -:man manual: dvisvgm Manual - -NAME ----- -dvisvgm - converts DVI and EPS files to the XML-based SVG format - - -SYNOPSIS --------- -*dvisvgm* [ 'options' ] 'file' [.dvi] - -*dvisvgm* -E [ 'options' ] 'file' [.eps] - - -DESCRIPTION ------------ -The command-line utility *dvisvgm* converts DVI files, as generated by TeX/LaTeX, to the -XML-based scalable vector graphics format SVG. It supports the classic DVI format 2 as -well as format 3 (created by pTeX in vertical mode), and the XeTeX formats 5 and 6 which are -also known as XDV. Besides the basic DVI commands, dvisvgm also evaluates many so-called -'specials' which heavily extend the capabilities of the DVI format. For a more detailed -overview, see section <> below. - -Since the current SVG standard 1.1 doesn't specify multi-page graphics, dvisvgm creates -separate SVG files for each DVI page. Because of compatibility reasons, only the first page -is converted by default. In order to select a different page or arbitrary page sequences, -use option *-p* which is described below. - -SVG is a vector-based graphics format and therefore dvisvgm tries to convert the glyph outlines -of all used fonts to scalable path descriptions. The fastest way to do that is to extract the -path information from font files in PFB, TTF, or OTF format. If dvisvgm is able to find such -a file, it extracts all necessary outline information about the glyphs from it. - -However, TeX's main source for font descriptions is Metafont, which produces bitmap output -(GF files). That's why not all obtainable TeX fonts are available in a scalable format. -In these cases, dvisvgm tries to vectorize Metafont's 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. - -When running dvisvgm without option *--no-fonts*, 'font' elements (++...++) are used to -embed the font data into the SVG files. Unfortunately, only few SVG renderes support these -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. - - -OPTIONS -------- -*-a, --trace-all*=['retrace']:: -This option forces dvisvgm to trace not only the actually needed glyphs but all -glyphs of all bitmap fonts used in the DVI file. Since the tracing results are stored in -the font cache, all following DVI conversions (without option *--trace-all*) where these -fonts are involved, will be much faster. By default, dvisvgm traces only the actually -needed glyphs, and adds them to the cache. -The boolean option 'retrace' determines how to handle glyphs already stored in the cache. -By default, these glyphs are skipped. Setting argument 'retrace' to 'yes' or -'true' forces dvisvgm to trace the corresponding bitmaps again. -+ -[NOTE] -This option only takes effect if font caching is active. Therefore, *--trace-all* cannot be -combined with option *--cache=none*. -+ - - -*-b, --bbox*='fmt':: -Sets the bounding box of the generated graphic to the specified format. The parameter 'fmt' -takes either one of the format specifiers listed below, or a sequence of four comma- or -whitespace-separated length values 'x1', 'y1', 'x2' and 'y2'. The latter define two diagonal -corners of the bounding box. Each length value consists of a floating point number and an optional -length unit (pt, bp, cm, mm, in, or pc). If the unit is omitted, TeX points (pt) are assumed. -+ -It's also possible to give only one length value 'l'. In this case, the minimal bounding box -is computed and enlarged by adding (-'l',-'l') to the upper left and ('l','l') to the lower -right corner. -+ -Alternatively, the following format specifiers are supported: - - *International DIN/ISO paper sizes*;; - A__n__, B__n__, C__n__, D__n__, where 'n' is a non-negative integer, e.g. A4 or a4 for DIN/ISO A4 - format (210mm × 297mm). - - *North American paper sizes*;; - invoice, executive, legal, letter, ledger - - *Special bounding box sizes*;; -[horizontal] - *dvi*::: page size stored in the DVI file - *min*::: computes the minimal/tightest bounding box - *none*::: no bounding box is assigned -// - *Page orientation*;; - The default page orientation for DIN/ISO and American paper sizes is 'portrait', - i.e. 'width' < 'height'. Appending *-landscape* or simply *-l* to the format - string switches to 'landscape' mode ('width' > 'height'). For symmetry reasons you can - also explicitly add *-portrait* or *-p* to indicate the default portrait format. - Note that these suffixes are part of the size string and not separate options. Thus, - they must directly follow the size specifier without additional blanks. - Furthermore, the orientation suffixes can't be used with *dvi*, *min*, and *none*. -+ -[NOTE] -Option *-b, --bbox* only affects the bounding box and does not transform the page content. -Hence, if you choose a landscape format, the page won't be rotated. -+ -// - -// -*-C, --cache*[='dir']:: -To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion -information in cache files. By default, these files are stored in $HOME/.dvisvgm/cache. If you prefer -a different location, use option *--cache* to overwrite the default. Furthermore, it is also possible -to disable the font caching mechanism completely with option *--cache=none*. If argument 'dir' is omitted, -dvisvgm prints the path of the default cache directory together with further information about the stored fonts. -Additionally, outdated and corrupted cache files are removed. - - -*-j, --clipjoin*:: -This option tells dvisvgm to compute the intersection of clipping paths itself if necessary, -and not to delegate this task to the SVG renderer. The resulting SVG files are more portable -because some SVG renderers don't support intersections of clipping paths which are defined by -'clipPath' elements that contain a 'clip-path' attribute. - - -*--color*:: -Enables colorization of messages printed during the conversion process. The colors can be customized -via the environment variable *DVISVGM_COLORS*. See the ENVIRONMENT section below for further information. - - -*-E, --eps*:: -If this option is given, dvisvgm does not expect a DVI but an EPS input file, and tries to convert -it to SVG. In order to do so, a single 'psfile' special command is created and forwarded to the -PostScript special handler. -This option is only available if dvisvgm was built with PostScript support enabled, and requires -Ghostscript to be available. See option *--libgs* for further information. - - -*-e, --exact*:: -If this option is given, dvisvgm computes the precise bounding box of each character. By default, -the values stored in a font's TFM file are used to determine a glyph's extent. As these values are -intended to implement optimal character placements and are not designed to represent the exact -dimensions, they don't necessarily correspond with the bounds of the visual glyphs. Thus, width -and/or height of some glyphs may be larger (or smaller) than the respective TFM values. As a result, -this can lead to clipped characters at the bounds of the SVG graphics. With option *--exact* given, -dvisvgm analyzes the actual shape of each character and derives a usually tight bounding box. - - -*-m, --fontmap*='filenames':: -Loads and evaluates a single or multiple font map files. These files are required to resolve -font file names and encodings. dvisvgm does not provide its own map files but tries to read -available ones coming with dvips or dvipdfm. If option *--fontmap* is omitted, dvisvgm looks for the -default map files 'ps2pk.map', 'dvipdfm.map', and 'psfonts.map' (in this order). Otherwise, the -listed files are used. Multiple filenames must be separated by commas without leading and/or trailing -whitespace. -The map files are evaluated in the given order. By default, redefined mappings do not replace previous ones. -However, each filename can be preceded by an optional mode specifier (*+*, *-*, or *=*) to change this behavior: - - +mapfile;; - Only those entries in the given map file that don't redefine a font mapping are applied. - That's also the default mode if no mode specifier is given. - - -mapfile;; - Ensures that none of the font mappings defined in the given map file are used, i.e. previously - defined mappings for the specified fonts are removed. - - =mapfile;; - All mappings defined in the map file are applied. Previously defined settings for the same font - are replaced. -+ -If the first filename in the filename sequence is preceded by a mode specifier, dvisvgm loads the -default font map (see above) and applies the other map files afterwards. Otherwise, none of default -map files will be loaded automatically. -+ -Examples: +--fontmap=myfile1.map,+myfile2.map+ loads 'myfile1.map' followed by 'myfile2.map' where all -redefinitions of `myfile2.map` are ignored. -+--fontmap==myfile1.map,-myfile2.map+ loads the default map file followed by 'myfile1.map' and 'myfile2.map' -where all redefinitions of 'myfile1.map' replace previous entries. Afterwards, all definitions for the fonts -given in 'myfile2.map' are removed from the font map tree. -+ -For further information about the map file formats and the mode specifiers, see the manuals of dvips and dvipdfm. - - -*--grad-overlap*:: -Tells dvisvgm to create overlapping grid segments when approximating color gradient fills (also see -option *--grad-segments* below). By default, adjacent segments don't overlap but only touch each other -like separate tiles. Unfortunately, this alignment can lead to visible gaps between the segments -because the background influences the color at the boundary of the segments if the SVG renderer uses -anti-aliasing to create smooth contours. -One way to avoid this and to create seamlessly touching color regions is to enlarge the segments so -that they extent into the area of their right and bottom neighbors. Since the latter are drawn on top -of the overlapping parts, the visible size of all segments keeps unchanged. Just the former gaps -disappear as the background is now completely covered by the correct colors. -Currently, dvisvgm computes the overlapping segments separately for each patch of the mesh (a patch mesh -may consist of multiple patches of the same type). Therefore, there still might be visible gaps -at the seam of two adjacent patches. - - -*--grad-segments*='number':: -Determines the maximal number of segments per column and row used to approximate gradient color fills. -Since SVG 1.1 only supports a small subset of the shading algorithms available in PostScript, -dvisvgm approximates some of them by subdividing the area to be filled into smaller, monochromatic -segments. Each of these segments gets the average color of the region it covers. Thus, increasing the -number of segments leads to smaller monochromatic areas and therefore results in a better approximation -of the actual color gradient. As a drawback, more segments imply bigger SVG files because every -segment is represented by a separate path element. -+ -Currently, dvisvgm supports free- and lattice-form triangular patch meshes as well as Coons and -tensor-product patch meshes. They are approximated by subdividing the area of each patch into a -__n__×__n__ grid of smaller segments. The maximal number of segments per column and row can be -changed with option *--grad-segments*. - - -*--grad-simplify*='delta':: -If the size of the segments created to approximate gradient color fills falls below the given delta -value, dvisvgm reduces their level of detail. For example, Bézier curves are replaced by straight -lines, and triangular segments are combined to tetragons. For a small delta these simplifications -are usually not noticeable but reduce the size of the generated SVG files. - - -*-h, --help*[='mode']:: -Prints a short summary of all available command-line options. The optional 'mode' parameter is -an integer value between 0 and 2. It selects the display variant of the help text. Mode 0 -lists all options divided into categories with section headers. This is also the default if -dvisvgm is called without parameters. Mode 1 lists all options ordered by the short option names, -while mode 2 sorts the lines by the long option names. - - -*--keep*:: -Disables the removal of temporary files as created by Metafont (usually .gf, .tfm, and .log files). - - -*--libgs*='filename':: -This option is only available if the Ghostscript library is not directly linked to dvisvgm and if -PostScript support was not completely disabled during compilation. In this case, dvisvgm tries -to load the shared GS library dynamically during runtime. By default, it expects the library's name -to be libgs.so.X (on Unix-like systems, where X is the ABI version of the library) or -gsdll32.dll/gsdll64.dll (Windows). Option *--libgs* can be used to give a different name. -Alternatively, it's also possible to set the GS library name by the environment variable *LIBGS*. -The latter has less precedence than the command-line option, i.e. dvisvgm ignores variable *LIBGS* -if *--libgs* is given. - - -*-L, --linkmark*='style':: -Selects the method how to mark hyperlinked areas. The 'style' argument can take one of the values -'none', 'box', and 'line', where 'box' is the default, i.e. a rectangle is drawn around -the linked region if option *--linkmark* is omitted. Style argument 'line' just draws the lower edge of -the bounding rectangle, and 'none' tells dvisvgm not to add any visible objects to hyperlinks. -The lines and boxes get the current text color selected. In order to apply a different, constant color, -a colon followed by a color specifier can be appended to the style string. A 'color specifier' is either -a hexadecimal RGB value of the form '#RRGGBB', or a -http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips[dvips color name]. -+ -Moreover, argument 'style' can take a single color specifier to highlight the linked region by -a frameless box filled with that color. An optional second color specifier separated by colon -selects the frame color. -+ -Examples: +box:red+ or +box:#ff0000+ draws red boxes around the linked areas. +yellow:blue+ creates -yellow filled rectangles with blue frames. - - -*-l, --list-specials*:: -Prints a list of registered special handlers and exits. Each handler processes a set of special -statements belonging to the same category. In most cases, the categories are identified by the -prefix of the special statements. It's usually a leading word separated from the rest of the -statement by a colon or a blank, e.g. 'color' or 'ps'. - - -*-M, --mag*='factor':: -Sets the magnification factor applied in conjunction with Metafont calls prior tracing the glyphs. -The larger this value, the better the tracing results. Nevertheless, large magnification values -can cause Metafont arithmetic errors due to number overflows. So, use this option with care. -The default setting usually produces nice results. - - -*--no-merge*:: -Puts every single character in a separate 'text' element with corresponding 'x' and 'y' attributes. -By default, new 'text' or 'tspan' elements are only created if a string starts at a location that -differs from the regular position defined by the characters' advance values. - - -*--no-mktexmf*:: -Suppresses the generation of missing font files. If dvisvgm can't find a font file -through the kpathsea lookup mechanism, it calls the external tools mktextfm or mktexmf by. -This option disables these calls. - - -*-n, --no-fonts*[='variant']:: -If this option is given, dvisvgm doesn't create SVG 'font' elements but uses 'paths' instead. The -resulting SVG files tend to be larger but they are concurrently more compatible with most applications that -don't support SVG fonts yet. The optional argument 'variant' selects the method how to substitute fonts -by paths. Variant 0 creates 'path' and 'use' elements. Variant 1 creates 'path' elements only. -Option *--no-fonts* implies *--no-styles*. - - -*-c, --scale*='sx'[,'sy']:: -Scales the page content horizontally by 'sx' and vertically by 'sy'. This option is equivalent -to *-TS*'sx','sy'. - - -*-S, --no-specials*[='names']:: -Disable processing of special commands embedded in the DVI file. If no further -parameter is given, all specials are ignored. To selectively disable sets of specials, -an optional comma-separated list of names can be appended to this option. A 'name' is the unique -identifier referencing the intended special handler. Option *--list-specials* lists all currently -available handlers and their names. -All unsupported special statements are silently ignored. - - -*--no-styles*:: -By default, dvisvgm creates CSS styles and class attributes to reference fonts because it's more -compact than repeatedly set the complete font information in each text element. However, if you -prefer direct font references, the default behavior can be disabled with option *--no-styles*. - - -*-o, --output*='pattern':: -Sets the name pattern of the output file. Parameter 'pattern' is a string that may -contain the variables *%f*, *%p*, and *%P*. *%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 after the percent sign specifies -the minimal number of digits to be written. If a particular value is shorter, 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 integer divisions with common precedence. The variables -*p* and *P* contain the current page number and the total number of pages, respectively. -For example, +--output="%f-%(p-1)"+ creates filenames where the numbering starts with 0 rather -than 1. -+ -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' -is a single-page document. Otherwise, multiple SVG files 'foo-01.svg', 'foo-02.svg', etc. are -produced. In Windows environments, the percent sign indicates dereferenced environment -variables, and must therefore be protected by a second percent sign, e.g. +--output=%%f-%%p+. - - -*-p, --page*='ranges':: -This option sets the pages to be processed. Parameter 'ranges' consists of a comma-separated list -of single page numbers and/or page ranges. A page range is a pair of numbers separated by a hyphen, -e.g. 5-12. Thus, a page sequence might look like this: 2-4,6,9-12,15. It doesn't matter if a page -is given more than once or if page ranges overlap. dvisvgm always extracts the page numbers in -ascending order and converts them only once. -In order to stay compatible with previous versions, the default page sequence is 1. dvisvgm -therefore converts only the first page and not the whole document in case option *--page* is omitted. -Usually, page ranges consist of two numbers denoting the first and last page to be converted. -If the conversion is to be started at page 1, or if it should continue up to the last DVI page, the -first or second range number can be omitted, respectively. Example: +--page=-10+ converts all -pages up to page 10, +--page=10-+ converts all pages starting with page 10. -Please consider that the page values don't refer to the page numbers printed on the page. -Instead, the physical page count is expected, where the first page always gets number 1. - - -*-d, --precision*='digits':: -Specifies the maximal number of decimal places applied to floating-point attribute values. -All attribute values written to the generated SVG file(s) are rounded accordingly. The -parameter 'digits' allows integer values from 0 to 6, where 0 enables the automatic selection -of significant decimal places. This is also the default value if dvisvgm is called without -option *--precision*. - - -*-P, --progress*[='delay']:: -Enables a simple progress indicator shown when time-consuming operations like -PostScript specials are processed. The indicator doesn't appear before the given -delay (in seconds) has elapsed. The default delay value is 0.5 seconds. - - -*-r, --rotate*='angle':: -Rotates the page content clockwise by 'angle' degrees around the page center. -This option is equivalent to *-TR*'angle'. - - -*-R, --relative*:: -SVG allows to define graphics paths by a sequence of absolute and/or relative commands, -i.e. each command expects either absolute coordinates or coordinates relative to the -current drawing position. By default, dvisvgm creates paths made up of absolute commands. -If option *--relative* is given, relative commands are created instead which slightly reduces -the size of the SVG files in most cases. - - -*-s, --stdout*:: -Don't write the SVG output to a file but redirect it to *stdout*. - - -*-T, --transform*='commands':: -Applies a sequence of transformations to the SVG content. Each transformation is described -by a 'command' beginning with a capital letter followed by a list of comma-separated -parameters. Following transformation commands are supported: - - *T* 'tx'[,'ty'];; - Translates (moves) the page in direction of vector ('tx','ty'). If 'ty' is omitted, - 'ty'=0 is assumed. - The expected unit length of 'tx' and 'ty' are TeX points (1pt = 1/72.27in). However, there - are several constants defined to simplify the unit conversion (see below). - - *S* 'sx'[,'sy'];; - Scales the page horizontally by 'sx' and vertically by 'sy'. If 'sy' is omitted, - 'sy'='sx' is assumed. - - *R* 'angle'[,'x','y'];; - Rotates the page clockwise by 'angle' degrees around point ('x','y'). If the optional - arguments 'x' and 'y' are omitted, the page will be rotated around its center depending on - the chosen page format. When option *-bnone* is given, the rotation center is origin (0,0). - - *KX* 'angle';; - Skews the page along the 'x'-axis by 'angle' degrees. Argument 'angle' can take any value - except 90+180__k__, where 'k' is an integer. - - *KY* 'angle';; - Skews the page along the 'y'-axis by 'angle' degrees. Argument 'angle' can take any value - except 90+180__k__, where 'k' is an integer. - - *FH* ['y'];; - Mirrors (flips) the page at the horizontal line through point (0,'y'). Omitting the optional argument - leads to 'y'='h'/2, where 'h' denotes the page height (see <> below). - - *FV* ['x'];; - Mirrors (flips) the page at the vertical line through point ('x',0). Omitting the optional argument - leads to 'x'='w'/2, where 'w' denotes the page width (see <> below). - - *M* 'm1',...,'m6';; - Applies a transformation described by the 3×3 matrix - \(('m1','m2','m3'),('m4','m5','m6'),(0,0,1)), where the inner triples denote - the rows. -+ -[NOTE] -================================================================================================= -All transformation commands of option *-T, --transform* are applied in the order of their appearance. -Multiple commands can optionally be separated by spaces. In this case the whole transformation string -has to be enclosed in double quotes. All parameters are expressions of floating point type. You can either -give plain numbers or arithmetic terms combined by the operators *+* (addition), *-* (subtraction), -*** (multiplication), */* (division) or *%* (modulo) with common associativity and -precedence rules. Parentheses may be used as well. - -[[constants]] -Additionally, some pre-defined constants are provided: - -[horizontal] -*ux*:: horizontal position of upper left page corner in TeX point units -*uy*:: vertical position of upper left page corner in TeX point units -*h*:: page height in TeX point units (0 in case of *-bnone*) -*w*:: page width in TeX point units (0 in case of *-bnone*) - -Furthermore, you can use the length constants *pt*, *mm*, *cm* and *in*, e.g. -+2cm+ or +1.6in+. Thus, option +-TT1in,0R45+ moves the page content 1 inch to the right and rotates it -by 45 degrees around the page center afterwards. - -For single transformations you can also use options *-c*, *-t* and *-r*. Note that -the order in which these options are given is not significant, i.e. you can't use them to describe -transformation sequences. They are simply independent shorthand options for common transformations. - -================================================================================================= -+ -// - -// -*-t, --translate*='tx'[,'ty']:: -Translates (moves) the page content in direction of vector ('tx','ty'). This option is -equivalent to *-TT*'tx','ty'. - - -*-v, --verbosity*='level':: -Controls the type of messages printed during a dvisvgm run: -[horizontal] - *0*;; no message output - *1*;; error messages only - *2*;; warning messages only - *4*;; informational messages only - -+ -[NOTE] -By adding these values you can combine the categories. The default level is 7, i.e. all -messages are printed. -+ - - -*-V, --version*[='extended']:: -Prints the version of dvisvgm and exits. If the optional argument is set to 'yes', the -version numbers of the linked libraries are printed as well. - - -*-z, --zip*[='level']:: -Creates a compressed SVG file with suffix .svgz. The optional argument specifies the compression -level. Valid values are in the range of 1 to 9 (default value is 9). Larger values cause better -compression results but take more computation time. -+ -CAUTION: This option cannot be combined with *-s, --stdout*. - - -*-Z, --zoom*[='factor']:: -Multiplies the 'width' and 'height' attributes of the SVG root element by argument 'factor' while -the coordinate system of the graphic is retained. As a result, most SVG viewers zoom the graphics -accordingly. If a negative zoom factor is given, the 'width' and 'height' attributes are omitted. - - -[[specials]] -SUPPORTED SPECIALS ------------------- -dvisvgm supports several sets of 'special commands' that can be used to enrich DVI files with additional -features, like color, graphics, and hyperlinks. The evaluation of special commands is delegated to dedicated -handlers. Each handler is responsible for all special statements of the same command set, i.e. commands -beginning with the same prefix. To get a list of actually provided special handlers, use option -*--list-specials* (see above). This section gives an overview of the special commands currently supported. - -*bgcolor*:: -Special statement for changing the background/page color. Since SVG 1.1 doesn't support background colors, -dvisvgm inserts a rectangle of the chosen color into the generated SVG document. This rectangle always gets -the same size as the selected or computed bounding box. This background color command is part of the color -special set but is handled separately in order to let the user turn it off. For an overview of the command -syntax, see the documentation of dvips, for instance. - -*color*:: -Statements of this command set provide instructions to change the text/paint color. For an overview of the -exact syntax, see the documentation of dvips, for instance. - -*dvisvgm*:: -dvisvgm offers its own small set of specials. The following list gives a brief overview. - *dvisvgm:raw* 'text';; - Adds an arbitrary sequence of characters to the page section of the SVG document. dvisvgm does not perform - any validation here, thus the user has to ensure that the resulting SVG is still valid. Parameter 'text' - may contain the expressions *{?x}*, *{?y}*, and *{?color}* that expand to the current 'x' or 'y' coordinate - and the current color, respectively. Furthermore, *{?nl}* expands to a newline character. - - *dvisvgm:rawdef* 'text';; - This command is similar to *dvisvgm:raw*, but puts the raw text into the section of the SVG document - currently being generated. - - *dvisvgm:rawset* 'name' ... *dvisvgm:endrawset*;; - This pair of specials marks the begin and end of a definition of a named raw SVG fragment. All *dvisvgm:raw* - and *dvisvgm:rawdef* specials enclosed by *dvisvgm:rawset* and *dvisvgm:endrawset* are not evaluated - immediately but jointly stored under the given 'name' for later use. Once defined, the named fragment can be - referenced throughout the DVI file by *dvisvgm:rawput* (see below). - The two commands *dvisvgm:rawset* and *dvisvgm:endrawset* must not be nested, i.e. each call of *dvisvgm:rawset* - has to be followed by a corresponding call of *dvisvgm:endrawset* before another *dvisvgm:rawset* may occur. - Also, the identifier 'name' must be unique throughout the DVI file. Using *dvisvgm:rawset* multiple times - together with the same 'name' leads to a warning message. - - *dvisvgm:rawput* 'name';; - Inserts raw SVG fragments previously stored under the given 'name'. dvisvgm distinguishes between fragments - that were specified with *dvisvgm:raw* or *dvisvgm:rawdef*, and handles them differently: It inserts all - *dvisvgm:raw* parts every time *dvisvgm:rawput* is called, whereas the *dvisvgm:rawdef* portions go to the - section of the current SVG document only once. - - *dvisvgm:img* 'width' 'height' 'file';; - Creates an image element at the current graphic position referencing the given file. JPEG, PNG, and SVG images - can be used here. However, dvisvgm does not check the file format or the file name suffix. The lengths 'width' - and 'height' must be given as plain floating point numbers in TeX point units (1in = 72.27pt). - - *dvisvgm:bbox* n[ew] 'name';; - Defines or resets a local bounding box called 'name'. The name may consist of letters and digits. - While processing a DVI page, dvisvgm continuously updates the (global) bounding box of the current page in order to - determine the minimal rectangle containing all visible page components (characters, images, drawing elements etc.) - Additionally to the global bounding box, the user can request an arbitrary number of named local bounding boxes. - Once defined, these boxes are updated together with the global bounding box starting with the first character that - follows the definition. Thus, the local boxes can be used to compute the extent of parts of the page. This is useful - for scenarios where the generated SVG file is post-processed. - In conjunction with special dvisvgm:raw, the macro *{?bbox 'name'}* expands to the four values 'x', 'y', 'w', and 'h' - (separated by spaces) specifying the coordinates of the upper left corner, width, and height of the local box 'name'. - If box 'name' wasn't previously defined, all four values equal zero. - - *dvisvgm:bbox* 'width' 'height' ['depth'];; - Updates the bounding box of the current page by embedding a virtual rectangle ('x', 'y', 'width', 'height') - where the lower left corner is located at the current DVI drawing position ('x','y'). If the optional parameter 'depth' - is specified, dvisvgm embeds a second rectangle ('x', 'y', 'width', -__depth__). The lengths 'width', 'height' and - 'depth' must be given as plain floating point numbers in TeX point units (1in = 72.27pt). Depending on size and position - of the virtual rectangle, this command either enlarges the overall bounding box or leaves it as is. It's not possible - to reduce its extent. This special should be used in conjunction with *dvisvgm:raw* in order to update the viewport - of the page properly. - - *dvisvgm:bbox* a[bs] 'x1' 'y1' 'x2' 'y2';; - This variant of the bbox special updates the bounding box by embedding a virtual rectangle ('x1','y1','x2','y2'). - The points ('x1','y1') and ('x2','y2') denote two diagonal corners of the rectangle given in TeX point units. - - *dvisvgm:bbox* f[ix] 'x1' 'y1' 'x2' 'y2';; - This variant of the bbox special assigns an absolute (final) bounding box to the resulting SVG. After executing - this command, dvisvgm doesn't further alter the bounding box coordinates, except this special is called again later. - The points ('x1','y1') and ('x2','y2') denote two diagonal corners of the rectangle given in TeX point units. -+ -The following TeX snippet adds two raw SVG elements to the output and updates the bounding box accordingly: -+ -[source,tex] ------------------------------------------------------------------------------------- -\special{dvisvgm:raw } -\special{dvisvgm:bbox 20 10 10} - -\special{dvisvgm:raw } -\special{dvisvgm:bbox abs 10 200 100 250} ------------------------------------------------------------------------------------- -+ - -*em*:: -These specials were introduced with the emTeX distribution by Eberhard Mattes. They provide line drawing -statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands. -dvisvgm supports only the line drawing statements and ignores all other em specials silently. -A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN). - -*html*:: -The hyperref specification defines several variants on how to mark hyperlinked areas in a DVI file. dvisvgm -supports the plain HyperTeX special constructs as created with hyperref package option 'hypertex'. -By default, all linked areas of the document are marked by a rectangle. Option *--linkmark* allows to change -this behavior. See above for further details. Information on syntax and semantics of the HyperTeX specials can be -found in the hyperref manual. - -*pdf*:: -pdfTeX and dvipdfmx introduced several special commands related to the generation of PDF files. Currently, only -two of them, 'pdf:mapfile' and 'pdf:mapline' are supported by dvisvgm. These specials allow modifying the font map -tree during the processing of DVI files. They are used by CTeX, for example. dvisvgm supports both, the dvips and -dvipdfm font map format. For further information on the command syntax and semantics, see the documentation of -+\pdfmapfile+ in the pdfTeX user manual. - -*ps*:: -The famous DVI driver dvips introduced its own set of specials in order to embed PostScript code into DVI files, -which greatly improves the capabilities of DVI documents. One aim of dvisvgm is to completely evaluate all -PostScript snippets and to convert as many of them as possible to SVG. In contrast to dvips, dvisvgm uses -floating point arithmetics to compute the precise position of each graphic element, i.e. it doesn't round the -coordinates. Therefore, the relative locations of the graphic elements may slightly differ from those computed -by dvips. -+ -Since PostScript is a rather complex language, dvisvgm does not try to implement its own PostScript interpreter -but relies on http://ghostscript.com[Ghostscript] instead. If the Ghostscript library was not linked to the -dvisvgm binary, it is looked up and loaded dynamically during runtime. In this case, dvisvgm looks for -'libgs.so.X' on Unix-like systems (supported ABI versions: 7,8,9), and for 'gsdll32.dll' or 'gsdll64.dll' on -Windows. You can override the default file names with environment variable *LIBGS* or the command-line -option *--libgs*. The library must be reachable through the ld search path (\*nix) or the PATH environment -variable (Windows). Alternatively, the absolute file path can be specified. If the library cannot be found, -dvisvgm disables the processing of PostScript specials and prints a warning message. -Use option *--list-specials* to check whether PostScript support is available, i.e. entry 'ps' is present. -+ -The PostScript handler also recognizes and evaluates bounding box data generated by the 'preview' package with -option 'tightpage'. If the data is present in a DVI file, dvisvgm adapts the bounding box of the generated SVG file -accordingly, and prints a message showing the width, height, and depth of the box in TeX point units. Especially, -the depth value can be used to vertically align the SVG graphics with the baseline of surrounding text in HTML -or XSL-FO documents, for example. - -*tpic*:: -The TPIC special set defines instructions for drawing simple geometric objects. Some LaTeX packages, like -eepic and tplot, use these specials to describe graphics. - - -EXAMPLES --------- --------------- -dvisvgm file --------------- -Converts the first page of 'file.dvi' to 'file.svg'. - ---------------- -dvisvgm -z file ---------------- -Converts the first page of 'file.dvi' to 'file.svgz' with default compression level 9. - -------------------------------------- -dvisvgm -p5 -z3 -ba4-l -onewfile file -------------------------------------- -Converts the fifth page of 'file.dvi' to 'newfile.svgz' with compression level 3. -The bounding box is set to DIN/ISO A4 in landscape format. - ------------------------------------------------------ -dvisvgm --transform="R20,w/3,2h/5 T1cm,1cm S2,3" file ------------------------------------------------------ -Converts the first page of 'file.dvi' to 'file.svg' where three transformations are applied. - - -ENVIRONMENT ------------ -dvisvgm uses the *kpathsea* library for locating the files that it opens. -Hence, the environment variables described in the library's documentation influence the converter. - -If dvisvgm was linked without the Ghostscript library, and if PostScript support has not been disabled, -the shared Ghostscript library is looked up during runtime via dlopen(). The environment variable *LIBGS* -can be used to specify path and file name of the library. - -The pre-compiled Windows versions of dvisvgm require a working installation of MiKTeX 2.9 or above. -dvisvgm does not work together with the portable edition of MiKTeX because it relies on MiKTeX's COM -interface only accessible in a local installation. -To enable the evaluation of PostScript specials, the original Ghostscript DLL 'gsdll32.dll' must be present -and reachable through the search path. 64-bit Windows builds require the 64-bit Ghostscript DLL 'gsdll64.dll'. -Both DLLs come with the corresponding Ghostscript installers available from www.ghostscript.com. - -The environment variable *DVISVGM_COLORS* specifies the colors used to highlight various parts of dvisvgm's -message output. It is only evaluated if option *--color* is given. The value of *DVISVGM_COLORS* is a list of -colon-separated entries of the form 'gg'='BF', where 'gg' denotes one of the color group indicators listed -below, and 'BF' are two hexadecimal digits specifying the background (first digit) and foreground/text color -(second digit). The color values are defined as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, -5=magenta, 6=cyan, 7=gray, 8=bright red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta, -D=bright cyan, E=bright gray, F=white. Depending on the terminal, the colors may differ. Rather than changing -both the text and background color, it's also possible to change only one of them: An asterisk (*) in -place of a hexadecimal digit indicates the default text or background color of the terminal. - -All malformed entries in the list are silently ignored. - -[horizontal] -*er*:: error messages -*wn*:: warning messages -*pn*:: messages about page numbers -*ps*:: page size messages -*fw*:: information about the files written -*sm*:: state messages -*tr*:: messages of the glyph tracer -*pi*:: progress indicator - -*Example:* +er=01:pi=\*5+ sets the colors of error messages (+er+) to red (+1+) on black (+0+), and those -of progress indicators (+pi+) to cyan (+5+) on default background (+*+). - -FILES ------ -The location of the following files is determined by the kpathsea library. -To check the actual kpathsea configuration you can use the *kpsewhich* utility. - -[horizontal] -**.enc*:: Font encoding files -**.fgd*:: Font glyph data files (cache files created by dvisvgm) -**.map*:: Font map files -**.mf*:: Metafont input files -**.pfb*:: PostScript Type 1 font files -**.pro*:: PostScript header/prologue files -**.tfm*:: TeX font metric files -**.ttf*:: TrueType font files -**.vf*:: Virtual font files - -SEE ALSO --------- -*tex(1), mf(1), mktexmf(1), grodvi(1), potrace(1)*, and the *kpathsea library* info documentation. - - -RESOURCES ---------- -Project home page::: http://dvisvgm.bplaced.net -Code repository::: https://github.com/mgieseki/dvisvgm - - -BUGS ----- -Please report bugs using the bug tracker at https://github.com/mgieseki/dvisvgm/issues[GitHub] -or https://bugs.launchpad.net/dvisvgm[Launchpad]. - - -AUTHOR ------- -Written by {author} <{email}> - - -COPYING -------- -Copyright (C) 2005-2015 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. - -// vim: set syntax=asciidoc: diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/tweak-dblatex-pdf.xsl b/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/tweak-dblatex-pdf.xsl deleted file mode 100644 index a28bbb97e30..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/doc/tweak-dblatex-pdf.xsl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - SYNOPSIS - - - - - - - - - - - \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/m4/ax_code_coverage.m4 b/Build/source/texk/dvisvgm/dvisvgm-1.11/m4/ax_code_coverage.m4 deleted file mode 100644 index 2751459c1d1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/m4/ax_code_coverage.m4 +++ /dev/null @@ -1,229 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CODE_COVERAGE() -# -# DESCRIPTION -# -# Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be -# included in the CFLAGS and LIBS/LDFLAGS variables of every build target -# (program or library) which should be built with code coverage support. -# Also defines CODE_COVERAGE_RULES which should be substituted in your -# Makefile; and $enable_code_coverage which can be used in subsequent -# configure output. CODE_COVERAGE_ENABLED is defined and substituted, and -# corresponds to the value of the --enable-code-coverage option, which -# defaults to being disabled. -# -# Test also for gcov program and create GCOV variable that could be -# substituted. -# -# Note that all optimisation flags in CFLAGS must be disabled when code -# coverage is enabled. -# -# Usage example: -# -# configure.ac: -# -# AX_CODE_COVERAGE -# -# Makefile.am: -# -# @CODE_COVERAGE_RULES@ -# my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ... -# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... -# -# This results in a "check-code-coverage" rule being added to any -# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module -# has been configured with --enable-code-coverage). Running `make -# check-code-coverage` in that directory will run the module's test suite -# (`make check`) and build a code coverage report detailing the code which -# was touched, then print the URI for the report. -# -# This code was derived from Makefile.decl in GLib, originally licenced -# under LGPLv2.1+. -# -# LICENSE -# -# Copyright (c) 2012 Philip Withnall -# Copyright (c) 2012 Xan Lopez -# Copyright (c) 2012 Christian Persch -# Copyright (c) 2012 Paolo Borelli -# Copyright (c) 2012 Dan Winship -# Copyright (c) 2015 Bastien ROUCARIES -# -# This library is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or (at -# your option) any later version. -# -# This library 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 Lesser -# General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -#serial 5 - -AC_DEFUN([AX_CODE_COVERAGE],[ - dnl Check for --enable-code-coverage - AC_REQUIRE([AC_PROG_SED]) - - # allow to override gcov location - AC_ARG_WITH([gcov], - [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) - - AC_MSG_CHECKING([whether to build with code coverage support]) - AC_ARG_ENABLE([code-coverage], - AS_HELP_STRING([--enable-code-coverage], - [Whether to enable code coverage support]),, - enable_code_coverage=no) - - AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) - AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) - AC_MSG_RESULT($enable_code_coverage) - - AS_IF([ test "$enable_code_coverage" = "yes" ], [ - # check for gcov - AC_CHECK_TOOL([GCOV], - [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], - [:]) - AS_IF([test "X$GCOV" = "X:"], - [AC_MSG_ERROR([gcov is needed to do coverage])]) - AC_SUBST([GCOV]) - - dnl Check if gcc is being used - AS_IF([ test "$GCC" = "no" ], [ - AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) - ]) - - # List of supported lcov versions. - lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11" - - AC_CHECK_PROG([LCOV], [lcov], [lcov]) - AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) - - AS_IF([ test "$LCOV" ], [ - AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [ - ax_cv_lcov_version=invalid - lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` - for lcov_check_version in $lcov_version_list; do - if test "$lcov_version" = "$lcov_check_version"; then - ax_cv_lcov_version="$lcov_check_version (ok)" - fi - done - ]) - ], [ - lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" - AC_MSG_ERROR([$lcov_msg]) - ]) - - case $ax_cv_lcov_version in - ""|invalid[)] - lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." - AC_MSG_ERROR([$lcov_msg]) - LCOV="exit 0;" - ;; - esac - - AS_IF([ test -z "$GENHTML" ], [ - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - ]) - - dnl Build the code coverage flags - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LDFLAGS="-lgcov" - - AC_SUBST([CODE_COVERAGE_CFLAGS]) - AC_SUBST([CODE_COVERAGE_LDFLAGS]) - ]) - -CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov -# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the lcov instance. -# (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance. -# (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: empty) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" -CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -CODE_COVERAGE_GENHTML_OPTIONS ?= -CODE_COVERAGE_IGNORE_PATTERN ?= - -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# Use recursive makes in order to ignore errors during check -check-code-coverage: -ifeq ($(CODE_COVERAGE_ENABLED),yes) - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook -ifeq ($(CODE_COVERAGE_ENABLED),yes) - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS) - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -ifeq ($(CODE_COVERAGE_ENABLED),yes) -clean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . -name "*.gcda" -o -name "*.gcov" -delete -endif - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -DISTCHECK_CONFIGURE_FLAGS ?= -DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -' - - AC_SUBST([CODE_COVERAGE_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) -]) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.cpp deleted file mode 100644 index 475a94566b0..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/************************************************************************* -** BasicDVIReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "BasicDVIReader.h" - -using namespace std; - - -BasicDVIReader::BasicDVIReader (std::istream &is) : StreamReader(is), _dviFormat(DVI_NONE) -{ -} - - -/** Evaluates the next DVI command, and computes the corresponding handler. - * @param[out] handler handler for current DVI command - * @param[out] param the handler must be called with this parameter - * @return opcode of current DVI command */ -int BasicDVIReader::evalCommand (CommandHandler &handler, int ¶m) { - struct DVICommand { - CommandHandler handler; - int length; // number of parameter bytes - }; - - /* Each cmdFOO command reads the necessary number of bytes from the stream, so executeCommand - doesn't need to know the exact DVI command format. Some cmdFOO methods are used for multiple - DVI commands because they only differ in length of their parameters. */ - static const DVICommand commands[] = { - {&BasicDVIReader::cmdSetChar, 1}, {&BasicDVIReader::cmdSetChar, 2}, // 128-129 - {&BasicDVIReader::cmdSetChar, 3}, {&BasicDVIReader::cmdSetChar, 4}, // 130-131 - {&BasicDVIReader::cmdSetRule, 8}, // 132 - {&BasicDVIReader::cmdPutChar, 1}, {&BasicDVIReader::cmdPutChar, 2}, // 133-134 - {&BasicDVIReader::cmdPutChar, 3}, {&BasicDVIReader::cmdPutChar, 4}, // 135-136 - {&BasicDVIReader::cmdPutRule, 8}, // 137 - {&BasicDVIReader::cmdNop, 0}, // 138 - {&BasicDVIReader::cmdBop, 44}, {&BasicDVIReader::cmdEop, 0}, // 139-140 - {&BasicDVIReader::cmdPush, 0}, {&BasicDVIReader::cmdPop, 0}, // 141-142 - {&BasicDVIReader::cmdRight, 1}, {&BasicDVIReader::cmdRight, 2}, // 143-144 - {&BasicDVIReader::cmdRight, 3}, {&BasicDVIReader::cmdRight, 4}, // 145-146 - {&BasicDVIReader::cmdW0, 0}, // 147 - {&BasicDVIReader::cmdW, 1}, {&BasicDVIReader::cmdW, 2}, // 148-149 - {&BasicDVIReader::cmdW, 3}, {&BasicDVIReader::cmdW, 4}, // 150-151 - {&BasicDVIReader::cmdX0, 0}, // 152 - {&BasicDVIReader::cmdX, 1}, {&BasicDVIReader::cmdX, 2}, // 153-154 - {&BasicDVIReader::cmdX, 3}, {&BasicDVIReader::cmdX, 4}, // 155-156 - {&BasicDVIReader::cmdDown, 1}, {&BasicDVIReader::cmdDown, 2}, // 157-158 - {&BasicDVIReader::cmdDown, 3}, {&BasicDVIReader::cmdDown, 4}, // 159-160 - {&BasicDVIReader::cmdY0, 0}, // 161 - {&BasicDVIReader::cmdY, 1}, {&BasicDVIReader::cmdY, 2}, // 162-163 - {&BasicDVIReader::cmdY, 3}, {&BasicDVIReader::cmdY, 4}, // 164-165 - {&BasicDVIReader::cmdZ0, 0}, // 166 - {&BasicDVIReader::cmdZ, 1}, {&BasicDVIReader::cmdZ, 2}, // 167-168 - {&BasicDVIReader::cmdZ, 3}, {&BasicDVIReader::cmdZ, 4}, // 169-170 - - {&BasicDVIReader::cmdFontNum, 1}, {&BasicDVIReader::cmdFontNum, 2}, // 235-236 - {&BasicDVIReader::cmdFontNum, 3}, {&BasicDVIReader::cmdFontNum, 4}, // 237-238 - {&BasicDVIReader::cmdXXX, 1}, {&BasicDVIReader::cmdXXX, 2}, // 239-240 - {&BasicDVIReader::cmdXXX, 3}, {&BasicDVIReader::cmdXXX, 4}, // 241-242 - {&BasicDVIReader::cmdFontDef, 1}, {&BasicDVIReader::cmdFontDef, 2}, // 243-244 - {&BasicDVIReader::cmdFontDef, 3}, {&BasicDVIReader::cmdFontDef, 4}, // 245-246 - {&BasicDVIReader::cmdPre, 0}, {&BasicDVIReader::cmdPost, 0}, // 247-248 - {&BasicDVIReader::cmdPostPost, 0}, // 249 - }; - - const int opcode = readByte(); - if (!isStreamValid() || opcode < 0) // at end of file - throw InvalidDVIFileException("invalid DVI file"); - - int num_param_bytes = 0; - param = -1; - if (opcode >= 0 && opcode <= 127) { - handler = &BasicDVIReader::cmdSetChar0; - param = opcode; - } - else if (opcode >= 171 && opcode <= 234) { - handler = &BasicDVIReader::cmdFontNum0; - param = opcode-171; - } - else if ((_dviFormat == DVI_XDVOLD && opcode >= 251 && opcode <= 254) - || (_dviFormat == DVI_XDVNEW && opcode >= 252 && opcode <= 253)) { // XDV command? - static const CommandHandler handlers[] = { - &BasicDVIReader::cmdXPic, - &BasicDVIReader::cmdXFontDef, - &BasicDVIReader::cmdXGlyphArray, - &BasicDVIReader::cmdXGlyphString - }; - handler = handlers[opcode-251]; - param = 0; - } - else if (_dviFormat == DVI_PTEX && opcode == 255) { // direction command set by pTeX? - handler = &BasicDVIReader::cmdDir; - num_param_bytes = 1; - } - else if (opcode >= 250) { - ostringstream oss; - oss << "undefined DVI command (opcode " << opcode << ')'; - throw DVIException(oss.str()); - } - else { - const int offset = opcode <= 170 ? 128 : 235-(170-128+1); - handler = commands[opcode-offset].handler; - num_param_bytes = commands[opcode-offset].length; - } - if (param < 0) - param = num_param_bytes; - return opcode; -} - - -/** Reads a single DVI command from the current position of the input stream and calls the - * corresponding cmdFOO method. - * @return opcode of the executed command */ -int BasicDVIReader::executeCommand () { - CommandHandler handler; - int param; // parameter of handler - int opcode = evalCommand(handler, param); - (this->*handler)(param); - return opcode; -} - - -void BasicDVIReader::executePostPost () { - clearStream(); // reset all status bits - if (!isStreamValid()) - throw DVIException("invalid DVI file"); - - seek(-1, ios::end); // stream pointer to last byte - int count=0; - while (peek() == 223) { // count trailing fill bytes - seek(-1, ios::cur); - count++; - } - if (count < 4) // the standard requires at least 4 trailing fill bytes - throw DVIException("missing fill bytes at end of file"); - - setDVIFormat((DVIFormat)readUnsigned(1)); -} - - -void BasicDVIReader::executeAllPages () { - if (_dviFormat == DVI_NONE) - executePostPost(); // get version ID from post_post - seek(0); // go to preamble - while (executeCommand() != 248); // execute all commands until postamble is reached -} - - -void BasicDVIReader::setDVIFormat (DVIFormat format) { - _dviFormat = max(_dviFormat, format); - switch (_dviFormat) { - case DVI_STANDARD: - case DVI_PTEX: - case DVI_XDVOLD: - case DVI_XDVNEW: - break; - default: - ostringstream oss; - oss << "DVI format " << _dviFormat << " not supported"; - throw DVIException(oss.str()); - } -} - -///////////////////////////////////// - -/** Executes preamble command. - * Format: pre i[1] num[4] den[4] mag[4] k[1] x[k] */ -void BasicDVIReader::cmdPre (int) { - setDVIFormat((DVIFormat)readUnsigned(1)); // identification number - seek(12, ios::cur); // skip numerator, denominator, and mag factor - UInt32 k = readUnsigned(1); // length of following comment - seek(k, ios::cur); // skip comment -} - - -/** Executes postamble command. - * Format: post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] */ -void BasicDVIReader::cmdPost (int) { - seek(28, ios::cur); -} - - -/** Executes postpost command. - * Format: postpost q[4] i[1] 223’s[>= 4] */ -void BasicDVIReader::cmdPostPost (int) { - seek(4, ios::cur); - setDVIFormat((DVIFormat)readUnsigned(1)); // identification byte - while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now -} - - -/** Executes bop (begin of page) command. - * Format: bop c0[+4] ... c9[+4] p[+4] */ -void BasicDVIReader::cmdBop (int) {seek(44, ios::cur);} -void BasicDVIReader::cmdEop (int) {} -void BasicDVIReader::cmdPush (int) {} -void BasicDVIReader::cmdPop (int) {} -void BasicDVIReader::cmdSetChar0 (int) {} -void BasicDVIReader::cmdSetChar (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdPutChar (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdSetRule (int) {seek(8, ios::cur);} -void BasicDVIReader::cmdPutRule (int) {seek(8, ios::cur);} -void BasicDVIReader::cmdRight (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdDown (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdX0 (int) {} -void BasicDVIReader::cmdY0 (int) {} -void BasicDVIReader::cmdW0 (int) {} -void BasicDVIReader::cmdZ0 (int) {} -void BasicDVIReader::cmdX (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdY (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdW (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdZ (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdNop (int) {} -void BasicDVIReader::cmdDir (int) {seek(1, ios::cur);} -void BasicDVIReader::cmdFontNum0 (int) {} -void BasicDVIReader::cmdFontNum (int len) {seek(len, ios::cur);} -void BasicDVIReader::cmdXXX (int len) {seek(readUnsigned(len), ios::cur);} - - -/** Executes fontdef command. - * Format fontdef k[len] c[4] s[4] d[4] a[1] l[1] n[a+l] - * @param[in] len size of font number variable (in bytes) */ -void BasicDVIReader::cmdFontDef (int len) { - seek(len+12, ios::cur); // skip font number - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name - seek(pathlen+namelen, ios::cur); -} - - -/** XDV extension: include image or pdf file. - * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ -void BasicDVIReader::cmdXPic (int) { - seek(1+24+2, ios::cur); - UInt16 len = readUnsigned(2); - seek(len, ios::cur); -} - - -void BasicDVIReader::cmdXFontDef (int) { - seek(4+4, ios::cur); - UInt16 flags = readUnsigned(2); - UInt8 len = readUnsigned(1); - if (_dviFormat == DVI_XDVOLD) - len += readUnsigned(1)+readUnsigned(1); - seek(len, ios::cur); - if (_dviFormat == DVI_XDVNEW) - seek(4, ios::cur); // skip subfont index - if (flags & 0x0200) // colored? - seek(4, ios::cur); - if (flags & 0x1000) // extend? - seek(4, ios::cur); - if (flags & 0x2000) // slant? - seek(4, ios::cur); - if (flags & 0x4000) // embolden? - seek(4, ios::cur); - if ((flags & 0x0800) && (_dviFormat == DVI_XDVOLD)) { // variations? - UInt16 num_variations = readSigned(2); - seek(4*num_variations, ios::cur); - } -} - - -void BasicDVIReader::cmdXGlyphArray (int) { - seek(4, ios::cur); - UInt16 num_glyphs = readUnsigned(2); - seek(10*num_glyphs, ios::cur); -} - - -void BasicDVIReader::cmdXGlyphString (int) { - seek(4, ios::cur); - UInt16 num_glyphs = readUnsigned(2); - seek(6*num_glyphs, ios::cur); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.h deleted file mode 100644 index 005269616c3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BasicDVIReader.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* -** BasicDVIReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_BASICDVIREADER_H -#define DVISVGM_BASICDVIREADER_H - -#include "MessageException.h" -#include "StreamReader.h" - -struct DVIException : public MessageException -{ - DVIException (const std::string &msg) : MessageException(msg) {} -}; - - -struct InvalidDVIFileException : public DVIException -{ - InvalidDVIFileException(const std::string &msg) : DVIException(msg) {} -}; - -class Matrix; - -class BasicDVIReader : public StreamReader -{ - protected: - typedef void (BasicDVIReader::*CommandHandler)(int); - enum DVIFormat {DVI_NONE=0, DVI_STANDARD=2, DVI_PTEX=3, DVI_XDVOLD=5, DVI_XDVNEW=6}; - - public: - BasicDVIReader (std::istream &is); - virtual ~BasicDVIReader () {} - virtual void executeAllPages (); - virtual double getXPos () const {return 0;} - virtual double getYPos () const {return 0;} - virtual void finishLine () {} - virtual void translateToX (double x) {} - virtual void translateToY (double y) {} - virtual int getStackDepth () const {return 0;} - virtual void getPageTransformation (Matrix &matrix) const {} - virtual unsigned getCurrentPageNumber () const {return 0;} - - protected: - void setDVIFormat (DVIFormat format); - DVIFormat getDVIFormat () const {return _dviFormat;} - virtual int evalCommand (CommandHandler &handler, int ¶m); - virtual int executeCommand (); - void executePostPost (); - - // the following methods represent the DVI commands - // they are called by executeCommand and should not be used directly - virtual void cmdSetChar0 (int c); - virtual void cmdSetChar (int len); - virtual void cmdPutChar (int len); - virtual void cmdSetRule (int len); - virtual void cmdPutRule (int len); - virtual void cmdNop (int len); - virtual void cmdBop (int len); - virtual void cmdEop (int len); - virtual void cmdPush (int len); - virtual void cmdPop (int len); - virtual void cmdDir (int len); - virtual void cmdRight (int len); - virtual void cmdDown (int len); - virtual void cmdX0 (int len); - virtual void cmdY0 (int len); - virtual void cmdW0 (int len); - virtual void cmdZ0 (int len); - virtual void cmdX (int len); - virtual void cmdY (int len); - virtual void cmdW (int len); - virtual void cmdZ (int len); - virtual void cmdFontDef (int len); - virtual void cmdFontNum0 (int n); - virtual void cmdFontNum (int len); - virtual void cmdXXX (int len); - virtual void cmdPre (int len); - virtual void cmdPost (int len); - virtual void cmdPostPost (int len); - virtual void cmdXFontDef (int len); // XDV only - virtual void cmdXGlyphArray (int len); // XDV only - virtual void cmdXGlyphString (int len); // XDV format 5 only - virtual void cmdXPic (int len); // XDV format 5 only - - private: - DVIFormat _dviFormat; ///< format of DVI file being processed -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.cpp deleted file mode 100644 index 46cc79d69d9..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************************* -** Bezier.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "Bezier.h" - -using namespace std; - -Bezier::Bezier () { - _points[0] = _points[1] = _points[2] = _points[3] = 0; -} - - -/** Creates a quadratic Bézier curve. internally, it's represented as a cubic one. */ -Bezier::Bezier (const DPair &p0, const DPair &p1, const DPair &p2) { - setPoints(p0, p0+(p1-p0)*2.0/3.0, p2+(p1-p2)*2.0/3.0, p2); -} - - -Bezier::Bezier (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3) { - setPoints(p0, p1, p2, p3); -} - - -/** Creates a subcurve of a given Bézier curve. - * @param[in] source original curve to be clipped - * @param[in] t0 'time' parameter \f$\in[0,1]\f$ of source curve where the subcurve starts - * @param[in] t1 'time' parameter \f$\in[0,1]\f$ of source curve where the subcurve ends */ -Bezier::Bezier (const Bezier &source, double t0, double t1) { - if (t0 == t1) - _points[0] = _points[1] = _points[2] = _points[3] = source.valueAt(t0); - else { - if (t0 > t1) - swap(t0, t1); - if (t0 == 0) - source.subdivide(t1, this, 0); - else if (t1 == 1) - source.subdivide(t0, 0, this); - else { - Bezier subcurve; - source.subdivide(t0, 0, &subcurve); - subcurve.subdivide((t1-t0)/(1-t0), this, 0); - } - } -} - - -void Bezier::setPoints(const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3) { - _points[0] = p0; - _points[1] = p1; - _points[2] = p2; - _points[3] = p3; -} - - -void Bezier::reverse() { - swap(_points[0], _points[3]); - swap(_points[1], _points[2]); -} - - -DPair Bezier::valueAt (double t) const { - const double s = 1-t; - return _points[0]*s*s*s + _points[1]*3.0*s*s*t + _points[2]*3.0*s*t*t + _points[3]*t*t*t; -} - - -/** Returns a value of the Bézier curve's blossom representation. */ -DPair Bezier::blossomValue (double u, double v, double w) const { - const double uv = u*v; - const double uw = u*w; - const double vw = v*w; - const double uvw = u*v*w; - return _points[0]*(1.0-u-v-w+uv+uw+vw-uvw) - +_points[1]*(u+v+w-2.0*(uv+uw+vw)+3.0*uvw) - +_points[2]*(uv+uw+vw-3.0*uvw) - +_points[3]*uvw; -} - - -/** Splits the curve at t into two sub-curves. */ -void Bezier::subdivide (double t, Bezier *bezier1, Bezier *bezier2) const { - const double s = 1-t; - DPair p01 = _points[0]*s + _points[1]*t; - DPair p12 = _points[1]*s + _points[2]*t; - DPair p23 = _points[2]*s + _points[3]*t; - DPair p012 = p01*s + p12*t; - DPair p123 = p12*s + p23*t; - DPair p0123 = p012*s + p123*t; - if (bezier1) - bezier1->setPoints(_points[0], p01, p012, p0123); - if (bezier2) - bezier2->setPoints(p0123, p123, p23, _points[3]); -} - - -/** Approximates the current Bézier curve by a sequence of line segments. - * This is done by subdividing the curve several times using De Casteljau's algorithm. - * If a sub-curve is almost flat, i.e. \f$\sum\limits_{k=0}^2 |p_{k+1}-p_k| - |p_3-p_0| < \delta\f$, - * the curve is not further subdivided. - * @param[in] delta threshold where to stop further subdivisions (see description above) - * @param[out] p the resulting sequence of points defining the start/end points of the line segments - * @param[out] t corresponding curve parameters of the approximated points p: \f$ b(t_i)=p_i \f$ - * @return number of points in vector p */ -int Bezier::approximate (double delta, std::vector &p, vector *t) const { - p.push_back(_points[0]); - if (t) - t->push_back(0); - return approximate(delta, 0, 1, p, t); -} - - -int Bezier::approximate (double delta, double t0, double t1, vector &p, vector *t) const { - // compute distance of adjacent control points - const double l01 = (_points[1]-_points[0]).length(); - const double l12 = (_points[2]-_points[1]).length(); - const double l23 = (_points[3]-_points[2]).length(); - const double l03 = (_points[3]-_points[0]).length(); - if (l01+l12+l23-l03 < delta) { // is curve flat enough? - p.push_back(_points[3]); // => store endpoint - if (t) - t->push_back(t1); - } - else { - // subdivide curve at b(0.5) and approximate the resulting parts separately - Bezier b1, b2; - subdivide(0.5, &b1, &b2); - double tmid = (t0+t1)/2; - b1.approximate(delta, t0, tmid, p, t); - b2.approximate(delta, tmid, t1, p, t); - } - return p.size(); -} - - -/** Returns the signed area of the triangle (p1, p2, p3). */ -static inline double signed_area (const DPair &p1, const DPair &p2, const DPair &p3) { - return ((p2.x()-p1.x())*(p3.y()-p1.y()) - (p3.x()-p1.x())*(p2.y()-p1.y()))/2.0; -} - - -static inline double dot_prod (const DPair &p1, const DPair &p2) { - return p1.x()*p2.x() + p1.y()*p2.y(); -} - - -/** Returns true if p3 is located between p1 and p2, i.e. p3 lays almost on the line - * between p1 and p2. */ -static bool between (const DPair &p1, const DPair &p2, const DPair &p3, double delta) { - double sqr_dist = dot_prod(p2-p1, p2-p1); - double factor = sqr_dist == 0.0 ? 1.0 : sqr_dist; - double area2 = fabs(signed_area(p1, p2, p3)); - return area2*area2/factor < delta // does p3 lay almost on the line through p1 and p2... - && min(p1.x(), p2.x()) <= p3.x() // ...and on or inside the rectangle spanned by p1 and p2? - && max(p1.x(), p2.x()) >= p3.x() - && min(p1.y(), p2.y()) <= p3.y() - && max(p1.y(), p2.y()) >= p3.y(); -} - - -static inline bool near (const DPair &p1, const DPair &p2, double delta) { - DPair diff = p2-p1; - return fabs(diff.x()) < delta && fabs(diff.y()) < delta; -} - - -/** Tries to reduce the degree of the Bézier curve. This only works if the number of - * control points can be reduces without changing the shape of the curve significantly. - * @param[in] delta deviation tolerance - * @param[in] p control points of the reduced curve - * @return degree of the reduced curve */ -int Bezier::reduceDegree (double delta, vector &p) const { - p.clear(); - if (near(_points[0], _points[1], delta) && near(_points[0], _points[2], delta) && near(_points[0], _points[3], delta)) - p.push_back(_points[0]); - else if (between(_points[0], _points[3], _points[1], delta) && between(_points[0], _points[3], _points[2], delta)) { - p.push_back(_points[0]); - p.push_back(_points[3]); - } - else if (near((_points[1]-_points[0])*1.5+_points[0], (_points[2]-_points[3])*1.5+_points[3], delta)) { - p.push_back(_points[0]); - p.push_back((_points[1]-_points[0])*1.5 + _points[0]); - p.push_back(_points[3]); - } - else { - p.resize(4); - for (int i=0; i < 4; i++) - p[i] = _points[i]; - } - return p.size()-1; -} - - -/** Try to solve the quadratic equation ax^2 + bx + c = 0. */ -static bool solve_quadratic_equation (double a, double b, double c, double &x1, double &x2) { - if (a == 0) { - if (b == 0) - return false; - x1 = x2 = -c/b; - } - else { - double discr = b*b - 4*a*c; - if (discr < 0) - return false; - double p = -b/a/2; - double r = sqrt(discr)/a/2; - x1 = p+r; - x2 = p-r; - } - return true; -} - - -/** Returns a tight bounding box parallel to the x- and y-axis. */ -void Bezier::getBBox (BoundingBox &bbox) const { - bbox.invalidate(); - // coefficients of the derivative - DPair pa = _points[3] - _points[2]*3.0 + _points[1]*3.0 - _points[0]; - DPair pb = (_points[2]-_points[1]*2.0+_points[0])*2.0; - DPair pc = _points[1]-_points[0]; - - // compute extrema for t > 0 and t < 1 - double t1, t2; - if (solve_quadratic_equation(pa.x(), pb.x(), pc.x(), t1, t2)) { - if (t1 > 0.001 && t1 < 0.999) - bbox.embed(valueAt(t1)); - if (t1 != t2 && t2 > 0.001 && t2 < 0.999) - bbox.embed(valueAt(t2)); - } - if (solve_quadratic_equation(pa.y(), pb.y(), pc.y(), t1, t2)) { - if (t1 > 0.001 && t1 < 0.999) - bbox.embed(valueAt(t1)); - if (t1 != t2 && t2 > 0.001 && t2 < 0.999) - bbox.embed(valueAt(t2)); - } - bbox.embed(_points[0]); - bbox.embed(_points[3]); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.h deleted file mode 100644 index dcb6ee393c6..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bezier.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* -** Bezier.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_BEZIER_H -#define DVISVGM_BEZIER_H - -#include -#include "BoundingBox.h" -#include "Pair.h" - -class Bezier -{ - public: - Bezier (); - Bezier (const DPair &p0, const DPair &p1, const DPair &p2); - Bezier (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3); - Bezier (const Bezier &source, double t0, double t1); - void setPoints (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3); - void reverse (); - DPair valueAt (double t) const; - DPair blossomValue (double u, double v, double w) const; - void subdivide (double t, Bezier *bezier1, Bezier *bezier2) const; - int approximate (double delta, std::vector &p, std::vector *t=0) const; - const DPair& point (int i) const {return _points[i];} - int reduceDegree (double delta, std::vector &p) const; - void getBBox (BoundingBox &bbox) const; - - protected: - int approximate (double delta, double t0, double t1, std::vector &p, std::vector *t) const; - - private: - DPair _points[4]; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.cpp deleted file mode 100644 index 43bf3a9f68b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* -** BgColorSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "BgColorSpecialHandler.h" -#include "ColorSpecialHandler.h" -#include "SpecialActions.h" - -using namespace std; - - -bool BgColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - ColorSpecialHandler csh; - return csh.process(prefix, is, actions); -} - - -const char** BgColorSpecialHandler::prefixes () const { - static const char *pfx[] = {"background", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.h deleted file mode 100644 index 1d7ec2fbd10..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BgColorSpecialHandler.h +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* -** BgColorSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_BGCOLORSPECIALHANDLER_H -#define DVISVGM_BGCOLORSPECIALHANDLER_H - -#include "SpecialHandler.h" - -struct BgColorSpecialHandler : SpecialHandler -{ - const char* info () const {return "background color special";} - const char* name () const {return "bgcolor";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions *actions); -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.cpp deleted file mode 100644 index 642f079b7ab..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* -** Bitmap.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "Bitmap.h" -#include "macros.h" - -using namespace std; - -Bitmap::Bitmap () : _rows(0), _cols(0), _xshift(0), _yshift(0), _bpr(0), _bytes(0) -{ -} - - -/** Constructs a Bitmap */ -Bitmap::Bitmap (int minx, int maxx, int miny , int maxy) { - resize(minx, maxx, miny, maxy); -} - - -/** Resizes the bitmap and clears all pixels. - * @param[in] minx index of leftmost pixel column - * @param[in] maxx index of rightmost pixel column - * @param[in] miny index of bottom row - * @param[in] maxy index of top row */ -void Bitmap::resize (int minx, int maxx, int miny , int maxy) { - _rows = abs(maxy-miny)+1; - _cols = abs(maxx-minx)+1; - _xshift = minx; - _yshift = miny; - _bpr = _cols/8 + (_cols % 8 ? 1 : 0); // bytes per row - _bytes.resize(_rows*_bpr); - FORALL(_bytes, vector::iterator, it) - *it = 0; -} - - -/** Sets n pixels of row r to 1 starting at pixel c. - * @param[in] row number of row - * @param[in] col number of column (pixel) - * @param[in] n number of bits to be set */ -void Bitmap::setBits (int row, int col, int n) { - row -= _yshift; - col -= _xshift; - UInt8 *byte = &_bytes[row*_bpr + col/8]; - if (byte < &_bytes[0]) - return; - const UInt8 *maxptr = &_bytes[0]+_bytes.size()-1; - while (n > 0 && byte <= maxptr) { - int b = 7 - col%8; // number of leftmost bit in current byte to be set - int m = min(n, b+1); // number of bits to be set in current byte - int bitseq = (1 << m)-1; // sequence of n set bits (bits 0..n-1 are set) - bitseq <<= b-m+1; // move bit sequence so that bit b is the leftmost set bit - *byte |= UInt8(bitseq); // apply bit sequence to current byte - byte++; - n -= m; - col += m; - } -} - - -void Bitmap::forAllPixels (Callback &data) const { - for (int row=0; row < _rows ; row++) { - for (int col=0; col < _bpr; col++) { - UInt8 byte = _bytes[row*_bpr+col]; - int x; - for (int b=7; (b >= 0) && ((x = 8*col+(7-b)) < _cols); b--) - data.pixel(x, row, byte & (1 << b), *this); - } - } - data.finish(); -} - - -class BBoxCallback : public Bitmap::Callback -{ - public: - BBoxCallback () : _changed(false), _minx(numeric_limits::max()), _miny(_minx), _maxx(0), _maxy(0) {} - int minx () const {return _minx;} - int miny () const {return _miny;} - int maxx () const {return _maxx;} - int maxy () const {return _maxy;} - bool empty () const {return !_changed;} - - void pixel (int x, int y, bool set, const Bitmap&) { - if (set) { - _minx = min(_minx, x); - _miny = min(_miny, y); - _maxx = max(_maxx, x); - _maxy = max(_maxy, y); - _changed = true; - } - } - - void finish () { - if (empty()) - _minx = _miny = 0; - } - - private: - bool _changed; - int _minx, _miny, _maxx, _maxy; -}; - - -/** Computes the bounding box that spans all set pixels. */ -bool Bitmap::getBBox (int &minx, int &miny, int &maxx, int &maxy) const { - BBoxCallback bboxCallback; - forAllPixels(bboxCallback); - minx = bboxCallback.minx(); - miny = bboxCallback.miny(); - maxx = bboxCallback.maxx(); - maxy = bboxCallback.maxy(); - return !bboxCallback.empty(); -} - - -/** Computes width and height of the bounding box that spans all set pixels. */ -void Bitmap::getExtent (int &w, int &h) const { - int minx, miny, maxx, maxy; - if (getBBox(minx, miny, maxx, maxy)) { - w = maxx-minx+1; - h = maxy-miny+1; - } - else - w = h = 0; -} - - -#if 0 -ostream& Bitmap::write (ostream &os) const { - for (int r=_rows-1; r >= 0 ; r--) { - for (int c=0; c < _bpr; c++) { - UInt8 byte = _bytes[r*_bpr+c]; - for (int b=128; b; b>>=1) - os << (byte & b ? '*' : '-'); - os << ' '; - } - os << endl; - } - return os; -} -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.h deleted file mode 100644 index 7a8210abeaa..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Bitmap.h +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* -** Bitmap.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_BITMAP_H -#define DVISVGM_BITMAP_H - -#include -#include -#include "types.h" - - -class Bitmap -{ - public: - struct Callback { - virtual ~Callback() {} - virtual void pixel (int x, int y, bool set, Bitmap &bm) {} - virtual void pixel (int x, int y, bool set, const Bitmap &bm) {} - virtual void finish () {} - }; - - public: - Bitmap (); - Bitmap (int minx, int maxx, int miny , int maxy); - void resize (int minx, int maxx, int miny , int maxy); - void setBits(int row, int col, int n); - const UInt8* rowPtr (int row) const {return &_bytes[row*_bpr];} - int height () const {return _rows;} - int width () const {return _cols;} - int xshift () const {return _xshift;} - int yshift () const {return _yshift;} - int bytesPerRow () const {return _bpr;} - bool empty () const {return (!_rows && !_cols) || _bytes.empty();} - bool getBBox (int &minx, int &miny, int &maxx, int &maxy) const; - void getExtent (int &w, int &h) const; - void forAllPixels (Callback &callback) const; - - template - int copy (std::vector &target, bool vflip=false) const; - -// template -// void write (std::ostream &os, const std::vector &v) const; - -// std::ostream& write (std::ostream &os) const; - - private: - int _rows, _cols; ///< number of rows, columns - int _xshift, _yshift; ///< horizontal/vertical shift - int _bpr; ///< number of bytes per row - std::vector _bytes; -}; - - -/** Copies the bitmap to a new target area and reorganizes the bits. - * @tparam T component type of target vector - * @param[out] target points to first T of new bitmap (must be deleted after usage) - * @param[in] vflip true if the new bitmap should be flipped vertically - * @return number of Ts per row */ -template -int Bitmap::copy (std::vector &target, bool vflip) const { - const int s = sizeof(T); - const int tpr = _bpr/s + (_bpr%s ? 1 : 0); // number of Ts per row - target.resize(_rows*tpr); - for (int r=0; r < _rows; r++) { - int targetrow = vflip ? _rows-r-1 : r; - for (int b=0; b < _bpr; b++) { - T &t = target[targetrow*tpr + b/s]; - T chunk = (T)_bytes[r*_bpr+b] << (8*(s-1-b%s)); - if (b % s == 0) - t = chunk; - else - t |= chunk; - } - } - return tpr; -} - - -/* -template -void Bitmap::write (std::ostream &os, const std::vector &v) const { - const int s = sizeof(T); - const int tpr = _bpr/s + (_bpr%s ? 1 : 0); // number of Ts per row - for (int r=_rows-1; r >= 0; r--) { - for (int t=0; t < tpr; t++) { - for (T b=(T)1<<(8*s-1); b; b>>=1) - os << ((v[r*tpr+t] & b) ? '*' : '-'); - os << ' '; - } - os << std::endl; - } -}*/ - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.cpp deleted file mode 100644 index 30d711f0eb2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/************************************************************************* -** BoundingBox.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "BoundingBox.h" -#include "Matrix.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -BoundingBox::BoundingBox () - : _ulx(0), _uly(0), _lrx(0), _lry(0), _valid(false), _locked(false) -{ -} - - -BoundingBox::BoundingBox (double ulxx, double ulyy, double lrxx, double lryy) - : _ulx(min(ulxx,lrxx)), _uly(min(ulyy,lryy)), - _lrx(max(ulxx,lrxx)), _lry(max(ulyy,lryy)), - _valid(true), _locked(false) -{ -} - - -BoundingBox::BoundingBox (const DPair &p1, const DPair &p2) - : _ulx(min(p1.x(), p2.x())), _uly(min(p1.y(), p2.y())), - _lrx(max(p1.x(), p2.x())), _lry(max(p1.y(), p2.y())), - _valid(true), _locked(false) -{ -} - - -BoundingBox::BoundingBox (const Length &ulxx, const Length &ulyy, const Length &lrxx, const Length &lryy) - : _ulx(min(ulxx.pt(),lrxx.pt())), _uly(min(ulyy.pt(),lryy.pt())), - _lrx(max(ulxx.pt(),lrxx.pt())), _lry(max(ulyy.pt(),lryy.pt())), - _valid(true), _locked(false) -{ -} - - -BoundingBox::BoundingBox (const string &boxstr) - : _ulx(0), _uly(0), _lrx(0), _lry(0), _valid(false), _locked(false) -{ - set(boxstr); -} - - -/** Removes leading and trailing whitespace from the given string. */ -static string& strip (string &str) { - size_t n=0; - while (n < str.length() && isspace(str[n])) - ++n; - str.erase(0, n); - n=str.length()-1; - while (n > 0 && isspace(str[n])) - --n; - str.erase(n+1); - return str; -} - - -/** Sets or modifies the bounding box. If 'boxstr' consists of 4 length values, - * they denote the absolute position of two diagonal corners of the box. In case - * of a single length value l the current box is enlarged by adding (-l,-l) the upper - * left and (l,l) to the lower right corner. - * @param[in] boxstr whitespace and/or comma separated string of lengths. */ -void BoundingBox::set (string boxstr) { - vector coord; - const size_t len = boxstr.length(); - size_t l=0; - strip(boxstr); - string lenstr; - do { - while (l < len && isspace(boxstr[l])) - l++; - size_t r=l; - while (r < len && !isspace(boxstr[r]) && boxstr[r] != ',') - r++; - lenstr = boxstr.substr(l, r-l); - if (!lenstr.empty()) { - coord.push_back(Length(lenstr)); - if (boxstr[r] == ',') - r++; - l = r; - } - } while (!lenstr.empty() && coord.size() < 4); - - switch (coord.size()) { - case 1: - _ulx -= coord[0].pt(); - _uly -= coord[0].pt(); - _lrx += coord[0].pt(); - _lry += coord[0].pt(); - break; - case 2: - _ulx -= coord[0].pt(); - _uly -= coord[1].pt(); - _lrx += coord[0].pt(); - _lry += coord[1].pt(); - break; - case 4: - _ulx = min(coord[0].pt(), coord[2].pt()); - _uly = min(coord[1].pt(), coord[3].pt()); - _lrx = max(coord[0].pt(), coord[2].pt()); - _lry = max(coord[1].pt(), coord[3].pt()); - break; - default: - throw BoundingBoxException("1, 2 or 4 length parameters expected"); - } - _valid = true; -} - - -/** Enlarges the box so that point (x,y) is enclosed. */ -void BoundingBox::embed (double x, double y) { - if (!_locked) { - if (_valid) { - if (x < _ulx) - _ulx = x; - else if (x > _lrx) - _lrx = x; - if (y < _uly) - _uly = y; - else if (y > _lry) - _lry = y; - } - else { - _ulx = _lrx = x; - _uly = _lry = y; - _valid = true; - } - } -} - - -/** Enlarges the box so that the given bounding box is enclosed. */ -void BoundingBox::embed (const BoundingBox &bbox) { - if (!_locked && bbox._valid) { - if (_valid) { - embed(bbox._ulx, bbox._uly); - embed(bbox._lrx, bbox._lry); - } - else { - _ulx = bbox._ulx; - _uly = bbox._uly; - _lrx = bbox._lrx; - _lry = bbox._lry; - _valid = true; - } - } -} - - -/** Embeds a virtual circle into the box and enlarges it accordingly. - * @param[in] c center of the circle - * @param[in] r radius of the circle */ -void BoundingBox::embed (const DPair &c, double r) { - embed(BoundingBox(c.x()-r, c.y()-r, c.x()+r, c.y()+r)); -} - - -/** Expands the box in all four directions by a given value. */ -void BoundingBox::expand (double m) { - if (!_locked) { - _ulx -= m; - _uly -= m; - _lrx += m; - _lry += m; - } -} - - -/** Intersects the current box with bbox and applies the result to *this. - * If both boxes are disjoint, *this is not altered. - * @param[in] bbox box to intersect with - * @return false if *this is locked or both boxes are disjoint */ -bool BoundingBox::intersect (const BoundingBox &bbox) { - // check if the two boxes are disjoint - if (_locked || _lrx < bbox._ulx || _lry < bbox._uly || _ulx > bbox._lrx || _uly > bbox._lry) - return false; - // not disjoint: compute the intersection - _ulx = max(_ulx, bbox._ulx); - _uly = max(_uly, bbox._uly); - _lrx = min(_lrx, bbox._lrx); - _lry = min(_lry, bbox._lry); - return true; -} - - -void BoundingBox::operator += (const BoundingBox &bbox) { - if (!_locked) { - _ulx += bbox._ulx; - _uly += bbox._uly; - _lrx += bbox._lrx; - _lry += bbox._lry; - } -} - - -bool BoundingBox::operator == (const BoundingBox &bbox) const { - return _valid && bbox._valid - && _ulx == bbox._ulx - && _uly == bbox._uly - && _lrx == bbox._lrx - && _lry == bbox._lry; -} - - -bool BoundingBox::operator != (const BoundingBox &bbox) const { - return !_valid || !bbox._valid - || _ulx != bbox._ulx - || _uly != bbox._uly - || _lrx != bbox._lrx - || _lry != bbox._lry; -} - - -void BoundingBox::scale (double sx, double sy) { - if (!_locked) { - _ulx *= sx; - _lrx *= sx; - if (sx < 0) swap(_ulx, _lrx); - _uly *= sy; - _lry *= sy; - if (sy < 0) swap(_uly, _lry); - } -} - - -void BoundingBox::transform (const Matrix &tm) { - if (!_locked) { - DPair ul = tm * DPair(_lrx, _lry); - DPair lr = tm * DPair(_ulx, _uly); - DPair ll = tm * DPair(_ulx, _lry); - DPair ur = tm * DPair(_lrx, _uly); - _ulx = min(min(ul.x(), lr.x()), min(ur.x(), ll.x())); - _uly = min(min(ul.y(), lr.y()), min(ur.y(), ll.y())); - _lrx = max(max(ul.x(), lr.x()), max(ur.x(), ll.x())); - _lry = max(max(ul.y(), lr.y()), max(ur.y(), ll.y())); - } -} - - -string BoundingBox::toSVGViewBox () const { - ostringstream oss; - oss << XMLString(_ulx) << ' ' << XMLString(_uly) << ' ' << XMLString(width()) << ' ' << XMLString(height()); - return oss.str(); -} - - -ostream& BoundingBox::write (ostream &os) const { - return os << '(' << _ulx << ", " << _uly - << ", " << _lrx << ", " << _lry << ')'; -} - - -XMLElementNode* BoundingBox::createSVGRect () const { - XMLElementNode *rect = new XMLElementNode("rect"); - rect->addAttribute("x", minX()); - rect->addAttribute("y", minY()); - rect->addAttribute("width", width()); - rect->addAttribute("height", height()); - rect->addAttribute("fill", "none"); - return rect; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.h deleted file mode 100644 index 223e0433748..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/BoundingBox.h +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* -** BoundingBox.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_BOUNDINGBOX_H -#define DVISVGM_BOUNDINGBOX_H - -#include -#include -#include "Length.h" -#include "MessageException.h" -#include "Pair.h" -#include "macros.h" -#include "types.h" - - -class Matrix; -class XMLElementNode; - - -struct BoundingBoxException : MessageException -{ - BoundingBoxException (const std::string &msg) : MessageException(msg) {} -}; - - -class BoundingBox -{ - public: - BoundingBox (); - BoundingBox (double ulxx, double ulyy, double lrxx, double lryy); - BoundingBox (const DPair &p1, const DPair &p2); - BoundingBox (const Length &ulxx, const Length &ulyy, const Length &lrxx, const Length &lryy); - BoundingBox (const std::string &boxstr); - void set (std::string boxstr); - void embed (double x, double y); - void embed (const BoundingBox &bb); - void embed (const DPair &p) {embed(p.x(), p.y());} - void embed (const DPair &c, double r); - - template - void embed (const Pair &p) {embed(p.x(), p.y());} - - void expand (double m); - bool intersect (const BoundingBox &bbox); - double minX () const {return _ulx;} - double minY () const {return _uly;} - double maxX () const {return _lrx;} - double maxY () const {return _lry;} - double width () const {return _lrx-_ulx;} - double height () const {return _lry-_uly;} - bool valid() const {return _valid;} - bool locked() const {return _locked;} - void lock () {_locked = true;} - void unlock () {_locked = false;} - void invalidate () {_valid = false;} - void operator += (const BoundingBox &bbox); - bool operator == (const BoundingBox &bbox) const; - bool operator != (const BoundingBox &bbox) const; - void scale (double sx, double sy); - void transform (const Matrix &tm); - std::string toSVGViewBox () const; - std::ostream& write (std::ostream &os) const; - XMLElementNode* createSVGRect () const; - - private: - double _ulx, _uly; ///< coordinates of upper left vertex (in PS point units) - double _lrx, _lry; ///< coordinates of lower right vertex (in PS point units) - bool _valid : 1; ///< true if the box coordinates are properly set - bool _locked : 1; ///< if true, the box data is read-only -}; - -IMPLEMENT_OUTPUT_OPERATOR(BoundingBox) - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.cpp deleted file mode 100644 index 2c9a22c8fbb..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* -** CMap.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "CMap.h" -#include "CMapManager.h" -#include "FileFinder.h" -#include "InputReader.h" - -using namespace std; - - -const char* CMap::path () const { - return FileFinder::lookup(name(), "cmap", false); -} - - -const FontEncoding* CMap::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { - return CMapManager::instance().findCompatibleBaseFontMap(font, this, charmapID); -} - -////////////////////////////////////////////////////////////////////// - -/** Returns the RO (Registry-Ordering) string of the CMap. */ -string SegmentedCMap::getROString() const { - if (_registry.empty() || _ordering.empty()) - return ""; - return _registry + "-" + _ordering; -} - - -/** Returns the CID for a given character code. */ -UInt32 SegmentedCMap::cid (UInt32 c) const { - if (_cidranges.valueExists(c)) - return _cidranges.valueAt(c); - if (_basemap) - return _basemap->cid(c); - return 0; -} - - -/** Returns the character code of a base font for a given CID. */ -UInt32 SegmentedCMap::bfcode (UInt32 cid) const { - if (_bfranges.valueExists(cid)) - return _bfranges.valueAt(cid); - if (_basemap) - return _basemap->bfcode(cid); - return 0; -} - - -void SegmentedCMap::write (ostream &os) const { - _cidranges.write(os); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.h deleted file mode 100644 index 5a58ced5f3a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMap.h +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* -** CMap.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CMAP_H -#define DVISVGM_CMAP_H - -#include -#include -#include -#include "FontEncoding.h" -#include "RangeMap.h" -#include "types.h" - - -struct CMap : public NamedFontEncoding -{ - virtual ~CMap () {} - virtual bool vertical () const =0; - virtual bool mapsToCID () const =0; - virtual const char* path () const; - virtual UInt32 cid (UInt32 c) const =0; - virtual UInt32 bfcode (UInt32 cid) const =0; - virtual std::string getROString () const =0; - virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; - virtual bool mapsToCharIndex () const {return mapsToCID();} - - Character decode (UInt32 c) const { - if (mapsToCID()) - return Character(Character::INDEX, cid(c)); - return Character(Character::CHRCODE, bfcode(c)); - } -}; - - -struct IdentityCMap : public CMap -{ - UInt32 cid (UInt32 c) const {return c;} - UInt32 bfcode (UInt32 cid) const {return 0;} - std::string getROString () const {return "Adobe-Identity";} - bool mapsToCID() const {return true;} -}; - - -struct IdentityHCMap : public IdentityCMap -{ - bool vertical () const {return false;} - const char* name () const {return "Identity-H";} -}; - - -struct IdentityVCMap : public IdentityCMap -{ - bool vertical () const {return true;} - const char* name () const {return "Identity-V";} -}; - - -struct UnicodeCMap : public CMap -{ - bool vertical () const {return false;} - const char* name () const {return "unicode";} - bool mapsToCID () const {return false;} - const char* path () const {return 0;} - UInt32 cid (UInt32 c) const {return c;} - UInt32 bfcode (UInt32 cid) const {return cid;} - std::string getROString () const {return "";} -}; - - -class SegmentedCMap : public CMap -{ - friend class CMapReader; - - public: - SegmentedCMap (const std::string &name) : _name(name), _basemap(0), _vertical(false), _mapsToCID(true) {} - const char* name () const {return _name.c_str();} - UInt32 cid (UInt32 c) const; - UInt32 bfcode (UInt32 cid) const; - void addCIDRange (UInt32 first, UInt32 last, UInt32 cid) {_cidranges.addRange(first, last, cid);} - void addBFRange (UInt32 first, UInt32 last, UInt32 chrcode) {_bfranges.addRange(first, last, chrcode);} - void write (std::ostream &os) const; - bool vertical () const {return _vertical;} - bool mapsToCID () const {return _mapsToCID;} - size_t numCIDRanges () const {return _cidranges.size();} - size_t numBFRanges () const {return _bfranges.size();} - std::string getROString () const; - - private: - std::string _name; - std::string _registry; - std::string _ordering; - CMap *_basemap; - bool _vertical; - bool _mapsToCID; // true: chrcode->CID, false: CID->charcode - RangeMap _cidranges; - RangeMap _bfranges; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.cpp deleted file mode 100644 index d3b3fd399d6..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************* -** CMapManager.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "CMap.h" -#include "CMapManager.h" -#include "CMapReader.h" -#include "Font.h" -#include "FileFinder.h" -#include "Message.h" - -using namespace std; - - -CMapManager::~CMapManager () { - for (CMaps::iterator it=_cmaps.begin(); it != _cmaps.end(); ++it) - delete it->second; -} - - -CMapManager& CMapManager::instance () { - static CMapManager cmm; - return cmm; -} - - -/** Loads a cmap and returns the corresponding object. */ -CMap* CMapManager::lookup (const string &name) { - CMaps::iterator it = _cmaps.find(name); - if (it != _cmaps.end()) - return it->second; - - if (_includedCMaps.find(name) != _includedCMaps.end()) { - _level = 0; - ostringstream oss; - oss << "circular reference of CMap " << name; - throw CMapReaderException(oss.str()); - } - - CMap *cmap=0; - if (name == "Identity-H") - cmap = new IdentityHCMap; - else if (name == "Identity-V") - cmap = new IdentityVCMap; - else if (name == "unicode") - cmap = new UnicodeCMap; - if (cmap) { - _cmaps[name] = cmap; - return cmap; - } - // Load cmap data of file and also process all cmaps referenced by operator "usecmap". - // This can lead to a sequence of further calls of lookup(). In order to prevent infinite loops - // due to (disallowed) circular cmap inclusions, we keep track of all cmaps processed during - // a sequence of inclusions. - _includedCMaps.insert(name); // save name of current cmap being processed - _level++; // increase nesting level - try { - CMapReader reader; - if (!(cmap = reader.read(name))) { - _level = 1; - Message::wstream(true) << "CMap file '" << name << "' not found\n"; - } - _cmaps[name] = cmap; - } - catch (const CMapReaderException &e) { - Message::estream(true) << "CMap file " << name << ": " << e.what() << "\n"; - } - if (--_level == 0) // back again at initial nesting level? - _includedCMaps.clear(); // => names of included cmaps are no longer needed - return cmap; -} - - -/** Looks for a base font CMap and a compatible encoding table in a given font. The CMap describe - * the mapping from CIDs to character codes where the latter are relative to the encoding table - * identified by charmapID. - * cmap:X->CID, bfmap:CID->Y, enctable:Y->CharCode - * @param[in] font look for available encoding tables in this font - * @param[in] cmap take the source registry-ordering pair from this CMap - * @param[out] charmapID ID of the compatible character map found in the given font - * @return base font CMap that maps from CIDs to character codes */ -const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID) { - if (!font || !cmap) - return 0; - - static const struct CharMapIDToEncName { - CharMapID id; - const char *encname; - } encodings[] = { - {CharMapID::WIN_UCS4, "UCS4"}, - {CharMapID::WIN_UCS2, "UCS2"}, - {CharMapID::WIN_SHIFTJIS, "90ms-RKSJ"}, - {CharMapID::WIN_PRC, "GBK-EUC"}, - {CharMapID::WIN_BIG5, "ETen-B5"}, - {CharMapID::WIN_WANSUNG, "KSCms-UHC"}, - {CharMapID::MAC_JAPANESE, "90pv-RKSJ"}, - {CharMapID::MAC_TRADCHINESE, "B5pc"}, - {CharMapID::MAC_SIMPLCHINESE, "GBpc-EUC"}, - {CharMapID::MAC_KOREAN, "KSCpc-EUC"} - }; - - // get IDs of all available charmaps in font - vector charmapIDs; - font->collectCharMapIDs(charmapIDs); - - const bool is_unicode_map = dynamic_cast(cmap); - const size_t num_encodings = is_unicode_map ? 2 : sizeof(encodings)/sizeof(CharMapIDToEncName); - - // try to find a compatible encoding CMap - const string ro = cmap->getROString(); - for (const CharMapIDToEncName *enc=encodings; enc < enc+num_encodings; enc++) { - for (size_t i=0; i < charmapIDs.size(); i++) { - if (enc->id == charmapIDs[i]) { - string cmapname = ro+"-"+enc->encname; - if (is_unicode_map || FileFinder::lookup(cmapname, "cmap", false)) { - charmapID = enc->id; - return is_unicode_map ? cmap : lookup(cmapname); - } - } - } - } - return 0; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.h deleted file mode 100644 index 5388cb90f94..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapManager.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* -** CMapManager.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CMAPMANAGER_H -#define DVISVGM_CMAPMANAGER_H - -#include -#include -#include -#include "CharMapID.h" -#include "Font.h" - -struct CMap; -struct FontEncoding; -class FontEncodingPair; - -class CMapManager -{ - typedef std::map CMaps; - public: - ~CMapManager (); - CMap* lookup (const std::string &name); - const CMap* findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID); - static CMapManager& instance (); - - protected: - CMapManager () : _level(0) {} - - private: - CMaps _cmaps; ///< loaded cmaps - int _level; ///< current inclusion depth; >0 if a cmap loaded by "usecmap" is being processed - std::set _includedCMaps; ///< names of cmaps loaded by "usecmap" -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.cpp deleted file mode 100644 index f655eca5139..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/************************************************************************* -** CMapReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "CMap.h" -#include "CMapManager.h" -#include "CMapReader.h" -#include "FileFinder.h" -#include "InputReader.h" - -using namespace std; - - -CMapReader::CMapReader () : _cmap(0), _inCMap(false) -{ -} - - -/** Reads a cmap file and returns the corresponding CMap object. - * @param fname[in] name/path of cmap file - * @return CMap object representing the read data, or 0 if file could not be read */ -CMap* CMapReader::read (const string &fname) { - if (const char *path = FileFinder::lookup(fname.c_str(), "cmap", false)) { - ifstream ifs(path); - if (ifs) - return read(ifs, fname); - } - _tokens.clear(); - return 0; -} - - -/** Reads cmap data from a given stream and returns the corresponding CMap object. - * @param is[in] cmap data input stream - * @param is[in] name name of CMap to be read - * @return CMap object representing the read data, or 0 if file could not be read */ -CMap* CMapReader::read (std::istream& is, const string &name) { - _tokens.clear(); - _cmap = new SegmentedCMap(name); - StreamInputReader ir(is); - try { - while (ir) { - Token token(ir); - if (token.type() == Token::TT_EOF) - break; - if (_inCMap) { - if (token.type() == Token::TT_OPERATOR) - executeOperator(token.strvalue(), ir); - else - _tokens.push_back(token); - } - else if (token.type() == Token::TT_OPERATOR && token.strvalue() == "begincmap") - _inCMap = true; - } - } - catch (CMapReaderException &e) { - delete _cmap; - _cmap = 0; - throw; - } - return _cmap; -} - - -void CMapReader::executeOperator (const string &op, InputReader &ir) { - const struct Operator { - const char *name; - void (CMapReader::*handler)(InputReader&); - } operators[] = { - {"beginbfchar", &CMapReader::op_beginbfchar}, - {"beginbfrange", &CMapReader::op_beginbfrange}, - {"begincidrange", &CMapReader::op_begincidrange}, - {"def", &CMapReader::op_def}, - {"endcmap", &CMapReader::op_endcmap}, - {"usecmap", &CMapReader::op_usecmap}, - }; - - for (size_t i=0; i < sizeof(operators)/sizeof(Operator); i++) { - if (operators[i].name == op) { - (this->*operators[i].handler)(ir); - break; - } - } - _tokens.clear(); -} - - -void CMapReader::op_def (InputReader&) { - size_t size = _tokens.size(); - if (size >= 2) { - const string val = popToken().strvalue(); - const string name = popToken().strvalue(); - if (name == "CMapName") { - if (val != _cmap->_name) - throw CMapReaderException("CMapName doesn't match filename"); - } - else if (name == "WMode") { - if (val == "0" || val == "1") - _cmap->_vertical = (val == "1"); - else - throw CMapReaderException("invalid WMode (0 or 1 expected)"); - } - else if (name == "Registry") - _cmap->_registry = val; - else if (name == "Ordering") - _cmap->_ordering = val; - } -} - - -void CMapReader::op_endcmap (InputReader &) { - _inCMap = false; -} - - -void CMapReader::op_usecmap (InputReader &) { - if (_tokens.empty()) - throw CMapReaderException("stack underflow while processing usecmap"); - else { - const string name = popToken().strvalue(); - if ((_cmap->_basemap = CMapManager::instance().lookup(name)) == 0) - throw CMapReaderException("CMap file '"+name+"' not found"); - } -} - - -static UInt32 parse_hexentry (InputReader &ir) { - ir.skipSpace(); - if (ir.get() != '<') - throw CMapReaderException("invalid range entry ('<' expected)"); - int val; - if (!ir.parseInt(16, val)) - throw CMapReaderException("invalid range entry (hexadecimal value expected)"); - if (ir.get() != '>') - throw CMapReaderException("invalid range entry ('>' expected)"); - return UInt32(val); -} - - -void CMapReader::op_begincidrange (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { - ir.skipSpace(); - int num_entries = static_cast(popToken().numvalue()); - while (num_entries > 0 && ir.peek() == '<') { - UInt32 first = parse_hexentry(ir); - UInt32 last = parse_hexentry(ir); - UInt32 cid; - ir.skipSpace(); - if (!ir.parseUInt(cid)) - throw CMapReaderException("invalid range entry (decimal value expected)"); - _cmap->addCIDRange(first, last, cid); - ir.skipSpace(); - } - } -} - - -void CMapReader::op_beginbfrange (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { - ir.skipSpace(); - int num_entries = static_cast(popToken().numvalue()); - while (num_entries > 0 && ir.peek() == '<') { - UInt32 first = parse_hexentry(ir); - UInt32 last = parse_hexentry(ir); - UInt32 chrcode = parse_hexentry(ir); - _cmap->addBFRange(first, last, chrcode); - ir.skipSpace(); - } - _cmap->_mapsToCID = false; - } -} - - -void CMapReader::op_beginbfchar (InputReader &ir) { - if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { - ir.skipSpace(); - int num_entries = static_cast(popToken().numvalue()); - while (num_entries > 0 && ir.peek() == '<') { - UInt32 cid = parse_hexentry(ir); - ir.skipSpace(); - if (ir.peek() == '/') - throw CMapReaderException("mapping of named characters is not supported"); - UInt32 chrcode = parse_hexentry(ir); - _cmap->addBFRange(cid, cid, chrcode); - ir.skipSpace(); - } - _cmap->_mapsToCID = false; - } -} - -//////////////////////////////////////////////////////////////////////////////////// - -CMapReader::Token::Token (InputReader &ir) { - scan(ir); -} - - -/** Reads the next characters from the input stream to create a token. */ -void CMapReader::Token::scan (InputReader &ir) { - ir.skipSpace(); - while (ir.peek() == '%') { // comment? - while (ir.peek() != '\n') // => skip until end of line - ir.get(); - ir.skipSpace(); - } - ir.skipSpace(); - if (ir.eof()) - _type = TT_EOF; - else if (ir.peek() == '/') { // PS name? - ir.get(); - while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) - _value += ir.get(); - _type = TT_NAME; - } - else if (ir.peek() == '(') { // string? - ir.get(); - int level=0; - while (ir.peek() != ')' || level > 0) { - if (ir.peek() == '(') - level++; - else if (ir.peek() == ')' && level > 0) - level--; - _value += ir.get(); - } - ir.get(); // skip ')' - _type = TT_STRING; - } - else if (strchr("[]{}<>", ir.peek())) { // PS delimiter - _value = ir.get(); - _type = TT_DELIM; - } - else if (isdigit(ir.peek())) { // number? - double val; - if (ir.parseDouble(val)) { - ostringstream oss; - oss << val; - _value = oss.str(); - _type = TT_NUMBER; - } - } - else { - while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) - _value += ir.get(); - _type = TT_OPERATOR; - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.h deleted file mode 100644 index a7a243999d7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CMapReader.h +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* -** CMapReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CMAPREADER_H -#define DVISVGM_CMAPREADER_H - -#include -#include -#include -#include -#include "MessageException.h" - - -struct CMap; -class InputReader; - -class CMapReader -{ - class Token - { - public: - enum Type {TT_UNKNOWN, TT_EOF, TT_DELIM, TT_NUMBER, TT_STRING, TT_NAME, TT_OPERATOR}; - - public: - Token (InputReader &ir); - void scan (InputReader &ir); - Type type () const {return _type;} - const std::string& strvalue () const {return _value;} - double numvalue () const {return std::atof(_value.c_str());} - - private: - Type _type; - std::string _value; - }; - - public: - CMapReader (); - CMap* read (const std::string &fname); - CMap* read (std::istream &is, const std::string &name); - - protected: - Token popToken () {Token t=_tokens.back(); _tokens.pop_back(); return t;} - void executeOperator (const std::string &op, InputReader &ir); - void op_beginbfchar (InputReader &ir); - void op_beginbfrange (InputReader &ir); - void op_begincidrange (InputReader &ir); - void op_def (InputReader &ir); - void op_endcmap (InputReader &ir); - void op_usecmap (InputReader &ir); - - private: - SegmentedCMap *_cmap; ///< CMap being read - std::vector _tokens; ///< stack of tokens to be processed - bool _inCMap; ///< operator begincmap has been executed -}; - - - -struct CMapReaderException : public MessageException -{ - CMapReaderException (const std::string &msg) : MessageException(msg) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.cpp deleted file mode 100644 index 09670551baf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* -** CRC32.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "CRC32.h" - -using namespace std; - - -CRC32::CRC32 () : _crc32(0xFFFFFFFF) -{ - const UInt32 poly = 0xEDB88320; - for (int i = 0; i < 256; i++) { - UInt32 crc=i; - for (int j=8; j > 0; j--) { - if (crc & 1) - crc = (crc >> 1) ^ poly; - else - crc >>= 1; - } - _tab[i] = crc; - } -} - - -/** Resets CRC32 sum to 0. */ -void CRC32::reset () { - _crc32 = 0xFFFFFFFF; -} - - -/** Appends string bytes to the previous data and computes the resulting checksum. - * @param[in] data string to update the checksum with */ -void CRC32::update (const char *data) { - update((const UInt8*)data, strlen(data)); -} - - -/** Appends a single value to the previous data and computes the resulting checksum. - * @param[in] n value to update the checksum with - * @param[in] bytes number of bytes to consider (0-4) */ -void CRC32::update (UInt32 n, int bytes) { - for (int i=bytes-1; i >= 0; --i) { - UInt8 byte = UInt8((n >> (8*i)) & 0xff); - update(&byte, 1); - } -} - - -/** Appends a sequence of bytes to the previous data and computes the resulting checksum. - * @param[in] bytes pointer to array of bytes - * @param[in] len number of bytes in array */ -void CRC32::update (const UInt8 *bytes, size_t len) { - for (size_t i=0; i < len; ++i) - _crc32 = ((_crc32 >> 8) & 0x00FFFFFF) ^ _tab[(_crc32 ^ *bytes++) & 0xFF]; -} - - -void CRC32::update (istream &is) { - char buf [4096]; - while (is) { - is.read(buf, 4096); - update((UInt8*)buf, is.gcount()); - } -} - - -/** Returns the checksum computed from values added with the update functions. */ -UInt32 CRC32::get () const { - return _crc32 ^ 0xFFFFFFFF; -} - - -/** Computes the CRC32 checksum of a sequence of bytes. - * @param[in] bytes pointer to array of bytes - * @param[in] len number of bytes in array - * @return CRC32 checksum */ -UInt32 CRC32::compute (const UInt8 *bytes, size_t len) { - CRC32 crc32; - crc32.update(bytes, len); - return crc32.get(); -} - - -/** Computes the CRC32 checksum of a string. */ -UInt32 CRC32::compute (const char *str) { - return compute((const UInt8*)str, strlen(str)); -} - - -UInt32 CRC32::compute (istream &is) { - CRC32 crc32; - crc32.update(is); - return crc32.get(); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.h deleted file mode 100644 index 3eacb17bf33..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CRC32.h +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* -** CRC32.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef CRC32_H -#define CRC32_H - -#include -#include -#include "types.h" - -class CRC32 -{ - public: - CRC32 (); - void update (const UInt8 *bytes, size_t len); - void update (UInt32 n, int bytes=4); - void update (const char *str); - void update (std::istream &is); - UInt32 get () const; - void reset (); - static UInt32 compute (const UInt8 *bytes, size_t len); - static UInt32 compute (const char *str); - static UInt32 compute (std::istream &is); - - protected: - CRC32 (const CRC32 &crc32) {} - - private: - UInt32 _crc32; - UInt32 _tab[256]; -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.cpp deleted file mode 100644 index d90405e8610..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* -** Calculator.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "Calculator.h" - -using namespace std; - -// token types -const char END = 0; -const char NUMBER = 1; -const char NAME = 2; - - -#include - - -/** 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 ret = expr(is, false); - if (lookAhead(is) > 0) - throw CalculatorException("expression syntax error"); - return ret; -} - - -/** Evaluates a given arithmetic expression and returns its value. - * @param[in] expr expression to evaluate - * @return expression value */ -double Calculator::eval (const string &expr) { - istringstream iss; - iss.str(expr); - return eval(iss); -} - - -/** Evaluates the root rule of the expression grammar. */ -double Calculator::expr (istream &is, bool skip) { // 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 - } - } -} - - -double Calculator::term (istream &is, bool skip) { // term: - double left = prim(is, skip); - for (;;) - switch (lookAhead(is)) { - case '*': left *= prim(is, true); 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: // prim => $1 - return left; - } -} - - -double Calculator::prim (istream &is, bool skip) { // 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); - } - 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"); - } -} - - -/** Determines type of next token without swallowing it. That means - * the same token will be read again next time. */ -char Calculator::lookAhead (istream &is) { - while (isspace(is.peek())) // skip whitespace - is.get(); - if (is.eof()) - return END; - int c = is.peek(); - if (isdigit(c) || c == '.') - return NUMBER; - if (isalpha(c)) - return NAME; - 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. - * @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: - is >> _numValue; - break; - case NAME: { - _strValue.clear(); - while (isalpha(is.peek())) - _strValue += char(is.get()); - break; - } - 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 { - map::const_iterator it = _variables.find(name); - if (it == _variables.end()) - throw CalculatorException("undefined variable '" + name + "'"); - return it->second; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.h deleted file mode 100644 index 76b07e40a60..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Calculator.h +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* -** Calculator.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CALCULATOR_H -#define DVISVGM_CALCULATOR_H - -#include -#include -#include -#include "MessageException.h" - - -struct CalculatorException : public MessageException -{ - CalculatorException (const std::string &msg) : MessageException(msg) {} -}; - -class Calculator -{ - public: - Calculator () : _numValue(0) {} - double eval (std::istream &is); - double eval (const std::string &expr); - 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); - - private: - std::map _variables; - double _numValue; - std::string _strValue; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.cpp deleted file mode 100644 index 0bcd054104f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* -** CharMapID.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include "CharMapID.h" - -const CharMapID CharMapID::NONE(0, 0); -const CharMapID CharMapID::WIN_SYMBOL(3, 0); -const CharMapID CharMapID::WIN_UCS2(3, 1); -const CharMapID CharMapID::WIN_SHIFTJIS(3, 2); -const CharMapID CharMapID::WIN_PRC(3, 3); -const CharMapID CharMapID::WIN_BIG5(3, 4); -const CharMapID CharMapID::WIN_WANSUNG(3, 5); -const CharMapID CharMapID::WIN_JOHAB(3, 6); -const CharMapID CharMapID::WIN_UCS4(3, 10); - -const CharMapID CharMapID::MAC_JAPANESE(1, 1); -const CharMapID CharMapID::MAC_TRADCHINESE(1, 2); -const CharMapID CharMapID::MAC_KOREAN(1, 3); -const CharMapID CharMapID::MAC_SIMPLCHINESE(1, 25); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.h deleted file mode 100644 index 0b4e6bf7e17..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CharMapID.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* -** CharMapID.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CHARMAPID_H -#define DVISVGM_CHARMAPID_H - -#include "types.h" - -/** Represents a character map of a font. */ -struct CharMapID { - CharMapID () : platform_id(0), encoding_id(0) {} - CharMapID (UInt8 plf_id, UInt8 enc_id) : platform_id(plf_id), encoding_id(enc_id) {} - - bool operator == (const CharMapID &ids) const { - return platform_id == ids.platform_id && encoding_id == ids.encoding_id; - } - - bool operator != (const CharMapID &ids) const { - return platform_id != ids.platform_id || encoding_id != ids.encoding_id; - } - - bool valid () const {return platform_id != 0 && encoding_id != 0;} - - static const CharMapID NONE; - static const CharMapID WIN_SYMBOL; - static const CharMapID WIN_UCS2; - static const CharMapID WIN_SHIFTJIS; - static const CharMapID WIN_PRC; - static const CharMapID WIN_BIG5; - static const CharMapID WIN_WANSUNG; - static const CharMapID WIN_JOHAB; - static const CharMapID WIN_UCS4; - static const CharMapID MAC_JAPANESE; - static const CharMapID MAC_TRADCHINESE; - static const CharMapID MAC_SIMPLCHINESE; - static const CharMapID MAC_KOREAN; - - UInt8 platform_id; - UInt8 encoding_id; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Character.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Character.h deleted file mode 100644 index 7ad3a7e36ff..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Character.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* -** Character.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CHARACTER_H -#define DVISVGM_CHARACTER_H - -#include "types.h" - -class Character -{ - public: - enum Type {CHRCODE, INDEX, NAME}; - Character (const char *name) : _type(NAME), _name(name) {} - Character (Type type, UInt32 val) : _type(type), _number(val) {} - Character (Type type, const Character &c) : _type(type), _number(c.type() != NAME ? c._number : 0) {} - Type type () const {return _type;} - const char* name () const {return _name;} - UInt32 number () const {return _number;} - - private: - Type _type; - union { - UInt32 _number; - const char *_name; - }; -}; - -#endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.cpp deleted file mode 100644 index da935b4b0dc..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/************************************************************************* -** CmdLineParserBase.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "CmdLineParserBase.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "Message.h" - -using namespace std; - -void CmdLineParserBase::init () { - _error = false; - _files.clear(); -} - - -/** Parses all options given on the command line. - * @param[in] argc number of command-line arguments - * @param[in] argv array providing the command-line arguments - * @param[in] printErrors enable/disable printing of error messages */ -void CmdLineParserBase::parse (int argc, char **argv, bool printErrors) { - init(); - _printErrors = printErrors; - bool filesOnly = false; // - for (int i=1; i < argc; i++) { - CharInputBuffer ib(argv[i], strlen(argv[i])); - BufferInputReader ir(ib); - if (filesOnly || ir.peek() != '-') - _files.push_back(argv[i]); - else { - ir.get(); - if (ir.peek() == '-') { - // scan long option - ir.get(); - if (ir.eof()) // "--" only - filesOnly = true; // treat all following options as filenames - else { - string longname; - while (isalnum(ir.peek()) || ir.peek() == '-') - longname += char(ir.get()); - if (const Option *opt = option(longname)) - (*opt->handler)(this, ir, *opt, true); - else if (!_error) { - if (printErrors) - Message::estream(false) << "unknown option --" << longname << '\n'; - _error = true; - } - } - } - else { - // scan short option(s) - bool combined = false; // multiple short options combined, e.g -abc - do { - int shortname = ir.get(); - if (const Option *opt = option(shortname)) { - if (!combined || opt->argmode == ARG_NONE) { - if (opt->argmode == ARG_REQUIRED && strlen(argv[i]) == 2) { // required argument separated by whitespace? - if (i+1 < argc && argv[i+1][0] != '-') - ib.assign(argv[++i]); - } - (*opt->handler)(this, ir, *opt, false); - if (opt->argmode == ARG_NONE) - combined = true; - } - else { - if (printErrors) - Message::estream(false) << "option -" << char(shortname) << " must be given separately\n"; - _error = true; - } - } - else if (shortname > 0) { - if (printErrors) - Message::estream(false) << "unknown option -" << char(shortname) << '\n'; - _error = true; - } - } - while (!_error && combined && !ir.eof()); - } - } - } -} - - -/** Prints an error message to stdout. - * @param[in] opt error occurred in this option - * @param[in] longopt the long option name was scanned - * @param[in] msg message to be printed */ -void CmdLineParserBase::error (const Option &opt, bool longopt, const char *msg) const { - if (_printErrors) { - Message::estream(false) << "option "; - if (longopt) - Message::estream(false) << "--" << opt.longname; - else - Message::estream(false) << '-' << opt.shortname; - Message::estream(false) << ": " << msg << '\n'; - } - _error = true; -} - - -#if 0 -#include - -/** Lists the scanned filenames. Just for debugging purposes. */ -void CmdLineParserBase::status () const { - cout << "file names:\n"; - for (size_t i=0; i < _files.size(); i++) - cout << " " << _files[i] << endl; - cout << endl; -} -#endif - - -/** Returns the option information of a given short option name. - * If the option name can't be found 0 is returned. - * @param[in] shortname short version of the option without leading hyphen (e.g. p, not -p) */ -const CmdLineParserBase::Option* CmdLineParserBase::option (char shortname) const { - size_t numopts; // number of available options - for (const Option *opts = options(&numopts); numopts > 0; ++opts) { - if (opts->shortname == shortname) - return opts; - numopts--; - } - return 0; -} - - -/** Returns the option information of a given long option name. - * Parameter 'longname' hasn't to be the complete long option name. The function looks up - * all options that start with 'longname'. If a unique or an exact match was found, it's returned. - * Otherwise, the return value is 0. - * @param[in] longname long version of the option without leading hyphens (e.g. param, not --param) */ -const CmdLineParserBase::Option* CmdLineParserBase::option (const string &longname) const { - vector matches; // all matching options - size_t len = longname.length(); - size_t numopts; // number of available options - for (const Option *opts = options(&numopts); numopts > 0; ++opts) { - if (string(opts->longname, len) == longname) { - if (len == strlen(opts->longname)) // exact match? - return opts; - matches.push_back(opts); - } - numopts--; - } - switch (matches.size()) { - default: - if (_printErrors) { - Message::estream(false) << "option --" << longname << " is ambiguous ("; - for (size_t i=0; i < matches.size(); i++) { - if (i > 0) - Message::estream(false) << ", "; - Message::estream(false) << matches[i]->longname; - } - Message::estream(false) << ")\n"; - } - _error = true; - - case 0 : return 0; - case 1 : return matches[0]; - } -} - - -/** Returns true if a valid separator between option and argument was found. - * Arguments of long options are preceded by a '='. The argument of a short option - * directly follows the option without a separation character. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given */ -bool CmdLineParserBase::checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const { - if (longopt) { - if (ir.peek() == '=') - ir.get(); - else { - error(opt, longopt, "'=' expected"); - return false; - } - } - return true; -} - - -/** Returns true if a given option has no argument, .e.g. -p or --param. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given */ -bool CmdLineParserBase::checkNoArg (InputReader &ir, const Option &opt, bool longopt) const { - if (ir.eof()) - return true; - error(opt, longopt, "no argument expected"); - return false; -} - - -/** Gets an integer argument of a given option, e.g. -p5 or --param=5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseInt(arg) && ir.eof()) - return true; - error(opt, longopt, "integer value expected"); - } - return false; -} - - -/** Gets an unsigned integer argument of a given option, e.g. -p5 or --param=5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseUInt(arg) && ir.eof()) - return true; - error(opt, longopt, "unsigned integer value expected"); - } - return false; -} - - -/** Gets a double (floating point) argument of a given option, e.g. -p2.5 or --param=2.5. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - if (ir.parseDouble(arg) != 0 && ir.eof()) - return true; - error(opt, longopt, "floating point value expected"); - } - return false; -} - - -/** Gets a string argument of a given option, e.g. -pstr or --param=str. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getStringArg (InputReader &ir, const Option &opt, bool longopt, string &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - arg.clear(); - while (!ir.eof()) - arg += char(ir.get()); - if (!arg.empty()) - return true; - error(opt, longopt, "string argument expected"); - } - return false; -} - - -/** Gets a boolean argument of a given option, e.g. -pyes or --param=yes. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - string str; - while (!ir.eof()) - str += char(ir.get()); - if (str == "yes" || str == "y" || str == "true" || str == "1") { - arg = true; - return true; - } - else if (str == "no" || str == "n" || str == "false" || str == "0") { - arg = false; - return true; - } - error(opt, longopt, "boolean argument expected (yes, no, true, false, 0, 1)"); - } - return false; -} - - -/** Gets a (single) character argument of a given option, e.g. -pc or --param=c. - * @param[in] ir argument is read from this InputReader - * @param[in] opt scans argument of this option - * @param[in] longopt true if the long option name was given - * @param[out] arg the scanned option argument - * @return true if argument could be scanned without errors */ -bool CmdLineParserBase::getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const { - if (checkArgPrefix(ir, opt, longopt)) { - arg = char(ir.get()); - if (arg >= 0 && ir.eof()) - return true; - error(opt, longopt, "character argument expected"); - } - return false; -} - - -/** Compares the short option characters of two help lines. - * @return true if line1 should appear before line2 */ -static bool cmp_short (const char *line1, const char *line2) { - if (*line1 != 'o' || *line2 != 'o' || (line1[1] == ' ' && line2[1] == ' ')) - return strcmp(line1, line2) < 0; - char lopt1 = tolower(line1[2]); - char lopt2 = tolower(line2[2]); - if (lopt1 == lopt2) // same character but different case? - return line1[2] > line2[2]; // line with lower-case letter first - return lopt1 < lopt2; -} - - -/** Compares the long option names of two help lines. - * @return true if line1 should appear before line2 */ -static bool cmp_long (const char *line1, const char *line2) { - if (*line1 != 'o' || *line2 != 'o') - return strcmp(line1, line2) < 0; - return strcmp(line1+6, line2+6) < 0; -} - - -/** Prints the help text to stdout. - * @param[in] mode format of help text */ -void CmdLineParserBase::help (int mode) const { - size_t numlines; - const char **lines = helplines(&numlines); - if (mode == 0) { // list options with section headers - for (size_t i=0; i < numlines; i++) { - switch (*lines[i]) { - case 's': fputc('\n', stdout); break; // section header - case 'o': fputs(" ", stdout); break; // option info - } - puts(lines[i]+1); - } - } - else { - vector linevec(lines, lines+numlines); - sort(linevec.begin(), linevec.end(), mode == 1 ? cmp_short : cmp_long); - for (vector::iterator it=linevec.begin(); it != linevec.end(); ++it) { - if (**it != 's') { // skip section headers - puts(*it+1); - if (**it == 'd') - puts("\nOptions:"); - } - } - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.h deleted file mode 100644 index 8096fa6500f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CmdLineParserBase.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* -** CmdLineParserBase.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_CMDLINEPARSERBASE_H -#define DVISVGM_CMDLINEPARSERBASE_H - -#include -#include - -class InputReader; - -class CmdLineParserBase -{ - protected: - struct Option; - - struct OptionHandler { - virtual ~OptionHandler () {} - virtual void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const=0; - }; - - template - class OptionHandlerImpl : public OptionHandler { - protected: - typedef void (T::*LocalHandler)(InputReader &ir, const Option &opt, bool longopt); - - public: - OptionHandlerImpl (LocalHandler handler) : _handler(handler) {} - - void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const { - if (T *tobj = dynamic_cast(obj)) - (tobj->*_handler)(ir, opt, longopt); - } - - private: - LocalHandler _handler; - }; - - enum ArgMode {ARG_NONE, ARG_OPTIONAL, ARG_REQUIRED}; - - struct Option { - ~Option () {delete handler;} - char shortname; - const char *longname; - ArgMode argmode; // mode of option argument - const OptionHandler *handler; - }; - - public: - virtual void parse (int argc, char **argv, bool printErrors=true); - virtual void help (int mode=0) const; - virtual int numFiles () const {return _files.size();} - virtual const char* file (size_t n) {return n < _files.size() ? _files[n].c_str() : 0;} -// virtual void status () const; - virtual bool error () const {return _error;} - - protected: - CmdLineParserBase () : _printErrors(true), _error(false) {} - CmdLineParserBase (const CmdLineParserBase &cmd) : _printErrors(true), _error(false) {} - virtual ~CmdLineParserBase () {} - virtual void init (); - virtual void error (const Option &opt, bool longopt, const char *msg) const; - virtual const Option* options (size_t *numopts) const =0; - virtual const char** helplines (size_t *numlines) const =0; - bool checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const; - bool checkNoArg (InputReader &ir, const Option &opt, bool longopt) const; - bool getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const; - bool getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const; - bool getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const; - bool getStringArg (InputReader &ir, const Option &opt, bool longopt, std::string &arg) const; - bool getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const; - bool getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const; - const Option* option (char shortname) const; - const Option* option (const std::string &longname) const; - - private: - bool _printErrors; ///< if true, print error messages - mutable bool _error; ///< error occured while parsing options - std::vector _files; ///< filename parameters -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.cpp deleted file mode 100644 index 2173cba9594..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/************************************************************************* -** Color.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#define _USE_MATH_DEFINES -#include -#include -#include -#include -#include -#include -#include -#include -#include "Color.h" - -using namespace std; - - -const Color Color::BLACK(UInt32(0)); -const Color Color::WHITE(UInt8(255), UInt8(255), UInt8(255)); -const Color Color::TRANSPARENT(UInt32(0xff000000)); - - -static inline UInt8 double_to_byte (double v) { - v = max(0.0, min(1.0, v)); - return UInt8(floor(255*v+0.5)); -} - - -static void tolower (string &str) { - for (size_t i=0; i < str.length(); i++) - str[i] = tolower(str[i]); -} - - -Color::Color (const char *name) { - if (!setName(name, false)) - setGray(UInt8(0)); -} - - -Color::Color (const string &name) { - if (!setName(name, false)) - setGray(UInt8(0)); -} - - -void Color::setRGB (double r, double g, double b) { - setRGB(double_to_byte(r), double_to_byte(g), double_to_byte(b)); -} - - -bool Color::setName (string name, bool case_sensitive) { - if (name[0] == '#') { - char *p=0; - _rgb = UInt32(strtol(name.c_str()+1, &p, 16)); - while (isspace(*p)) - p++; - return (*p == 0 && _rgb <= 0xFFFFFF); - } - // converted color constants from color.pro - static const struct ColorConstant { - const char *name; - const UInt32 rgb; - } - constants[] = { - {"Apricot", 0xFFAD7A}, - {"Aquamarine", 0x2DFFB2}, - {"Bittersweet", 0xC10200}, - {"Black", 0x000000}, - {"Blue", 0x0000FF}, - {"BlueGreen", 0x26FFAA}, - {"BlueViolet", 0x190CF4}, - {"BrickRed", 0xB70000}, - {"Brown", 0x660000}, - {"BurntOrange", 0xFF7C00}, - {"CadetBlue", 0x606DC4}, - {"CarnationPink", 0xFF5EFF}, - {"Cerulean", 0x0FE2FF}, - {"CornflowerBlue", 0x59DDFF}, - {"Cyan", 0x00FFFF}, - {"Dandelion", 0xFFB528}, - {"DarkOrchid", 0x9932CC}, - {"Emerald", 0x00FF7F}, - {"ForestGreen", 0x00E000}, - {"Fuchsia", 0x7202EA}, - {"Goldenrod", 0xFFE528}, - {"Gray", 0x7F7F7F}, - {"Green", 0x00FF00}, - {"GreenYellow", 0xD8FF4F}, - {"JungleGreen", 0x02FF7A}, - {"Lavender", 0xFF84FF}, - {"LimeGreen", 0x7FFF00}, - {"Magenta", 0xFF00FF}, - {"Mahogany", 0xA50000}, - {"Maroon", 0xAD0000}, - {"Melon", 0xFF897F}, - {"MidnightBlue", 0x007091}, - {"Mulberry", 0xA314F9}, - {"NavyBlue", 0x0F75FF}, - {"OliveGreen", 0x009900}, - {"Orange", 0xFF6321}, - {"OrangeRed", 0xFF007F}, - {"Orchid", 0xAD5BFF}, - {"Peach", 0xFF7F4C}, - {"Periwinkle", 0x6D72FF}, - {"PineGreen", 0x00BF28}, - {"Plum", 0x7F00FF}, - {"ProcessBlue", 0x0AFFFF}, - {"Purple", 0x8C23FF}, - {"RawSienna", 0x8C0000}, - {"Red", 0xFF0000}, - {"RedOrange", 0xFF3A21}, - {"RedViolet", 0x9600A8}, - {"Rhodamine", 0xFF2DFF}, - {"RoyalBlue", 0x007FFF}, - {"RoyalPurple", 0x3F19FF}, - {"RubineRed", 0xFF00DD}, - {"Salmon", 0xFF779E}, - {"SeaGreen", 0x4FFF7F}, - {"Sepia", 0x4C0000}, - {"SkyBlue", 0x60FFE0}, - {"SpringGreen", 0xBCFF3D}, - {"Tan", 0xDB9370}, - {"TealBlue", 0x1EF9A3}, - {"Thistle", 0xE068FF}, - {"Turquoise", 0x26FFCC}, - {"Violet", 0x351EFF}, - {"VioletRed", 0xFF30FF}, - {"White", 0xFFFFFF}, - {"WildStrawberry", 0xFF0A9B}, - {"Yellow", 0xFFFF00}, - {"YellowGreen", 0x8EFF42}, - {"YellowOrange", 0xFF9300}, - }; - if (!case_sensitive) { - tolower(name); - for (size_t i=0; i < sizeof(constants)/sizeof(ColorConstant); i++) { - string cmpname = constants[i].name; - tolower(cmpname); - if (name == cmpname) { - _rgb = constants[i].rgb; - return true; - } - } - return false; - } - - // binary search - int first=0, last=sizeof(constants)/sizeof(ColorConstant)-1; - while (first <= last) { - int mid = first+(last-first)/2; - int cmp = strcmp(constants[mid].name, name.c_str()); - if (cmp > 0) - last = mid-1; - else if (cmp < 0) - first = mid+1; - else { - _rgb = constants[mid].rgb; - return true; - } - } - return false; -} - - -void Color::setHSB (double h, double s, double b) { - valarray hsb(3), rgb(3); - hsb[0] = h; - hsb[1] = s; - hsb[2] = b; - HSB2RGB(hsb, rgb); - setRGB(rgb); -} - - -void Color::setCMYK (double c, double m, double y, double k) { - valarray cmyk(4), rgb(3); - cmyk[0] = c; - cmyk[1] = m; - cmyk[2] = y; - cmyk[3] = k; - CMYK2RGB(cmyk, rgb); - setRGB(rgb); -} - - -void Color::setCMYK (const std::valarray &cmyk) { - valarray rgb(3); - CMYK2RGB(cmyk, rgb); - setRGB(rgb); -} - - -void Color::set (ColorSpace colorSpace, VectorIterator &it) { - switch (colorSpace) { - case GRAY_SPACE: setGray(*it++); break; - case RGB_SPACE : setRGB(*it, *(it+1), *(it+2)); it+=3; break; - case LAB_SPACE : setLab(*it, *(it+1), *(it+2)); it+=3; break; - case CMYK_SPACE: setCMYK(*it, *(it+1), *(it+2), *(it+3)); it+=4; break; - } -} - - -void Color::operator *= (double c) { - UInt32 rgb=0; - for (int i=0; i < 3; i++) { - rgb |= UInt32(floor((_rgb & 0xff)*c+0.5)) << (8*i); - _rgb >>= 8; - } - _rgb = rgb; -} - - -string Color::rgbString () const { - ostringstream oss; - oss << '#'; - for (int i=2; i >= 0; i--) { - oss << setbase(16) << setfill('0') << setw(2) - << (((_rgb >> (8*i)) & 0xff)); - } - return oss.str(); -} - - -/** Approximates a CMYK color by an RGB triple. The component values - * are expected to be normalized, i.e. 0 <= cmyk[i],rgb[j] <= 1. - * @param[in] cmyk color in CMYK space - * @param[out] rgb RGB approximation */ -void Color::CMYK2RGB (const valarray &cmyk, valarray &rgb) { - double kc = 1.0-cmyk[3]; - for (int i=0; i < 3; i++) - rgb[i] = min(1.0, max(0.0, (1.0-cmyk[i])*kc)); -} - - -void Color::RGB2CMYK (const valarray &rgb, valarray &cmyk) { - double c = 1-rgb[0]; - double m = 1-rgb[1]; - double y = 1-rgb[2]; - cmyk[3] = min(min(c, m), y); - cmyk[0] = c-cmyk[3]; - cmyk[1] = m-cmyk[3]; - cmyk[2] = y-cmyk[3]; -} - - -/** Converts a color given in HSB coordinates to RGB. - * @param[in] hsb color in HSB space - * @param[out] rgb color in RGB space */ -void Color::HSB2RGB (const valarray &hsb, valarray &rgb) { - if (hsb[1] == 0) - rgb[0] = rgb[1] = rgb[2] = hsb[2]; - else { - double h = hsb[0]-floor(hsb[0]); - int i = int(6*h); - double f = 6*h-i; - double p = hsb[2]*(1-hsb[1]); - double q = hsb[2]*(1-hsb[1]*f); - double t = hsb[2]*(1-hsb[1]*(1-f)); - switch (i) { - case 0 : rgb[0]=hsb[2]; rgb[1]=t; rgb[2]=p; break; - case 1 : rgb[0]=q; rgb[1]=hsb[2]; rgb[2]=p; break; - case 2 : rgb[0]=p; rgb[1]=hsb[2]; rgb[2]=t; break; - case 3 : rgb[0]=p; rgb[1]=q; rgb[2]=hsb[2]; break; - case 4 : rgb[0]=t; rgb[1]=p; rgb[2]=hsb[2]; break; - case 5 : rgb[0]=hsb[2]; rgb[1]=p; rgb[2]=q; break; - default: ; // prevent compiler warning - } - } -} - - -double Color::getGray () const { - double r, g, b; - getRGB(r, g, b); - return r*0.3 + g*0.59 + b*0.11; // gray value according to NTSC video standard -} - - -void Color::getGray (valarray &gray) const { - gray.resize(1); - gray[0] = getGray(); -} - - -void Color::getRGB (double &r, double &g, double &b) const { - r = ((_rgb >> 16) & 255) / 255.0; - g = ((_rgb >> 8) & 255) / 255.0; - b = (_rgb & 255) / 255.0; -} - - -void Color::getRGB (valarray &rgb) const { - rgb.resize(3); - double r, g, b; - getRGB(r, g, b); - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; -} - - -void Color::getCMYK (double &c, double &m, double &y, double &k) const { - valarray rgb(3), cmyk(4); - getRGB(rgb); - RGB2CMYK(rgb, cmyk); - c = cmyk[0]; - m = cmyk[1]; - y = cmyk[2]; - k = cmyk[3]; -} - - -void Color::getCMYK (std::valarray &cmyk) const { - cmyk.resize(4); - valarray rgb(3); - getRGB(rgb); - RGB2CMYK(rgb, cmyk); -} - - -void Color::getXYZ (double &x, double &y, double &z) const { - valarray rgb(3), xyz(3); - getRGB(rgb); - RGB2XYZ(rgb, xyz); - x = xyz[0]; - y = xyz[1]; - z = xyz[2]; -} - - -void Color::setXYZ (double x, double y, double z) { - valarray xyz(3), rgb(3); - xyz[0] = x; - xyz[1] = y; - xyz[2] = z; - XYZ2RGB(xyz, rgb); - setRGB(rgb); -} - - -void Color::setXYZ (const valarray &xyz) { - valarray rgb(3); - XYZ2RGB(xyz, rgb); - setRGB(rgb); -} - - -void Color::setLab (double l, double a, double b) { - valarray lab(3), xyz(3); - lab[0] = l; - lab[1] = a; - lab[2] = b; - Lab2XYZ(lab, xyz); - setXYZ(xyz); -} - - -void Color::setLab (const valarray &lab) { - valarray xyz(3); - Lab2XYZ(lab, xyz); - setXYZ(xyz); -} - - -/** Get the color in CIELAB color space using the sRGB working space and reference white D65. */ -void Color::getLab (double &l, double &a, double &b) const { - valarray rgb(3), lab(3); - getRGB(rgb); - RGB2Lab(rgb, lab); - l = lab[0]; - a = lab[1]; - b = lab[2]; -} - - -void Color::getLab (std::valarray &lab) const { - lab.resize(3); - valarray rgb(3); - getRGB(rgb); - RGB2Lab(rgb, lab); -} - - -static inline double sqr (double x) {return x*x;} -static inline double cube (double x) {return x*x*x;} - - -void Color::Lab2XYZ (const valarray &lab, valarray &xyz) { - xyz.resize(3); - double wx=0.95047, wy=1.00, wz=1.08883; // reference white D65 - double eps = 0.008856; - double kappa = 903.3; - double fy = (lab[0]+16)/116; - double fx = lab[1]/500 + fy; - double fz = fy - lab[2]/200; - double xr = (cube(fx) > eps ? cube(fx) : (116*fx-16)/kappa); - double yr = (lab[0] > kappa*eps ? cube((lab[0]+16)/116) : lab[0]/kappa); - double zr = (cube(fz) > eps ? cube(fz) : (116*fz-16)/kappa); - xyz[0] = xr*wx; - xyz[1] = yr*wy; - xyz[2] = zr*wz; -} - - -void Color::XYZ2RGB (const valarray &xyz, valarray &rgb) { - rgb.resize(3); - rgb[0] = 3.2404542*xyz[0] - 1.5371385*xyz[1] - 0.4985314*xyz[2]; - rgb[1] = -0.9692660*xyz[0] + 1.8760108*xyz[1] + 0.0415560*xyz[2]; - rgb[2] = 0.0556434*xyz[0] - 0.2040259*xyz[1] + 1.0572252*xyz[2]; - for (int i=0; i < 3; i++) - rgb[i] = (rgb[i] <= 0.0031308 ? 12.92*rgb[i] : 1.055*pow(rgb[i], 1/2.4)-0.055); -} - - -void Color::RGB2XYZ (valarray rgb, valarray &xyz) { - xyz.resize(3); - for (int i=0; i < 3; i++) - rgb[i] = (rgb[i] <= 0.04045 ? rgb[i]/12.92 : pow((rgb[i]+0.055)/1.055, 2.4)); - xyz[0] = 0.4124564*rgb[0] + 0.3575761*rgb[1] + 0.1804375*rgb[2]; - xyz[1] = 0.2126729*rgb[0] + 0.7151522*rgb[1] + 0.0721750*rgb[2]; - xyz[2] = 0.0193339*rgb[0] + 0.1191920*rgb[1] + 0.9503041*rgb[2]; -} - - -void Color::RGB2Lab (const valarray &rgb, valarray &lab) { - double wx=0.95047, wy=1.00, wz=1.08883; // reference white D65 - double eps = 0.008856; - double kappa = 903.3; - valarray xyz(3); - RGB2XYZ(rgb, xyz); - xyz[0] /= wx; - xyz[1] /= wy; - xyz[2] /= wz; - double fx = (xyz[0] > eps ? pow(xyz[0], 1.0/3) : (kappa*xyz[0]+16)/116); - double fy = (xyz[1] > eps ? pow(xyz[1], 1.0/3) : (kappa*xyz[1]+16)/116); - double fz = (xyz[2] > eps ? pow(xyz[2], 1.0/3) : (kappa*xyz[2]+16)/116); - lab[0] = 116*fy-16; - lab[1] = 500*(fx-fy); - lab[2] = 200*(fy-fz); -} - - -/** Returns the Delta E difference (CIE 2000) between this and another color. */ -double Color::deltaE (const Color &c) const { - double l1, a1, b1; - double l2, a2, b2; - getLab(l1, a1, b1); - c.getLab(l2, a2, b2); - double dl = l2-l1; - double lm = (l1+l2)/2; - double c1 = sqrt(a1*a1 + b1*b1); - double c2 = sqrt(a2*a2 + b2*b2); - double cm = (c1+c2)/2; - double g = (1-sqrt(pow(cm, 7)/(pow(cm, 7)+pow(25.0, 7))))/2; - double aa1 = a1*(1+g); - double aa2 = a2*(1+g); - double cc1 = sqrt(aa1*aa1 + b1*b1); - double cc2 = sqrt(aa2*aa2 + b2*b2); - double ccm = (cc1+cc2)/2; - double dcc = cc2-cc1; - double h1 = atan2(b1, aa1)*180/M_PI; - if (h1 < 0) h1 += 360; - double h2 = atan2(b2, aa2)*180/M_PI; - if (h2 < 0) h2 += 360; - double hm = (abs(h1-h2) > 180 ? (h1+h2+360) : (h1+h2))/2; - double t = 1 - 0.17*cos(hm-30) + 0.24*cos(2*hm) + 0.32*cos(3*hm+6) - 0.2*cos(4*hm-63); - double dh = h2-h1; - if (h2-h1 < -180) - dh += 360; - else if (h2-h1 > 180) - dh -= 360; - double dhh = 2*sqrt(cc1*cc2)*sin(dh/2); - double sl = 1 + 0.015*(lm-50.0)*(lm-50.0)/sqrt(20.0+(lm-50.0)); - double sc = 1 + 0.045*ccm; - double sh = 1 + 0.015*ccm*t; - double dtheta = 30*exp(-sqr(hm-275)/25); - double rc = 2*sqrt(pow(ccm, 7)/(pow(ccm, 7)+pow(25.0, 7))); - double rt = -rc*sin(2*dtheta); - return sqrt(sqr(dl/sl) + sqr(dcc/sc) + sqr(dhh/sh) + rt*dcc/sc*dhh/sh); -} - - -int Color::numComponents (ColorSpace colorSpace) { - switch (colorSpace) { - case GRAY_SPACE: return 1; - case LAB_SPACE: - case RGB_SPACE: return 3; - case CMYK_SPACE: return 4; - } - return 0; -} \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.h deleted file mode 100644 index 6b1c50d5d71..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Color.h +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* -** Color.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_COLOR_H -#define DVISVGM_COLOR_H - -#include -#include -#include -#include "types.h" -#include "VectorIterator.h" - -#ifdef TRANSPARENT -#undef TRANSPARENT -#endif - -class Color -{ - public: - static const Color BLACK; - static const Color WHITE; - static const Color TRANSPARENT; - - enum ColorSpace {GRAY_SPACE, RGB_SPACE, CMYK_SPACE, LAB_SPACE}; - - public: - Color () : _rgb(0) {} - Color (UInt32 rgb) : _rgb(rgb) {} - Color (UInt8 r, UInt8 g, UInt8 b) {setRGB(r,g,b);} - Color (double r, double g, double b) {setRGB(r,g,b);} - Color (const std::valarray &rgb) {setRGB(rgb);} - Color (const char *name); - Color (const std::string &name); -// Color (ColorSpace colorSpace, std::vector::const_iterator &it) {set(colorSpace, it);} - operator UInt32 () const {return _rgb;} - bool operator == (const Color &c) const {return _rgb == c._rgb;} - bool operator != (const Color &c) const {return _rgb != c._rgb;} - void setRGB (UInt8 r, UInt8 g, UInt8 b) {_rgb = (r << 16) | (g << 8) | b;} - void setRGB (double r, double g, double b); - void setRGB (const std::valarray &rgb) {setRGB(rgb[0], rgb[1], rgb[2]);} - bool setName (std::string name, bool case_sensitive=true); - void setGray (UInt8 g) {setRGB(g,g,g);} - void setGray (double g) {setRGB(g,g,g);} - void setGray (const std::valarray &gray) {setRGB(gray[0], gray[0], gray[0]);} - void setHSB (double h, double s, double b); - void setCMYK (double c, double m, double y, double k); - void setCMYK (const std::valarray &cmyk); - void setXYZ (double x, double y, double z); - void setXYZ (const std::valarray &xyz); - void setLab (double l, double a, double b); - void setLab (const std::valarray &lab); - void set (ColorSpace colorSpace, VectorIterator &it); - double getGray () const; - void getGray (std::valarray &gray) const; - void getRGB (double &r, double &g, double &b) const; - void getRGB (std::valarray &rgb) const; - void getCMYK (double &c, double &m, double &y, double &k) const; - void getCMYK (std::valarray &cmyk) const; - void getXYZ (double &x, double &y, double &z) const; - void getLab (double &l, double &a, double &b) const; - void getLab (std::valarray &lab) const; - void operator *= (double c); - double deltaE (const Color &c) const; - std::string rgbString () const; - static void CMYK2RGB (const std::valarray &cmyk, std::valarray &rgb); - static void RGB2CMYK (const std::valarray &rgb, std::valarray &cmyk); - static void HSB2RGB (const std::valarray &hsb, std::valarray &rgb); - static void RGB2XYZ (std::valarray rgb, std::valarray &xyz); - static void XYZ2RGB (const std::valarray &xyz, std::valarray &rgb); - static void RGB2Lab (const std::valarray &rgb, std::valarray &lab); - static void Lab2XYZ (const std::valarray &lab, std::valarray &xyz); - static int numComponents (ColorSpace colorSpace); - - private: - UInt32 _rgb; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.cpp deleted file mode 100644 index b3743a71979..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* -** ColorSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "ColorSpecialHandler.h" -#include "SpecialActions.h" - -using namespace std; - - -static double read_double (istream &is) { - is.clear(); - double v; - is >> v; - if (is.fail()) - throw SpecialException("number expected"); - return v; -} - - -/** Reads multiple double values from a given stream. The number of - * values read is determined by the size of the result vector. - * @param[in] is stream to be read from - * @param[out] v the resulting values */ -static void read_doubles (istream &is, vector &v) { - for (size_t i=0; i < v.size(); i++) - v[i] = read_double(is); -} - - -/** Reads a color statement from an input stream and converts it to RGB. - * A color statement has the following syntax: - * _color model_ _component values_ - * Currently, the following color models are supported: rgb, cmyk, hsb and gray. - * Examples: rgb 1 0.5 0, gray 0.5 - * @param[in] model if model != "" this value specifies the model, otherwise it's read from the stream - * @param[in] is stream to be read from - * @param[out] color italicresulting RGB triple - * @return true if statement has successfully been read */ -static void read_color (string model, istream &is, Color &color) { - if (model.empty()) - is >> model; - if (model == "rgb") { - vector rgb(3); - read_doubles(is, rgb); - color.setRGB(rgb[0], rgb[1], rgb[2]); - } - else if (model == "cmyk") { - vector cmyk(4); - read_doubles(is, cmyk); - color.setCMYK(cmyk[0], cmyk[1], cmyk[2], cmyk[3]); - } - else if (model == "hsb") { - vector hsb(3); - read_doubles(is, hsb); - color.setHSB(hsb[0], hsb[1], hsb[2]); - } - else if (model == "gray") - color.setGray(read_double(is)); - else if (!color.setName(model, true)) - throw SpecialException("unknown color statement"); -} - - -bool ColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - Color color; - if (prefix && strcmp(prefix, "background") == 0) { - read_color("", is, color); - actions->setBgColor(color); - } - else { - string cmd; - is >> cmd; - if (cmd == "push") { // color push - read_color("", is, color); - _colorStack.push(color); - } - else if (cmd == "pop") { - if (!_colorStack.empty()) // color pop - _colorStack.pop(); - } - else { // color - read_color(cmd, is, color); - while (!_colorStack.empty()) - _colorStack.pop(); - _colorStack.push(color); - } - if (actions) { - if (_colorStack.empty()) - actions->setColor(Color::BLACK); - else - actions->setColor(_colorStack.top()); - } - } - return true; -} - - -const char** ColorSpecialHandler::prefixes () const { - static const char *pfx[] = {"color", 0}; - return pfx; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.h deleted file mode 100644 index f945492b05b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ColorSpecialHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* -** ColorSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_COLORSPECIALHANDLER_H -#define DVISVGM_COLORSPECIALHANDLER_H - -#include -#include -#include "Color.h" -#include "SpecialHandler.h" - - -class ColorSpecialHandler : public SpecialHandler -{ - public: - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - const char* name () const {return "color";} - const char* info () const {return "complete support of color specials";} - const char** prefixes () const; - - private: - std::stack _colorStack; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.cpp deleted file mode 100644 index ead88465ae3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.cpp +++ /dev/null @@ -1,398 +0,0 @@ -// This file was automatically generated by opt2cpp. -// 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. -// (C) 2009-2015 Martin Gieseking - -#include -#include -#include -#include -#include "InputReader.h" -#include "CommandLine.h" - -using namespace std; - -const CmdLineParserBase::Option CommandLine::_options[] = { - {'b', "bbox", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_bbox)}, - {'C', "cache", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_cache)}, -#if !defined(DISABLE_GS) - {'j', "clipjoin", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_clipjoin)}, -#endif - {'\0', "color", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_color)}, -#if !defined(DISABLE_GS) - {'E', "eps", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_eps)}, -#endif - {'e', "exact", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_exact)}, - {'m', "fontmap", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_fontmap)}, -#if !defined(DISABLE_GS) - {'\0', "grad-overlap", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_grad_overlap)}, -#endif -#if !defined(DISABLE_GS) - {'\0', "grad-segments", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_grad_segments)}, -#endif -#if !defined(DISABLE_GS) - {'\0', "grad-simplify", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_grad_simplify)}, -#endif - {'h', "help", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_help)}, - {'\0', "keep", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_keep)}, -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - {'\0', "libgs", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_libgs)}, -#endif - {'L', "linkmark", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_linkmark)}, - {'l', "list-specials", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_list_specials)}, - {'M', "mag", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_mag)}, - {'n', "no-fonts", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_no_fonts)}, - {'\0', "no-merge", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_merge)}, - {'\0', "no-mktexmf", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_mktexmf)}, - {'S', "no-specials", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_no_specials)}, - {'\0', "no-styles", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_styles)}, - {'o', "output", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_output)}, - {'p', "page", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_page)}, - {'d', "precision", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_precision)}, - {'P', "progress", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_progress)}, - {'R', "relative", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_relative)}, - {'r', "rotate", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_rotate)}, - {'c', "scale", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_scale)}, - {'s', "stdout", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_stdout)}, - {'a', "trace-all", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_trace_all)}, - {'T', "transform", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_transform)}, - {'t', "translate", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_translate)}, - {'v', "verbosity", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_verbosity)}, - {'V', "version", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_version)}, - {'z', "zip", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_zip)}, - {'Z', "zoom", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_zoom)}, -}; - -const CmdLineParserBase::Option* CommandLine::options (size_t *numopts) const { - *numopts = sizeof(_options)/sizeof(CmdLineParserBase::Option); - return _options; -} - -void CommandLine::init () { - CmdLineParserBase::init(); - - // disable all options by default - _bbox_given = false; - _cache_given = false; -#if !defined(DISABLE_GS) - _clipjoin_given = false; -#endif - _color_given = false; -#if !defined(DISABLE_GS) - _eps_given = false; -#endif - _exact_given = false; - _fontmap_given = false; -#if !defined(DISABLE_GS) - _grad_overlap_given = false; -#endif -#if !defined(DISABLE_GS) - _grad_segments_given = false; -#endif -#if !defined(DISABLE_GS) - _grad_simplify_given = false; -#endif - _help_given = false; - _keep_given = false; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - _libgs_given = false; -#endif - _linkmark_given = false; - _list_specials_given = false; - _mag_given = false; - _no_fonts_given = false; - _no_merge_given = false; - _no_mktexmf_given = false; - _no_specials_given = false; - _no_styles_given = false; - _output_given = false; - _page_given = false; - _precision_given = false; - _progress_given = false; - _relative_given = false; - _rotate_given = false; - _scale_given = false; - _stdout_given = false; - _trace_all_given = false; - _transform_given = false; - _translate_given = false; - _verbosity_given = false; - _version_given = false; - _zip_given = false; - _zoom_given = false; - - // set default option values - _bbox_arg = "min"; - _cache_arg.clear(); - _fontmap_arg.clear(); -#if !defined(DISABLE_GS) - _grad_segments_arg = 20; -#endif -#if !defined(DISABLE_GS) - _grad_simplify_arg = 0.05; -#endif - _help_arg = 0; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - _libgs_arg.clear(); -#endif - _linkmark_arg = "box"; - _mag_arg = 4; - _no_fonts_arg = 0; - _no_specials_arg.clear(); - _output_arg.clear(); - _page_arg = "1"; - _precision_arg = 0; - _progress_arg = 0.5; - _rotate_arg = 0; - _scale_arg.clear(); - _trace_all_arg = false; - _transform_arg.clear(); - _translate_arg.clear(); - _verbosity_arg = 7; - _version_arg = false; - _zip_arg = 9; - _zoom_arg = 1.0; -} - -const char** CommandLine::helplines (size_t *numlines) const { - static const char *lines[] = { - "dThis program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG.\n\nUsage: dvisvgm [options] dvifile\n dvisvgm -E [options] epsfile", - "sInput options:", - "o-p, --page=ranges choose pages to convert [1]", - "o-m, --fontmap=filenames evaluate (additional) font map files", -#if !defined(DISABLE_GS) - "o-E, --eps convert an EPS file to SVG", -#endif - "sSVG output options:", - "o-b, --bbox=size set size of bounding box [min]", -#if !defined(DISABLE_GS) - "o-j, --clipjoin compute intersection of clipping paths", -#endif -#if !defined(DISABLE_GS) - "o --grad-overlap create operlapping color gradient segments", -#endif -#if !defined(DISABLE_GS) - "o --grad-segments=number number of color gradient segments per row [20]", -#endif -#if !defined(DISABLE_GS) - "o --grad-simplify=delta reduce level of detail for small segments [0.05]", -#endif - "o-L, --linkmark=style select how to mark hyperlinked areas [box]", - "o-o, --output=pattern set name pattern of output files", - "o-d, --precision=number set number of decimal points (0-6) [0]", - "o-R, --relative create relative path commands", - "o-s, --stdout write SVG output to stdout", - "o-n, --no-fonts[=variant] draw glyphs by using path elements [0]", - "o --no-merge don't merge adjacent text elements", - "o --no-styles don't use styles to reference fonts", - "o-z, --zip[=level] create compressed .svgz file [9]", - "sSVG transformations:", - "o-r, --rotate=angle rotate page content clockwise", - "o-c, --scale=sx[,sy] scale page content", - "o-t, --translate=tx[,ty] shift page content", - "o-T, --transform=commands transform page content", - "o-Z, --zoom=factor zoom page content [1.0]", - "sProcessing options:", - "o-C, --cache[=dir] set/print path of cache directory", - "o-e, --exact compute exact glyph boxes", - "o --keep keep temporary files", -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - "o --libgs=filename set name of Ghostscript shared library", -#endif - "o-M, --mag=factor magnification of Metafont output [4]", - "o --no-mktexmf don't try to create missing fonts", - "o-S, --no-specials[=prefixes] don't process [selected] specials", - "o-a, --trace-all[=retrace] trace all glyphs of bitmap fonts [no]", - "sMessage options:", - "o --color colorize messages", - "o-h, --help[=mode] print this summary of options and exit [0]", - "o-l, --list-specials print supported special sets and exit", - "o-P, --progress[=delay] enable progess indicator [0.5]", - "o-v, --verbosity=level set verbosity level (0-7) [7]", - "o-V, --version[=extended] print version and exit [no]", - }; - *numlines = sizeof(lines)/sizeof(char*); - return lines; -} - -void CommandLine::handle_bbox (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _bbox_arg)) - _bbox_given = true; -} - -void CommandLine::handle_cache (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getStringArg(ir, opt, longopt, _cache_arg)) - _cache_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_clipjoin (InputReader &ir, const Option &opt, bool longopt) { - _clipjoin_given = true; -} -#endif - -void CommandLine::handle_color (InputReader &ir, const Option &opt, bool longopt) { - _color_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_eps (InputReader &ir, const Option &opt, bool longopt) { - _eps_given = true; -} -#endif - -void CommandLine::handle_exact (InputReader &ir, const Option &opt, bool longopt) { - _exact_given = true; -} - -void CommandLine::handle_fontmap (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _fontmap_arg)) - _fontmap_given = true; -} - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt) { - _grad_overlap_given = true; -} -#endif - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_segments (InputReader &ir, const Option &opt, bool longopt) { - if (getIntArg(ir, opt, longopt, _grad_segments_arg)) - _grad_segments_given = true; -} -#endif - -#if !defined(DISABLE_GS) -void CommandLine::handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _grad_simplify_arg)) - _grad_simplify_given = true; -} -#endif - -void CommandLine::handle_help (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _help_arg)) - _help_given = true; -} - -void CommandLine::handle_keep (InputReader &ir, const Option &opt, bool longopt) { - _keep_given = true; -} - -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) -void CommandLine::handle_libgs (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _libgs_arg)) - _libgs_given = true; -} -#endif - -void CommandLine::handle_linkmark (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _linkmark_arg)) - _linkmark_given = true; -} - -void CommandLine::handle_list_specials (InputReader &ir, const Option &opt, bool longopt) { - _list_specials_given = true; -} - -void CommandLine::handle_mag (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _mag_arg)) - _mag_given = true; -} - -void CommandLine::handle_no_fonts (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _no_fonts_arg)) - _no_fonts_given = true; -} - -void CommandLine::handle_no_merge (InputReader &ir, const Option &opt, bool longopt) { - _no_merge_given = true; -} - -void CommandLine::handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt) { - _no_mktexmf_given = true; -} - -void CommandLine::handle_no_specials (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getStringArg(ir, opt, longopt, _no_specials_arg)) - _no_specials_given = true; -} - -void CommandLine::handle_no_styles (InputReader &ir, const Option &opt, bool longopt) { - _no_styles_given = true; -} - -void CommandLine::handle_output (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _output_arg)) - _output_given = true; -} - -void CommandLine::handle_page (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _page_arg)) - _page_given = true; -} - -void CommandLine::handle_precision (InputReader &ir, const Option &opt, bool longopt) { - if (getIntArg(ir, opt, longopt, _precision_arg)) - _precision_given = true; -} - -void CommandLine::handle_progress (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getDoubleArg(ir, opt, longopt, _progress_arg)) - _progress_given = true; -} - -void CommandLine::handle_relative (InputReader &ir, const Option &opt, bool longopt) { - _relative_given = true; -} - -void CommandLine::handle_rotate (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _rotate_arg)) - _rotate_given = true; -} - -void CommandLine::handle_scale (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _scale_arg)) - _scale_given = true; -} - -void CommandLine::handle_stdout (InputReader &ir, const Option &opt, bool longopt) { - _stdout_given = true; -} - -void CommandLine::handle_trace_all (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getBoolArg(ir, opt, longopt, _trace_all_arg)) - _trace_all_given = true; -} - -void CommandLine::handle_transform (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _transform_arg)) - _transform_given = true; -} - -void CommandLine::handle_translate (InputReader &ir, const Option &opt, bool longopt) { - if (getStringArg(ir, opt, longopt, _translate_arg)) - _translate_given = true; -} - -void CommandLine::handle_verbosity (InputReader &ir, const Option &opt, bool longopt) { - if (getUIntArg(ir, opt, longopt, _verbosity_arg)) - _verbosity_given = true; -} - -void CommandLine::handle_version (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getBoolArg(ir, opt, longopt, _version_arg)) - _version_given = true; -} - -void CommandLine::handle_zip (InputReader &ir, const Option &opt, bool longopt) { - if (ir.eof() || getIntArg(ir, opt, longopt, _zip_arg)) - _zip_given = true; -} - -void CommandLine::handle_zoom (InputReader &ir, const Option &opt, bool longopt) { - if (getDoubleArg(ir, opt, longopt, _zoom_arg)) - _zoom_given = true; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.h deleted file mode 100644 index 4c68706fc7e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/CommandLine.h +++ /dev/null @@ -1,219 +0,0 @@ -// This file was automatically generated by opt2cpp. -// 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. -// (C) 2009-2015 Martin Gieseking - -#ifndef COMMANDLINE_H -#define COMMANDLINE_H - -#include -#include "CmdLineParserBase.h" - -class CommandLine : public CmdLineParserBase -{ - public: - CommandLine () {init();} - CommandLine (int argc, char **argv, bool printErrors) {parse(argc, argv, printErrors);} - bool bbox_given () const {return _bbox_given;} - const std::string& bbox_arg () const {return _bbox_arg;} - bool cache_given () const {return _cache_given;} - const std::string& cache_arg () const {return _cache_arg;} -#if !defined(DISABLE_GS) - bool clipjoin_given () const {return _clipjoin_given;} -#endif - bool color_given () const {return _color_given;} -#if !defined(DISABLE_GS) - bool eps_given () const {return _eps_given;} -#endif - bool exact_given () const {return _exact_given;} - bool fontmap_given () const {return _fontmap_given;} - const std::string& fontmap_arg () const {return _fontmap_arg;} -#if !defined(DISABLE_GS) - bool grad_overlap_given () const {return _grad_overlap_given;} -#endif -#if !defined(DISABLE_GS) - bool grad_segments_given () const {return _grad_segments_given;} - int grad_segments_arg () const {return _grad_segments_arg;} -#endif -#if !defined(DISABLE_GS) - bool grad_simplify_given () const {return _grad_simplify_given;} - double grad_simplify_arg () const {return _grad_simplify_arg;} -#endif - bool help_given () const {return _help_given;} - int help_arg () const {return _help_arg;} - bool keep_given () const {return _keep_given;} -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - bool libgs_given () const {return _libgs_given;} - const std::string& libgs_arg () const {return _libgs_arg;} -#endif - bool linkmark_given () const {return _linkmark_given;} - const std::string& linkmark_arg () const {return _linkmark_arg;} - bool list_specials_given () const {return _list_specials_given;} - bool mag_given () const {return _mag_given;} - double mag_arg () const {return _mag_arg;} - bool no_fonts_given () const {return _no_fonts_given;} - int no_fonts_arg () const {return _no_fonts_arg;} - bool no_merge_given () const {return _no_merge_given;} - bool no_mktexmf_given () const {return _no_mktexmf_given;} - bool no_specials_given () const {return _no_specials_given;} - const std::string& no_specials_arg () const {return _no_specials_arg;} - bool no_styles_given () const {return _no_styles_given;} - bool output_given () const {return _output_given;} - const std::string& output_arg () const {return _output_arg;} - bool page_given () const {return _page_given;} - const std::string& page_arg () const {return _page_arg;} - bool precision_given () const {return _precision_given;} - int precision_arg () const {return _precision_arg;} - bool progress_given () const {return _progress_given;} - double progress_arg () const {return _progress_arg;} - bool relative_given () const {return _relative_given;} - bool rotate_given () const {return _rotate_given;} - double rotate_arg () const {return _rotate_arg;} - bool scale_given () const {return _scale_given;} - const std::string& scale_arg () const {return _scale_arg;} - bool stdout_given () const {return _stdout_given;} - bool trace_all_given () const {return _trace_all_given;} - bool trace_all_arg () const {return _trace_all_arg;} - bool transform_given () const {return _transform_given;} - const std::string& transform_arg () const {return _transform_arg;} - bool translate_given () const {return _translate_given;} - const std::string& translate_arg () const {return _translate_arg;} - bool verbosity_given () const {return _verbosity_given;} - unsigned verbosity_arg () const {return _verbosity_arg;} - bool version_given () const {return _version_given;} - bool version_arg () const {return _version_arg;} - bool zip_given () const {return _zip_given;} - int zip_arg () const {return _zip_arg;} - bool zoom_given () const {return _zoom_given;} - double zoom_arg () const {return _zoom_arg;} - protected: - void init (); - const CmdLineParserBase::Option* options (size_t *numopts) const; - const char** helplines (size_t *numlines) const; - void handle_bbox (InputReader &ir, const Option &opt, bool longopt); - void handle_cache (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_clipjoin (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_color (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_eps (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_exact (InputReader &ir, const Option &opt, bool longopt); - void handle_fontmap (InputReader &ir, const Option &opt, bool longopt); -#if !defined(DISABLE_GS) - void handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt); -#endif -#if !defined(DISABLE_GS) - void handle_grad_segments (InputReader &ir, const Option &opt, bool longopt); -#endif -#if !defined(DISABLE_GS) - void handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_help (InputReader &ir, const Option &opt, bool longopt); - void handle_keep (InputReader &ir, const Option &opt, bool longopt); -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - void handle_libgs (InputReader &ir, const Option &opt, bool longopt); -#endif - void handle_linkmark (InputReader &ir, const Option &opt, bool longopt); - void handle_list_specials (InputReader &ir, const Option &opt, bool longopt); - void handle_mag (InputReader &ir, const Option &opt, bool longopt); - void handle_no_fonts (InputReader &ir, const Option &opt, bool longopt); - void handle_no_merge (InputReader &ir, const Option &opt, bool longopt); - void handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt); - void handle_no_specials (InputReader &ir, const Option &opt, bool longopt); - void handle_no_styles (InputReader &ir, const Option &opt, bool longopt); - void handle_output (InputReader &ir, const Option &opt, bool longopt); - void handle_page (InputReader &ir, const Option &opt, bool longopt); - void handle_precision (InputReader &ir, const Option &opt, bool longopt); - void handle_progress (InputReader &ir, const Option &opt, bool longopt); - void handle_relative (InputReader &ir, const Option &opt, bool longopt); - void handle_rotate (InputReader &ir, const Option &opt, bool longopt); - void handle_scale (InputReader &ir, const Option &opt, bool longopt); - void handle_stdout (InputReader &ir, const Option &opt, bool longopt); - void handle_trace_all (InputReader &ir, const Option &opt, bool longopt); - void handle_transform (InputReader &ir, const Option &opt, bool longopt); - void handle_translate (InputReader &ir, const Option &opt, bool longopt); - void handle_verbosity (InputReader &ir, const Option &opt, bool longopt); - void handle_version (InputReader &ir, const Option &opt, bool longopt); - void handle_zip (InputReader &ir, const Option &opt, bool longopt); - void handle_zoom (InputReader &ir, const Option &opt, bool longopt); - - private: - static const CmdLineParserBase::Option _options[]; - bool _bbox_given; - std::string _bbox_arg; - bool _cache_given; - std::string _cache_arg; -#if !defined(DISABLE_GS) - bool _clipjoin_given; -#endif - bool _color_given; -#if !defined(DISABLE_GS) - bool _eps_given; -#endif - bool _exact_given; - bool _fontmap_given; - std::string _fontmap_arg; -#if !defined(DISABLE_GS) - bool _grad_overlap_given; -#endif -#if !defined(DISABLE_GS) - bool _grad_segments_given; - int _grad_segments_arg; -#endif -#if !defined(DISABLE_GS) - bool _grad_simplify_given; - double _grad_simplify_arg; -#endif - bool _help_given; - int _help_arg; - bool _keep_given; -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - bool _libgs_given; - std::string _libgs_arg; -#endif - bool _linkmark_given; - std::string _linkmark_arg; - bool _list_specials_given; - bool _mag_given; - double _mag_arg; - bool _no_fonts_given; - int _no_fonts_arg; - bool _no_merge_given; - bool _no_mktexmf_given; - bool _no_specials_given; - std::string _no_specials_arg; - bool _no_styles_given; - bool _output_given; - std::string _output_arg; - bool _page_given; - std::string _page_arg; - bool _precision_given; - int _precision_arg; - bool _progress_given; - double _progress_arg; - bool _relative_given; - bool _rotate_given; - double _rotate_arg; - bool _scale_given; - std::string _scale_arg; - bool _stdout_given; - bool _trace_all_given; - bool _trace_all_arg; - bool _transform_given; - std::string _transform_arg; - bool _translate_given; - std::string _translate_arg; - bool _verbosity_given; - unsigned _verbosity_arg; - bool _version_given; - bool _version_arg; - bool _zip_given; - int _zip_arg; - bool _zoom_given; - double _zoom_arg; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.cpp deleted file mode 100644 index f227cae1f80..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* -** DLLoader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "DLLoader.h" - - -DLLoader::DLLoader (const char *dlname) : _handle(0) -{ - if (dlname && *dlname) { -#ifdef __WIN32__ - _handle = LoadLibrary(dlname); -#else - _handle = dlopen(dlname, RTLD_LAZY); -#endif - } -} - - -DLLoader::~DLLoader () { - if (_handle) { -#ifdef __WIN32__ - FreeLibrary(_handle); -#else - dlclose(_handle); -#endif - } -} - - -/** Loads a function or variable from the dynamic/shared library. - * @param[in] name name of function/variable to load - * @return pointer to loaded symbol, or 0 if the symbol could not be loaded */ -void* DLLoader::loadSymbol (const char *name) { - if (_handle) { -#ifdef __WIN32__ - return (void*)GetProcAddress(_handle, name); -#else - return dlsym(_handle, name); -#endif - } - return 0; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.h deleted file mode 100644 index 6050467277b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DLLoader.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -** DLLoader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DLLOADER_H -#define DVISVGM_DLLOADER_H - -#ifdef __WIN32__ - #include -#else - #include -#endif - - -class DLLoader -{ - public: - DLLoader (const char *dlname); - virtual ~DLLoader (); - bool loaded () const {return _handle != 0;} - - protected: - DLLoader () : _handle(0) {} - void* loadSymbol (const char *name); - - private: -#ifdef __WIN32__ - HINSTANCE _handle; -#else - void *_handle; -#endif -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIActions.h deleted file mode 100644 index d6248d59cf3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIActions.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* -** DVIActions.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DVIACTIONS_H -#define DVISVGM_DVIACTIONS_H - -#include -#include "Message.h" -#include "types.h" - -class BoundingBox; -struct Font; -class SpecialManager; - - -struct DVIActions -{ - virtual ~DVIActions () {} - virtual void setChar (double x, double y, unsigned c, bool vertical, const Font *f) {} - virtual void setRule (double x, double y, double height, double width) {} - virtual void setTextOrientation (bool vertical) {} - virtual void moveToX (double x) {} - virtual void moveToY (double y) {} - virtual void defineFont (int num, const Font *font) {} - virtual void setFont (int num, const Font *font) {} - virtual void special (const std::string &s, double dvi2bp, bool preprocessing=false) {} - virtual void preamble (const std::string &cmt) {} - virtual void postamble () {} - virtual void beginPage (unsigned pageno, Int32 *c) {} - virtual void endPage (unsigned pageno) {} - virtual BoundingBox& bbox () =0; - virtual void progress (size_t current, size_t total, const char *id=0) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.cpp deleted file mode 100644 index f84252bff1c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.cpp +++ /dev/null @@ -1,687 +0,0 @@ -/************************************************************************* -** DVIReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "Color.h" -#include "DVIActions.h" -#include "DVIReader.h" -#include "Font.h" -#include "FontManager.h" -#include "Message.h" -#include "SignalHandler.h" -#include "VectorStream.h" -#include "macros.h" -#include "types.h" - - -using namespace std; - -bool DVIReader::COMPUTE_PROGRESS = false; - - -DVIReader::DVIReader (istream &is, DVIActions *a) : BasicDVIReader(is), _actions(a) -{ - _inPage = false; - _pageHeight = _pageWidth = 0; - _dvi2bp = 0.0; - _tx = _ty = 0; // no cursor translation - _prevYPos = numeric_limits::min(); - _inPostamble = false; - _currFontNum = 0; - _currPageNum = 0; - _pagePos = 0; - _mag = 1; - executePreamble(); - collectBopOffsets(); - executePostamble(); -} - - -DVIActions* DVIReader::replaceActions (DVIActions *a) { - DVIActions *prev_actions = _actions; - _actions = a; - return prev_actions; -} - - -/** Reads a single DVI command from the current position of the input stream and calls the - * corresponding cmdFOO method. - * @return opcode of the command executed */ -int DVIReader::executeCommand () { - SignalHandler::instance().check(); - CommandHandler handler; - int param; // parameter of handler - const streampos cmdpos = tell(); - int opcode = evalCommand(handler, param); - (this->*handler)(param); - if (_dviState.v+_ty != _prevYPos) { - _tx = _ty = 0; - _prevYPos = _dviState.v; - } - if (COMPUTE_PROGRESS && _inPage && _actions) { - size_t pagelen = numberOfPageBytes(_currPageNum-1); - // ensure progress() is called at 0% - if (opcode == 139) // bop? - _actions->progress(0, pagelen); - // ensure progress() is called at 100% - if (peek() == 140) // eop reached? - _pagePos = pagelen; - else - _pagePos += tell()-cmdpos; - _actions->progress(_pagePos, pagelen); - } - return opcode; -} - - -/** Executes all DVI commands read from the input stream. */ -void DVIReader::executeAll () { - int opcode = 0; - while (!eof() && opcode >= 0) { - try { - opcode = executeCommand(); - } - catch (const InvalidDVIFileException &e) { - // end of stream reached - opcode = -1; - } - } -} - - -/** Reads and executes the commands of a single page. - * This methods stops reading after the page's eop command has been executed. - * @param[in] n number of page to be executed - * @returns true if page was read successfully */ -bool DVIReader::executePage (unsigned n) { - clearStream(); // reset all status bits - if (!isStreamValid()) - throw DVIException("invalid DVI file"); - if (n < 1 || n > numberOfPages()) - return false; - - seek(_bopOffsets[n-1]); // goto bop of n-th page - _inPostamble = false; // not in postamble - _currPageNum = n; - while (executeCommand() != 140); // 140 == eop - return true; -} - - -void DVIReader::executePreamble () { - clearStream(); - if (isStreamValid()) { - seek(0); - if (readByte() == 247) { - cmdPre(0); - return; - } - } - throw DVIException("invalid DVI file"); -} - - -/** Moves stream pointer to begin of postamble */ -static void to_postamble (StreamReader &reader) { - reader.clearStream(); - if (!reader.isStreamValid()) - throw DVIException("invalid DVI file"); - - reader.seek(-1, ios::end); // stream pointer to last byte - int count=0; - while (reader.peek() == 223) { - reader.seek(-1, ios::cur); // skip fill bytes - count++; - } - if (count < 4) // the standard requires at least 4 trailing fill bytes - throw DVIException("missing fill bytes at end of file"); - - reader.seek(-4, ios::cur); // now on first byte of q (pointer to begin of postamble) - UInt32 q = reader.readUnsigned(4); // pointer to begin of postamble - reader.seek(q); // now on begin of postamble -} - - -/** Reads and executes the commands of the postamble. */ -void DVIReader::executePostamble () { - to_postamble(*this); - while (executeCommand() != 249); // executes all commands until post_post (= 249) is reached -} - - -/** Collects and records the file offsets of all bop commands. */ -void DVIReader::collectBopOffsets () { - to_postamble(*this); - _bopOffsets.push_back(tell()); // also add offset of postamble - readByte(); // skip post command - UInt32 offset = readUnsigned(4); // offset of final bop - while ((Int32)offset > 0) { // not yet on first bop? - _bopOffsets.push_back(offset); // record offset - seek(offset+41); // skip bop command and the 10 \count values => now on offset of previous bop - offset = readUnsigned(4); - } - reverse(_bopOffsets.begin(), _bopOffsets.end()); -} - - -/** Returns the current x coordinate in PS point units. - * This is the horizontal position where the next output would be placed. */ -double DVIReader::getXPos () const { - return _dviState.h+_tx; -} - - -/** Returns the current y coordinate in PS point units. - * This is the vertical position where the next output would be placed. */ -double DVIReader::getYPos () const { - return _dviState.v+_ty; -} - - -///////////////////////////////////// - -/** Reads and executes DVI preamble command. - * Format: pre ver[1] num[4] den[4] mag[4] cmtlen[1] cmt[cmtlen] */ -void DVIReader::cmdPre (int) { - setDVIFormat((DVIFormat)readUnsigned(1)); // identification number - UInt32 num = readUnsigned(4); // numerator units of measurement - UInt32 den = readUnsigned(4); // denominator units of measurement - if (den == 0) - throw DVIException("denominator of measurement unit is zero"); - _mag = readUnsigned(4); // magnification - UInt32 k = readUnsigned(1); // length of following comment - string cmt = readString(k); // comment - // 1 dviunit * num/den == multiples of 0.0000001m - // 1 dviunit * _dvibp: length of 1 dviunit in PS points * _mag/1000 - _dvi2bp = num/254000.0*72.0/den*_mag/1000.0; - if (_actions) - _actions->preamble(cmt); -} - - -/** Reads and executes DVI postamble command. - * Format: post p[4] num[4] den[4] mag[4] ph[4] pw[4] sd[2] np[2] */ -void DVIReader::cmdPost (int) { - readUnsigned(4); // skip pointer to previous bop - UInt32 num = readUnsigned(4); - UInt32 den = readUnsigned(4); - if (den == 0) - throw DVIException("denominator of measurement unit is zero"); - _mag = readUnsigned(4); - _pageHeight = readUnsigned(4); // height of tallest page in dvi units - _pageWidth = readUnsigned(4); // width of widest page in dvi units - readUnsigned(2); // skip max. stack depth - if (readUnsigned(2) != numberOfPages()) - throw DVIException("page count entry doesn't match actual number of pages"); - - // 1 dviunit * num/den == multiples of 0.0000001m - // 1 dviunit * _dvi2bp: length of 1 dviunit in PS points * _mag/1000 - _dvi2bp = num/254000.0*72.0/den*_mag/1000.0; - _pageHeight *= _dvi2bp; // to pt units - _pageWidth *= _dvi2bp; - _inPostamble = true; - if (_actions) - _actions->postamble(); -} - - -/** Reads and executes DVI post_post command. - * Format: post_post q[4] i[1] 223[>=4] */ -void DVIReader::cmdPostPost (int) { - _inPostamble = false; - readUnsigned(4); // pointer to begin of postamble - setDVIFormat((DVIFormat)readUnsigned(1)); // identification byte - while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now -} - - -/** Reads and executes Begin-Of-Page command. - * Format: bop c0[+4] ... c9[+4] p[+4] */ -void DVIReader::cmdBop (int) { - Int32 c[10]; - for (int i=0; i < 10; i++) - c[i] = readSigned(4); - readSigned(4); // pointer to peceeding bop (-1 in case of first page) - _dviState.reset(); // set all DVI registers to 0 - while (!_stateStack.empty()) - _stateStack.pop(); - _currFontNum = 0; - _inPage = true; - _pagePos = 0; - beginPage(_currPageNum, c); - if (_actions) - _actions->beginPage(_currPageNum, c); -} - - -/** Reads and executes End-Of-Page command. */ -void DVIReader::cmdEop (int) { - if (!_stateStack.empty()) - throw DVIException("stack not empty at end of page"); - _inPage = false; - endPage(_currPageNum); - if (_actions) - _actions->endPage(_currPageNum); -} - - -/** Reads and executes push command. */ -void DVIReader::cmdPush (int) { - _stateStack.push(_dviState); -} - - -/** Reads and executes pop command (restores pushed position information). */ -void DVIReader::cmdPop (int) { - if (_stateStack.empty()) - throw DVIException("stack empty at pop command"); - else { - DVIState prevState = _dviState; - _dviState = _stateStack.top(); - _stateStack.pop(); - if (_actions) { - if (prevState.h != _dviState.h) - _actions->moveToX(_dviState.h + _tx); - if (prevState.v != _dviState.v) - _actions->moveToY(_dviState.v + _ty); - if (prevState.d != _dviState.d) - _actions->setTextOrientation(_dviState.d != WMODE_LR); - } - } -} - - -/** Helper function that actually sets/puts a charater. It is called by the - * cmdSetChar and cmdPutChar methods. - * @param[in] c character to typeset - * @param[in] moveCursor if true, register h is increased by the character width - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::putChar (UInt32 c, bool moveCursor) { - if (!_inPage) - throw DVIException("set_char/put_char outside of page"); - - FontManager &fm = FontManager::instance(); - Font *font = fm.getFont(_currFontNum); - if (!font) - throw DVIException("no font selected"); - - if (VirtualFont *vf = dynamic_cast(font)) { // is current font a virtual font? - vector *dvi = const_cast*>(vf->getDVI(c)); // get DVI snippet that describes character c - if (dvi) { - DVIState pos = _dviState; // save current cursor position - _dviState.x = _dviState.y = _dviState.w = _dviState.z = 0; - int save_fontnum = _currFontNum; // save current font number - fm.enterVF(vf); // new font number context - cmdFontNum0(fm.vfFirstFontNum(vf)); - double save_scale = _dvi2bp; - // DVI units in virtual fonts are multiples of 1^(-20) times the scaled size of the VF - _dvi2bp = vf->scaledSize()/(1 << 20); - - VectorInputStream vis(*dvi); - istream &is = replaceStream(vis); - try { - executeAll(); // execute DVI fragment - } - catch (const DVIException &e) { - // Message::estream(true) << "invalid dvi in vf: " << e.getMessage() << endl; // @@ - } - replaceStream(is); // restore previous input stream - _dvi2bp = save_scale; // restore previous scale factor - fm.leaveVF(); // restore previous font number context - cmdFontNum0(save_fontnum); // restore previous font number - _dviState = pos; // restore previous cursor position - } - } - else if (_actions) - _actions->setChar(_dviState.h+_tx, _dviState.v+_ty, c, _dviState.d != WMODE_LR, font); - - if (moveCursor) { - double dist = font->charWidth(c) * font->scaleFactor() * _mag/1000.0; - switch (_dviState.d) { - case WMODE_LR: _dviState.h += dist; break; - case WMODE_TB: _dviState.v += dist; break; - case WMODE_BT: _dviState.v -= dist; break; - } - } -} - - -/** Reads and executes set_char_x command. Puts a character at the current - * position and advances the cursor. - * @param[in] c character to set - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::cmdSetChar0 (int c) { - putChar(c, true); -} - - -/** Reads and executes setx command. Puts a character at the current - * position and advances the cursor. - * @param[in] len number of parameter bytes (possible values: 1-4) - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::cmdSetChar (int len) { - // According to the dvi specification all character codes are unsigned - // except len == 4. At the moment all char codes are treated as unsigned... - UInt32 c = readUnsigned(len); // if len == 4 c may be signed - putChar(c, true); -} - - -/** Reads and executes putx command. Puts a character at the current - * position but doesn't change the cursor position. - * @param[in] len number of parameter bytes (possible values: 1-4) - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::cmdPutChar (int len) { - // According to the dvi specification all character codes are unsigned - // except len == 4. At the moment all char codes are treated as unsigned... - Int32 c = readUnsigned(len); - putChar(c, false); -} - - -/** Reads and executes set_rule command. Puts a solid rectangle at the current - * position and updates the cursor position. - * Format: set_rule h[+4] w[+4] - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::cmdSetRule (int) { - if (!_inPage) - throw DVIException("set_rule outside of page"); - double height = _dvi2bp*readSigned(4); - double width = _dvi2bp*readSigned(4); - if (_actions && height > 0 && width > 0) - _actions->setRule(_dviState.h+_tx, _dviState.v+_ty, height, width); - moveRight(width); -} - - -/** Reads and executes set_rule command. Puts a solid rectangle at the current - * position but leaves the cursor position unchanged. - * Format: put_rule h[+4] w[+4] - * @throw DVIException if method is called ouside a bop/eop pair */ -void DVIReader::cmdPutRule (int) { - if (!_inPage) - throw DVIException("put_rule outside of page"); - double height = _dvi2bp*readSigned(4); - double width = _dvi2bp*readSigned(4); - if (_actions && height > 0 && width > 0) - _actions->setRule(_dviState.h+_tx, _dviState.v+_ty, height, width); -} - - -void DVIReader::moveRight (double dx) { - switch (_dviState.d) { - case WMODE_LR: _dviState.h += dx; break; - case WMODE_TB: _dviState.v += dx; break; - case WMODE_BT: _dviState.v -= dx; break; - } - if (_actions) { - if (_dviState.d == WMODE_LR) - _actions->moveToX(_dviState.h+_tx); - else - _actions->moveToY(_dviState.v+_ty); - } -} - - -void DVIReader::moveDown (double dy) { - switch (_dviState.d) { - case WMODE_LR: _dviState.v += dy; break; - case WMODE_TB: _dviState.h -= dy; break; - case WMODE_BT: _dviState.h += dy; break; - } - if (_actions) { - if (_dviState.d == WMODE_LR) - _actions->moveToY(_dviState.v+_ty); - else - _actions->moveToX(_dviState.h+_tx); - } -} - - -void DVIReader::cmdRight (int len) {moveRight(_dvi2bp*readSigned(len));} -void DVIReader::cmdDown (int len) {moveDown(_dvi2bp*readSigned(len));} -void DVIReader::cmdX0 (int) {moveRight(_dviState.x);} -void DVIReader::cmdY0 (int) {moveDown(_dviState.y);} -void DVIReader::cmdW0 (int) {moveRight(_dviState.w);} -void DVIReader::cmdZ0 (int) {moveDown(_dviState.z);} -void DVIReader::cmdX (int len) {_dviState.x = _dvi2bp*readSigned(len); cmdX0(0);} -void DVIReader::cmdY (int len) {_dviState.y = _dvi2bp*readSigned(len); cmdY0(0);} -void DVIReader::cmdW (int len) {_dviState.w = _dvi2bp*readSigned(len); cmdW0(0);} -void DVIReader::cmdZ (int len) {_dviState.z = _dvi2bp*readSigned(len); cmdZ0(0);} -void DVIReader::cmdNop (int) {} - - -/** Sets the text orientation (horizontal, vertical). - * This command is only available in DVI files of format 3 (created by pTeX) */ -void DVIReader::cmdDir (int) { - UInt8 wmode = readUnsigned(1); - if (wmode == 4) // yoko mode (4) equals default LR mode (0) - wmode = 0; - if (wmode == 2 || wmode > 3) { - ostringstream oss; - oss << "invalid writing mode value " << wmode << " (0, 1, or 3 expected)"; - throw DVIException(oss.str()); - } - _dviState.d = (WritingMode)wmode; - if (_actions) - _actions->setTextOrientation(_dviState.d != WMODE_LR); -} - - -void DVIReader::cmdXXX (int len) { - if (!_inPage) - throw DVIException("special outside of page"); - UInt32 numBytes = readUnsigned(len); - string s = readString(numBytes); - if (_actions) - _actions->special(s, _dvi2bp); -} - - -/** Selects a previously defined font by its number. - * @param[in] num font number - * @throw DVIException if font number is undefined */ -void DVIReader::cmdFontNum0 (int num) { - if (Font *font = FontManager::instance().getFont(num)) { - _currFontNum = num; - if (_actions && !dynamic_cast(font)) - _actions->setFont(FontManager::instance().fontID(num), font); // all fonts get a recomputed ID - } - else { - ostringstream oss; - oss << "undefined font number " << num; - throw DVIException(oss.str()); - } -} - - -/** Selects a previously defined font. - * @param[in] len size of font number variable (in bytes) - * @throw DVIException if font number is undefined */ -void DVIReader::cmdFontNum (int len) { - UInt32 num = readUnsigned(len); - cmdFontNum0(num); -} - - -/** Helper function to handle a font definition. - * @param[in] fontnum local font number - * @param[in] name font name - * @param[in] cs checksum to be compared with TFM checksum - * @param[in] ds design size in PS point units - * @param[in] ss scaled size in PS point units */ -void DVIReader::defineFont (UInt32 fontnum, const string &name, UInt32 cs, double ds, double ss) { - if (!_inPostamble) // only process font definitions collected in the postamble; skip all others - return; - - FontManager &fm = FontManager::instance(); - int id = fm.registerFont(fontnum, name, cs, ds, ss); - Font *font = fm.getFontById(id); - if (VirtualFont *vf = dynamic_cast(font)) { - // read vf file, register its font and character definitions - fm.enterVF(vf); - ifstream ifs(vf->path(), ios::binary); - VFReader vfReader(ifs); - vfReader.replaceActions(this); - vfReader.executeAll(); - fm.leaveVF(); - } - if (_actions) - _actions->defineFont(id, font); -} - - -/** Defines a new font. - * @param[in] len size of font number variable (in bytes) */ -void DVIReader::cmdFontDef (int len) { - UInt32 fontnum = readUnsigned(len); // font number - UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) - UInt32 ssize = readUnsigned(4); // scaled size of font in DVI units - UInt32 dsize = readUnsigned(4); // design size of font in DVI units - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name - readString(pathlen); // skip font path - string fontname = readString(namelen); - - defineFont(fontnum, fontname, checksum, dsize*_dvi2bp, ssize*_dvi2bp); -} - - -/** This template method is called by the VFReader after reading a font definition from a VF file. - * @param[in] fontnum local font number - * @param[in] path path to font file - * @param[in] name font name - * @param[in] checksum checksum to be compared with TFM checksum - * @param[in] dsize design size in PS point units - * @param[in] ssize scaled size in PS point units */ -void DVIReader::defineVFFont (UInt32 fontnum, string path, string name, UInt32 checksum, double dsize, double ssize) { - if (VirtualFont *vf = FontManager::instance().getVF()) - defineFont(fontnum, name, checksum, dsize, ssize * vf->scaleFactor()); -} - - -/** This template method is called by the VFReader after reading a character definition from a VF file. - * @param[in] c character number - * @param[in] dvi DVI fragment describing the character */ -void DVIReader::defineVFChar (UInt32 c, vector *dvi) { - FontManager::instance().assignVfChar(c, dvi); -} - - -/** XDV extension: includes image or pdf file. - * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ -void DVIReader::cmdXPic (int) { - // just skip the parameters - readUnsigned(1); // box - for (int i=0; i < 6; i++) // matrix - readSigned(4); - readSigned(2); // page number - UInt16 len = readUnsigned(2); - readString(len); // path to image/pdf file -} - - -/** XDV extension: defines a native font */ -void DVIReader::cmdXFontDef (int) { - Int32 fontnum = readSigned(4); - double ptsize = _dvi2bp*readUnsigned(4); - UInt16 flags = readUnsigned(2); - UInt8 psname_len = readUnsigned(1); - UInt8 fmname_len = getDVIFormat() == DVI_XDVOLD ? readUnsigned(1) : 0; - UInt8 stname_len = getDVIFormat() == DVI_XDVOLD ? readUnsigned(1) : 0; - string fontname = readString(psname_len); - UInt32 fontIndex=0; - if (getDVIFormat() == DVI_XDVOLD) - seek(fmname_len+stname_len, ios::cur); - else - fontIndex = readUnsigned(4); - FontStyle style; - Color color; - if (flags & 0x0100) { // vertical? - } - if (flags & 0x0200) { // colored? - // The font color must not interfere with color specials. If the font color is not black, - // all color specials should be ignored, i.e. glyphs of a non-black fonts have a fixed color - // that can't be changed by color specials. - UInt32 rgba = readUnsigned(4); - color.setRGB(UInt8(rgba >> 24), UInt8((rgba >> 16) & 0xff), UInt8((rgba >> 8) & 0xff)); - } - if (flags & 0x1000) // extend? - style.extend = _dvi2bp*readSigned(4); - if (flags & 0x2000) // slant? - style.slant = _dvi2bp*readSigned(4); - if (flags & 0x4000) // embolden? - style.bold = _dvi2bp*readSigned(4); - if ((flags & 0x0800) && (getDVIFormat() == DVI_XDVOLD)) { // variations? - UInt16 num_variations = readSigned(2); - for (int i=0; i < num_variations; i++) - readUnsigned(4); - } - if (_inPage) - FontManager::instance().registerFont(fontnum, fontname, fontIndex, ptsize, style, color); -} - - -/** XDV extension: prints an array of characters where each character - * can take independent x and y coordinates. - * parameters: w[4] n[2] x[4][n] y[4][n] c[2][n] */ -void DVIReader::cmdXGlyphArray (int) { - putGlyphArray(false); -} - - -/** XDV extension: prints an array/string of characters where each character - * can take independent x coordinates whereas all share a single y coordinate. - * parameters: w[4] n[2] x[4][n] y[4] c[2][n] */ -void DVIReader::cmdXGlyphString (int) { - putGlyphArray(true); -} - - -/** Implements the common functionality of cmdXGlyphA and cmdXGlyphS. - * @param[in] xonly indicates if the characters share a single y coordinate (xonly==true) */ -void DVIReader::putGlyphArray (bool xonly) { - double strwidth = _dvi2bp*readSigned(4); - UInt16 num_glyphs = readUnsigned(2); - vector x(num_glyphs); - vector y(num_glyphs); - for (int i=0; i < num_glyphs; i++) { - x[i] = readSigned(4); - y[i] = xonly ? 0 : readSigned(4); - } - if (!_actions) - seek(2*num_glyphs, ios::cur); - else { - if (Font *font = FontManager::instance().getFont(_currFontNum)) { - for (int i=0; i < num_glyphs; i++) { - UInt16 glyph_index = readUnsigned(2); - double xx = _dviState.h + x[i]*_dvi2bp + _tx; - double yy = _dviState.v + y[i]*_dvi2bp + _ty; - _actions->setChar(xx, yy, glyph_index, false, font); - } - } - } - moveRight(strwidth); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.h deleted file mode 100644 index 4a1a5f5f899..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIReader.h +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************* -** DVIReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DVIREADER_H -#define DVISVGM_DVIREADER_H - -#include -#include -#include -#include -#include "BasicDVIReader.h" -#include "MessageException.h" -#include "StreamReader.h" -#include "VFActions.h" -#include "types.h" - - -struct DVIActions; - -class DVIReader : public BasicDVIReader, protected VFActions -{ - enum WritingMode {WMODE_LR=0, WMODE_TB=1, WMODE_BT=3}; - - struct DVIState - { - double h, v; ///< horizontal and vertical cursor position - double x, w, y, z; ///< additional registers to store horizontal (x, w) and vertical (y, z) positions - WritingMode d; ///< direction: 0: horizontal, 1: vertical(top->bottom), 3: vertical (bottom->top) - DVIState () {reset();} - void reset () {h = v = x = w = y = z = 0.0; d=WMODE_LR;} - }; - - public: - DVIReader (std::istream &is, DVIActions *a=0); - - bool executeDocument (); - void executeAll (); - void executePreamble (); - void executePostamble (); - bool executePage (unsigned n); - bool inPostamble () const {return _inPostamble;} - double getXPos () const; - double getYPos () const; - void finishLine () {_prevYPos = std::numeric_limits::min();} - void translateToX (double x) {_tx = x-_dviState.h-_tx;} - void translateToY (double y) {_ty = y-_dviState.v-_ty;} - double getPageWidth () const {return _pageWidth;} - double getPageHeight () const {return _pageHeight;} - int getStackDepth () const {return _stateStack.size();} - int getCurrentFontNumber () const {return _currFontNum;} - unsigned getCurrentPageNumber () const {return _currPageNum;} - unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} - DVIActions* getActions () const {return _actions;} - DVIActions* replaceActions (DVIActions *a); - - protected: - void collectBopOffsets (); - size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} - int executeCommand (); - void moveRight (double dx); - void moveDown (double dy); - void putChar (UInt32 c, bool moveCursor); - void putGlyphArray (bool xonly); - void defineFont (UInt32 fontnum, const std::string &name, UInt32 cs, double ds, double ss); - virtual void beginPage (unsigned pageno, Int32 *c) {} - virtual void endPage (unsigned pageno) {} - - // VFAction methods - void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize); - void defineVFChar (UInt32 c, std::vector *dvi); - - // the following methods represent the DVI commands - // they are called by executeCommand and should not be used directly - void cmdSetChar0 (int c); - void cmdSetChar (int len); - void cmdPutChar (int len); - void cmdSetRule (int len); - void cmdPutRule (int len); - void cmdNop (int len); - void cmdBop (int len); - void cmdEop (int len); - void cmdPush (int len); - void cmdPop (int len); - void cmdDir (int len); - void cmdRight (int len); - void cmdDown (int len); - void cmdX0 (int len); - void cmdY0 (int len); - void cmdW0 (int len); - void cmdZ0 (int len); - void cmdX (int len); - void cmdY (int len); - void cmdW (int len); - void cmdZ (int len); - void cmdFontDef (int len); - void cmdFontNum0 (int n); - void cmdFontNum (int len); - void cmdXXX (int len); - void cmdPre (int len); - void cmdPost (int len); - void cmdPostPost (int len); - void cmdXPic (int len); - void cmdXFontDef (int len); - void cmdXGlyphArray (int len); - void cmdXGlyphString (int len); - - private: - DVIActions *_actions; ///< actions to be performed on various DVI events - bool _inPage; ///< true if between bop and eop - unsigned _currPageNum; ///< current page number (1 is first page) - int _currFontNum; ///< current font number - double _dvi2bp; ///< factor to convert dvi units to PS points - UInt32 _mag; ///< magnification factor * 1000 - bool _inPostamble; ///< true if stream pointer is inside the postamble - double _pageHeight, _pageWidth; ///< page height and width in PS points - DVIState _dviState; ///< current cursor position - std::stack _stateStack; - std::vector _bopOffsets; - double _prevYPos; ///< previous vertical cursor position - double _tx, _ty; ///< tranlation of cursor position - std::streampos _pagePos; ///< distance of current DVI command from bop (in bytes) - - public: - static bool COMPUTE_PROGRESS; ///< if true, an action to handle the progress ratio of a page is triggered -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.cpp deleted file mode 100644 index 00becb10aeb..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/************************************************************************* -** DVIToSVG.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "Calculator.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "Font.h" -#include "FontManager.h" -#include "FileFinder.h" -#include "GlyphTracerMessages.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "Matrix.h" -#include "Message.h" -#include "PageRanges.h" -#include "PageSize.h" -#include "SVGOutput.h" -// -/////////////////////////////////// -// special handlers - -#include "BgColorSpecialHandler.h" -#include "ColorSpecialHandler.h" -#include "DvisvgmSpecialHandler.h" -#include "EmSpecialHandler.h" -#include "PdfSpecialHandler.h" -#include "HtmlSpecialHandler.h" -#ifndef HAVE_LIBGS - #include "NoPsSpecialHandler.h" -#endif -#ifndef DISABLE_GS - #include "PsSpecialHandler.h" -#endif -#include "TpicSpecialHandler.h" -#include "PreScanDVIReader.h" - -/////////////////////////////////// - -using namespace std; - - -/** 'a': trace all glyphs even if some of them are already cached - * 'm': trace missing glyphs, i.e. glyphs not yet cached - * 0 : only trace actually required glyphs */ -char DVIToSVG::TRACE_MODE = 0; - - -DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) : DVIReader(is), _out(out) -{ - replaceActions(new DVIToSVGActions(*this, _svg)); -} - - -DVIToSVG::~DVIToSVG () { - delete replaceActions(0); -} - - -/** Starts the conversion process. - * @param[in] first number of first page to convert - * @param[in] last number of last page to convert - * @param[out] pageinfo (number of converted pages, number of total pages) */ -void DVIToSVG::convert (unsigned first, unsigned last, pair *pageinfo) { - if (first > last) - swap(first, last); - if (first > numberOfPages()) { - ostringstream oss; - oss << "file contains only " << numberOfPages() << " page"; - if (numberOfPages() > 1) - oss << 's'; - throw DVIException(oss.str()); - } - last = min(last, numberOfPages()); - - for (unsigned i=first; i <= last; ++i) { - executePage(i); - _svg.removeRedundantElements(); - embedFonts(_svg.rootNode()); - _svg.write(_out.getPageStream(getCurrentPageNumber(), numberOfPages())); - string fname = _out.filename(i, numberOfPages()); - Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\npage written to " << (fname.empty() ? "" : fname) << '\n'; - _svg.reset(); - static_cast(getActions())->reset(); - } - if (pageinfo) { - pageinfo->first = last-first+1; - pageinfo->second = numberOfPages(); - } -} - - -/** Convert DVI pages specified by a page range string. - * @param[in] rangestr string describing the pages to convert - * @param[out] pageinfo (number of converted pages, number of total pages) */ -void DVIToSVG::convert (const string &rangestr, pair *pageinfo) { - PageRanges ranges; - if (!ranges.parse(rangestr, numberOfPages())) - throw MessageException("invalid page range format"); - - Message::mstream(false, Message::MC_PAGE_NUMBER) << "pre-processing DVI file (format " << getDVIFormat() << ")\n"; - if (DVIToSVGActions *actions = dynamic_cast(getActions())) { - PreScanDVIReader prescan(getInputStream(), actions); - actions->setDVIReader(prescan); - prescan.executeAllPages(); - actions->setDVIReader(*this); - SpecialManager::instance().notifyPreprocessingFinished(); - } - - FORALL(ranges, PageRanges::ConstIterator, it) - convert(it->first, it->second); - if (pageinfo) { - pageinfo->first = ranges.numberOfPages(); - pageinfo->second = numberOfPages(); - } -} - - -/** This template method is called by parent class DVIReader before - * executing the BOP actions. - * @param[in] pageno physical page number (1 = first page) - * @param[in] c contains information about the page (page number etc.) */ -void DVIToSVG::beginPage (unsigned pageno, Int32 *c) { - if (dynamic_cast(getActions())) { - Message::mstream().indent(0); - Message::mstream(false, Message::MC_PAGE_NUMBER) << "processing page " << pageno; - if (pageno != (unsigned)c[0]) // Does page number shown on page differ from physical page number? - Message::mstream(false) << " [" << c[0] << ']'; - Message::mstream().indent(1); - _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); - } -} - - -/** This template method is called by parent class DVIReader before - * executing the EOP actions. */ -void DVIToSVG::endPage (unsigned pageno) { - if (!dynamic_cast(getActions())) - return; - - SpecialManager::instance().notifyEndPage(pageno); - // set bounding box and apply page transformations - BoundingBox &bbox = getActions()->bbox(); - bbox.unlock(); - Matrix matrix; - getPageTransformation(matrix); - static_cast(getActions())->setPageMatrix(matrix); - if (_bboxString == "min") - bbox.transform(matrix); - if (string("dvi none min").find(_bboxString) == string::npos) { - istringstream iss(_bboxString); - StreamInputReader ir(iss); - ir.skipSpace(); - if (isalpha(ir.peek())) { - // set explicitly given page format - PageSize size(_bboxString); - if (size.valid()) { - // convention: DVI position (0,0) equals (1in, 1in) relative - // to the upper left vertex of the page (see DVI specification) - const double border = -72; - bbox = BoundingBox(border, border, size.widthInBP()+border, size.heightInBP()+border); - } - } - else { // set/modify bounding box by explicitly given values - try { - bbox.set(_bboxString); - } - catch (const MessageException &e) { - } - } - } - else if (_bboxString == "dvi") { - // center page content - double dx = (getPageWidth()-bbox.width())/2; - double dy = (getPageHeight()-bbox.height())/2; - bbox += BoundingBox(-dx, -dy, dx, dy); - } - if (_bboxString != "none") { - if (bbox.width() == 0) - Message::wstream(false) << "\npage is empty\n"; - else { - _svg.setBBox(bbox); - - const double bp2pt = 72.27/72; - const double bp2mm = 25.4/72; - Message::mstream(false) << '\n'; - Message::mstream(false, Message::MC_PAGE_SIZE) << "page size: " << XMLString(bbox.width()*bp2pt) << "pt" - " x " << XMLString(bbox.height()*bp2pt) << "pt" - " (" << XMLString(bbox.width()*bp2mm) << "mm" - " x " << XMLString(bbox.height()*bp2mm) << "mm)"; - Message::mstream(false) << '\n'; - } - } -} - - -void DVIToSVG::getPageTransformation(Matrix &matrix) const { - if (_transCmds.empty()) - matrix.set(1); // unity matrix - else { - Calculator calc; - if (getActions()) { - const double bp2pt = 72.27/72; - BoundingBox &bbox = getActions()->bbox(); - calc.setVariable("ux", bbox.minX()*bp2pt); - calc.setVariable("uy", bbox.minY()*bp2pt); - calc.setVariable("w", bbox.width()*bp2pt); - calc.setVariable("h", bbox.height()*bp2pt); - } - calc.setVariable("pt", 1); - calc.setVariable("in", 72.27); - calc.setVariable("cm", 72.27/2.54); - calc.setVariable("mm", 72.27/25.4); - matrix.set(_transCmds, calc); - } -} - - -static void collect_chars (map > &fm) { - typedef const map > UsedCharsMap; - FORALL(fm, UsedCharsMap::const_iterator, it) { - if (it->first->uniqueFont() != it->first) { - FORALL(it->second, set::const_iterator, cit) - fm[it->first->uniqueFont()].insert(*cit); - } - } -} - - -/** Adds the font information to the SVG tree. - * @param[in] svgElement the font nodes are added to this node */ -void DVIToSVG::embedFonts (XMLElementNode *svgElement) { - if (!svgElement) - return; - if (!getActions()) // no dvi actions => no chars written => no fonts to embed - return; - - typedef map > UsedCharsMap; - const DVIToSVGActions *svgActions = static_cast(getActions()); - UsedCharsMap &usedChars = svgActions->getUsedChars(); - - collect_chars(usedChars); - - GlyphTracerMessages messages; - set tracedFonts; // collect unique fonts already traced - FORALL(usedChars, UsedCharsMap::const_iterator, it) { - const Font *font = it->first; - if (const PhysicalFont *ph_font = dynamic_cast(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()) { - ph_font->traceAllGlyphs(TRACE_MODE == 'a', &messages); - tracedFonts.insert(ph_font->uniqueFont()); - } - if (font->path()) // does font file exist? - _svg.append(*ph_font, it->second, &messages); - else - Message::wstream(true) << "can't embed font '" << font->name() << "'\n"; - } - else - Message::wstream(true) << "can't embed font '" << font->name() << "'\n"; - } - _svg.appendFontStyles(svgActions->getUsedFonts()); -} - - -/** Enables or disables processing of specials. If ignorelist == 0, all - * supported special handlers are loaded. To disable selected sets of specials, - * the corresponding prefixes can be given separated by non alpha-numeric characters, - * e.g. "color, ps, em" or "color: ps em" etc. - * A single "*" in the ignore list disables all specials. - * @param[in] ignorelist list of special prefixes to ignore - * @param[in] pswarning if true, shows warning about disabled PS support - * @return the SpecialManager that handles special statements */ -void DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) { - if (ignorelist && strcmp(ignorelist, "*") == 0) { // ignore all specials? - SpecialManager::instance().unregisterHandlers(); - } - else { - // add special handlers - SpecialHandler *handlers[] = { - 0, // placeholder for PsSpecialHandler - new BgColorSpecialHandler, // handles background color special - new ColorSpecialHandler, // handles color specials - new DvisvgmSpecialHandler, // handles raw SVG embeddings - new EmSpecialHandler, // handles emTeX specials - new HtmlSpecialHandler, // handles hyperref specials - new PdfSpecialHandler, // handles pdf specials - new TpicSpecialHandler, // handles tpic specials - 0 - }; - SpecialHandler **p = handlers; -#ifndef DISABLE_GS - if (Ghostscript().available()) - *p = new PsSpecialHandler; - else -#endif - { -#ifndef HAVE_LIBGS - *p = new NoPsSpecialHandler; // dummy PS special handler that only prints warning messages - if (pswarning) { -#ifdef DISABLE_GS - Message::wstream() << "processing of PostScript specials has been disabled permanently\n"; -#else - Message::wstream() << "processing of PostScript specials is disabled (Ghostscript not found)\n"; -#endif - } -#endif - } - SpecialManager::instance().unregisterHandlers(); - SpecialManager::instance().registerHandlers(p, ignorelist); - } -} - - -string DVIToSVG::getSVGFilename (unsigned pageno) const { - return _out.filename(pageno, numberOfPages()); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.h deleted file mode 100644 index 9e3f5d659ca..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVG.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* -** DVIToSVG.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DVITOSVG_H -#define DVISVGM_DVITOSVG_H - -#include -#include -#include -#include "DVIReader.h" -#include "SpecialManager.h" -#include "SVGTree.h" - -class Matrix; -struct SVGOutputBase; - -class DVIToSVG : public DVIReader -{ - public: - DVIToSVG (std::istream &is, SVGOutputBase &out); - ~DVIToSVG (); - void convert (const std::string &range, std::pair *pageinfo=0); - void setPageSize (const std::string &name) {_bboxString = name;} - void setPageTransformation (const std::string &cmds) {_transCmds = cmds;} - void getPageTransformation (Matrix &matrix) const; - std::string getSVGFilename (unsigned pageno) const; - static void setProcessSpecials (const char *ignorelist=0, bool pswarning=false); - - public: - static char TRACE_MODE; - - protected: - DVIToSVG (const DVIToSVG &); - void convert (unsigned firstPage, unsigned lastPage, std::pair *pageinfo=0); - void beginPage (unsigned pageno, Int32 *c); - void endPage (unsigned pageno); - void embedFonts (XMLElementNode *svgElement); - - private: - SVGTree _svg; - SVGOutputBase &_out; - std::string _bboxString; - std::string _transCmds; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.cpp deleted file mode 100644 index adf4ebe549d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/************************************************************************* -** DVIToSVGActions.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "BoundingBox.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "Font.h" -#include "FontManager.h" -#include "GlyphTracerMessages.h" -#include "SpecialManager.h" -#include "System.h" -#include "XMLNode.h" -#include "XMLString.h" - - -using namespace std; - - -DVIToSVGActions::DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg) - : _svg(svg), _dvireader(&dvisvg), _pageMatrix(0), _bgcolor(Color::TRANSPARENT), _boxes(0) -{ - _currentFontNum = -1; - _pageCount = 0; -} - - -DVIToSVGActions::~DVIToSVGActions () { - delete _pageMatrix; - delete _boxes; -} - - -void DVIToSVGActions::reset() { - _usedChars.clear(); - _usedFonts.clear(); - _bbox = BoundingBox(); - _currentFontNum = -1; - _bgcolor = Color::TRANSPARENT; -} - - -void DVIToSVGActions::setPageMatrix (const Matrix &matrix) { - delete _pageMatrix; - _pageMatrix = new Matrix(matrix); -} - - -void DVIToSVGActions::moveToX (double x) { - SpecialManager::instance().notifyPositionChange(getX(), getY()); - _svg.setX(x); -} - - -void DVIToSVGActions::moveToY (double y) { - SpecialManager::instance().notifyPositionChange(getX(), getY()); - _svg.setY(y); -} - - -string DVIToSVGActions::getSVGFilename (unsigned pageno) const { - if (DVIToSVG *dvi2svg = dynamic_cast(_dvireader)) - return dvi2svg->getSVGFilename(pageno); - return ""; -} - - -/** This method is called when a "set char" command was found in the DVI file. - * It draws a character of the current font. - * @param[in] x horizontal position of left bounding box edge - * @param[in] y vertical position of the character's baseline - * @param[in] c character code relative to the current font - * @param[in] vertical true if we're in vertical mode - * @param[in] font font to be used */ -void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, const Font *font) { - // If we use SVG fonts there is no need to record all font name/char/size combinations - // because the SVG font mechanism handles this automatically. It's sufficient to - // record font names and chars. The various font sizes can be ignored here. - // For a given font object, Font::uniqueFont() returns the same unique font object for - // all fonts with the same name. - _usedChars[SVGTree::USE_FONTS ? font->uniqueFont() : font].insert(c); - - // However, we record all required fonts - _usedFonts.insert(font); - _svg.appendChar(c, x, y, *font); - - static string fontname; - GlyphTracerMessages callback(fontname != font->name(), false); - fontname = font->name(); - - BoundingBox charbox; - GlyphMetrics metrics; - font->getGlyphMetrics(c, vertical, metrics); - const PhysicalFont* pf = dynamic_cast(font); - if (PhysicalFont::EXACT_BBOX && pf) { - GlyphMetrics exact_metrics; - pf->getExactGlyphBox(c, exact_metrics, vertical, &callback); - if (vertical) { - // move top of bbox to upper margin of glyph (just an approximation yet) - y += (metrics.d-exact_metrics.h-exact_metrics.d)/2; - } - metrics = exact_metrics; - } - BoundingBox bbox(x-metrics.wl, y-metrics.h, x+metrics.wr, y+metrics.d); - - // update bounding box - if (!getMatrix().isIdentity()) - bbox.transform(getMatrix()); - embed(bbox); -#if 0 - XMLElementNode *rect = new XMLElementNode("rect"); - rect->addAttribute("x", x-metrics.wl); - rect->addAttribute("y", y-metrics.h); - rect->addAttribute("width", metrics.wl+metrics.wr); - rect->addAttribute("height", metrics.h+metrics.d); - rect->addAttribute("fill", "none"); - rect->addAttribute("stroke", "red"); - rect->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(rect); - if (metrics.d > 0) { - XMLElementNode *line = new XMLElementNode("line"); - line->addAttribute("x1", x-metrics.wl); - line->addAttribute("y1", y); - line->addAttribute("x2", x+metrics.wr); - line->addAttribute("y2", y); - line->addAttribute("stroke", "blue"); - line->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(line); - } - if (metrics.wl > 0) { - XMLElementNode *line = new XMLElementNode("line"); - line->addAttribute("x1", x); - line->addAttribute("y1", y-metrics.h); - line->addAttribute("x2", x); - line->addAttribute("y2", y+metrics.d); - line->addAttribute("stroke", "blue"); - line->addAttribute("stroke-width", "0.5"); - _svg.appendToPage(line); - } -#endif -} - - -/** This method is called when a "set rule" or "put rule" command was found in the - * DVI file. It draws a solid unrotated rectangle. - * @param[in] x horizontal position of left edge - * @param[in] y vertical position of bottom(!) edge - * @param[in] height length of the vertical edges - * @param[in] width length of the horizontal edges */ -void DVIToSVGActions::setRule (double x, double y, double height, double width) { - // (x,y) is the lower left corner of the rectangle - XMLElementNode *rect = new XMLElementNode("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().getSVG()); - if (getColor() != Color::BLACK) - rect->addAttribute("fill", _svg.getColor().rgbString()); - _svg.appendToPage(rect); - - // update bounding box - BoundingBox bb(x, y-height, x+width, y); - if (!getMatrix().isIdentity()) - bb.transform(getMatrix()); - embed(bb); -} - - -/** This method is called when a "set font" command was found in the DVI file. The - * font must be previously defined. - * @param[in] num unique number of the font in the DVI file (not necessarily equal to the DVI font number) - * @param[in] font pointer to the font object (always represents a physical font and never a virtual font) */ -void DVIToSVGActions::setFont (int num, const Font *font) { - _currentFontNum = num; - _svg.setFont(num, font); -} - - -/** This method is called when a "special" command was found in the DVI file. - * @param[in] spc the special expression - * @param[in] dvi2bp factor to scale DVI units to PS points - * @param[in] preprocessing if true, the DVI file is being pre-processed */ -void DVIToSVGActions::special (const string &spc, double dvi2bp, bool preprocessing) { - try { - if (preprocessing) - SpecialManager::instance().preprocess(spc, this); - else - SpecialManager::instance().process(spc, dvi2bp, this); - // @@ output message in case of unsupported specials? - } - catch (const SpecialException &e) { - Message::estream(true) << "error in special: " << e.what() << '\n'; - } -} - - -/** This method is called when the DVI preamble was read - * @param[in] cmt preamble comment text. */ -void DVIToSVGActions::preamble (const string &cmt) { -} - - -void DVIToSVGActions::postamble () { -} - - -/** This method is called when a "begin of page (bop)" command was found in the DVI file. - * @param[in] pageno physical page number - * @param[in] c array with 10 components representing \\count0 ... \\count9. c[0] contains the - * current (printed) page number (may differ from page count) */ -void DVIToSVGActions::beginPage (unsigned pageno, Int32 *c) { - _svg.newPage(++_pageCount); - _bbox = BoundingBox(); // clear bounding box - if (_boxes) - _boxes->clear(); -} - - -/** This method is called when an "end of page (eop)" command was found in the DVI file. */ -void DVIToSVGActions::endPage (unsigned pageno) { - _svg.transformPage(_pageMatrix); - if (_bgcolor != Color::TRANSPARENT) { - // create a rectangle filled with the background color - XMLElementNode *r = new XMLElementNode("rect"); - r->addAttribute("x", _bbox.minX()); - r->addAttribute("y", _bbox.minY()); - r->addAttribute("width", _bbox.width()); - r->addAttribute("height", _bbox.height()); - r->addAttribute("fill", _bgcolor.rgbString()); - _svg.prependToPage(r); - } -} - - -void DVIToSVGActions::setBgColor (const Color &color) { - _bgcolor = color; -} - - -void DVIToSVGActions::embed(const BoundingBox& bbox) { - _bbox.embed(bbox); - if (_boxes) { - FORALL(*_boxes, BoxMap::iterator, it) - it->second.embed(bbox); - } -} - - -void DVIToSVGActions::embed(const DPair& p, double r) { - if (r == 0) - _bbox.embed(p); - else - _bbox.embed(p, r); - if (_boxes) - FORALL(*_boxes, BoxMap::iterator, it) - it->second.embed(p, r); -} - - -BoundingBox& DVIToSVGActions::bbox(const string& name, bool reset) { - if (!_boxes) - _boxes = new BoxMap; - BoundingBox &box = (*_boxes)[name]; - if (reset) - box = BoundingBox(); - return box; -} - - -/** This method is called by subprocesses like the PS handler when - * a computation step has finished. Since the total number of steps - * can't be determined in advance, we don't show a percent value but - * a rotating dash. */ -void DVIToSVGActions::progress (const char *id) { - if (PROGRESSBAR_DELAY < 1000) { - static double time=0; - // slow down updating of the progress indicator to prevent flickering - if (System::time() - time > 0.1) { - progress(0, 0, id); - time = System::time(); - } - } -} - - -/** Returns the number of digits of a given integer. */ -static int digits (int n) { - if (n == 0) - return 1; - if (n > 0) - return int(log10(double(n))+1); - return int(log10(double(-n))+2); -} - - -/** Draws a simple progress indicator. - * @param[in] current current iteration step (of 'total' steps) - * @param[in] total total number of iteration steps - * @param[in] id ID of the subprocess providing the information */ -void DVIToSVGActions::progress (size_t current, size_t total, const char *id) { - static double time=0; - static bool draw=false; // show progress indicator? - static const char *prev_id=0; - if (current == 0 && total > 0) { - time = System::time(); - draw = false; - Message::mstream() << '\n'; - } - // don't show the progress indicator before the given time has elapsed - if (!draw && System::time()-time > PROGRESSBAR_DELAY) { - draw = true; - Terminal::cursor(false); - } - if (draw && (System::time() - time > 0.1 || (total > 0 && current == total) || prev_id != id)) { - static int step = -1; // >=0: rotating dash - static size_t prev_current=0, prev_total=1; - const char *tips = "-\\|/"; - if (total == 0) { - current = prev_current; - total = prev_total; - step = (step+1) % 4; - } - else { - prev_current = current; - prev_total = total; - step = -1; - } - // adapt length of progress indicator to terminal width - int cols = Terminal::columns(); - int width = (cols == 0 || cols > 60) ? 50 : 49-60+cols; - double factor = double(current)/double(total); - int length = int(width*factor); - Message::mstream(false, Message::MC_PROGRESS) - << '[' << string(length, '=') - << (factor < 1.0 ? (step < 0 ? ' ' : tips[step]) : '=') - << string(width-length, ' ') - << "] " << string(3-digits(int(100*factor)), ' ') << int(100*factor) - << "%\r"; - // overprint indicator when finished - if (factor == 1.0) { - Message::estream().clearline(); - Terminal::cursor(true); - } - time = System::time(); - prev_id = id; - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.h deleted file mode 100644 index 873f104550a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DVIToSVGActions.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* -** DVIToSVGActions.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DVITOSVGACTIONS_H -#define DVISVGM_DVITOSVGACTIONS_H - -#include -#include -#include "BoundingBox.h" -#include "DVIActions.h" -#include "Matrix.h" -#include "SpecialActions.h" -#include "SpecialManager.h" -#include "SVGTree.h" -#include "DVIReader.h" - - -class DVIToSVG; -struct FileFinder; -struct Font; -struct XMLNode; - -class DVIToSVGActions : public DVIActions, public SpecialActions -{ - typedef std::map > CharMap; - typedef std::set FontSet; - typedef std::map BoxMap; - - public: - DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg); - ~DVIToSVGActions (); - void reset (); - void setChar (double x, double y, unsigned c, bool vertical, const Font *f); - void setRule (double x, double y, double height, double width); - void setBgColor (const Color &color); - void setColor (const Color &color) {_svg.setColor(color);} - void setMatrix (const Matrix &m) {_svg.setMatrix(m);} - const Matrix& getMatrix () const {return _svg.getMatrix();} - void getPageTransform (Matrix &matrix) const {_dvireader->getPageTransformation(matrix);} - Color getColor () const {return _svg.getColor();} - int getDVIStackDepth() const {return _dvireader->getStackDepth();} - unsigned getCurrentPageNumber() const {return _dvireader->getCurrentPageNumber();} - void appendToPage (XMLNode *node) {_svg.appendToPage(node);} - void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} - void prependToPage (XMLNode *node) {_svg.prependToPage(node);} - void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} - void popContextElement () {_svg.popContextElement();} - void setTextOrientation(bool vertical) {_svg.setVertical(vertical);} - void moveToX (double x); - void moveToY (double y); - void setFont (int num, const Font *font); - void special (const std::string &spc, double dvi2bp, bool preprocessing=false); - void preamble (const std::string &cmt); - void postamble (); - void beginPage (unsigned pageno, Int32 *c); - void endPage (unsigned pageno); - void progress (size_t current, size_t total, const char *id=0); - void progress (const char *id); - CharMap& getUsedChars () const {return _usedChars;} - const FontSet& getUsedFonts () const {return _usedFonts;} - void setDVIReader (BasicDVIReader &r) {_dvireader = &r;} - void setPageMatrix (const Matrix &tm); - double getX() const {return _dvireader->getXPos();} - double getY() const {return _dvireader->getYPos();} - void setX (double x) {_dvireader->translateToX(x); _svg.setX(x);} - void setY (double y) {_dvireader->translateToY(y); _svg.setY(y);} - void finishLine () {_dvireader->finishLine();} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false); - void embed (const BoundingBox &bbox); - void embed (const DPair &p, double r=0); - std::string getSVGFilename (unsigned pageno) const; - - private: - SVGTree &_svg; - BasicDVIReader *_dvireader; - BoundingBox _bbox; - int _pageCount; - int _currentFontNum; - mutable CharMap _usedChars; - FontSet _usedFonts; - Matrix *_pageMatrix; // transformation of whole page - Color _bgcolor; - BoxMap *_boxes; -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DependencyGraph.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DependencyGraph.h deleted file mode 100644 index e00a68ffbd1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DependencyGraph.h +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* -** DependencyGraph.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - - -#ifndef DEPENDENCYGRAPH_H -#define DEPENDENCYGRAPH_H - -#include -#include - -template -class DependencyGraph -{ - struct GraphNode { - typedef typename std::vector Dependees; - typedef typename Dependees::iterator Iterator; - - GraphNode (const T &k) : key(k), dependent(0) {} - - void addDependee (GraphNode *node) { - if (node) { - node->dependent = this; - dependees.push_back(node); - } - } - - void deleteDependentsAndSelf () { - if (dependent) - dependent->deleteDependentsAndSelf(); - for (typename Dependees::iterator it = dependees.begin(); it != dependees.end(); ++it) - (*it)->dependent = 0; - delete this; - } - - T key; - GraphNode *dependent; - Dependees dependees; - }; - - typedef std::map NodeMap; - - public: - ~DependencyGraph() { - for (typename NodeMap::iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) - delete it->second; - } - - void insert (const T &key) { - if (!contains(key)) - _nodeMap[key] = new GraphNode(key); - } - - void insert (const T &depKey, const T &key) { - if (contains(key)) - return; - typename NodeMap::iterator it = _nodeMap.find(depKey); - if (it != _nodeMap.end()) { - GraphNode *node = new GraphNode(key); - it->second->addDependee(node); - _nodeMap[key] = node; - } - } - - void removeDependencyPath (const T &key) { - typename NodeMap::iterator it = _nodeMap.find(key); - if (it != _nodeMap.end()) { - GraphNode *startNode = it->second; - for (GraphNode *node=startNode; node; node=node->dependent) - _nodeMap.erase(node->key); - startNode->deleteDependentsAndSelf(); - } - } - - void getKeys (std::vector &keys) const { - for (typename NodeMap::const_iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) - keys.push_back(it->first); - } - - bool contains (const T &value) const { - return _nodeMap.find(value) != _nodeMap.end(); - } - - bool empty () const { - return _nodeMap.empty(); - } - -#if 0 - void writeDOT (std::ostream &os) const { - os << "digraph {\n"; - for (typename NodeMap::const_iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) { - GraphNode *node = it->second; - if (node->dependent) - os << (node->key) << " -> " << (node->dependent->key) << ";\n"; - else if (node->dependees.empty()) - os << (node->key) << ";\n"; - } - os << "}\n"; - } -#endif - - private: - NodeMap _nodeMap; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.cpp deleted file mode 100644 index 0bc3c555e45..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* -** Directory.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "Directory.h" - -using namespace std; - -#ifdef __WIN32__ - #include -#else - #include - #include -#endif - - -Directory::Directory () { -#if __WIN32__ - handle = INVALID_HANDLE_VALUE; - firstread = true; - memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); -#else - dir = 0; - dirent = 0; -#endif -} - - -Directory::Directory (string dirname) { -#if __WIN32__ - handle = INVALID_HANDLE_VALUE; - firstread = true; - memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); -#else - dir = 0; - dirent = 0; -#endif - open(dirname); -} - - -Directory::~Directory () { - close(); -} - - -bool Directory::open (string dname) { - _dirname = dname; -#ifdef __WIN32__ - firstread = true; - if (dname[dname.length()-1] == '/' || dname[dname.length()-1] == '\\') - dname = dname.substr(0, dname.length()-1); - dname += "\\*"; - handle = FindFirstFile(dname.c_str(), &fileData); - return handle != INVALID_HANDLE_VALUE; -#else - dir = opendir(_dirname.c_str()); - return dir; -#endif -} - - -void Directory::close () { -#ifdef __WIN32__ - FindClose(handle); -#else - closedir(dir); -#endif -} - - -/** Reads first/next directory entry. - * @param[in] type type of entry to return (a: file or dir, f: file, d: dir) - * @return name of entry */ -const char* Directory::read (EntryType type) { -#ifdef __WIN32__ - if (handle == INVALID_HANDLE_VALUE) - return 0; - while (firstread || FindNextFile(handle, &fileData)) { - firstread = false; - if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - if (type == ET_FILE_OR_DIR || type == ET_DIR) - return fileData.cFileName; - } - else if (type == ET_FILE_OR_DIR || type == ET_FILE) - return fileData.cFileName; - } - FindClose(handle); - handle = INVALID_HANDLE_VALUE; - return 0; -#else - if (!dir) - return 0; - while ((dirent = readdir(dir))) { - string path = string(_dirname) + "/" + dirent->d_name; - struct stat stats; - if (stat(path.c_str(), &stats) == 0) { - if (S_ISDIR(stats.st_mode)) { - if (type == ET_FILE_OR_DIR || type == ET_DIR) - return dirent->d_name; - } - else if (type == ET_FILE_OR_DIR || type == ET_FILE) - return dirent->d_name; - } - } - closedir(dir); - dir = 0; - return 0; -#endif -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.h deleted file mode 100644 index 17bd10f507d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Directory.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* -** Directory.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DIRECTORY_H -#define DVISVGM_DIRECTORY_H - -#include -#ifdef __WIN32__ - #include -#else - #include -#endif - -class Directory -{ - public: - enum EntryType {ET_FILE, ET_DIR, ET_FILE_OR_DIR}; - - public: - Directory (); - Directory (std::string path); - ~Directory (); - bool open (std::string path); - void close (); - const char* read (EntryType type=ET_FILE_OR_DIR); - - private: - std::string _dirname; -#ifdef __WIN32__ - bool firstread; - HANDLE handle; - WIN32_FIND_DATA fileData; -#else - DIR *dir; - struct dirent *dirent; -#endif -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.cpp deleted file mode 100644 index 809172d0b8c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/************************************************************************* -** DvisvgmSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "DvisvgmSpecialHandler.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "SpecialActions.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -DvisvgmSpecialHandler::DvisvgmSpecialHandler () - : _currentMacro(_macros.end()), _nestingLevel(0) -{ -} - - -void DvisvgmSpecialHandler::preprocess (const char*, istream &is, SpecialActions*) { - struct Command { - const char *name; - void (DvisvgmSpecialHandler::*handler)(InputReader&); - } commands[] = { - {"raw", &DvisvgmSpecialHandler::preprocessRaw}, - {"rawdef", &DvisvgmSpecialHandler::preprocessRawDef}, - {"rawset", &DvisvgmSpecialHandler::preprocessRawSet}, - {"endrawset", &DvisvgmSpecialHandler::preprocessEndRawSet}, - {"rawput", &DvisvgmSpecialHandler::preprocessRawPut}, - }; - - StreamInputReader ir(is); - string cmd = ir.getWord(); - for (size_t i=0; i < sizeof(commands)/sizeof(Command); i++) { - if (commands[i].name == cmd) { - ir.skipSpace(); - (this->*commands[i].handler)(ir); - return; - } - } -} - - -void DvisvgmSpecialHandler::preprocessRawSet (InputReader &ir) { - _nestingLevel++; - string id = ir.getString(); - if (id.empty()) - throw SpecialException("definition of unnamed SVG fragment"); - if (_nestingLevel > 1) - throw SpecialException("nested definition of SVG fragment '" + id + "'"); - - _currentMacro = _macros.find(id); - if (_currentMacro != _macros.end()) { - _currentMacro = _macros.end(); - throw SpecialException("redefinition of SVG fragment '" + id + "'"); - } - pair entry(id, StringVector()); - pair state = _macros.insert(entry); - _currentMacro = state.first; -} - - -void DvisvgmSpecialHandler::preprocessEndRawSet (InputReader&) { - if (_nestingLevel > 0 && --_nestingLevel == 0) - _currentMacro = _macros.end(); -} - - -void DvisvgmSpecialHandler::preprocessRaw (InputReader &ir) { - if (_currentMacro == _macros.end()) - return; - string str = ir.getLine(); - if (!str.empty()) - _currentMacro->second.push_back(string("P")+str); -} - - -void DvisvgmSpecialHandler::preprocessRawDef (InputReader &ir) { - if (_currentMacro == _macros.end()) - return; - string str = ir.getLine(); - if (!str.empty()) - _currentMacro->second.push_back(string("D")+str); -} - - -void DvisvgmSpecialHandler::preprocessRawPut (InputReader &ir) { - if (_currentMacro != _macros.end()) - throw SpecialException("dvisvgm:rawput not allowed inside rawset/endrawset"); -} - - -/** Evaluates and executes a dvisvgm special statement. - * @param[in] prefix special prefix read by the SpecialManager - * @param[in] is the special statement is read from this stream - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -bool DvisvgmSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - if (!actions) - return true; - - struct Command { - const char *name; - void (DvisvgmSpecialHandler::*handler)(InputReader&, SpecialActions*); - } commands[] = { - {"raw", &DvisvgmSpecialHandler::processRaw}, - {"rawdef", &DvisvgmSpecialHandler::processRawDef}, - {"rawset", &DvisvgmSpecialHandler::processRawSet}, - {"endrawset", &DvisvgmSpecialHandler::processEndRawSet}, - {"rawput", &DvisvgmSpecialHandler::processRawPut}, - {"bbox", &DvisvgmSpecialHandler::processBBox}, - {"img", &DvisvgmSpecialHandler::processImg}, - }; - StreamInputReader ir(is); - string cmd = ir.getWord(); - for (size_t i=0; i < sizeof(commands)/sizeof(Command); i++) { - if (commands[i].name == cmd) { - ir.skipSpace(); - (this->*commands[i].handler)(ir, actions); - return true; - } - } - return true; -} - - -/** Replaces constants of the form {?name} by their corresponding value. - * @param[in,out] str text to expand - * @param[in] actions interfcae to the world outside the special handler */ -static void expand_constants (string &str, SpecialActions *actions) { - struct Constant { - const char *name; - string val; - } - constants[] = { - {"x", XMLString(actions->getX())}, - {"y", XMLString(actions->getY())}, - {"color", actions->getColor().rgbString()}, - {"nl", "\n"}, - {0, ""} - }; - bool repl_bbox = true; - while (repl_bbox) { - size_t pos = str.find(string("{?bbox ")); - if (pos == string::npos) - repl_bbox = false; - else { - size_t endpos = pos+7; - while (endpos < str.length() && isalnum(str[endpos])) - ++endpos; - if (str[endpos] == '}') { - BoundingBox &box=actions->bbox(str.substr(pos+7, endpos-pos-7)); - str.replace(pos, endpos-pos+1, box.toSVGViewBox()); - } - else - repl_bbox = false; - } - } - for (const Constant *p=constants; p->name; p++) { - const string pattern = string("{?")+p->name+"}"; - size_t pos = str.find(pattern); - while (pos != string::npos) { - str.replace(pos, strlen(p->name)+3, p->val); - pos = str.find(pattern, pos+p->val.length()); // look for further matches - } - } -} - - -void DvisvgmSpecialHandler::processRaw (InputReader &ir, SpecialActions *actions) { - if (_nestingLevel == 0) { - string str = ir.getLine(); - if (!str.empty()) { - expand_constants(str, actions); - actions->appendToPage(new XMLTextNode(str)); - } - } -} - - -void DvisvgmSpecialHandler::processRawDef (InputReader &ir, SpecialActions *actions) { - if (_nestingLevel == 0) { - string str = ir.getLine(); - if (!str.empty()) { - expand_constants(str, actions); - actions->appendToDefs(new XMLTextNode(str)); - } - } -} - - -void DvisvgmSpecialHandler::processRawSet (InputReader&, SpecialActions*) { - _nestingLevel++; -} - - -void DvisvgmSpecialHandler::processEndRawSet (InputReader&, SpecialActions*) { - if (_nestingLevel > 0) - _nestingLevel--; -} - - -void DvisvgmSpecialHandler::processRawPut (InputReader &ir, SpecialActions *actions) { - if (_nestingLevel > 0) - return; - string id = ir.getString(); - MacroMap::iterator it = _macros.find(id); - if (it == _macros.end()) - throw SpecialException("undefined SVG fragment '" + id + "' referenced"); - - StringVector &defs = it->second; - for (StringVector::iterator defs_it=defs.begin(); defs_it != defs.end(); ++defs_it) { - char &type = defs_it->at(0); - string def = defs_it->substr(1); - if ((type == 'P' || type == 'D') && !def.empty()) { - expand_constants(def, actions); - if (type == 'P') - actions->appendToPage(new XMLTextNode(def)); - else { // type == 'D' - actions->appendToDefs(new XMLTextNode(def)); - type = 'L'; // locked - } - } - } -} - - -/** Embeds the virtual rectangle (x, y ,w , h) into the current bounding box, - * where (x,y) is the lower left vertex composed of the current DVI position. - * @param[in] w width of the rectangle in PS point units - * @param[in] h height of the rectangle in PS point units - * @param[in] d depth of the rectangle in PS point units - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -static void update_bbox (double w, double h, double d, SpecialActions *actions) { - double x = actions->getX(); - double y = actions->getY(); - actions->embed(BoundingBox(x, y, x+w, y-h)); - actions->embed(BoundingBox(x, y, x+w, y+d)); -} - - -/** Evaluates the special dvisvgm:bbox. - * variant 1: dvisvgm:bbox [r[el]] [] - * variant 2: dvisvgm:bbox a[bs] - * variant 3: dvisvgm:bbox f[ix] - * variant 4: dvisvgm:bbox n[ew] */ -void DvisvgmSpecialHandler::processBBox (InputReader &ir, SpecialActions *actions) { - const double pt2bp = 72/72.27; - ir.skipSpace(); - int c = ir.peek(); - if (isalpha(c)) { - while (!isspace(ir.peek())) // skip trailing characters - ir.get(); - if (c == 'n') { - ir.skipSpace(); - string name; - while (isalnum(ir.peek())) - name += char(ir.get()); - ir.skipSpace(); - if (!name.empty() && ir.eof()) - actions->bbox(name, true); // create new user box - } - else if (c == 'a' || c == 'f') { - double p[4]; - for (int i=0; i < 4; i++) - p[i] = ir.getDouble()*pt2bp; - BoundingBox b(p[0], p[1], p[2], p[3]); - if (c == 'a') - actions->embed(b); - else { - actions->bbox() = b; - actions->bbox().lock(); - } - } - } - else - c = 'r'; // no mode specifier => relative box parameters - - if (c == 'r') { - double w = ir.getDouble()*pt2bp; - double h = ir.getDouble()*pt2bp; - double d = ir.getDouble()*pt2bp; - update_bbox(w, h, d, actions); - } -} - - -void DvisvgmSpecialHandler::processImg (InputReader &ir, SpecialActions *actions) { - if (actions) { - const double pt2bp = 72/72.27; - double w = ir.getDouble()*pt2bp; - double h = ir.getDouble()*pt2bp; - string f = ir.getString(); - update_bbox(w, h, 0, actions); - XMLElementNode *img = new XMLElementNode("image"); - img->addAttribute("x", actions->getX()); - img->addAttribute("y", actions->getY()); - img->addAttribute("width", w); - img->addAttribute("height", h); - img->addAttribute("xlink:href", f); - if (!actions->getMatrix().isIdentity()) - img->addAttribute("transform", actions->getMatrix().getSVG()); - actions->appendToPage(img); - } -} - - -void DvisvgmSpecialHandler::dviPreprocessingFinished () { - string id; - if (_currentMacro != _macros.end()) - id = _currentMacro->first; - // ensure all pattern definitions are closed after pre-processing the whole DVI file - _currentMacro = _macros.end(); - _nestingLevel = 0; - if (!id.empty()) - throw SpecialException("missing dvisvgm:endrawset for SVG fragment '" + id + "'"); -} - - -void DvisvgmSpecialHandler::dviEndPage (unsigned) { - for (MacroMap::iterator map_it=_macros.begin(); map_it != _macros.end(); ++map_it) { - StringVector &vec = map_it->second; - for (StringVector::iterator str_it=vec.begin(); str_it != vec.end(); ++str_it) { - // activate locked parts of a pattern again - if (str_it->at(0) == 'L') - str_it->at(0) = 'D'; - } - } -} - - -const char** DvisvgmSpecialHandler::prefixes () const { - static const char *pfx[] = {"dvisvgm:", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.h deleted file mode 100644 index fb3a0c754aa..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/DvisvgmSpecialHandler.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* -** DvisvgmSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_DVISVGMSPECIALHANDLER_H -#define DVISVGM_DVISVGMSPECIALHANDLER_H - -#include -#include -#include -#include "SpecialHandler.h" - -class InputReader; -struct SpecialActions; - -class DvisvgmSpecialHandler : public SpecialHandler, public DVIPreprocessingListener, public DVIEndPageListener -{ - typedef std::vector StringVector; - typedef std::map MacroMap; - - public: - DvisvgmSpecialHandler (); - const char* name () const {return "dvisvgm";} - const char* info () const {return "special set for embedding raw SVG snippets";} - const char** prefixes () const; - void preprocess (const char *prefix, std::istream &is, SpecialActions *actions); - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - - protected: - void preprocessRaw (InputReader &ir); - void preprocessRawDef (InputReader &ir); - void preprocessRawSet (InputReader &ir); - void preprocessEndRawSet (InputReader &ir); - void preprocessRawPut (InputReader &ir); - void processRaw (InputReader &ir, SpecialActions *actions); - void processRawDef (InputReader &ir, SpecialActions *actions); - void processRawSet (InputReader &ir, SpecialActions *actions); - void processEndRawSet (InputReader &ir, SpecialActions *actions); - void processRawPut (InputReader &ir, SpecialActions *actions); - void processBBox (InputReader &ir, SpecialActions *actions); - void processImg (InputReader &ir, SpecialActions *actions); - void dviPreprocessingFinished (); - void dviEndPage (unsigned pageno); - - private: - MacroMap _macros; - MacroMap::iterator _currentMacro; - int _nestingLevel; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.cpp deleted file mode 100644 index 3b8632599a3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* -** EPSFile.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "EPSFile.h" -#include "InputBuffer.h" -#include "InputReader.h" - -using namespace std; - - -/** Reads a little-endian 32-bit integer from the given input stream. */ -static UInt32 getUInt32 (istream &is) { - UInt32 value=0; - char buf[4]; - is.read(buf, 4); - for (int i=0; i < 4; i++) - value |= ((buf[i] & 255) << (8*i)); - return value; -} - - -static size_t getline (istream &is, char *line, size_t n) { - char buf[512]; - is.get(buf, min(n, (size_t)512)-1); - n = is.gcount(); - size_t linelen=0; - for (size_t i=0; i < n; i++) - if (isprint(buf[i])) - line[linelen++] = buf[i]; - line[linelen] = 0; - if (is.peek() == '\n') - is.get(); - else - is.ignore(numeric_limits::max(), '\n'); - return linelen; -} - - -EPSFile::EPSFile (const std::string& fname) : _ifs(fname.c_str(), ios::binary), _headerValid(false), _offset(0), _pslength(0) -{ - if (_ifs) { - if (getUInt32(_ifs) != 0xC6D3D0C5) // no binary header present? - _ifs.seekg(0); // go back to the first byte - else { - _offset = getUInt32(_ifs); // stream offset where PS part of the file begins - _pslength = getUInt32(_ifs); // length of PS section in bytes - _ifs.seekg(_offset); // continue reading at the beginning of the PS section - } - string str; - str += _ifs.get(); - str += _ifs.get(); - _headerValid = (str == "%!"); - _ifs.seekg(0); - } -} - - -/** Returns an input stream for the EPS file. The stream pointer is automatically moved - * to the beginning of the ASCII (PostScript) part of the file. */ -istream& EPSFile::istream () const { - _ifs.clear(); - _ifs.seekg(_offset); - return _ifs; -} - - -/** Extracts the bounding box information from the DSC header/footer (if present) - * @param[out] box the extracted bounding box - * @return true if %%BoundingBox data could be read successfully */ -bool EPSFile::bbox (BoundingBox &box) const { - std::istream &is = EPSFile::istream(); - if (is) { - char buf[64]; - while (is) { - size_t linelen = getline(is, buf, 64); - if (strncmp(buf, "%%BoundingBox:", 14) == 0) { - CharInputBuffer ib(buf, linelen); - BufferInputReader ir(ib); - ir.skip(14); - ir.skipSpace(); - if (!ir.check("(atend)", true)) { - int val[4]; - for (int i=0; i < 4; i++) { - ir.skipSpace(); - ir.parseInt(val[i]); - } - box = BoundingBox(val[0], val[1], val[2], val[3]); - return true; - } - } - } - } - return false; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.h deleted file mode 100644 index 24871103327..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSFile.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* -** EPSFile.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_EPSFILE_H -#define DVISVGM_EPSFILE_H - -#include -#include -#include "BoundingBox.h" -#include "types.h" - -class EPSFile -{ - public: - EPSFile (const std::string &fname); - std::istream& istream () const; - bool hasValidHeader () const {return _headerValid;} - bool bbox (BoundingBox &box) const; - UInt32 pslength () const {return _pslength;} - - private: - mutable std::ifstream _ifs; - bool _headerValid; ///< true if file has a valid header - UInt32 _offset; ///< stream offset where ASCII part of the file begins - UInt32 _pslength; ///< length of PS section (in bytes) -}; - -#endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.cpp deleted file mode 100644 index 555e3549760..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* -** EPSToSVG.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "EPSFile.h" -#include "EPSToSVG.h" -#include "Message.h" -#include "MessageException.h" -#include "PsSpecialHandler.h" -#include "SVGOutput.h" -#include "System.h" - - -using namespace std; - - -void EPSToSVG::convert () { -#ifndef HAVE_LIBGS - if (!Ghostscript().available()) - throw MessageException("Ghostscript is required to process the EPS file"); -#endif - EPSFile epsfile(_fname); - if (!epsfile.hasValidHeader()) - throw PSException("invalid EPS file"); - - BoundingBox bbox; - epsfile.bbox(bbox); - if (bbox.width() == 0 || bbox.height() == 0) - Message::wstream(true) << "bounding box of file " << _fname << " is empty\n"; - Message::mstream(false, Message::MC_PAGE_NUMBER) << "processing file " << _fname << '\n'; - Message::mstream().indent(1); - _svg.newPage(1); - // create a psfile special and forward it to the PsSpecialHandler - stringstream ss; - ss << "\"" << _fname << "\" " - "llx=" << bbox.minX() << " " - "lly=" << bbox.minY() << " " - "urx=" << bbox.maxX() << " " - "ury=" << bbox.maxY(); - PsSpecialHandler pshandler; - pshandler.process("psfile=", ss, this); - progress(0); - // output SVG file - _svg.setBBox(_bbox); - _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); - _svg.write(_out.getPageStream(1, 1)); - string svgfname = _out.filename(1, 1); - const double bp2pt = 72.27/72; - const double bp2mm = 25.4/72; - Message::mstream(false, Message::MC_PAGE_SIZE) << "graphic size: " << XMLString(bbox.width()*bp2pt) << "pt" - " x " << XMLString(bbox.height()*bp2pt) << "pt" - " (" << XMLString(bbox.width()*bp2mm) << "mm" - " x " << XMLString(bbox.height()*bp2mm) << "mm)\n"; - Message::mstream(false, Message::MC_PAGE_WRITTEN) << "graphic written to " << (svgfname.empty() ? "" : svgfname) << '\n'; -} - - -string EPSToSVG::getSVGFilename (unsigned pageno) const { - if (pageno == 1) - return _out.filename(1, 1); - return ""; -} - - -void EPSToSVG::progress (const char *id) { - static double time=0; - static bool draw=false; // show progress indicator? - static size_t count=0; - count++; - // don't show the progress indicator before the given time has elapsed - if (!draw && System::time()-time > PROGRESSBAR_DELAY) { - draw = true; - Terminal::cursor(false); - Message::mstream(false) << "\n"; - } - if (draw && ((System::time() - time > 0.05) || id == 0)) { - const size_t DIGITS=6; - Message::mstream(false, Message::MC_PROGRESS) - << string(DIGITS-min(DIGITS, static_cast(log10(count))), ' ') - << count << " PostScript instructions processed\r"; - // overprint indicator when finished - if (id == 0) { - Message::estream().clearline(); - Terminal::cursor(true); - } - time = System::time(); - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.h deleted file mode 100644 index 841ffe5d0a9..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EPSToSVG.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* -** EPSToSVG.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_EPSTOSVG_H -#define DVISVGM_EPSTOSVG_H - -#include -#include "SpecialActions.h" -#include "SVGTree.h" - -struct SVGOutputBase; - -class EPSToSVG : protected SpecialActions -{ - public: - EPSToSVG (const std::string &fname, SVGOutputBase &out) : _fname(fname), _out(out), _x(0), _y(0) {} - void convert (); - void setTransformation (const Matrix &m); - void setPageSize (const std::string &name); - - protected: - // implement abstract base class SpecialActions - double getX () const {return _x;} - double getY () const {return _y;} - void setX (double x) {_x = x; _svg.setX(x);} - void setY (double y) {_y = y; _svg.setY(y);} - void finishLine () {} - void setColor (const Color &color) {_svg.setColor(color);} - Color getColor () const {return _svg.getColor();} - void setMatrix (const Matrix &m) {_svg.setMatrix(m);} - const Matrix& getMatrix () const {return _svg.getMatrix();} - void getPageTransform (Matrix &matrix) const {} - void setBgColor (const Color &color) {} - void appendToPage (XMLNode *node) {_svg.appendToPage(node);} - void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} - void prependToPage (XMLNode *node) {_svg.prependToPage(node);} - void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} - void popContextElement () {_svg.popContextElement();} - void embed (const BoundingBox &bbox) {_bbox.embed(bbox);} - void embed (const DPair &p, double r=0) {if (r==0) _bbox.embed(p); else _bbox.embed(p, r);} - void progress (const char *id); - unsigned getCurrentPageNumber() const {return 0;} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} - std::string getSVGFilename (unsigned pageno) const; - - private: - std::string _fname; ///< name of EPS file - SVGTree _svg; - SVGOutputBase &_out; - double _x, _y; - BoundingBox _bbox; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.cpp deleted file mode 100644 index 994f46f7c4b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* -** EmSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "EmSpecialHandler.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "SpecialActions.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -EmSpecialHandler::EmSpecialHandler () : _linewidth(0.4*72/72.27), _actions(0) { -} - - -/** Computes the "cut vector" that is used to compute the line shape. - * Because each line has a width > 0 the actual shape of the line is a tetragon. - * The 4 vertices can be influenced by the cut parameter c that specifies - * a horizontal, vertical or orthogonal cut of a line end. Depending on c and the - * line's slope a cut vector v can be computed that, relatively to endpoint p, denotes - * the 2 vertices of that line end: v1=p+v and v2=p-v. - * @param[in] c cut direction ('h', 'v' or 'p') - * @param[in] v direction vector of line to be drawn - * @param[in] lw width of line to be drawn - * @return the "cut vector" */ -static DPair cut_vector (char c, const DPair &v, double lw) { - if (c == 'p') - return v.ortho()/v.length() * (lw/2); - DPair cut; - if (c == 'v' && v.x() != 0) { - double slope = v.y()/v.x(); - double h = sqrt(lw*lw*(1+slope*slope)); - cut.y(0.5*h); - } - else if (v.y() != 0) { // c == 'h' - double slope = v.x()/v.y(); - double h = sqrt(lw*lw*(1+slope*slope)); - double sgn = slope < 0 ? 1.0 : -1.0; - cut.x(0.5*h*sgn); - } - return cut; -} - - -/** Creates the SVG element that will a the line. - * @param[in] p1 first endpoint in PS point units - * @param[in] p2 second endpoint in PS point units - * @param[in] c1 cut method of first endpoint ('h', 'v' or 'p') - * @param[in] c2 cut method of second endpoint ('h', 'v' or 'p') - * @param[in] lw line width in PS point units - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, double lw, SpecialActions *actions) { - XMLElementNode *node=0; - DPair dir = p2-p1; - if (dir.x() == 0 || dir.y() == 0 || (c1 == 'p' && c2 == 'p')) { - // draw regular line - node = new XMLElementNode("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().rgbString()); - // update bounding box - actions->embed(p1); - actions->embed(p2); - } - else { - // draw polygon - 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; - node = new XMLElementNode("polygon"); - 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->addAttribute("points", oss.str()); - if (actions->getColor() != Color::BLACK) - node->addAttribute("fill", actions->getColor().rgbString()); - // update bounding box - actions->embed(q11); - actions->embed(q12); - actions->embed(q21); - actions->embed(q22); - } - actions->appendToPage(node); -} - - -static double read_length (InputReader &in) { - struct Unit { - const char *name; - double factor; - } - units[] = { - {"pt", 1.0}, - {"pc", 12.0}, - {"in", 72.27}, - {"bp", 72.27/72}, - {"cm", 72.27/2.54}, - {"mm", 72.27/25.4}, - {"dd", 1238.0/1157}, - {"cc", 1238.0/1157*12}, - {"sp", 1.0/65536}, - {0, 0} - }; - double len = in.getDouble(); - in.skipSpace(); - for (Unit *p=units; p->name; p++) - if (in.check(p->name)) { - len *= p->factor; - break; - } - return len*72/72.27; -} - - -bool EmSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - // em:moveto => move graphic cursor to dvi cursor - // em:lineto => draw line from graphic cursor to dvi cursor, move graphic cursor to dvi cursor - // em:linewidth => set line width to - // em:point [,[,]] => defines point as (,); if and/or is missing, - // the corresponding dvi cursor coordinate is inserted - // and are lengths - // em:line [h|v|p], [h|v|p] [,] => draws line of width from point # to point # - // point number suffixes: - // h: cut line horizontally - // v: cut line vertically - // p: cut line orthogonally to line direction (default) - // if is omitted, the global line width is used - // - // supported length units: pt, pc, in, bp, cm, mm, dd, cc, sp - // default line width: 0.4pt - - if (actions) { - _actions = actions; // save pointer to SpecialActions for later use in endPage - StreamInputBuffer ib(is, 128); - BufferInputReader in(ib); - string cmd = in.getWord(); - if (cmd == "moveto") - _pos = DPair(actions->getX(), actions->getY()); - else if (cmd == "lineto") { - DPair p(actions->getX(), actions->getY()); - create_line(_pos, p, 'p', 'p', _linewidth, actions); - _pos = p; - } - else if (cmd == "linewidth") - _linewidth = read_length(in); - else if (cmd == "point") { - DPair p(actions->getX(), actions->getY()); - int n = in.getInt(); - if (in.getPunct() == ',') { - p.x(in.getDouble()); - if (in.getPunct() == ',') - p.y(in.getDouble()); - } - _points[n] = p; - } - else if (cmd == "line") { - int n1 = in.getInt(); - int c1 = 'p'; - if (isalpha(in.peek())) - c1 = in.get(); - in.getPunct(); - int n2 = in.getInt(); - int c2 = 'p'; - if (isalpha(in.peek())) - c2 = in.get(); - double lw = _linewidth; - if (in.getPunct() == ',') - lw = read_length(in); - map::iterator it1=_points.find(n1); - map::iterator it2=_points.find(n2); - if (it1 != _points.end() && it2 != _points.end()) - create_line(it1->second, it2->second, char(c1), char(c2), lw, actions); - else { - // Line endpoints havn't necessarily to be defined before - // a line definition. If a point wasn't defined yet we push the line - // in a wait list and process the lines at the end of the page. - _lines.push_back(Line(n1, n2, char(c1), char(c2), lw)); - } - } - } - return true; -} - - -/** This method is called at the end of a DVI page. Here we have to draw all pending - * lines that are still in the line list. All line endpoints must be defined until here. */ -void EmSpecialHandler::dviEndPage (unsigned pageno) { - if (_actions) { - FORALL(_lines, list::iterator, it) { - map::iterator pit1=_points.find(it->p1); - map::iterator pit2=_points.find(it->p2); - if (pit1 != _points.end() && pit2 != _points.end()) - create_line(pit1->second, pit2->second, it->c1, it->c2, it->width, _actions); - // all lines with still undefined points are ignored - } - } - // line and point definitions are local to a page - _lines.clear(); - _points.clear(); -} - - -const char** EmSpecialHandler::prefixes () const { - static const char *pfx[] = {"em:", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.h deleted file mode 100644 index 7b3c78b6b24..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EmSpecialHandler.h +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* -** EmSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_EMSPECIALHANDLER_H -#define DVISVGM_EMSPECIALHANDLER_H - -#include -#include -#include "Pair.h" -#include "SpecialHandler.h" - - -class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener -{ - struct Line { - Line (int pp1, int pp2, char cc1, char cc2, double w) : p1(pp1), p2(pp2), c1(cc1), c2(cc2), width(w) {} - int p1, p2; ///< point numbers of line ends - char c1, c2; ///< cut type of line ends (h, v or p) - double width; ///< line width - }; - - public: - EmSpecialHandler (); - const char* name () const {return "em";} - const char* info () const {return "line drawing statements of the emTeX special set";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &in, SpecialActions *actions); - - protected: - void dviEndPage (unsigned pageno); - - private: - std::map _points; ///< points defined by special em:point - std::list _lines; ///< list of lines with undefined end points - double _linewidth; ///< global line width - DPair _pos; ///< current position of "graphic cursor" - SpecialActions *_actions; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.cpp deleted file mode 100644 index cc1b8151e14..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* -** EncFile.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "Font.h" -#include "EncFile.h" -#include "FontMap.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "FileFinder.h" -#include "Message.h" - -using namespace std; - -static string read_entry (InputReader &in); -static bool valid_name_char (int c); - - -EncFile::EncFile (const string &encname) : _encname(encname) -{ - read(); -} - - -const char* EncFile::path () const { - return FileFinder::lookup(_encname+".enc", false); -} - - -/** Search for suitable enc-file and read its encoding information. - * The file contents must be a valid PostScript vector with 256 entries. */ -void EncFile::read () { - if (const char *p = path()) { - ifstream ifs(p); - read(ifs); - } - else - Message::wstream(true) << "encoding file '" << _encname << ".enc' not found\n"; -} - - -/** Read encoding information from stream. */ -void EncFile::read (istream &is) { - StreamInputBuffer ib(is, 256); - BufferInputReader in(ib); - _table.resize(256); - - // find beginning of vector - while (!in.eof()) { - in.skipSpace(); - if (in.peek() == '%') - in.skipUntil("\n"); - else - if (in.get() == '[') - break; - } - - // read vector entries - int n=0; - while (!in.eof()) { - in.skipSpace(); - if (in.peek() == '%') - in.skipUntil("\n"); - else if (in.peek() == ']') { - in.get(); - break; - } - else { - string entry = read_entry(in); - if (entry == ".notdef") - entry.clear(); - if (n < 256) - _table[n++] = entry; - } - } - // remove trailing .notdef names - for (n--; n > 0 && _table[n].empty(); n--); - _table.resize(n+1); -} - - -static string read_entry (InputReader &in) { - string entry; - bool accept_slashes=true; - while (!in.eof() && ((in.peek() == '/' && accept_slashes) || valid_name_char(in.peek()))) { - if (in.peek() != '/') - accept_slashes = false; - entry += in.get(); - } - if (entry.length() > 1) { - // strip leading slashes - // According to the PostScript specification, a single slash without further - // following characters is a valid name. - size_t n=0; - while (n < entry.length() && entry[n] == '/') - n++; - entry = entry.substr(n); - } - return entry; -} - - -static bool valid_name_char (int c) { - const char *delimiters = "<>(){}[]/~%"; - return isprint(c) && !isspace(c) && !strchr(delimiters, c); -} - - -/** Returns an entry of the encoding table. - * @param[in] c character code - * @return character name assigned to character code c*/ -const char* EncFile::charName (UInt32 c) const { - if (c < _table.size()) - return !_table[c].empty() ? _table[c].c_str() : 0; - return 0; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.h deleted file mode 100644 index 249db961054..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/EncFile.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -** EncFile.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_ENCFILE_H -#define DVISVGM_ENCFILE_H - -#include -#include -#include -#include -#include "FontEncoding.h" -#include "types.h" - - -class EncFile : public NamedFontEncoding -{ - public: - EncFile (const std::string &name); - void read (); - void read (std::istream &is); - int size () const {return _table.size();} - const char* name () const {return _encname.c_str();} - const char* charName (UInt32 c) const; - Character decode (UInt32 c) const {return Character(charName(c));} - bool mapsToCharIndex () const {return false;} - const char* path () const; - - private: - std::string _encname; - std::vector _table; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.cpp deleted file mode 100644 index 2418c8fb786..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/************************************************************************* -** FileFinder.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include - -#ifdef MIKTEX - #include "MessageException.h" - #include "MiKTeXCom.h" - static MiKTeXCom *miktex=0; -#else - #ifdef KPSE_CXX_UNSAFE - extern "C" { - #endif - #include - #ifdef KPSE_CXX_UNSAFE - } - #endif -#endif - -#include -#include -#include -#include -#include "FileFinder.h" -#include "FileSystem.h" -#include "FontMap.h" -#include "Message.h" -#include "Process.h" - -// --------------------------------------------------- - -static bool _initialized = false; -static bool _mktex_enabled = false; - -// --------------------------------------------------- - -static const char* find_file (const std::string &fname, const char *ftype); -static const char* find_mapped_file (std::string fname); -static const char* mktex (const std::string &fname); - - -/** Initializes the file finder. This function must be called before any other - * FileFinder function. - * @param[in] argv0 argv[0] of main() function - * @param[in] progname name of application using the FileFinder - * @param[in] enable_mktexmf if true, tfm and mf file generation is activated */ -void FileFinder::init (const char *argv0, const char *progname, bool enable_mktexmf) { - if (_initialized) - return; - - _mktex_enabled = enable_mktexmf; -#ifdef MIKTEX - miktex = new MiKTeXCom; -#else - kpse_set_program_name(argv0, progname); - // enable tfm and mf generation (actually invoked by calls of kpse_make_tex) - kpse_set_program_enabled(kpse_tfm_format, 1, kpse_src_env); - kpse_set_program_enabled(kpse_mf_format, 1, kpse_src_env); - kpse_make_tex_discard_errors = true; // suppress messages from mktexFOO tools -#ifdef TEXLIVEWIN32 - texlive_gs_init(); -#endif -#endif - _initialized = true; -} - - -/** Cleans up the FileFinder. This function must be called before leaving the - * application's main() function. */ -void FileFinder::finish () { -#ifdef MIKTEX - if (miktex) { - delete miktex; - miktex = 0; - } -#endif - _initialized = false; -} - - -/** Returns the version string of the underlying file searching library (kpathsea, MiKTeX) */ -std::string FileFinder::version () { -#ifdef MIKTEX - bool autoinit=false; - try { - if (!_initialized) { - init("", "", false); - autoinit = true; - } - std::string ret = miktex->getVersion(); - if (autoinit) - finish(); - return ret; - } - catch (MessageException &e) { - if (autoinit) - finish(); - } -#else - if (const char *v = strrchr(KPSEVERSION, ' ')) - return v+1; -#endif - return "unknown"; -} - - -/** Determines filetype by the filename extension and calls kpse_find_file - * to actually look up the file. - * @param[in] fname name of file to look up - * @param[in] ftype expected file format of file fname; if 0, it's derived from the filename suffix - * @return file path on success, 0 otherwise */ -static const char* find_file (const std::string &fname, const char *ftype) { - if (!_initialized || fname.empty()) - return 0; - - std::string ext; - if (ftype) - ext = ftype; - else { - size_t pos = fname.rfind('.'); - if (pos == std::string::npos) - return 0; // no extension and no file type => no search - ext = fname.substr(pos+1); - } - - static std::string buf; -#ifdef MIKTEX - if (ext == "dll" || ext == "exe") { - // lookup dll and exe files in the MiKTeX bin directory first - buf = miktex->getBinDir() + "/" + fname; - if (FileSystem::exists(buf.c_str())) - return buf.c_str(); - } - else if (ext == "cmap") { - // The MiKTeX SDK doesn't support the lookup of files without suffix (yet), thus - // it's not possible to find cmap files which usually don't have a suffix. In order - // to work around this, we try to lookup the files by calling kpsewhich. - Process process("kpsewhich", std::string("-format=cmap ")+fname); - process.run(&buf); - return buf.empty() ? 0 : buf.c_str(); - } - try { - return miktex->findFile(fname.c_str()); - } - catch (const MessageException &e) { - return 0; - } -#else -#ifdef TEXLIVEWIN32 - if (ext == "exe") { - // lookup exe files in directory where dvisvgm is located - if (const char *path = kpse_var_value("SELFAUTOLOC")) { - buf = std::string(path) + "/" + fname; - return FileSystem::exists(buf.c_str()) ? buf.c_str() : 0; - } - return 0; - } -#endif - static std::map types; - if (types.empty()) { - types["tfm"] = kpse_tfm_format; - types["pfb"] = kpse_type1_format; - types["vf"] = kpse_vf_format; - types["mf"] = kpse_mf_format; - types["ttc"] = kpse_truetype_format; - types["ttf"] = kpse_truetype_format; - types["otf"] = kpse_opentype_format; - types["map"] = kpse_fontmap_format; - types["cmap"] = kpse_cmap_format; - types["sty"] = kpse_tex_format; - types["enc"] = kpse_enc_format; - types["pro"] = kpse_tex_ps_header_format; - types["sfd"] = kpse_sfd_format; - } - std::map::iterator it = types.find(ext.c_str()); - if (it == types.end()) - return 0; - - if (char *path = kpse_find_file(fname.c_str(), it->second, 0)) { - // In the current version of libkpathsea, each call of kpse_find_file produces - // a memory leak since the path buffer is not freed. I don't think we can do - // anything against it here... - buf = path; - std::free(path); - return buf.c_str(); - } - return 0; -#endif -} - - -/** Checks whether the given file is mapped to a different name and if the - * file can be found under this name. - * @param[in] fname name of file to look up - * @return file path on success, 0 otherwise */ -static const char* find_mapped_file (std::string fname) { - size_t pos = fname.rfind('.'); - if (pos == std::string::npos) - return 0; - const std::string ext = fname.substr(pos+1); // file extension - const std::string base = fname.substr(0, pos); - if (const FontMap::Entry *entry = FontMap::instance().lookup(base)) { - const char *path=0; - if (entry->fontname.find('.') != std::string::npos) // does the mapped filename has an extension? - path = find_file(entry->fontname, 0); // look for that file - else { // otherwise, use extension of unmapped file - fname = entry->fontname + "." + ext; - (path = find_file(fname, 0)) || (path = mktex(fname)); - } - return path; - } - return 0; -} - - -/** Runs external mktexFOO tool to create missing tfm or mf file. - * @param[in] fname name of file to build - * @return file path on success, 0 otherwise */ -static const char* mktex (const std::string &fname) { - if (!_initialized) - return 0; - - size_t pos = fname.rfind('.'); - if (!_mktex_enabled || pos == std::string::npos) - return 0; - - std::string ext = fname.substr(pos+1); // file extension - if (ext != "tfm" && ext != "mf") - return 0; - - const char *path = 0; -#ifdef MIKTEX - // maketfm and makemf are located in miktex/bin which is in the search PATH - std::string toolname = (ext == "tfm" ? "miktex-maketfm" : "miktex-makemf"); - system((toolname+".exe "+fname).c_str()); - path = find_file(fname, 0); -#else - kpse_file_format_type type = (ext == "tfm" ? kpse_tfm_format : kpse_mf_format); - path = kpse_make_tex(type, fname.c_str()); -#endif - return path; -} - - -/** Searches a file in the TeX directory tree. - * If the file doesn't exist, maximal two further steps are applied - * (if "extended" is true): - * - checks whether the filename is mapped to a different name and returns - * the path to that name - * - in case of tfm or mf files: invokes the external mktextfm/mktexmf tool - * to create the missing file - * @param[in] fname name of file to look up - * @param[in] ftype type/format of file to look up - * @param[in] extended if true, use fontmap lookup and mktexFOO calls - * @return path to file on success, 0 otherwise */ -const char* FileFinder::lookup (const std::string &fname, const char *ftype, bool extended) { - const char *path; - if ((path = find_file(fname, ftype)) || (extended && ((path = find_mapped_file(fname)) || (path = mktex(fname))))) - return path; - return 0; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.h deleted file mode 100644 index 6727bd3e81d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileFinder.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* -** FileFinder.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_KPSFILEFINDER_H -#define DVISVGM_KPSFILEFINDER_H - -#include - -struct FileFinder -{ - static void init (const char *argv0, const char *progname, bool enable_mktexmf); - static void finish (); - static std::string version (); - static const char* lookup (const std::string &fname, const char *ftype, bool extended=true); - static const char* lookup (const std::string &fname, bool extended=true) {return lookup(fname, 0, extended);} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.cpp deleted file mode 100644 index fc8430145f5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************* -** FilePath.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "FilePath.h" -#include "FileSystem.h" -#include "MessageException.h" -#include "macros.h" - -using namespace std; - - -/** Removes redundant slashes from a given path. */ -static string& single_slashes (string &str) { - size_t pos=0; - while ((pos = str.find("//", pos)) != string::npos) - str.replace(pos, 2, "/"); - return str; -} - - -#ifdef __WIN32__ -static char strip_drive_letter (string &path) { - char letter = 0; - if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) { - letter = tolower(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) + ":").c_str())) { - path.insert(0, FileSystem::getcwd()+"/"); - strip_drive_letter(path); - } - else - throw MessageException("drive " + string(1, target_drive) + ": not accessible"); - } - } - } - return target_drive; -} - - -static void tolower (string &str) { - for (size_t i=0; i < str.length(); ++i) - str[i] = tolower(str[i]); -} -#endif - - -/** Constructs a FilePath object from a given path. Relative paths are - * relative to the current working directory. - * @param[in] path absolute or relative path to a file or directory */ -FilePath::FilePath (const string &path) { - init(path, !FileSystem::isDirectory(path.c_str()), FileSystem::getcwd()); -} - - -/** Constructs a FilePath object. - * @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 - * @param[in] current_dir if 'path' is a relative path expression it will be related to 'current_dir' */ -FilePath::FilePath (const string &path, bool isfile, string current_dir) { - init(path, isfile, current_dir); -} - - -/** Initializes a FilePath object. This method should be called by the constructors only. - * @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 - * @param[in] current_dir if 'path' is a relative path expression it will be related to 'current_dir' */ -void FilePath::init (string path, bool isfile, string current_dir) { - single_slashes(path); - single_slashes(current_dir); -#ifdef __WIN32__ - tolower(path); - path = FileSystem::adaptPathSeperators(path); - _drive = strip_drive_letter(path); -#endif - if (isfile) { - size_t pos = path.rfind('/'); - _fname = path.substr((pos == string::npos) ? 0 : pos+1); - if (pos != string::npos) - path.erase(pos); - else - path.clear(); - } - if (current_dir.empty()) - current_dir = FileSystem::getcwd(); -#ifdef __WIN32__ - tolower(current_dir); - _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 + "/"); - string elem; - FORALL (path, string::const_iterator, it) { - if (*it == '/') { - add(elem); - elem.clear(); - } - else - elem += *it; - } - add(elem); -} - - -/** Adds a location step to the current path. */ -void FilePath::add (const string &dir) { - if (dir == ".." && !_dirs.empty()) - _dirs.pop_back(); - else if (dir.length() > 0 && dir != ".") - _dirs.push_back(dir); -} - - -/** Returns the suffix of the filename. If FilePath represents the - * location of a directory (and not of a file) an empty string - * is returned. */ -string FilePath::suffix () const { - size_t start = 0; - // ignore leading dots - while (start < _fname.length() && _fname[start] == '.') - start++; - string sub = _fname.substr(start); - size_t pos = sub.rfind('.'); - if (pos != string::npos && pos < sub.length()-1) - return sub.substr(pos+1); - return ""; -} - - -/** Changes the suffix of the filename. If FilePath represents the - * location of a directory (and not of a file) nothing happens. - * @param[in] s new suffix */ -void FilePath::suffix (const string &s) { - if (!_fname.empty()) { - string current_suffix = suffix(); - if (!current_suffix.empty()) - _fname.erase(_fname.length()-current_suffix.length()-1); - _fname += "."+s; - } -} - - -/** Returns the filename without suffix. - * Example: FilePath("/a/b/c.def", true) == "c" */ -string FilePath::basename () const { - if (!_fname.empty()) { - size_t len = suffix().length(); - if (len > 0) - len++; // strip dot too - return _fname.substr(0, _fname.length()-len); - } - return ""; -} - - -/** Returns the absolute path string of this FilePath. - * @param[in] with_filename if false, the filename is omitted - * @return the absolute path string */ -string FilePath::absolute (bool with_filename) const { - string path; - FORALL (_dirs, ConstIterator, it) { - path += "/" + *it; - } - 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); -} - - -/** Returns a path string of this FilePath relative to reldir. If we wanted to - * navigate from /a/b/c/d to /a/b/e/f using the shell command "cd", we could do that - * with the relative path argument: "cd ../../e/f". This function returns such a relative - * path. Example: FilePath("/a/b/e/f").relative("/a/b/c/d") => "../../e/f". - * @param[in] reldir absolute path to a directory - * @param[in] with_filename if false, the filename is omitted - * @return the relative path string */ -string FilePath::relative (string reldir, bool with_filename) const { - if (reldir.empty()) - reldir = FileSystem::getcwd(); -#ifdef __WIN32__ - adapt_current_path(reldir, _drive); -#endif - if (reldir[0] != '/') - return absolute(); - FilePath rel(reldir, false); - string path; -#ifdef __WIN32__ - if (rel._drive && _drive && rel._drive != _drive) - path += string(1, _drive) + ":"; -#endif - ConstIterator i = _dirs.begin(); - ConstIterator j = rel._dirs.begin(); - while (i != _dirs.end() && j != rel._dirs.end() && *i == *j) - ++i, ++j; - for (; j != rel._dirs.end(); ++j) - path += "../"; - for (; i != _dirs.end(); ++i) - path += *i + "/"; - if (!path.empty()) - path.erase(path.length()-1, 1); // remove trailing slash - if (with_filename && !_fname.empty()) { - if (!path.empty() && path != "/") - path += "/"; - path += _fname; - } - if (path.empty()) - path = "."; - return single_slashes(path); -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.h deleted file mode 100644 index 005d9ecc66e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FilePath.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* -** FilePath.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FILEPATH_H -#define DVISVGM_FILEPATH_H - -#include -#include - -class FilePath -{ - typedef std::vector Directories; - typedef Directories::iterator Iterator; - typedef Directories::const_iterator ConstIterator; - public: - FilePath (const std::string &path); - FilePath (const std::string &path, bool isfile, std::string current_dir=""); - std::string absolute (bool with_filename=true) const; - std::string relative (std::string reldir="", bool with_filename=true) const; - std::string basename () const; - std::string suffix () const; - void suffix (const std::string &s); - size_t depth () const {return _dirs.size();} - bool isFile () const {return !_fname.empty();} - bool empty () const {return _dirs.empty() && _fname.empty();} - const std::string& filename () const {return _fname;} - void filename (const std::string &fname) {_fname = fname;} - - protected: - void init (std::string path, bool isfile, std::string current_dir); - void add (const std::string &elem); - - private: - Directories _dirs; - std::string _fname; -#ifdef __WIN32__ - char _drive; -#endif -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.cpp deleted file mode 100644 index a0c93177ac8..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/************************************************************************* -** FileSystem.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "FileSystem.h" -#include "macros.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - - -using namespace std; - -#ifdef __WIN32__ - #include - #include - const char *FileSystem::DEVNULL = "nul"; - const char FileSystem::PATHSEP = '\\'; - #define unlink _unlink -#else - #include - #include - #include - #include - const char *FileSystem::DEVNULL = "/dev/null"; - const char FileSystem::PATHSEP = '/'; -#endif - - -bool FileSystem::remove (const string &fname) { - return unlink(fname.c_str()) == 0; -} - - -/** Copies a file. - * @param[in] src path of file to copy - * @param[in] dest path of target file - * @param[in] remove_src remove file 'src' if true - * @return true on success */ -bool FileSystem::copy (const string &src, const string &dest, bool remove_src) { - ifstream ifs(src.c_str(), ios::in|ios::binary); - ofstream ofs(dest.c_str(), ios::out|ios::binary); - if (ifs && ofs) { - ofs << ifs.rdbuf(); - if (!ifs.fail() && !ofs.fail() && remove_src) { - ofs.close(); - ifs.close(); - return remove(src); - } - else - return !remove_src; - } - return false; -} - - -bool FileSystem::rename (const string &oldname, const string &newname) { - return ::rename(oldname.c_str(), newname.c_str()) == 0; -} - - -UInt64 FileSystem::filesize (const string &fname) { -#ifdef __WIN32__ - // unfortunately, stat doesn't work properly under Windows - // so we have to use this freaky code - WIN32_FILE_ATTRIBUTE_DATA attr; - GetFileAttributesExA(fname.c_str(), GetFileExInfoStandard, &attr); - return (static_cast(attr.nFileSizeHigh) << (8*sizeof(attr.nFileSizeLow))) | attr.nFileSizeLow; -#else - struct stat attr; - return (stat(fname.c_str(), &attr) == 0) ? attr.st_size : 0; -#endif -} - - -string FileSystem::adaptPathSeperators (string path) { - for (size_t i=0; i < path.length(); i++) - if (path[i] == PATHSEP) - path[i] = '/'; - return path; -} - - -string FileSystem::getcwd () { - char buf[1024]; -#ifdef __WIN32__ - return adaptPathSeperators(_getcwd(buf, 1024)); -#else - return ::getcwd(buf, 1024); -#endif -} - - -/** Changes the work directory. - * @param[in] dir path to new work directory - * @return true on success */ -bool FileSystem::chdir (const char *dir) { - bool success = false; - if (dir) { -#ifdef __WIN32__ - success = (_chdir(dir) == 0); -#else - success = (chdir(dir) == 0); -#endif - } - return success; -} - - -/** Returns the user's home directory. */ -const char* FileSystem::userdir () { -#ifdef __WIN32__ - const char *drive=getenv("HOMEDRIVE"); - const char *path=getenv("HOMEPATH"); - if (drive && path) { - static string ret = string(drive)+path; - if (!ret.empty()) - return ret.c_str(); - } - return 0; -#else - const char *dir=getenv("HOME"); - if (!dir) { - if (const char *user=getenv("USER")) { - if (struct passwd *pw=getpwnam(user)) - dir = pw->pw_dir; - } - } - return dir; -#endif -} - - -/** Private wrapper function for mkdir: creates a single folder. - * @param[in] dir folder name - * @return true on success */ -static bool s_mkdir (const char *dir) { - bool success = true; - if (!FileSystem::exists(dir)) { -#ifdef __WIN32__ - success = (_mkdir(dir) == 0); -#else - success = (mkdir(dir, 0776) == 0); -#endif - } - return success; -} - - -static bool inline s_rmdir (const char *dir) { -#ifdef __WIN32__ - return (_rmdir(dir) == 0); -#else - return (rmdir(dir) == 0); -#endif -} - - -/** Removes leading and trailing whitespace from a string. */ -static string trim (const string &str) { - int first=0, last=str.length()-1; - while (isspace(str[first])) - first++; - while (isspace(str[last])) - last--; - return str.substr(first, last-first+1); -} - - -/** Creates a new folder relative to the current work directory. If necessary, - * the parent folders are also created. - * @param[in] dir single folder name or path to folder - * @return true if folder(s) could be created */ -bool FileSystem::mkdir (const char *dir) { - bool success = false; - if (dir) { - success = true; - const string dirstr = adaptPathSeperators(trim(dir)); - for (size_t pos=1; success && (pos = dirstr.find('/', pos)) != string::npos; pos++) - success &= s_mkdir(dirstr.substr(0, pos).c_str()); - success &= s_mkdir(dirstr.c_str()); - } - return success; -} - - -/** Removes a directory and its contents. - * @param[in] dirname path to directory - * @return true on success */ -bool FileSystem::rmdir (const char *dirname) { - bool ok = false; - if (dirname && isDirectory(dirname)) { - ok = true; -#ifdef __WIN32__ - string pattern = string(dirname) + "/*"; - WIN32_FIND_DATA data; - HANDLE h = FindFirstFile(pattern.c_str(), &data); - bool ready = (h == INVALID_HANDLE_VALUE); - while (!ready && ok) { - const char *fname = data.cFileName; - string path = string(dirname) + "/" + fname; - if (isDirectory(path.c_str())) { - if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) - ok = rmdir(path.c_str()) && s_rmdir(path.c_str()); - } - else if (isFile(path.c_str())) - ok = remove(path); - else - ok = false; - ready = !FindNextFile(h, &data); - } - FindClose(h); -#else - if (DIR *dir = opendir(dirname)) { - struct dirent *ent; - while ((ent = readdir(dir)) && ok) { - const char *fname = ent->d_name; - string path = string(fname) + "/" + fname; - if (isDirectory(path.c_str())) { - if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) - ok = rmdir(path.c_str()) && s_rmdir(path.c_str()); - } - else if (isFile(path.c_str())) - ok = remove(path); - else - ok = false; - } - closedir(dir); - } -#endif - ok = s_rmdir(dirname); - } - return ok; -} - - -/** Checks if a file or directory exits. */ -bool FileSystem::exists (const char *fname) { - if (!fname) - return false; -#ifdef __WIN32__ - return GetFileAttributes(fname) != INVALID_FILE_ATTRIBUTES; -#else - struct stat attr; - return stat(fname, &attr) == 0; -#endif -} - - -/** Returns true if 'fname' references a directory. */ -bool FileSystem::isDirectory (const char *fname) { - if (!fname) - return false; -#ifdef __WIN32__ - return GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY; -#else - struct stat attr; - return stat(fname, &attr) == 0 && S_ISDIR(attr.st_mode); -#endif -} - - -/** Returns true if 'fname' references a file. */ -bool FileSystem::isFile (const char *fname) { - if (!fname) - return false; -#ifdef __WIN32__ - ifstream ifs(fname); - return (bool)ifs; -#else - struct stat attr; - return stat(fname, &attr) == 0 && S_ISREG(attr.st_mode); -#endif -} - - -int FileSystem::collect (const char *dirname, vector &entries) { - entries.clear(); -#ifdef __WIN32__ - string pattern = string(dirname) + "/*"; - WIN32_FIND_DATA data; - HANDLE h = FindFirstFile(pattern.c_str(), &data); - bool ready = (h == INVALID_HANDLE_VALUE); - while (!ready) { - string fname = data.cFileName; - string path = string(dirname)+"/"+fname; - string typechar = isFile(path.c_str()) ? "f" : isDirectory(path.c_str()) ? "d" : "?"; - if (fname != "." && fname != "..") - entries.push_back(typechar+fname); - ready = !FindNextFile(h, &data); - } - FindClose(h); -#else - if (DIR *dir = opendir(dirname)) { - struct dirent *ent; - while ((ent = readdir(dir))) { - string fname = ent->d_name; - string path = string(dirname)+"/"+fname; - string typechar = isFile(path.c_str()) ? "f" : isDirectory(path.c_str()) ? "d" : "?"; - if (fname != "." && fname != "..") - entries.push_back(typechar+fname); - } - closedir(dir); - } -#endif - return entries.size(); -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.h deleted file mode 100644 index d14454262ac..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FileSystem.h +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* -** FileSystem.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FILESYSTEM_H -#define DVISVGM_FILESYSTEM_H - -#include -#include -#include "types.h" - -struct FileSystem -{ - static bool remove (const std::string &fname); - static bool rename (const std::string &oldname, const std::string &newname); - static bool copy (const std::string &src, const std::string &dest, bool remove_src=false); - static UInt64 filesize (const std::string &fname); - static std::string adaptPathSeperators (std::string path); - static std::string getcwd (); - static bool chdir (const char *dir); - static bool exists (const char *file); - static bool mkdir (const char *dir); - static bool rmdir (const char *fname); - static int collect (const char *dirname, std::vector &entries); - static bool isDirectory (const char *fname); - static bool isFile (const char *fname); - static const char* userdir (); - static const char* DEVNULL; - static const char PATHSEP; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.cpp deleted file mode 100644 index d09f3c7d334..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/************************************************************************* -** Font.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "CMap.h" -#include "FileFinder.h" -#include "FileSystem.h" -#include "Font.h" -#include "FontEncoding.h" -#include "FontEngine.h" -#include "GFGlyphTracer.h" -#include "Glyph.h" -#include "Message.h" -#include "MetafontWrapper.h" -#include "TFM.h" -#include "VFReader.h" -#include "SignalHandler.h" -#include "Subfont.h" -#include "SVGTree.h" -#include "Unicode.h" -#include "macros.h" - - -using namespace std; - - -UInt32 Font::unicode (UInt32 c) const { - return Unicode::charToCodepoint(c); -} - - -/** Returns the encoding object of this font which is asigned in a map file. - * If there's no encoding assigned, the function returns 0. */ -const FontEncoding* Font::encoding () const { - if (const FontMap::Entry *entry = fontMapEntry()) - return FontEncoding::encoding(entry->encname); - return 0; -} - - -const FontMap::Entry* Font::fontMapEntry () const { - string fontname = name(); - size_t pos = fontname.rfind('.'); - if (pos != string::npos) - fontname = fontname.substr(0, pos); // strip extension - return FontMap::instance().lookup(fontname); -} - - -/** Compute the extents of a given glyph. - * @param[in] c character code of glyph - * @param[in] vertical true if is glyph is part of vertical aligned text - * @param[out] metrics the resulting extents */ -void Font::getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const { - double s = scaleFactor(); - if (vertical) { // get metrics for vertical text flow? - if (verticalLayout()) { // is the font designed for vertical texts? - metrics.wl = s*charDepth(c); - metrics.wr = s*charHeight(c); - metrics.h = 0; - metrics.d = s*charWidth(c); - } - else { // rotate box by 90 degrees for alphabetic text - metrics.wl = s*charDepth(c); - metrics.wr = s*charHeight(c); - metrics.h = 0; - metrics.d = s*(charWidth(c)+italicCorr(c)); - } - } - else { - metrics.wl = 0; - metrics.wr = s*(charWidth(c)+italicCorr(c)); - metrics.h = s*charHeight(c); - metrics.d = s*charDepth(c); - } -} - - -const char* Font::filename () const { - const char *fname = strrchr(path(), '/'); - if (fname) - return fname+1; - return path(); -} - -/////////////////////////////////////////////////////////////////////////////////////// - -TFMFont::TFMFont (string name, UInt32 cs, double ds, double ss) - : _metrics(0), _fontname(name), _checksum(cs), _dsize(ds), _ssize(ss) -{ -} - - -TFMFont::~TFMFont () { - delete _metrics; -} - - -/** Returns a font metrics object for the current font. - * @throw FontException if TFM file can't be found */ -const FontMetrics* TFMFont::getMetrics () const { - if (!_metrics) { - try { - _metrics = FontMetrics::read(_fontname.c_str()); - if (!_metrics) { - _metrics = new NullFontMetric; - Message::wstream(true) << "can't find "+_fontname+".tfm\n"; - } - } - catch (FontMetricException &e) { - _metrics = new NullFontMetric; - Message::wstream(true) << e.what() << " in " << _fontname << ".tfm\n"; - } - } - return _metrics; -} - - -double TFMFont::charWidth (int c) const { - double w = getMetrics() ? getMetrics()->getCharWidth(c) : 0; - if (style()) { - w *= style()->extend; - w += fabs(style()->slant*charHeight(c)); // slant := tan(phi) = dx/height - } - return w; -} - - -double TFMFont::italicCorr (int c) const { - double w = getMetrics() ? getMetrics()->getItalicCorr(c) : 0; - if (style()) - w *= style()->extend; - return w; -} - - -double TFMFont::charDepth (int c) const {return getMetrics() ? getMetrics()->getCharDepth(c) : 0;} -double TFMFont::charHeight (int c) const {return getMetrics() ? getMetrics()->getCharHeight(c) : 0;} - - -/** Tests if the checksum of the font matches that of the corresponding TFM file. */ -bool TFMFont::verifyChecksums () const { - if (_checksum != 0 && getMetrics() && getMetrics()->getChecksum() != 0) - return _checksum == getMetrics()->getChecksum(); - return true; -} - -////////////////////////////////////////////////////////////////////////////// - -// static class variables -bool PhysicalFont::EXACT_BBOX = false; -bool PhysicalFont::KEEP_TEMP_FILES = false; -const char *PhysicalFont::CACHE_PATH = 0; -double PhysicalFont::METAFONT_MAG = 4; -FontCache PhysicalFont::_cache; - - -Font* PhysicalFont::create (string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type) { - return new PhysicalFontImpl(name, 0, checksum, dsize, ssize, type); -} - - -Font* PhysicalFont::create (string name, int fontindex, UInt32 checksum, double dsize, double ssize) { - return new PhysicalFontImpl(name, fontindex, checksum, dsize, ssize, PhysicalFont::TTC); -} - - -const char* PhysicalFont::path () const { - const char *ext=0; - switch (type()) { - case OTF: ext = "otf"; break; - case PFB: ext = "pfb"; break; - case TTC: ext = "ttc"; break; - case TTF: ext = "ttf"; break; - case MF : ext = "mf"; break; - default : ext = 0; - } - if (ext) - return FileFinder::lookup(name()+"."+ext); - return FileFinder::lookup(name()); -} - - -/** Returns true if this font is CID-based. */ -bool PhysicalFont::isCIDFont () const { - if (type() == MF) - return false; - FontEngine::instance().setFont(*this); - return FontEngine::instance().isCIDFont(); -} - - -/** Retrieve the IDs of all charachter maps available in the font file. - * @param[out] charMapIDs IDs of the found character maps - * @return number of found character maps */ -int PhysicalFont::collectCharMapIDs (std::vector &charMapIDs) const { - if (type() == MF) - return 0; - FontEngine::instance().setFont(*this); - return FontEngine::instance().getCharMapIDs(charMapIDs); -} - - -/** Decodes a character code used in the DVI file to the code required to - * address the correct character in the font. - * @param[in] c DVI character to decode - * @return target character code or name */ -Character PhysicalFont::decodeChar (UInt32 c) const { - if (const FontEncoding *enc = encoding()) - return enc->decode(c); - return Character(Character::CHRCODE, c); -} - - -/** Returns the number of units per EM. The EM square is the virtual area a glyph is designed on. - * All coordinates used to specify portions of the glyph are relative to the origin (0,0) at the - * lower left corner of this square, while the upper right corner is located at (m,m), where m - * is an integer value defined with the font, and returned by this function. */ -int PhysicalFont::unitsPerEm() const { - if (type() == MF) - return 1000; - FontEngine::instance().setFont(*this); - return FontEngine::instance().getUnitsPerEM(); -} - - -int PhysicalFont::hAdvance () const { - if (type() == MF) - return 0; - FontEngine::instance().setFont(*this); - return FontEngine::instance().getHAdvance(); -} - - -double PhysicalFont::hAdvance (int c) const { - if (type() == MF) - return unitsPerEm()*charWidth(c)/designSize(); - FontEngine::instance().setFont(*this); - if (const FontMap::Entry *entry = fontMapEntry()) - if (Subfont *sf = entry->subfont) - c = sf->decode(c); - return FontEngine::instance().getHAdvance(decodeChar(c)); -} - - -double PhysicalFont::vAdvance (int c) const { - if (type() == MF) - return unitsPerEm()*charWidth(c)/designSize(); - FontEngine::instance().setFont(*this); - if (const FontMap::Entry *entry = fontMapEntry()) - if (Subfont *sf = entry->subfont) - c = sf->decode(c); - return FontEngine::instance().getVAdvance(decodeChar(c)); -} - - -string PhysicalFont::glyphName (int c) const { - if (type() == MF) - return ""; - FontEngine::instance().setFont(*this); - if (const FontMap::Entry *entry = fontMapEntry()) - if (Subfont *sf = entry->subfont) - c = sf->decode(c); - return FontEngine::instance().getGlyphName(decodeChar(c)); -} - - -double PhysicalFont::scaledAscent() const { - return ascent()*scaledSize()/unitsPerEm(); -} - - -int PhysicalFont::ascent () const { - if (type() == MF) - return 0; - FontEngine::instance().setFont(*this); - return FontEngine::instance().getAscender(); -} - - -int PhysicalFont::descent () const { - if (type() == MF) - return 0; - FontEngine::instance().setFont(*this); - return FontEngine::instance().getDescender(); -} - - -/** Extracts the glyph outlines of a given character. - * @param[in] c character code of requested glyph - * @param[out] glyph path segments of the glyph outline - * @param[in] cb optional callback object for tracer class - * @return true if outline could be computed */ -bool PhysicalFont::getGlyph (int c, GraphicPath &glyph, GFGlyphTracer::Callback *cb) const { - if (type() == MF) { - const Glyph *cached_glyph=0; - if (CACHE_PATH) { - _cache.write(CACHE_PATH); - _cache.read(name().c_str(), CACHE_PATH); - cached_glyph = _cache.getGlyph(c); - } - if (cached_glyph) { - glyph = *cached_glyph; - return true; - } - else { - string gfname; - if (createGF(gfname)) { - try { - double ds = getMetrics() ? getMetrics()->getDesignSize() : 1; - GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb); - tracer.setGlyph(glyph); - tracer.executeChar(c); - glyph.closeOpenSubPaths(); - if (CACHE_PATH) - _cache.setGlyph(c, glyph); - return true; - } - catch (GFException &e) { - // @@ print error message - } - } - else { - Message::wstream(true) << "failed creating " << name() << ".gf\n"; - } - } - } - else { // vector fonts (OTF, PFB, TTF, TTC) - bool ok=true; - FontEngine::instance().setFont(*this); - if (const FontMap::Entry *entry = fontMapEntry()) - if (Subfont *sf = entry->subfont) - c = sf->decode(c); - ok = FontEngine::instance().traceOutline(decodeChar(c), glyph, false); - glyph.closeOpenSubPaths(); - return ok; - } - return false; -} - - -/** Creates a GF file for this font object. - * @param[out] gfname name of GF font file - * @return true on success */ -bool PhysicalFont::createGF (string &gfname) const { - SignalHandler::instance().check(); - gfname = name()+".gf"; - MetafontWrapper mf(name()); - bool ok = mf.make("ljfour", METAFONT_MAG); // call Metafont if necessary - return ok && mf.success() && getMetrics(); -} - - -/** Traces all glyphs of the current font and stores them in the cache. If caching is disabled, nothing happens. - * @param[in] includeCached if true, glyphs already cached are traced again - * @param[in] cb optional callback methods called by the tracer - * @return number of glyphs traced */ -int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const { - int count = 0; - if (type() == MF && CACHE_PATH) { - if (const FontMetrics *metrics = getMetrics()) { - int fchar = metrics->firstChar(); - int lchar = metrics->lastChar(); - string gfname; - Glyph glyph; - if (createGF(gfname)) { - _cache.read(name().c_str(), CACHE_PATH); - double ds = getMetrics() ? getMetrics()->getDesignSize() : 1; - GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb); - tracer.setGlyph(glyph); - for (int i=fchar; i <= lchar; i++) { - if (includeCached || !_cache.getGlyph(i)) { - glyph.clear(); - tracer.executeChar(i); - glyph.closeOpenSubPaths(); - _cache.setGlyph(i, glyph); - ++count; - } - } - _cache.write(CACHE_PATH); - } - } - } - return count; -} - - -/** Computes the exact bounding box of a glyph. - * @param[in] c character code of the glyph - * @param[out] bbox the computed bounding box - * @param[in] cb optional calback object forwarded to the tracer - * @return true if the box could be computed successfully */ -bool PhysicalFont::getExactGlyphBox(int c, BoundingBox& bbox, GFGlyphTracer::Callback* cb) const { - Glyph glyph; - if (getGlyph(c, glyph, cb)) { - glyph.computeBBox(bbox); - double s = scaledSize()/unitsPerEm(); - bbox.scale(s, s); - return true; - } - return false; -} - - -bool PhysicalFont::getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb) const { - BoundingBox charbox; - if (!getExactGlyphBox(c, charbox, cb)) - return false; - if ((metrics.wl = -charbox.minX()) < 0) metrics.wl=0; - if ((metrics.wr = charbox.maxX()) < 0) metrics.wr=0; - if ((metrics.h = charbox.maxY()) < 0) metrics.h=0; - if ((metrics.d = -charbox.minY()) < 0) metrics.d=0; - if (vertical) { // vertical text orientation - if (verticalLayout()) { // font designed for vertical layout? - metrics.wl = metrics.wr = (metrics.wl+metrics.wr)/2; - metrics.d += metrics.h; - metrics.h = 0; - } - else { - double depth = metrics.d; - metrics.d = metrics.wr; - metrics.wr = metrics.h; - metrics.h = metrics.wl; - metrics.wl = depth; - } - } - return true; -} - - -Font* VirtualFont::create (string name, UInt32 checksum, double dsize, double ssize) { - return new VirtualFontImpl(name, checksum, dsize, ssize); -} - - -////////////////////////////////////////////////////////////////////////////// - - -PhysicalFontImpl::PhysicalFontImpl (string name, int fontindex, UInt32 cs, double ds, double ss, PhysicalFont::Type type) - : TFMFont(name, cs, ds, ss), - _filetype(type), _fontIndex(fontindex), _fontMapEntry(Font::fontMapEntry()), _encodingPair(Font::encoding()), _localCharMap(0) -{ -} - - -PhysicalFontImpl::~PhysicalFontImpl () { - if (CACHE_PATH) - _cache.write(CACHE_PATH); - if (!KEEP_TEMP_FILES) - tidy(); - delete _localCharMap; -} - - -const FontEncoding* PhysicalFontImpl::encoding () const { - if (!_encodingPair.enc1()) - return 0; - return &_encodingPair; -} - - -bool PhysicalFontImpl::findAndAssignBaseFontMap () { - const FontEncoding *enc = encoding(); - if (enc && enc->mapsToCharIndex()) { - // try to find a base font map that maps from character indexes to a suitable - // target encoding supported by the font file - if (const FontEncoding *bfmap = enc->findCompatibleBaseFontMap(this, _charmapID)) - _encodingPair.assign(bfmap); - else - return false; - } - else if (type() != MF) { - FontEngine::instance().setFont(*this); - if ((_localCharMap = FontEngine::instance().createCustomToUnicodeMap()) != 0) - _charmapID = FontEngine::instance().setCustomCharMap(); - else - _charmapID = FontEngine::instance().setUnicodeCharMap(); - } - return true; -} - - -/** Returns the Unicode point for a given DVI character. */ -UInt32 PhysicalFontImpl::unicode (UInt32 c) const { - if (type() == MF) - return Font::unicode(c); - Character chr = decodeChar(c); - if (type() == PFB) { - // try to get the Unicode point from the character name - string glyphname = glyphName(c); - UInt32 codepoint; - if (!glyphname.empty() && (codepoint = Unicode::psNameToCodepoint(glyphname)) != 0) - return codepoint; - if (c <= 0x1900) // does character code c fit into Private Use Zone U+E000? - return 0xe000+c; -// Message::wstream() << "can't properly map PS character '" << glyphname << "' (0x" << hex << c << ") to Unicode\n"; - // If we get here, there is no easy mapping. As for now, we use the character code as Unicode point. - // Although quite unlikely, it might collide with properly mapped characters. - return Unicode::charToCodepoint(c); - } - if (chr.type() == Character::NAME || chr.number() == 0) - return Unicode::charToCodepoint(chr.number()); - - if (_localCharMap) { - if (UInt32 mapped_char = _localCharMap->valueAt(chr.number())) - return mapped_char; - } - // No Unicode equivalent found in the font file. - // Now we should look for a smart alternative but at the moment - // it's sufficient to simply choose a valid unused codepoint. - return Unicode::charToCodepoint(chr.number()); -} - - -/** Delete all temporary font files created by Metafont. */ -void PhysicalFontImpl::tidy () const { - if (type() == MF) { - const char *ext[] = {"gf", "tfm", "log", 0}; - for (const char **p=ext; *p; ++p) { - if (FileSystem::exists((name()+"."+(*p)).c_str())) - FileSystem::remove(name()+"."+(*p)); - } - } -} - -////////////////////////////////////////////////////////////////////////////// - -string NativeFont::uniqueName (const string &path, const FontStyle &style) { - static map ids; - ostringstream oss; - oss << path << "b" << style.bold << "e" << style.extend << "s" << style.slant; - map::iterator it = ids.find(oss.str()); - int id = ids.size(); - if (it == ids.end()) - ids[oss.str()] = id; - else - id = it->second; - oss.str(""); - oss << "nf" << id; - return oss.str(); -} - - -string NativeFont::name () const { - return uniqueName(path(), _style); -} - - -PhysicalFont::Type NativeFont::type () const { - if (const char *filepath = path()) { - if (const char *p =strrchr(filepath, '.')) { - string ext = p+1; - if (ext == "otf") - return PhysicalFont::OTF; - if (ext == "ttf") - return PhysicalFont::TTF; - if (ext == "pfb") - return PhysicalFont::PFB; - } - } - return PhysicalFont::UNKNOWN; -} - - -double NativeFont::charWidth (int c) const { - FontEngine::instance().setFont(*this); - int upem = FontEngine::instance().getUnitsPerEM(); - double w = upem ? (scaledSize()*FontEngine::instance().getAdvance(c)/upem*_style.extend) : 0; - w += fabs(_style.slant*charHeight(c)); - return w; -} - - -double NativeFont::charHeight (int c) const { - FontEngine::instance().setFont(*this); - int upem = FontEngine::instance().getUnitsPerEM(); - return upem ? (scaledSize()*FontEngine::instance().getAscender()/upem) : 0; -} - - -double NativeFont::charDepth (int c) const { - FontEngine::instance().setFont(*this); - int upem = FontEngine::instance().getUnitsPerEM(); - return upem ? (-scaledSize()*FontEngine::instance().getDescender()/upem) : 0; -} - - -bool NativeFontImpl::findAndAssignBaseFontMap () { - FontEngine &fe = FontEngine::instance(); - fe.setFont(*this); - fe.setUnicodeCharMap(); - fe.buildCharMap(_toUnicodeMap); - if (!_toUnicodeMap.addMissingMappings(fe.getNumGlyphs())) - Message::wstream(true) << "incomplete Unicode mapping for native font " << name() << " (" << filename() << ")\n"; - return true; -} - - -Character NativeFontImpl::decodeChar (UInt32 c) const { - return Character(Character::INDEX, c); -} - - -UInt32 NativeFontImpl::unicode (UInt32 c) const { - UInt32 ucode = _toUnicodeMap.valueAt(c); - return Unicode::charToCodepoint(ucode); -} - -////////////////////////////////////////////////////////////////////////////// - -VirtualFontImpl::VirtualFontImpl (string name, UInt32 cs, double ds, double ss) - : TFMFont(name, cs, ds, ss) -{ -} - - -VirtualFontImpl::~VirtualFontImpl () { - // delete dvi vectors received by VFReaderAction - for (map::iterator i=_charDefs.begin(); i != _charDefs.end(); ++i) - delete i->second; -} - - -const char* VirtualFontImpl::path () const { - return FileFinder::lookup(name()+".vf"); -} - - -void VirtualFontImpl::assignChar (UInt32 c, DVIVector *dvi) { - if (dvi) { - if (_charDefs.find(c) == _charDefs.end()) - _charDefs[c] = dvi; - else - delete dvi; - } -} - - -const vector* VirtualFontImpl::getDVI (int c) const { - map::const_iterator it = _charDefs.find(c); - return (it == _charDefs.end() ? 0 : it->second); -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.h deleted file mode 100644 index e1959f202e1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Font.h +++ /dev/null @@ -1,392 +0,0 @@ -/************************************************************************* -** Font.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONT_H -#define DVISVGM_FONT_H - -#include -#include -#include -#include "Character.h" -#include "CharMapID.h" -#include "Color.h" -#include "FontCache.h" -#include "FontEncoding.h" -#include "FontMap.h" -#include "FontMetrics.h" -#include "GFGlyphTracer.h" -#include "Glyph.h" -#include "GraphicPath.h" -#include "MessageException.h" -#include "RangeMap.h" -#include "ToUnicodeMap.h" -#include "VFActions.h" -#include "VFReader.h" -#include "types.h" - - -struct FontStyle; - - -struct GlyphMetrics -{ - GlyphMetrics () : wl(0), wr(0), h(0), d(0) {} - GlyphMetrics (double wwl, double wwr, double hh, double dd) : wl(wwl), wr(wwr), h(hh), d(dd) {} - double wl, wr, h, d; -}; - - -/** Abstract base for all font classes. */ -struct Font { - virtual ~Font () {} - virtual Font* clone (double ds, double sc) const =0; - virtual const Font* uniqueFont () const =0; - virtual std::string name () const =0; - virtual double designSize () const =0; - virtual double scaledSize () const =0; - virtual double scaleFactor () const {return scaledSize()/designSize();} - virtual double charWidth (int c) const =0; - virtual double charDepth (int c) const =0; - virtual double charHeight (int c) const =0; - virtual double italicCorr (int c) const =0; - virtual const FontMetrics* getMetrics () const =0; - 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 *cb=0) const =0; - virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const; - virtual UInt32 unicode (UInt32 c) const; - virtual void tidy () const {} - virtual bool findAndAssignBaseFontMap () {return true;} - virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;} - virtual bool verifyChecksums () const {return true;} - virtual int fontIndex () const {return 0;} - virtual const FontStyle* style () const {return 0;} - virtual Color color () const {return Color::BLACK;} - virtual const FontMap::Entry* fontMapEntry () const; -}; - - -/** Empty font without any glyphs. Instances of this class are used - * if no physical or virtual font file can be found. - * The metric values returned by the member functions are based on cmr10. */ -struct EmptyFont : public Font -{ - public: - EmptyFont (std::string name) : _fontname(name) {} - Font* clone (double ds, double sc) const {return new EmptyFont(*this);} - const Font* uniqueFont () const {return this;} - std::string name () const {return _fontname;} - double designSize () const {return 10;} // cmr10 design size in pt - double scaledSize () const {return 10;} // cmr10 scaled size in pt - double charWidth (int c) const {return 9.164;} // width of cmr10's 'M' in pt - double charHeight (int c) const {return 6.833;} // height of cmr10's 'M' in pt - double charDepth (int c) const {return 0;} - double italicCorr (int c) const {return 0;} - const FontMetrics* getMetrics () const {return 0;} - const char* path () const {return 0;} - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} - - private: - std::string _fontname; -}; - - -/** Interface for all physical fonts. */ -class PhysicalFont : public virtual Font -{ - public: - enum Type {MF, OTF, PFB, TTC, TTF, UNKNOWN}; - - static Font* create (std::string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); - static Font* create (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize); - virtual Type type () const =0; - virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const; - virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=0) const; - virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=0) const; - virtual bool isCIDFont () const; - virtual int hAdvance () const; - virtual double hAdvance (int c) const; - virtual double vAdvance (int c) const; - std::string glyphName (int c) const; - virtual int unitsPerEm () const; - virtual double scaledAscent () const; - virtual int ascent () const; - virtual int descent () const; - virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=0) const; - virtual int collectCharMapIDs (std::vector &charmapIDs) const; - virtual CharMapID getCharMapID () const =0; - virtual void setCharMapID (const CharMapID &id) {} - virtual Character decodeChar (UInt32 c) const; - const char* path () const; - - protected: - bool createGF (std::string &gfname) const; - - public: - static bool EXACT_BBOX; - static bool KEEP_TEMP_FILES; - static const char *CACHE_PATH; ///< path to cache directory (0 if caching is disabled) - static double METAFONT_MAG; ///< magnification factor for Metafont calls - - protected: - static FontCache _cache; -}; - - -/** Interface for all virtual fonts. */ -class VirtualFont : public virtual Font -{ - friend class FontManager; - public: - typedef std::vector DVIVector; - - public: - static Font* create (std::string name, UInt32 checksum, double dsize, double ssize); - virtual const DVIVector* getDVI (int c) const =0; - bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} - - protected: - virtual void assignChar (UInt32 c, DVIVector *dvi) =0; -}; - - -class TFMFont : public virtual Font -{ - public: - TFMFont (std::string name, UInt32 checksum, double dsize, double ssize); - ~TFMFont (); - const FontMetrics* getMetrics () const; - std::string name () const {return _fontname;} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const; - double charDepth (int c) const; - double charHeight (int c) const; - double italicCorr (int c) const; - bool verifyChecksums () const; - - private: - mutable FontMetrics *_metrics; - std::string _fontname; - UInt32 _checksum; ///< cheksum to be compared with TFM checksum - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class PhysicalFontProxy : public PhysicalFont -{ - friend class PhysicalFontImpl; - public: - Font* clone (double ds, double sc) const {return new PhysicalFontProxy(*this, ds, sc);} - const Font* uniqueFont () const {return _pf;} - std::string name () const {return _pf->name();} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const {return _pf->charWidth(c);} - double charDepth (int c) const {return _pf->charDepth(c);} - double charHeight (int c) const {return _pf->charHeight(c);} - double italicCorr (int c) const {return _pf->italicCorr(c);} - const FontMetrics* getMetrics () const {return _pf->getMetrics();} - Type type () const {return _pf->type();} - UInt32 unicode (UInt32 c) const {return _pf->unicode(c);} - int fontIndex () const {return _pf->fontIndex();} - const FontStyle* style () const {return _pf->style();} - const FontMap::Entry* fontMapEntry () const {return _pf->fontMapEntry();} - const FontEncoding* encoding () const {return _pf->encoding();} - CharMapID getCharMapID () const {return _pf->getCharMapID();} - int collectCharMapIDs (std::vector &charmapIDs) const {return _pf->collectCharMapIDs(charmapIDs);} - - protected: - PhysicalFontProxy (const PhysicalFont *font, double ds, double ss) : _pf(font), _dsize(ds), _ssize(ss) {} - PhysicalFontProxy (const PhysicalFontProxy &proxy, double ds, double ss) : _pf(proxy._pf), _dsize(ds), _ssize(ss) {} - - private: - const PhysicalFont *_pf; - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class PhysicalFontImpl : public PhysicalFont, public TFMFont -{ - friend class PhysicalFont; - public: - ~PhysicalFontImpl(); - Font* clone (double ds, double ss) const {return new PhysicalFontProxy(this, ds, ss);} - const Font* uniqueFont () const {return this;} - Type type () const {return _filetype;} - int fontIndex() const {return _fontIndex;} - const FontStyle* style () const {return _fontMapEntry ? &_fontMapEntry->style : 0;} - const FontMap::Entry* fontMapEntry () const {return _fontMapEntry;} - const FontEncoding* encoding () const; - UInt32 unicode (UInt32 c) const; - bool findAndAssignBaseFontMap (); - void tidy () const; - CharMapID getCharMapID () const {return _charmapID;} - - protected: - PhysicalFontImpl (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); - - private: - Type _filetype; - int _fontIndex; - const FontMap::Entry *_fontMapEntry; - FontEncodingPair _encodingPair; - CharMapID _charmapID; ///< ID of the font's charmap to use - const RangeMap *_localCharMap; -}; - - -class NativeFont : public PhysicalFont -{ - public: - virtual NativeFont* clone (double ptsize, const FontStyle &style, Color color) const =0; - virtual Font* clone (double ds, double sc) const =0; - std::string name () const; - Type type () const; - double designSize () const {return _ptsize;} - double scaledSize () const {return _ptsize;} - double charWidth (int c) const; - double charDepth (int c) const; - double charHeight (int c) const; - double italicCorr (int c) const {return 0;} - const FontMetrics* getMetrics () const {return 0;} - const FontStyle* style () const {return &_style;} - Color color () const {return _color;} - const FontMap::Entry* fontMapEntry () const {return 0;} - static std::string uniqueName (const std::string &path, const FontStyle &style); - - protected: - NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {} - - private: - double _ptsize; ///< font size in PS point units - FontStyle _style; - Color _color; -}; - - -class NativeFontProxy : public NativeFont -{ - friend class NativeFontImpl; - public: - NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { - return new NativeFontProxy(this, ptsize, style, color); - } - - Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} - const Font* uniqueFont () const {return _nfont;} - const char* path () const {return _nfont->path();} - int fontIndex () const {return _nfont->fontIndex();} - Character decodeChar (UInt32 c) const {return _nfont->decodeChar(c);} - UInt32 unicode (UInt32 c) const {return _nfont->unicode(c);} - CharMapID getCharMapID () const {return _nfont->getCharMapID();} - - protected: - NativeFontProxy (const NativeFont *nfont, double ptsize, const FontStyle &style, Color color) - : NativeFont(ptsize, style, color), _nfont(nfont) {} - - private: - const NativeFont *_nfont; -}; - - -class NativeFontImpl : public NativeFont -{ - public: - NativeFontImpl (const std::string &fname, int fontIndex, double ptsize, const FontStyle &style, Color color) - : NativeFont(ptsize, style, color), _path(fname), _fontIndex(fontIndex) {} - - NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { - return new NativeFontProxy(this, ptsize, style, color); - } - - Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} - const Font* uniqueFont () const {return this;} - const char* path () const {return _path.c_str();} - int fontIndex() const {return _fontIndex;} - bool findAndAssignBaseFontMap (); - CharMapID getCharMapID () const {return CharMapID::NONE;} - Character decodeChar (UInt32 c) const; - UInt32 unicode (UInt32 c) const; - - private: - std::string _path; - int _fontIndex; - ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points -}; - - -class VirtualFontProxy : public VirtualFont -{ - friend class VirtualFontImpl; - public: - Font* clone (double ds, double ss) const {return new VirtualFontProxy(*this, ds, ss);} - const Font* uniqueFont () const {return _vf;} - std::string name () const {return _vf->name();} - const DVIVector* getDVI (int c) const {return _vf->getDVI(c);} - double designSize () const {return _dsize;} - double scaledSize () const {return _ssize;} - double charWidth (int c) const {return _vf->charWidth(c);} - double charDepth (int c) const {return _vf->charDepth(c);} - double charHeight (int c) const {return _vf->charHeight(c);} - double italicCorr (int c) const {return _vf->italicCorr(c);} - const FontMetrics* getMetrics () const {return _vf->getMetrics();} - const char* path () const {return _vf->path();} - - protected: - VirtualFontProxy (const VirtualFont *font, double ds, double ss) : _vf(font), _dsize(ds), _ssize(ss) {} - VirtualFontProxy (const VirtualFontProxy &proxy, double ds, double ss) : _vf(proxy._vf), _dsize(ds), _ssize(ss) {} - void assignChar (UInt32 c, DVIVector *dvi) {delete dvi;} - - private: - const VirtualFont *_vf; - double _dsize; ///< design size in PS point units - double _ssize; ///< scaled size in PS point units -}; - - -class VirtualFontImpl : public VirtualFont, public TFMFont -{ - friend class VirtualFont; - public: - ~VirtualFontImpl (); - Font* clone (double ds, double ss) const {return new VirtualFontProxy(this, ds, ss);} - const Font* uniqueFont () const {return this;} - const DVIVector* getDVI (int c) const; - const char* path () const; - - protected: - VirtualFontImpl (std::string name, UInt32 checksum, double dsize, double ssize); - void assignChar (UInt32 c, DVIVector *dvi); - - private: - std::map _charDefs; ///< dvi subroutines defining the characters -}; - - -struct FontException : public MessageException -{ - FontException (std::string msg) : MessageException(msg) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.cpp deleted file mode 100644 index df638715785..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************* -** FontCache.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include "CRC32.h" -#include "FileSystem.h" -#include "FontCache.h" -#include "Glyph.h" -#include "Pair.h" -#include "StreamReader.h" -#include "StreamWriter.h" -#include "types.h" - -using namespace std; - -const UInt8 FontCache::FORMAT_VERSION = 5; - - -static Pair32 read_pair (int bytes, StreamReader &sr) { - Int32 x = sr.readSigned(bytes); - Int32 y = sr.readSigned(bytes); - return Pair32(x, y); -} - - -FontCache::FontCache () : _changed(false) -{ -} - - -FontCache::~FontCache () { - clear(); -} - - -/** Removes all data from the cache. This does not affect the cache files. */ -void FontCache::clear () { - _glyphs.clear(); - _fontname.clear(); -} - - -/** Assigns glyph data to a character and adds it to the cache. - * @param[in] c character code - * @param[in] glyph font glyph data */ -void FontCache::setGlyph (int c, const Glyph &glyph) { - _glyphs[c] = glyph; - _changed = true; -} - - -/** Returns the corresponding glyph data of a given character of the current font. - * @param[in] c character code - * @return font glyph data (0 if no matching data was found) */ -const Glyph* FontCache::getGlyph (int c) const { - GlyphMap::const_iterator it = _glyphs.find(c); - return (it != _glyphs.end()) ? &it->second : 0; -} - - -/** Writes the current cache data to a file (only if anything changed after - * the last call of read()). - * @param[in] fontname name of current font - * @param[in] dir directory where the cache file should go - * @return true if writing was successful */ -bool FontCache::write (const char *fontname, const char *dir) const { - if (!_changed) - return true; - - if (fontname && strlen(fontname) > 0) { - string dirstr = (dir == 0 || strlen(dir) == 0) ? FileSystem::getcwd() : dir; - ostringstream oss; - oss << dirstr << '/' << fontname << ".fgd"; - ofstream ofs(oss.str().c_str(), ios::binary); - return write(fontname, ofs); - } - return false; -} - - -bool FontCache::write (const char* dir) const { - return _fontname.empty() ? false : write(_fontname.c_str(), dir); -} - - -/** Returns the minimal number of bytes needed to store the given value. */ -static int max_int_size (Int32 value) { - Int32 limit = 0x7f; - for (int i=1; i <= 4; i++) { - if ((value < 0 && -value <= limit+1) || (value >= 0 && value <= limit)) - return i; - limit = (limit << 8) | 0xff; - } - return 4; -} - - -/** Returns the minimal number of bytes needed to store the biggest - * pair component of the given vector. */ -static int max_int_size (const Pair *pairs, size_t n) { - int ret=0; - for (size_t i=0; i < n; i++) { - ret = max(ret, max_int_size(pairs[i].x())); - ret = max(ret, max_int_size(pairs[i].y())); - } - return ret; -} - - -/** Writes the current cache data to a stream (only if anything changed after - * the last call of read()). - * @param[in] fontname name of current font - * @param[in] os output stream - * @return true if writing was successful */ -bool FontCache::write (const char *fontname, ostream &os) const { - if (!_changed) - return true; - if (!os) - return false; - - StreamWriter sw(os); - CRC32 crc32; - - struct WriteActions : Glyph::Actions { - WriteActions (StreamWriter &sw, CRC32 &crc32) : _sw(sw), _crc32(crc32) {} - - void draw (char cmd, const Glyph::Point *points, int n) { - int bytes = max_int_size(points, n); - int cmdchar = (bytes << 5) | (cmd - 'A'); - _sw.writeUnsigned(cmdchar, 1, _crc32); - for (int i=0; i < n; i++) { - _sw.writeSigned(points[i].x(), bytes, _crc32); - _sw.writeSigned(points[i].y(), bytes, _crc32); - } - } - StreamWriter &_sw; - CRC32 &_crc32; - } actions(sw, crc32); - - sw.writeUnsigned(FORMAT_VERSION, 1, crc32); - sw.writeUnsigned(0, 4); // space for checksum - sw.writeString(fontname, crc32, true); - sw.writeUnsigned(_glyphs.size(), 4, crc32); - FORALL(_glyphs, GlyphMap::const_iterator, it) { - const Glyph &glyph = it->second; - sw.writeUnsigned(it->first, 4, crc32); - sw.writeUnsigned(glyph.size(), 2, crc32); - glyph.iterate(actions, false); - } - os.seekp(1); - sw.writeUnsigned(crc32.get(), 4); // insert CRC32 checksum - os.seekp(0, ios::end); - return true; -} - - -/** Reads font glyph information from a file. - * @param[in] fontname name of font data to read - * @param[in] dir directory where the cache files are located - * @return true if reading was successful */ -bool FontCache::read (const char *fontname, const char *dir) { - if (!fontname || strlen(fontname) == 0) - return false; - if (_fontname == fontname) - return true; - clear(); - string dirstr = (dir == 0 || strlen(dir) == 0) ? FileSystem::getcwd() : dir; - ostringstream oss; - oss << dirstr << '/' << fontname << ".fgd"; - ifstream ifs(oss.str().c_str(), ios::binary); - return read(fontname, ifs); -} - - -/** Reads font glyph information from a stream. - * @param[in] fontname name of font data to read - * @param[in] is input stream to read the glyph data from - * @return true if reading was successful */ -bool FontCache::read (const char *fontname, istream &is) { - if (_fontname == fontname) - return true; - clear(); - _fontname = fontname; - if (!is) - return false; - - StreamReader sr(is); - CRC32 crc32; - if (sr.readUnsigned(1, crc32) != FORMAT_VERSION) - return false; - - UInt32 crc32_cmp = sr.readUnsigned(4); - crc32.update(is); - if (crc32.get() != crc32_cmp) - return false; - - is.clear(); - is.seekg(5); // continue reading after checksum - - string fname = sr.readString(); - if (fname != fontname) - return false; - - UInt32 num_glyphs = sr.readUnsigned(4); - while (num_glyphs-- > 0) { - UInt32 c = sr.readUnsigned(4); // character code - UInt16 s = sr.readUnsigned(2); // number of path commands - Glyph &glyph = _glyphs[c]; - while (s-- > 0) { - UInt8 cmdval = sr.readUnsigned(1); - UInt8 cmdchar = (cmdval & 0x1f) + 'A'; - int bytes = cmdval >> 5; - switch (cmdchar) { - case 'C': { - Pair32 p1 = read_pair(bytes, sr); - Pair32 p2 = read_pair(bytes, sr); - Pair32 p3 = read_pair(bytes, sr); - glyph.cubicto(p1, p2, p3); - break; - } - case 'L': - glyph.lineto(read_pair(bytes, sr)); - break; - case 'M': - glyph.moveto(read_pair(bytes, sr)); - break; - case 'Q': { - Pair32 p1 = read_pair(bytes, sr); - Pair32 p2 = read_pair(bytes, sr); - glyph.conicto(p1, p2); - break; - } - case 'Z': - glyph.closepath(); - } - } - } - _changed = false; - return true; -} - - -/** Collects font cache information. - * @param[in] dirname path to font cache directory - * @param[out] infos the collected font information - * @param[out] invalid names of outdated/corrupted cache files - * @return true on success */ -bool FontCache::fontinfo (const char *dirname, vector &infos, vector &invalid) { - infos.clear(); - invalid.clear(); - if (dirname) { - vector fnames; - FileSystem::collect(dirname, fnames); - FORALL(fnames, vector::iterator, it) { - if ((*it)[0] == 'f' && it->length() > 5 && it->substr(it->length()-4) == ".fgd") { - FontInfo info; - string path = string(dirname)+"/"+(it->substr(1)); - ifstream ifs(path.c_str(), ios::binary); - if (fontinfo(ifs, info)) - infos.push_back(info); - else - invalid.push_back(it->substr(1)); - } - } - } - return !infos.empty(); -} - - -/** Collects font cache information of a single font. - * @param[in] is input stream of the cache file - * @param[out] info the collected data - * @return true if data could be read, false if cache file is unavailable, outdated, or corrupted */ -bool FontCache::fontinfo (std::istream &is, FontInfo &info) { - info.name.clear(); - info.numchars = info.numbytes = info.numcmds = 0; - if (is) { - is.clear(); - is.seekg(0); - try { - StreamReader sr(is); - CRC32 crc32; - if ((info.version = sr.readUnsigned(1, crc32)) != FORMAT_VERSION) - return false; - - info.checksum = sr.readUnsigned(4); - crc32.update(is); - if (crc32.get() != info.checksum) - return false; - - is.clear(); - is.seekg(5); // continue reading after checksum - - info.name = sr.readString(); - info.numchars = sr.readUnsigned(4); - for (UInt32 i=0; i < info.numchars; i++) { - sr.readUnsigned(4); // character code - UInt16 s = sr.readUnsigned(2); // number of path commands - while (s-- > 0) { - UInt8 cmdval = sr.readUnsigned(1); - UInt8 cmdchar = (cmdval & 0x1f) + 'A'; - int bytes = cmdval >> 5; - int bc = 0; - switch (cmdchar) { - case 'C': bc = 6*bytes; break; - case 'H': - case 'L': - case 'M': - case 'T': - case 'V': bc = 2*bytes; break; - case 'Q': - case 'S': bc = 4*bytes; break; - case 'Z': break; - default : return false; - } - info.numbytes += bc+1; // command length + command - info.numcmds++; - is.seekg(bc, ios::cur); - } - info.numbytes += 6; // number of path commands + char code - } - info.numbytes += 6+info.name.length(); // version + 0-byte + fontname + number of chars - } - catch (StreamReaderException &e) { - return false; - } - } - return true; -} - - -/** Collects font cache information and write it to a stream. - * @param[in] dirname path to font cache directory - * @param[in] os output is written to this stream - * @param[in] purge if true, outdated and corrupted cache files are removed */ -void FontCache::fontinfo (const char *dirname, ostream &os, bool purge) { - if (dirname) { - ios::fmtflags osflags(os.flags()); - vector infos; - vector invalid_files; - if (fontinfo(dirname, infos, invalid_files)) { - os << "cache format version " << infos[0].version << endl; - typedef map SortMap; - SortMap sortmap; - FORALL(infos, vector::iterator, it) - sortmap[it->name] = &(*it); - - FORALL(sortmap, SortMap::iterator, it) { - os << dec << setfill(' ') << left - << setw(10) << left << it->second->name - << setw(5) << right << it->second->numchars << " glyph" << (it->second->numchars == 1 ? ' ':'s') - << setw(10) << right << it->second->numcmds << " cmd" << (it->second->numcmds == 1 ? ' ':'s') - << setw(12) << right << it->second->numbytes << " byte" << (it->second->numbytes == 1 ? ' ':'s') - << setw(6) << "crc:" << setw(8) << hex << right << setfill('0') << it->second->checksum - << endl; - } - } - else - os << "cache is empty\n"; - FORALL(invalid_files, vector::iterator, it) { - string path=string(dirname)+"/"+(*it); - if (FileSystem::remove(path)) - os << "invalid cache file " << (*it) << " removed\n"; - } - os.flags(osflags); // restore format flags - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.h deleted file mode 100644 index 49efb455495..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontCache.h +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* -** FontCache.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTCACHE_H -#define DVISVGM_FONTCACHE_H - -#include -#include -#include -#include "types.h" -#include "Glyph.h" - - -class FontCache -{ - typedef std::map GlyphMap; - - public: - struct FontInfo - { - std::string name; // fontname - UInt16 version; // file format version - UInt32 checksum; // CRC32 checksum of file data - UInt32 numchars; // number of characters - UInt32 numbytes; // number of bytes - UInt32 numcmds; // number of path commands - }; - - public: - FontCache (); - ~FontCache (); - bool read (const char *fontname, const char *dir); - bool read (const char *fontname, std::istream &is); - bool write (const char *dir) const; - bool write (const char *fontname, const char *dir) const; - bool write (const char *fontname, std::ostream &os) const; - const Glyph* getGlyph (int c) const; - void setGlyph (int c, const Glyph &glyph); - void clear (); - const std::string& fontname () const {return _fontname;} - - static bool fontinfo (const char *dirname, std::vector &infos, std::vector &invalid); - static bool fontinfo (std::istream &is, FontInfo &info); - static void fontinfo (const char *dirname, std::ostream &os, bool purge=false); - - private: - static const UInt8 FORMAT_VERSION; - std::string _fontname; - GlyphMap _glyphs; - bool _changed; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.cpp deleted file mode 100644 index d2dbfd8da50..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************* -** FontEncoding.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "CMap.h" -#include "CMapManager.h" -#include "EncFile.h" -#include "FileFinder.h" -#include "FontEncoding.h" - -using namespace std; - - -struct EncodingMap : public map -{ - ~EncodingMap () { - for (EncodingMap::iterator it=begin(); it != end(); ++it) - delete it->second; - } -}; - - -/** Returns the encoding object for a given encoding name. - * @param[in] encname name of the encoding to lookup - * @return pointer to encoding object, or 0 if there is no encoding defined */ -FontEncoding* FontEncoding::encoding (const string &encname) { - if (encname.empty()) - return 0; - // initially, try to find an .enc file with the given name - static EncodingMap encmap; - EncodingMap::const_iterator it = encmap.find(encname); - if (it != encmap.end()) - return it->second; - if (FileFinder::lookup(encname + ".enc", false)) { - EncFile *enc = new EncFile(encname); - encmap[encname] = enc; - return enc; - } - // no .enc file found => try to find a CMap - if (CMap *cmap = CMapManager::instance().lookup(encname)) - return cmap; - return 0; -} - -///////////////////////////////////////////////////////////////////////// - -Character FontEncodingPair::decode (UInt32 c) const { - if (_enc1) { - Character chr = _enc1->decode(c); - if (_enc2 && chr.type() != Character::NAME) - chr = _enc2->decode(chr.number()); - return chr; - } - return Character(Character::INDEX, 0); -} - - -bool FontEncodingPair::mapsToCharIndex () const { - if (_enc2) - return _enc2->mapsToCharIndex(); - if (_enc1) - return _enc1->mapsToCharIndex(); - return false; -} - - -const FontEncoding* FontEncodingPair::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { - if (_enc2) - return _enc2->findCompatibleBaseFontMap(font, charmapID); - if (_enc1) - return _enc1->findCompatibleBaseFontMap(font, charmapID); - return 0; -} - - -void FontEncodingPair::assign (const FontEncoding *enc) { - if (!_enc1) - _enc1 = enc; - else - _enc2 = enc; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.h deleted file mode 100644 index e36eb899bac..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEncoding.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* -** FontEncoding.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTENCODING_H -#define DVISVGM_FONTENCODING_H - -#include -#include "Character.h" -#include "types.h" - - -struct CharMapID; -class PhysicalFont; - -struct FontEncoding -{ - virtual ~FontEncoding () {} - virtual Character decode (UInt32 c) const =0; - virtual bool mapsToCharIndex () const =0; - virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const {return 0;} - static FontEncoding* encoding (const std::string &encname); -}; - - -struct NamedFontEncoding : public FontEncoding -{ - virtual const char* name () const =0; - virtual const char* path () const =0; -}; - - -class FontEncodingPair : public FontEncoding -{ - public: - FontEncodingPair (const FontEncoding *enc1) : _enc1(enc1), _enc2(0) {} - FontEncodingPair (const FontEncoding *enc1, const FontEncoding *enc2) : _enc1(enc1), _enc2(enc2) {} - Character decode (UInt32 c) const; - bool mapsToCharIndex () const; - const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; - const FontEncoding* enc1 () const {return _enc1;} - const FontEncoding* enc2 () const {return _enc2;} - void assign (const FontEncoding *enc); - - private: - const FontEncoding *_enc1, *_enc2; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.cpp deleted file mode 100644 index 633be5514db..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/************************************************************************* -** FontEngine.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include FT_ADVANCES_H -#include FT_GLYPH_H -#include FT_OUTLINE_H -#include FT_TRUETYPE_TABLES_H -#include FT_TYPES_H -#include "Font.h" -#include "FontEngine.h" -#include "FontStyle.h" -#include "Message.h" - -using namespace std; - - -/** Converts a floating point value to a 16.16 fixed point value. */ -static inline FT_Fixed to_16dot16 (double val) { - return static_cast(val*65536.0 + 0.5); -} - - -/** Converts an integer to a 16.16 fixed point value. */ -static inline FT_Fixed to_16dot16 (int val) { - return static_cast(val) << 16; -} - - -/////////////////////////////////////////////////////////////////////////// - - -FontEngine::FontEngine () : _currentFace(0), _currentFont(0) -{ - _currentChar = _currentGlyphIndex = 0; - _horDeviceRes = _vertDeviceRes = 300; - if (FT_Init_FreeType(&_library)) - Message::estream(true) << "FontEngine: error initializing FreeType library\n"; -} - - -FontEngine::~FontEngine () { - if (_currentFace && FT_Done_Face(_currentFace)) - Message::estream(true) << "FontEngine: error removing glyph\n"; - if (FT_Done_FreeType(_library)) - Message::estream(true) << "FontEngine: error removing FreeType library\n"; -} - - -/** Returns the singleton instance of this class. */ -FontEngine& FontEngine::instance () { - static FontEngine engine; - return engine; -} - - -string FontEngine::version () { - FT_Int major, minor, patch; - FT_Library &lib = instance()._library; - FT_Library_Version(lib, &major, &minor, &patch); - ostringstream oss; - oss << major << '.' << minor << '.' << patch; - return oss.str(); -} - - -void FontEngine::setDeviceResolution (int x, int y) { - _horDeviceRes = x; - _vertDeviceRes = y; -} - - -/** Sets the font to be used. - * @param[in] fname path to font file - * @param[in] fontindex index of font in font collection (multi-font files, like TTC) - * @return true on success */ -bool FontEngine::setFont (const string &fname, int fontindex, const CharMapID &charMapID) { - if (_currentFace && FT_Done_Face(_currentFace)) - Message::estream(true) << "FontEngine: error removing font\n"; - if (FT_New_Face(_library, fname.c_str(), fontindex, &_currentFace)) { - Message::estream(true) << "FontEngine: error reading file " << fname << '\n'; - return false; - } - if (charMapID.valid()) - setCharMap(charMapID); - return true; -} - - -bool FontEngine::setFont (const Font &font) { - if (!_currentFont || _currentFont->name() != font.name()) { - const PhysicalFont *pf = dynamic_cast(&font); - _currentFont = &font; - return setFont(font.path(), font.fontIndex(), pf ? pf->getCharMapID() : CharMapID()); - } - return true; -} - - -bool FontEngine::isCIDFont() const { - FT_Bool cid_keyed; - return FT_Get_CID_Is_Internally_CID_Keyed(_currentFace, &cid_keyed) == 0 && cid_keyed; -} - - -bool FontEngine::setCharMap (const CharMapID &charMapID) { - for (int i=0; i < _currentFace->num_charmaps; i++) { - FT_CharMap ft_cmap = _currentFace->charmaps[i]; - if (ft_cmap->platform_id == charMapID.platform_id && ft_cmap->encoding_id == charMapID.encoding_id) { - FT_Set_Charmap(_currentFace, ft_cmap); - return true; - } - } - return false; -} - - -/** Returns a character map that maps from character indexes to character codes - * of the current encoding. - * @param[out] charmap the resulting charmap */ -void FontEngine::buildCharMap (RangeMap &charmap) { - charmap.clear(); - FT_UInt glyph_index; - UInt32 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); - } -} - - -/** Creates a charmap that maps from the custom character encoding to unicode. - * @return pointer to charmap if it could be created, 0 otherwise */ -const RangeMap* FontEngine::createCustomToUnicodeMap () { - FT_CharMap ftcharmap = _currentFace->charmap; - if (FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) != 0) - return 0; - RangeMap index_to_source_chrcode; - buildCharMap(index_to_source_chrcode); - if (FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) != 0) - return 0; - RangeMap *charmap = new RangeMap; - FT_UInt glyph_index; - UInt32 unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); - while (glyph_index) { - UInt32 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_Set_Charmap(_currentFace, ftcharmap); - return charmap; -} - - -const char* FontEngine::getFamilyName () const { - return _currentFace ? _currentFace->family_name : 0; -} - - -const char* FontEngine::getStyleName () const { - return _currentFace ? _currentFace->style_name : 0; -} - - -int FontEngine::getUnitsPerEM () const { - return _currentFace ? _currentFace->units_per_EM : 0; -} - - -/** Returns the ascender of the current font in font units. */ -int FontEngine::getAscender () const { - return _currentFace ? _currentFace->ascender : 0; -} - - -/** Returns the descender of the current font in font units. */ -int FontEngine::getDescender () const { - return _currentFace ? _currentFace->descender : 0; -} - - -int FontEngine::getAdvance (int c) const { - if (_currentFace) { - FT_Fixed adv=0; - FT_Get_Advance(_currentFace, c, FT_LOAD_NO_SCALE, &adv); - return adv; - } - return 0; -} - - -int FontEngine::getHAdvance () const { - if (_currentFace) { - TT_OS2 *table = static_cast(FT_Get_Sfnt_Table(_currentFace, ft_sfnt_os2)); - return table ? table->xAvgCharWidth : 0; - } - return 0; -} - - -int FontEngine::getHAdvance (const Character &c) const { - if (_currentFace) { - FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); - return _currentFace->glyph->metrics.horiAdvance; - } - return 0; -} - - -int FontEngine::getVAdvance (const Character &c) const { - if (_currentFace) { - FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); - if (FT_HAS_VERTICAL(_currentFace)) - return _currentFace->glyph->metrics.vertAdvance; - return _currentFace->glyph->metrics.horiAdvance; - } - return 0; -} - - -int FontEngine::charIndex (const Character &c) const { - switch (c.type()) { - case Character::CHRCODE: - return FT_Get_Char_Index(_currentFace, (FT_ULong)c.number()); - case Character::NAME: - return FT_Get_Name_Index(_currentFace, (FT_String*)c.name()); - default: - return c.number(); - } -} - - -/** Get first available character of the current font face. */ -int FontEngine::getFirstChar () const { - if (_currentFace) - return _currentChar = FT_Get_First_Char(_currentFace, &_currentGlyphIndex); - return 0; -} - - -/** Get the next available character of the current font face. */ -int FontEngine::getNextChar () const { - if (_currentFace && _currentGlyphIndex) - return _currentChar = FT_Get_Next_Char(_currentFace, _currentChar, &_currentGlyphIndex); - return getFirstChar(); -} - - -/** Returns the number of glyphs present in the current font face. */ -int FontEngine::getNumGlyphs () const { - return _currentFace ? _currentFace->num_glyphs : 0; -} - - -/** Returns the glyph name for a given charater code. - * @param[in] c char code - * @return glyph name */ -string FontEngine::getGlyphName (const Character &c) const { - if (c.type() == Character::NAME) - return c.name(); - - if (_currentFace && FT_HAS_GLYPH_NAMES(_currentFace)) { - char buf[256]; - FT_Get_Glyph_Name(_currentFace, charIndex(c), buf, 256); - return string(buf); - } - return ""; -} - - -vector FontEngine::getPanose () const { - vector panose(10); - if (_currentFace) { - TT_OS2 *table = static_cast(FT_Get_Sfnt_Table(_currentFace, ft_sfnt_os2)); - if (table) - for (int i=0; i < 10; i++) - panose[i] = table->panose[i]; - } - return panose; -} - - -int FontEngine::getCharMapIDs (vector &charmapIDs) const { - charmapIDs.clear(); - if (_currentFace) { - for (int i=0; i < _currentFace->num_charmaps; i++) { - FT_CharMap charmap = _currentFace->charmaps[i]; - charmapIDs.push_back(CharMapID(charmap->platform_id, charmap->encoding_id)); - } - } - return charmapIDs.size(); -} - - -CharMapID FontEngine::setUnicodeCharMap () { - if (_currentFace && FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) == 0) - return CharMapID(_currentFace->charmap->platform_id, _currentFace->charmap->encoding_id); - return CharMapID(); -} - - -CharMapID FontEngine::setCustomCharMap () { - if (_currentFace && FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) == 0) - return CharMapID(_currentFace->charmap->platform_id, _currentFace->charmap->encoding_id); - return CharMapID(); -} - - -// handle API change in freetype version 2.2.1 -#if FREETYPE_MAJOR > 2 || (FREETYPE_MAJOR == 2 && (FREETYPE_MINOR > 2 || (FREETYPE_MINOR == 2 && FREETYPE_PATCH >= 1))) - typedef const FT_Vector *FTVectorPtr; -#else - typedef FT_Vector *FTVectorPtr; -#endif - - -// Callback functions used by trace_outline/FT_Outline_Decompose -static int moveto (FTVectorPtr to, void *user) { - Glyph *glyph = static_cast(user); - glyph->moveto(to->x, to->y); - return 0; -} - - -static int lineto (FTVectorPtr to, void *user) { - Glyph *glyph = static_cast(user); - glyph->lineto(to->x, to->y); - return 0; -} - - -static int conicto (FTVectorPtr control, FTVectorPtr to, void *user) { - Glyph *glyph = static_cast(user); - glyph->conicto(control->x, control->y, to->x, to->y); - return 0; -} - - -static int cubicto (FTVectorPtr control1, FTVectorPtr control2, FTVectorPtr to, void *user) { - Glyph *glyph = static_cast(user); - glyph->cubicto(control1->x, control1->y, control2->x, control2->y, to->x, to->y); - return 0; -} - - -/** Traces the outline of a glyph by calling the corresponding "drawing" functions. - * Each glyph is composed of straight lines, quadratic (conic) or cubic B�zier curves. - * This function creates a Glyph object representing these graphics segments. - * @param[in] face FreeType object representing the font to scan - * @param[in] font corresponding Font object providing additional data - * @param[in] index index of the glyph to be traced - * @param[out] glyph resulting Glyph object containing the graphics segments - * @param[in] scale if true the current pt size will be considered otherwise the plain TrueType units are used. - * @return false on errors */ -static bool trace_outline (FT_Face face, const Font *font, int index, Glyph &glyph, bool scale) { - if (face) { - if (FT_Load_Glyph(face, index, scale ? FT_LOAD_DEFAULT : FT_LOAD_NO_SCALE)) { - Message::estream(true) << "can't load glyph " << int(index) << '\n'; - return false; - } - if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) { - Message::estream(true) << "no outlines found in glyph " << int(index) << '\n'; - return false; - } - FT_Outline outline = face->glyph->outline; - // apply style parameters if set - if (const FontStyle *style = font->style()) { - FT_Matrix matrix = {to_16dot16(style->extend), to_16dot16(style->slant), 0, to_16dot16(1)}; - FT_Outline_Transform(&outline, &matrix); - if (style->bold != 0) - FT_Outline_Embolden(&outline, style->bold/font->scaledSize()*face->units_per_EM); - } - const FT_Outline_Funcs funcs = {moveto, lineto, conicto, cubicto, 0, 0}; - FT_Outline_Decompose(&outline, &funcs, &glyph); - return true; - } - Message::wstream(true) << "FontEngine: can't trace outline, no font face selected\n"; - return false; -} - - -/** Traces the outline of a glyph by calling the corresponding "drawing" functions. - * Each glyph is composed of straight lines, quadratic (conic) or cubic B�zier curves. - * This function creates a Glyph object representing these graphics segments. - * @param[in] c the glyph of this character will be traced - * @param[out] glyph resulting Glyph object containing the graphics segments - * @param[in] scale if true the current pt size will be considered otherwise the plain TrueType units are used. - * @return false on errors */ -bool FontEngine::traceOutline (const Character &c, Glyph &glyph, bool scale) const { - if (_currentFace) - return trace_outline(_currentFace, _currentFont, charIndex(c), glyph, scale); - Message::wstream(true) << "FontEngine: can't trace outline, no font face selected\n"; - return false; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.h deleted file mode 100644 index 33a4cf7a63b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontEngine.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* -** FontEngine.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTENGINE_H -#define DVISVGM_FONTENGINE_H - -#include -#include FT_FREETYPE_H -#include FT_CID_H -#include -#include -#include -#include "Character.h" -#include "CharMapID.h" -#include "Font.h" -#include "Glyph.h" -#include "RangeMap.h" -#include "types.h" - - -/** This class provides methods to handle font files and font data. - * It's a wrapper for the Freetype font library. */ -class FontEngine -{ - public: - ~FontEngine (); - static FontEngine& instance (); - static std::string version (); - void setDeviceResolution (int x, int y); - bool setFont (const Font &font); - bool isCIDFont() const; - bool traceOutline (const Character &c, Glyph &glyph, bool scale=true) const; - const char* getFamilyName () const; - const char* getStyleName () const; - int getUnitsPerEM () const; - int getAscender () const; - int getDescender () const; - int getAdvance (int c) const; - int getHAdvance () const; - int getHAdvance (const Character &c) const; - int getVAdvance (const Character &c) const; - int getFirstChar () const; - int getNextChar () const; - int getCharMapIDs (std::vector &charmapIDs) const; - int getNumGlyphs () const; - CharMapID setUnicodeCharMap (); - CharMapID setCustomCharMap (); - std::vector getPanose () const; - std::string getGlyphName (const Character &c) const; - int getCharByGlyphName (const char *name) const; - bool setCharMap (const CharMapID &charMapID); - void buildCharMap (RangeMap &charmap); - const RangeMap* createCustomToUnicodeMap (); - - protected: - FontEngine (); - bool setFont (const std::string &fname, int fontindex, const CharMapID &charmapID); - int charIndex (const Character &c) const; - - private: - int _horDeviceRes, _vertDeviceRes; - mutable unsigned int _currentChar, _currentGlyphIndex; - FT_Face _currentFace; - FT_Library _library; - const Font *_currentFont; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.cpp deleted file mode 100644 index 36ac5b017c2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.cpp +++ /dev/null @@ -1,348 +0,0 @@ -/************************************************************************* -** FontManager.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "CMap.h" -#include "Font.h" -#include "FontManager.h" -#include "FontMap.h" -#include "FileFinder.h" -#include "FileSystem.h" -#include "Message.h" -#include "macros.h" -#include "CMapManager.h" - -using namespace std; - - -FontManager::~FontManager () { - FORALL(_fonts, vector::iterator, i) - delete *i; -} - - -/** Returns the singleton instance */ -FontManager& FontManager::instance () { - static FontManager fm; - return fm; -} - - -/** Returns a unique ID that identifies the font. - * @param[in] n local font number, as used in DVI and VF files - * @return non-negative font ID if font was found, -1 otherwise */ -int FontManager::fontID (int n) const { - if (_vfStack.empty()) { - Num2IdMap::const_iterator it = _num2id.find(n); - return (it == _num2id.end()) ? -1 : it->second; - } - VfNum2IdMap::const_iterator vit = _vfnum2id.find(_vfStack.top()); - if (vit == _vfnum2id.end()) - return -1; - const Num2IdMap &num2id = vit->second; - Num2IdMap::const_iterator it = num2id.find(n); - return (it == num2id.end()) ? -1 : it->second; -} - - -/** Returns a unique ID that identifies the font. Not the font object but the - * font pointer is looked up to get the ID. Thus, two different pointers - * referencing different objects of the same font are mapped to different IDs. - * @param[in] font pointer to font object to be identified - * @return non-negative font ID if font was found, -1 otherwise */ -int FontManager::fontID (const Font *font) const { - for (size_t i=0; i < _fonts.size(); i++) - if (_fonts[i] == font) - return i; - return -1; -} - - -/** Returns a unique ID that identifies the font. - * @param[in] name name of font to be identified, e.g. cmr10 - * @return non-negative font ID if font was found, -1 otherwise */ -int FontManager::fontID (const string &name) const { - map::const_iterator it = _name2id.find(name); - if (it == _name2id.end()) - return -1; - return it->second; -} - - -int FontManager::fontnum (int id) const { - if (id < 0 || size_t(id) > _fonts.size()) - return -1; - if (_vfStack.empty()) { - FORALL(_num2id, Num2IdMap::const_iterator, i) - if (i->second == id) - return i->first; - } - else { - VfNum2IdMap::const_iterator it = _vfnum2id.find(_vfStack.top()); - if (it == _vfnum2id.end()) - return -1; - const Num2IdMap &num2id = it->second; - FORALL(num2id, Num2IdMap::const_iterator, i) - if (i->second == id) - return i->first; - } - return -1; -} - - -int FontManager::vfFirstFontNum (VirtualFont *vf) const { - VfFirstFontMap::const_iterator it = _vfFirstFontMap.find(vf); - return (it == _vfFirstFontMap.end()) ? -1 : (int) it->second; -} - - -/** Returns a previously registered font. - * @param[in] n local font number, as used in DVI and VF files - * @return pointer to font if font was found, 0 otherwise */ -Font* FontManager::getFont (int n) const { - int id = fontID(n); - return (id < 0) ? 0 : _fonts[id]; -} - - -Font* FontManager::getFont (const string &name) const { - int id = fontID(name); - if (id < 0) - return 0; - return _fonts[id]; -} - - -Font* FontManager::getFontById (int id) const { - if (id < 0 || size_t(id) >= _fonts.size()) - return 0; - return _fonts[id]; -} - - -/** Returns the current active virtual font. */ -VirtualFont* FontManager::getVF () const { - return _vfStack.empty() ? 0 : _vfStack.top(); -} - - -static Font* create_font (const string &filename, const string &fontname, int fontindex, UInt32 checksum, double dsize, double ssize) { - string ext; - if (const char *dot = strrchr(filename.c_str(), '.')) - ext = dot+1; - if (!ext.empty() && FileFinder::lookup(filename)) { - if (ext == "pfb") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::PFB); - if (ext == "otf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::OTF); - if (ext == "ttf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::TTF); - if (ext == "ttc") - return PhysicalFont::create(fontname, fontindex, checksum, dsize, ssize); - if (ext == "vf") - return VirtualFont::create(fontname, checksum, dsize, ssize); - if (ext == "mf") - return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::MF); - } - return 0; -} - - -/** Registers a new font to be managed by the FontManager. If there is - * already a registered font assigned to number n, nothing happens. - * @param[in] fontnum local font number, as used in DVI and VF files - * @param[in] name TFM fontname given in DVI file, e.g. cmr10 - * @param[in] checksum checksum to be compared with TFM checksum - * @param[in] dsize design size in PS point units - * @param[in] ssize scaled size in PS point units - * @return id of registered font */ -int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, double dsize, double ssize) { - int id = fontID(fontnum); - if (id >= 0) - return id; - - Font *newfont = 0; - const int newid = _fonts.size(); // the new font gets this ID - Name2IdMap::iterator it = _name2id.find(name); - if (it != _name2id.end()) { // font with same name already registered? - Font *font = _fonts[it->second]; - newfont = font->clone(dsize, ssize); - } - else { - string filename = name; - int fontindex = 0; - const FontMap::Entry *map_entry = FontMap::instance().lookup(name); - if (map_entry) { - filename = map_entry->fontname; - fontindex = map_entry->fontindex; - } - // try to find font file with the exact given name - if (filename.rfind(".") != string::npos) - newfont = create_font(filename, name, fontindex, checksum, dsize, ssize); - else { - // try various font file formats if the given file has no extension - const char *exts[] = {"pfb", "otf", "ttc", "ttf", "vf", "mf", 0}; - for (const char **p = exts; *p && !newfont; ++p) - newfont = create_font(filename+"."+*p, name, fontindex, checksum, dsize, ssize); - } - if (newfont) { - if (!newfont->findAndAssignBaseFontMap()) - Message::wstream(true) << "no suitable encoding table found for font " << filename << "\n"; - if (!newfont->verifyChecksums()) - Message::wstream(true) << "checksum mismatch in font " << name << '\n'; - } - else { - // create dummy font as a placeholder if the proper font is not available - newfont = new EmptyFont(name); - if (filename.rfind(".") == string::npos) - filename += ".mf"; - // print warning message about missing font file (only once for each filename) - static set missing_fonts; - if (missing_fonts.find(filename) == missing_fonts.end()) { - Message::wstream(true) << "font file '" << filename << "' not found\n"; - missing_fonts.insert(filename); - } - } - _name2id[name] = newid; - } - _fonts.push_back(newfont); - if (_vfStack.empty()) // register font referenced in dvi file? - _num2id[fontnum] = newid; - else { // register font referenced in vf file - VirtualFont *vf = const_cast(_vfStack.top()); - _vfnum2id[vf][fontnum] = newid; - if (_vfFirstFontMap.find(vf) == _vfFirstFontMap.end()) // first fontdef of VF? - _vfFirstFontMap[vf] = fontnum; - } - return newid; -} - - -int FontManager::registerFont (UInt32 fontnum, string filename, double ptsize, const FontStyle &style, Color color) { - return registerFont(fontnum, filename, 0, ptsize, style, color); -} - - -int FontManager::registerFont (UInt32 fontnum, string filename, int fontIndex, double ptsize, const FontStyle &style, Color color) { - int id = fontID(fontnum); - if (id >= 0) - return id; - - if (!filename.empty() && filename[0] == '[' && filename[filename.size()-1] == ']') - filename = filename.substr(1, filename.size()-2); - string fontname = NativeFont::uniqueName(filename, style); - const char *path = filename.c_str(); - Font *newfont=0; - const int newid = _fonts.size(); // the new font gets this ID - Name2IdMap::iterator it = _name2id.find(fontname); - if (it != _name2id.end()) { // font with same name already registered? - if (NativeFont *font = dynamic_cast(_fonts[it->second])) - newfont = font->clone(ptsize, style, color); - } - else { - if (!FileSystem::exists(path)) - path = FileFinder::lookup(filename, false); - if (path) { - newfont = new NativeFontImpl(path, fontIndex, ptsize, style, color); - newfont->findAndAssignBaseFontMap(); - } - if (!newfont) { - // create dummy font as a placeholder if the proper font is not available - newfont = new EmptyFont(filename); - // print warning message about missing font file (only once for each filename) - static set missing_fonts; - if (missing_fonts.find(filename) == missing_fonts.end()) { - Message::wstream(true) << "font file '" << filename << "' not found\n"; - missing_fonts.insert(filename); - } - } - _name2id[fontname] = newid; - } - _fonts.push_back(newfont); - _num2id[fontnum] = newid; - return newid; -} - - -/** Enters a new virtual font frame. - * This method must be called before processing a VF character. - * @param[in] vf virtual font */ -void FontManager::enterVF (VirtualFont *vf) { - if (vf) - _vfStack.push(vf); -} - - -/** Leaves a previously entered virtual font frame. */ -void FontManager::leaveVF () { - if (!_vfStack.empty()) - _vfStack.pop(); -} - - -/** Assigns a sequence of DVI commands to a char code. - * @param[in] c character code - * @param[in] dvi points to vector with DVI commands */ -void FontManager::assignVfChar (int c, vector *dvi) { - if (!_vfStack.empty() && dvi) - _vfStack.top()->assignChar(c, dvi); -} - - -ostream& FontManager::write (ostream &os, Font *font, int level) { -#if 0 - if (font) { - int id = -1; - for (int i=0; i < fonts.size() && id < 0; i++) - if (fonts[i] == font) - id = i; - - VirtualFont *vf = dynamic_cast(font); - for (int j=0; j < level+1; j++) - os << " "; - os << "id " << id - << " fontnum " << fontnum(id) << " " - << (vf ? "VF" : "PF") << " " - << font->name() - << endl; - - if (vf) { - enterVF(vf); - const Num2IdMap &num2id = vfnum2id.find(vf)->second; - FORALL(num2id, Num2IdMap::const_iterator, i) { - Font *font = fonts[i->second]; - write(os, font, level+1); - } - leaveVF(); - } - } - else { - for (int i=0; i < fonts.size(); i++) - write(os, fonts[i], level); - os << endl; - } -#endif - return os; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.h deleted file mode 100644 index f856eb656a1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontManager.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* -** FontManager.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTMANAGER_H -#define DVISVGM_FONTMANAGER_H - -#include -#include -#include -#include -#include -#include -#include "Color.h" -#include "FontStyle.h" -#include "types.h" - - -struct FileFinder; -struct Font; -class VirtualFont; - -/** This class provides methods for easy DVI font handling. - * DVI and VF files use local font numbers to reference fonts. For SVG output - * we need a single list with unique IDs of all physical fonts. Characters of - * virtual fonts are completely replaced by their DVI description so they don't - * appear anywhere in the output. */ -class FontManager -{ - typedef std::map Num2IdMap; - typedef std::map Name2IdMap; - typedef std::map VfNum2IdMap; - typedef std::map VfFirstFontMap; - typedef std::stack VfStack; - - public: - ~FontManager (); - static FontManager& instance (); - int registerFont (UInt32 fontnum, std::string fontname, UInt32 checksum, double dsize, double scale); - int registerFont (UInt32 fontnum, std::string fname, double ptsize, const FontStyle &style, Color color); - int registerFont (UInt32 fontnum, std::string fname, int fontIndex, double ptsize, const FontStyle &style, Color color); - Font* getFont (int n) const; - Font* getFont (const std::string &name) const; - Font* getFontById (int id) const; - VirtualFont* getVF () const; - int fontID (int n) const; - int fontID (const Font *font) const; - int fontID (const std::string &name) const; - int fontnum (int id) const; - int vfFirstFontNum (VirtualFont *vf) const; - void enterVF (VirtualFont *vf); - void leaveVF (); - void assignVfChar (int c, std::vector *dvi); - const std::vector& getFonts () const {return _fonts;} - std::ostream& write (std::ostream &os, Font *font=0, int level=0); - - protected: - FontManager () {} - - private: - std::vector _fonts; ///< all registered Fonts - Num2IdMap _num2id; ///< DVI font number -> fontID - Name2IdMap _name2id; ///< fontname -> fontID - VfNum2IdMap _vfnum2id; - VfStack _vfStack; ///< stack of currently processed virtual fonts - VfFirstFontMap _vfFirstFontMap; ///< VF -> local font number of first font defined in VF -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.cpp deleted file mode 100644 index e6179c8115e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/************************************************************************* -** FontMap.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "CMap.h" -#include "Directory.h" -#include "FileFinder.h" -#include "FontManager.h" -#include "FontMap.h" -#include "MapLine.h" -#include "Message.h" -#include "Subfont.h" - -using namespace std; - - -FontMap::~FontMap () { - for (Iterator it=_entries.begin(); it != _entries.end(); ++it) - delete it->second; -} - - -/** Returns the singleton instance. */ -FontMap& FontMap::instance() { - static FontMap fontmap; - return fontmap; -} - - -/** Reads and evaluates a single font map file. - * @param[in] fname name of map file to read - * @param[in] mode selects how to integrate the map file entries into the global map tree - * @return true if file could be opened */ -bool FontMap::read (const string &fname, FontMap::Mode mode) { - ifstream ifs(fname.c_str()); - if (!ifs) - return false; - - int line_number = 1; - while (ifs) { - int c = ifs.peek(); - if (c < 0 || strchr("\n&#%;*", c)) // comment or empty line? - ifs.ignore(numeric_limits::max(), '\n'); - else { - try { - MapLine mapline(ifs); - apply(mapline, mode); - } - catch (const MapLineException &e) { - Message::wstream(true) << fname << ", line " << line_number << ": " << e.what() << '\n'; - } - catch (const SubfontException &e) { - Message::wstream(true) << e.filename(); - if (e.lineno() > 0) - Message::wstream(false) << ", line " << e.lineno(); - Message::wstream(false) << e.what() << '\n'; - } - } - line_number++; - } - return true; -} - - -bool FontMap::read (const string &fname, char modechar) { - Mode mode; - switch (modechar) { - case '=': mode = FM_REPLACE; break; - case '-': mode = FM_REMOVE; break; - default : mode = FM_APPEND; - } - return read(fname, mode); -} - - -/** Applies a mapline according to the given mode (append, remove, replace). - * @param[in] mapline the mapline to be applied - * @param[in] mode mode to use - * @return true in case of success */ -bool FontMap::apply (const MapLine& mapline, FontMap::Mode mode) { - switch (mode) { - case FM_APPEND: - return append(mapline); - case FM_REMOVE: - return remove(mapline); - default: - return replace(mapline); - } -} - - -/** Applies a mapline according to the given mode (append, remove, replace). - * @param[in] mapline the mapline to be applied - * @param[in] modechar character that denotes the mode (+, -, or =) - * @return true in case of success */ -bool FontMap::apply (const MapLine& mapline, char modechar) { - Mode mode; - switch (modechar) { - case '=': mode = FM_REPLACE; break; - case '-': mode = FM_REMOVE; break; - default : mode = FM_APPEND; - } - return apply(mapline, mode); -} - - -/** Reads and evaluates a sequence of map files. Each map file is looked up in the local - * directory and the TeX file tree. - * @param[in] fname_seq comma-separated list of map file names - * @return true if at least one of the given map files was found */ -bool FontMap::read (const string &fname_seq) { - bool found = false; - size_t left=0; - while (left < fname_seq.length()) { - const char modechar = fname_seq[left]; - if (strchr("+-=", modechar)) - left++; - string fname; - size_t right = fname_seq.find(',', left); - if (right != string::npos) - fname = fname_seq.substr(left, right-left); - else { - fname = fname_seq.substr(left); - right = fname_seq.length(); - } - if (!fname.empty()) { - if (!read(fname, modechar)) { - if (const char *path = FileFinder::lookup(fname, false)) - found = found || read(path, modechar); - else - Message::wstream(true) << "map file " << fname << " not found\n"; - } - } - left = right+1; - } - return found; -} - - -/** Appends given map line data to the font map if there is no entry for the corresponding - * font in the map yet. - * @param[in] mapline parsed font data - * @return true if data has been appended */ -bool FontMap::append (const MapLine &mapline) { - bool ret = false; - if (!mapline.texname().empty()) { - if (!mapline.fontfname().empty() || !mapline.encname().empty()) { - vector subfonts; - if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); - else - subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); - if (it == _entries.end()) { - _entries[fontname] = new Entry(mapline, subfonts[i]); - ret = true; - } - } - } - } - return ret; -} - - -/** Replaces the map data of the given font. - * If the font is locked (because it's already in use) nothing happens. - * @param[in] mapline parsed font data - * @return true if data has been replaced */ -bool FontMap::replace (const MapLine &mapline) { - if (mapline.texname().empty()) - return false; - if (mapline.fontfname().empty() && mapline.encname().empty()) - return remove(mapline); - - vector subfonts; - if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); - else - subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); - if (it == _entries.end()) - _entries[fontname] = new Entry(mapline, subfonts[i]); - else if (!it->second->locked) - *it->second = Entry(mapline, subfonts[i]); - } - return true; -} - - -/** Removes the map entry of the given font. - * If the font is locked (because it's already in use) nothing happens. - * @param[in] mapline parsed font data - * @return true if entry has been removed */ -bool FontMap::remove (const MapLine &mapline) { - bool ret = false; - if (!mapline.texname().empty()) { - vector subfonts; - if (mapline.sfd()) - mapline.sfd()->subfonts(subfonts); - else - subfonts.push_back(0); - for (size_t i=0; i < subfonts.size(); i++) { - string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); - Iterator it = _entries.find(fontname); - if (it != _entries.end() && !it->second->locked) { - _entries.erase(it); - ret = true; - } - } - } - return ret; -} - - -ostream& FontMap::write (ostream &os) const { - for (ConstIterator it=_entries.begin(); it != _entries.end(); ++it) - os << it->first << " -> " << it->second->fontname << " [" << it->second->encname << "]\n"; - return os; -} - - -/** Reads and evaluates all map files in the given directory. - * @param[in] dirname path to directory containing the map files to be read */ -void FontMap::readdir (const string &dirname) { - Directory dir(dirname); - while (const char *fname = dir.read(Directory::ET_FILE)) { - if (strlen(fname) >= 4 && strcmp(fname+strlen(fname)-4, ".map") == 0) { - string path = dirname + "/" + fname; - read(path.c_str()); - } - } -} - - -/** Returns name of font that is mapped to a given font. - * @param[in] fontname name of font whose mapped name is retrieved - * @returns name of mapped font */ -const FontMap::Entry* FontMap::lookup (const string &fontname) const { - ConstIterator it = _entries.find(fontname); - if (it == _entries.end()) - return 0; - return it->second; -} - - -/** Sets the lock flag for the given font in order to avoid changing the map data of this font. - * @param[in] fontname name of font to be locked */ -void FontMap::lockFont (const string& fontname) { - Iterator it = _entries.find(fontname); - if (it != _entries.end()) - it->second->locked = true; -} - - -/** Removes all (unlocked) entries from the font map. - * @param[in] unlocked_only if true, only unlocked entries are removed */ -void FontMap::clear (bool unlocked_only) { - if (!unlocked_only) - _entries.clear(); - else { - Iterator it=_entries.begin(); - while (it != _entries.end()) { - if (it->second->locked) - ++it; - else { - delete it->second; - _entries.erase(it++); - } - } - } -} - -///////////////////////////////////////////////// - -FontMap::Entry::Entry (const MapLine &mapline, Subfont *sf) - : fontname(mapline.fontfname()), encname(mapline.encname()), subfont(sf), fontindex(mapline.fontindex()), - locked(false), style(mapline.bold(), mapline.extend(), mapline.slant()) -{ -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.h deleted file mode 100644 index 0360a67d3df..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMap.h +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* -** FontMap.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTMAP_H -#define DVISVGM_FONTMAP_H - -#include -#include -#include -#include "FontStyle.h" - - -struct FontEncoding; -class MapLine; -class Subfont; - -class FontMap -{ - public: - struct Entry - { - Entry (const MapLine &mapline, Subfont *subfont=0); - std::string fontname; ///< target font name - std::string encname; ///< name of font encoding - Subfont *subfont; - int fontindex; ///< index of font in multi-font file - bool locked; - FontStyle style; - }; - - protected: - typedef std::map::iterator Iterator; - typedef std::map::const_iterator ConstIterator; - - public: - enum Mode {FM_APPEND, FM_REMOVE, FM_REPLACE}; - - ~FontMap (); - static FontMap& instance (); - bool read (const std::string &fname, Mode mode); - bool read (const std::string &fname, char modechar); - bool read (const std::string &fname_seq); - void readdir (const std::string &dirname); - bool apply (const MapLine &mapline, Mode mode); - bool apply (const MapLine &mapline, char modechar); - bool append (const MapLine &mapline); - bool replace (const MapLine &mapline); - bool remove (const MapLine &mapline); - void lockFont (const std::string &fontname); - void clear (bool unlocked_only=false); - std::ostream& write (std::ostream &os) const; - const Entry* lookup(const std::string &fontname) const; - - protected: - FontMap () {} - - private: - std::map _entries; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.cpp deleted file mode 100644 index 5792e8abbd5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* -** FontMetrics.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "FileFinder.h" -#include "FontMetrics.h" -#include "JFM.h" -#include "TFM.h" - -using namespace std; - - -FontMetrics* FontMetrics::read (const char *fontname) { - const char *path = FileFinder::lookup(string(fontname) + ".tfm"); - ifstream ifs(path, ios::binary); - if (!ifs) - return 0; - UInt16 id = 256*ifs.get(); - id += ifs.get(); - if (id == 9 || id == 11) // Japanese font metric file? - return new JFM(ifs); - return new TFM(ifs); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.h deleted file mode 100644 index 7e7a9d3e12a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontMetrics.h +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* -** FontMetrics.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_FONTMETRICS_H -#define DVISVGM_FONTMETRICS_H - -#include -#include "MessageException.h" -#include "types.h" - -struct FontMetrics -{ - virtual ~FontMetrics () {} - virtual double getDesignSize () const =0; - virtual double getCharWidth (int c) const =0; - virtual double getCharHeight (int c) const =0; - virtual double getCharDepth (int c) const =0; - virtual double getItalicCorr (int c) const =0; - virtual bool verticalLayout () const =0; - virtual UInt32 getChecksum () const =0; - virtual UInt16 firstChar () const =0; - virtual UInt16 lastChar () const =0; - static FontMetrics* read (const char *fontname); -}; - - -struct NullFontMetric : public FontMetrics -{ - double getDesignSize () const {return 1;} - double getCharWidth (int c) const {return 0;} - double getCharHeight (int c) const {return 0;} - double getCharDepth (int c) const {return 0;} - double getItalicCorr (int c) const {return 0;} - bool verticalLayout () const {return false;} - UInt32 getChecksum () const {return 0;} - UInt16 firstChar () const {return 0;} - UInt16 lastChar () const {return 0;} -}; - - -struct FontMetricException : public MessageException -{ - FontMetricException (const std::string &msg) : MessageException(msg) {} -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontStyle.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontStyle.h deleted file mode 100644 index 932c09291cc..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/FontStyle.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef FONTSTYLE -#define FONTSTYLE - -struct FontStyle { - FontStyle () : bold(0), extend(1), slant(0) {} - FontStyle (float b, float e, float s) : bold(b), extend(e), slant(s) {} - double bold; ///< stroke width in pt used to draw the glyph outlines - double extend; ///< factor to strech/shrink the glyphs horizontally - double slant; ///< horizontal slanting/skewing value (= tan(phi)) -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.cpp deleted file mode 100644 index 19d9e0bb533..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* -** GFGlyphTracer.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "GFGlyphTracer.h" -#include "Pair.h" - -using namespace std; - -GFGlyphTracer::GFGlyphTracer () : GFTracer(_ifs, 0), _glyph(0), _callback(0) -{ -} - -/** 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) - : GFTracer(_ifs, upp), _glyph(0), _callback(cb) -{ - if (_callback) - _callback->setFont(fname); - _ifs.open(fname.c_str(), ios::binary); -} - - -void GFGlyphTracer::reset (string &fname, double upp) { - if (_callback) - _callback->setFont(fname); - if (_ifs.is_open()) - _ifs.close(); - unitsPerPoint(upp); - _ifs.open(fname.c_str(), ios::binary); -} - - -bool GFGlyphTracer::executeChar (UInt8 c) { - if (!_glyph) - return false; - - if (_callback) - _callback->beginChar(c); - bool ok = GFTracer::executeChar(c); - if (_callback) { - if (ok) - _callback->endChar(c); - else - _callback->emptyChar(c); - } - return ok; -} - - -void GFGlyphTracer::moveTo (double x, double y) { - _glyph->moveto(int(x), int(y)); -} - - -void GFGlyphTracer::lineTo (double x, double y) { - _glyph->lineto(int(x), int(y)); -} - - -void GFGlyphTracer::curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) { - _glyph->cubicto(int(c1x), int(c1y), int(c2x), int(c2y), int(x), int(y)); -} - - -void GFGlyphTracer::closePath () { - _glyph->closepath(); -} - - -void GFGlyphTracer::endChar (UInt32 c) { - _glyph->clear(); - GFTracer::endChar(c); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.h deleted file mode 100644 index 1449657465f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFGlyphTracer.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* -** GFGlyphTracer.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GFGLYPHTRACER_H -#define DVISVGM_GFGLYPHTRACER_H - -#include -#include -#include "GFTracer.h" -#include "Glyph.h" - -class GFGlyphTracer : public GFTracer -{ - public: - struct Callback { - virtual ~Callback () {} - virtual void setFont (const std::string &fontname) {} - virtual void beginChar (UInt8 c) {} - virtual void endChar (UInt8 c) {} - virtual void emptyChar (UInt8 c) {} - }; - - public: - GFGlyphTracer (); - GFGlyphTracer (std::string &fname, double upp, Callback *cb=0); - void reset (std::string &fname, double upp); - void setCallback (Callback *cb) {_callback = cb;} - bool executeChar (UInt8 c); - void moveTo (double x, double y); - void lineTo (double x, double y); - void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y); - void closePath (); - void endChar (UInt32 c); - void setGlyph (Glyph &glyph) {_glyph = &glyph;} - const Glyph& getGlyph () const {return *_glyph;} - - private: - std::ifstream _ifs; - Glyph *_glyph; - Callback *_callback; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.cpp deleted file mode 100644 index 8e10c21373f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/************************************************************************* -** GFReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "GFReader.h" -#include "macros.h" -#include "SignalHandler.h" - -using namespace std; - -struct GFCommand -{ - void (GFReader::*method)(int); - int numBytes; -}; - - -/** Converts a fix point length to double (PS point units) */ -static inline double fix2double (Int32 fix) { - return double(fix)/(1 << 20)*72/72.27; -} - - -static inline double scaled2double (Int32 scaled) { - return double(scaled)/(1 << 16); -} - - -GFReader::GFReader (istream &is) : _in(is), _penDown(false) -{ - _minX = _maxX = _minY = _maxY = _x = _y = 0; - _currentChar = 0; - _designSize = 0; - _hppp = _vppp = 0; - _checksum = 0; -} - - -UInt32 GFReader::readUnsigned (int bytes) { - UInt32 ret = 0; - for (int i=bytes-1; i >= 0 && !_in.eof(); i--) { - UInt32 b = _in.get(); - ret |= b << (8*i); - } - return ret; -} - - -Int32 GFReader::readSigned (int bytes) { - Int32 ret = _in.get(); - if (ret & 128) // negative value? - ret |= 0xffffff00; - for (int i=bytes-2; i >= 0 && !_in.eof(); i--) - ret = (ret << 8) | _in.get(); - return ret; -} - - -string GFReader::readString (int bytes) { - vector buf(bytes+1); - if (bytes > 0) - _in.get(&buf[0], bytes+1); // reads 'bytes' bytes (pos. bytes+1 is set to 0) - else - buf[0] = 0; - return &buf[0]; -} - - -/** Reads a single GF command from the current position of the input stream and calls the - * corresponding cmdFOO method. - * @return opcode of the executed command */ -int GFReader::executeCommand () { - SignalHandler::instance().check(); - /* Each cmdFOO command reads the necessary number of bytes from the stream so executeCommand - doesn't need to know the exact GF command format. Some cmdFOO methods are used for multiple - GF commands because they only differ in the size of their parameters. */ - static const GFCommand commands[] = { - {&GFReader::cmdPaint, 1}, {&GFReader::cmdPaint, 2}, {&GFReader::cmdPaint, 3}, // 64-66 - {&GFReader::cmdBoc, 0}, {&GFReader::cmdBoc1, 0}, // 67-68 - {&GFReader::cmdEoc, 0}, // 69 - {&GFReader::cmdSkip, 0}, {&GFReader::cmdSkip, 1}, {&GFReader::cmdSkip, 2},{&GFReader::cmdSkip, 3}, // 70-73 - {&GFReader::cmdXXX, 1}, {&GFReader::cmdXXX, 2}, {&GFReader::cmdXXX, 3}, {&GFReader::cmdXXX, 4}, // 239-242 - {&GFReader::cmdYYY, 0}, // 243 - {&GFReader::cmdNop, 0}, // 244 - {&GFReader::cmdCharLoc, 0}, {&GFReader::cmdCharLoc0, 0}, // 245-246 - {&GFReader::cmdPre, 0}, {&GFReader::cmdPost, 0}, {&GFReader::cmdPostPost, 0} // 247-249 - }; - - int opcode = _in.get(); - if (opcode < 0) // at end of file? - throw GFException("unexpected end of file"); - - if (opcode >= 0 && opcode <= 63) - cmdPaint0(opcode); - else if (opcode >= 74 && opcode <= 238) - cmdNewRow(opcode-74); - else if (opcode >= 250) { - ostringstream oss; - oss << "undefined GF command (opcode " << opcode << ")"; - throw GFException(oss.str()); - } - else { - int offset = opcode <= 73 ? 64 : 239-(73-64+1); - const GFCommand &cmd = commands[opcode-offset]; - if (cmd.method) - (this->*cmd.method)(cmd.numBytes); - } - return opcode; -} - - -bool GFReader::executeChar (UInt8 c) { - _in.clear(); - if (_charInfoMap.empty()) - executePostamble(); // read character info - _in.clear(); - Iterator it = _charInfoMap.find(c); - if (_in && it != _charInfoMap.end()) { - _in.seekg(it->second.location); - while (executeCommand() != 69); // execute all commands until eoc is reached - return true; - } - return false; -} - - -bool GFReader::executeAllChars () { - _in.clear(); - if (_charInfoMap.empty()) - executePostamble(); // read character info - _in.clear(); - if (_in) { - _in.seekg(0); - while (executeCommand() != 248); // execute all commands until postamble is reached - return true; - } - return false; -} - - -bool GFReader::executePreamble () { - _in.clear(); - if (!_in) - return false; - _in.seekg(0); - executeCommand(); - return true; -} - - -bool GFReader::executePostamble () { - _in.clear(); - if (!_in) - return false; - _in.seekg(-1, ios::end); - while (_in.peek() == 223) // skip fill bytes - _in.seekg(-1, ios::cur); - _in.seekg(-4, ios::cur); - UInt32 q = readUnsigned(4); // pointer to begin of postamble - _in.seekg(q); // now on begin of postamble - while (executeCommand() != 249); // execute all commands until postpost is reached - return true; -} - - -/** Returns the design size of this font in PS point units. */ -double GFReader::getDesignSize () const { - return fix2double(_designSize); -} - -/** Returns the number of horizontal pixels per point. */ -double GFReader::getHPixelsPerPoint () const { - return scaled2double(_hppp)*72/72.27; -} - -/** Returns the number of vertical pixels per point. */ -double GFReader::getVPixelsPerPoint () const { - return scaled2double(_vppp)*72/72.27; -} - -/** Returns the width of character c in PS point units */ -double GFReader::getCharWidth (UInt32 c) const { - ConstIterator it = _charInfoMap.find(c%256); - return it == _charInfoMap.end() ? 0 : it->second.width*getDesignSize()/(1<<24); -} - -/////////////////////// - - -/** Reads the preamble. */ -void GFReader::cmdPre (int) { - UInt32 i = readUnsigned(1); - if (i == 131) { - UInt32 k = readUnsigned(1); - string s = readString(k); - preamble(s); - } - else - throw GFException("invalid identification number in GF preamble"); -} - - -/** Reads the postamble. */ -void GFReader::cmdPost (int) { - readUnsigned(4); // pointer to byte after final eoc - _designSize = readUnsigned(4); // design size of font in points - _checksum = readUnsigned(4); // checksum - _hppp = readUnsigned(4); // horizontal pixels per point (scaled int) - _vppp = readUnsigned(4); // vertical pixels per point (scaled int) - _in.seekg(16, ios::cur); // skip x and y bounds - postamble(); -} - - -/** Reads trailing bytes at end of stream. */ -void GFReader::cmdPostPost (int) { - readUnsigned(4); // pointer to begin of postamble - UInt32 i = readUnsigned(1); - if (i == 131) - while (readUnsigned(1) == 223); // skip fill bytes - else - throw GFException("invalid identification number in GF preamble"); -} - - -/** Inverts "paint color" (black to white or vice versa) of n pixels - * and advances the cursor by n. - * @param[in] n number of pixels to be inverted */ -void GFReader::cmdPaint0 (int n) { - if (_penDown) // set pixels? - _bitmap.setBits(_y, _x, n); - _x += n; - _penDown = !_penDown; // inverse pen state -} - - -/** Inverts "paint color" (black to white or vice versa) of n pixels - * and advances the cursor by n. The number n of pixels is read from - * the input stream. - * @param[in] len size of n in bytes */ -void GFReader::cmdPaint (int len) { - UInt32 pixels = readUnsigned(len); - cmdPaint0(pixels); -} - - -/** Beginning of character (generic format). */ -void GFReader::cmdBoc (int) { - _currentChar = readSigned(4); - readSigned(4); // pointer to previous boc with same c mod 256 - _minX = readSigned(4); - _maxX = readSigned(4); - _minY = readSigned(4); - _maxY = readSigned(4); - _x = _minX; - _y = _maxY; - _penDown = false; - _bitmap.resize(_minX, _maxX, _minY, _maxY); - beginChar(_currentChar); -} - - -/** Beginning of character (compact format). */ -void GFReader::cmdBoc1 (int) { - _currentChar = readUnsigned(1); - UInt32 dx = readUnsigned(1); - _maxX = readUnsigned(1); - _minX = _maxX - dx; - UInt32 dy = readUnsigned(1); - _maxY = readUnsigned(1); - _minY = _maxY - dy; - _x = _minX; - _y = _maxY; - _penDown = false; - _bitmap.resize(_minX, _maxX, _minY, _maxY); - beginChar(_currentChar); -} - - -/** End of character. */ -void GFReader::cmdEoc (int) { - endChar(_currentChar); -} - - -/** Moves cursor to the beginning of a following row and sets - * paint color to white. - * @param[in] len if 0: move to next row, otherwise: number of bytes to read. - * The read value denotes the number of rows to be skipped. */ -void GFReader::cmdSkip (int len) { - if (len == 0) - _y--; - else - _y -= readUnsigned(len)+1; - _x = _minX; - _penDown = false; -} - - -/** Moves cursor to pixel number 'col' in the next row and sets - * the paint color to black. - * @param[in] col pixel/column number */ -void GFReader::cmdNewRow (int col) { - _x = _minX + col ; - _y--; - _penDown = true; -} - - -void GFReader::cmdXXX (int len) { - UInt32 n = readUnsigned(len); - string str = readString(n); - special(str); -} - - -void GFReader::cmdYYY (int) { - Int32 y = readSigned(4); - numspecial(y); -} - - -/** Does nothing. */ -void GFReader::cmdNop (int) { -} - - -/** Reads character locator (part of postamble) */ -void GFReader::cmdCharLoc0 (int) { - UInt8 c = readUnsigned(1); // character code mod 256 - UInt8 dm = readUnsigned(1); // - Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize - Int32 p = readSigned(4); // pointer to begin of (last) character data - Int32 dx = 65536*dm; - Int32 dy = 0; - _charInfoMap[c] = CharInfo(dx, dy, w, p); -} - - -/** Reads character locator (part of postamble) */ -void GFReader::cmdCharLoc (int) { - UInt32 c = readUnsigned(1); // character code mod 256 - Int32 dx = readSigned(4); // horizontal escapement (scaled pixel units) - Int32 dy = readSigned(4); // vertical escapement (scaled pixel units) - Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize - Int32 p = readSigned(4); // pointer to begin of (last) character data - _charInfoMap[c] = CharInfo(dx, dy, w, p); -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.h deleted file mode 100644 index a644fce901c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFReader.h +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************* -** GFReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GFREADER_H -#define DVISVGM_GFREADER_H - -#include -#include -#include -#include "Bitmap.h" -#include "MessageException.h" -#include "types.h" - - -class CharInfo; - - -struct GFException : public MessageException -{ - GFException (const std::string &msg) : MessageException(msg) {} -}; - - -class GFReader -{ - struct CharInfo - { - CharInfo () : dx(0), dy(0), width(0), location(0) {} - CharInfo (Int32 dxx, Int32 dyy, Int32 w, UInt32 p) : dx(dxx), dy(dyy), width(w), location(p) {} - - Int32 dx, dy; - Int32 width; // 2^24 * (true width)/(design size) - UInt32 location; - }; - - typedef std::map::iterator Iterator; - typedef std::map::const_iterator ConstIterator; - public: - GFReader (std::istream &is); - virtual ~GFReader () {} - bool executeChar (UInt8 c); - bool executeAllChars (); - bool executePreamble (); - bool executePostamble (); - virtual void preamble (const std::string &str) {} - virtual void postamble () {} - virtual void beginChar (UInt32 c) {} - virtual void endChar (UInt32 c) {} - virtual void special (std::string str) {} - virtual void numspecial (Int32 y) {} - const Bitmap& getBitmap () const {return _bitmap;} - double getDesignSize () const; - double getHPixelsPerPoint () const; - double getVPixelsPerPoint () const; - double getCharWidth (UInt32 c) const; - UInt32 getChecksum () const {return _checksum;} - - protected: - Int32 readSigned (int bytes); - UInt32 readUnsigned (int bytes); - std::string readString (int len); - int executeCommand (); - std::istream& getInputStream () const {return _in;} - - void cmdPre (int); - void cmdPost (int); - void cmdPostPost (int); - void cmdPaint0 (int pixels); - void cmdPaint (int len); - void cmdBoc (int); - void cmdBoc1 (int); - void cmdEoc (int); - void cmdSkip (int len); - void cmdNewRow (int col); - void cmdXXX (int len); - void cmdYYY (int); - void cmdNop (int); - void cmdCharLoc0 (int); - void cmdCharLoc (int); - - private: - std::istream &_in; - Int32 _minX, _maxX, _minY, _maxY; - Int32 _x, _y; // current pen location (pixel units) - Int32 _currentChar; - Bitmap _bitmap; // bitmap of current char - FixWord _designSize; // designSize - ScaledInt _hppp, _vppp; // horizontal and vertical pixel per point - UInt32 _checksum; - std::map _charInfoMap; - bool _penDown; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.cpp deleted file mode 100644 index e071e93e1f6..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* -** GFTracer.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "GFTracer.h" -#include "Glyph.h" -#include "Message.h" - -#ifdef __MSVC__ -#include -#else -extern "C" { -#include -} -#endif - -using namespace std; - - -GFTracer::GFTracer (istream &is) - : GFReader(is), _unitsPerPoint(0.0) -{ -} - - -/** Constructs a new GFTracer. - * @param[in] is GF file is read from this stream - * @param[in] upp target units per PS point */ -GFTracer::GFTracer (istream &is, double upp) - : GFReader(is), _unitsPerPoint(upp) -{ -} - - -void GFTracer::beginChar (UInt32 c) { -} - - -void GFTracer::endChar (UInt32 c) { - const Bitmap &bitmap = getBitmap(); - if (bitmap.empty()) - return; - - // prepare potrace's bitmap structure - vector buffer; - potrace_bitmap_t pobitmap; - pobitmap.w = bitmap.width(); - pobitmap.h = bitmap.height(); - pobitmap.dy = bitmap.copy(buffer); - pobitmap.map = &buffer[0]; - potrace_param_t *param = potrace_param_default(); - potrace_state_t *state = potrace_trace(param, &pobitmap); - potrace_param_free(param); - - if (!state || state->status == POTRACE_STATUS_INCOMPLETE) - Message::wstream(true) << "error while tracing character\n"; - else { - double hsf=1.0, vsf=1.0; // horizontal a d vertical scale factor - if (_unitsPerPoint != 0.0) { - hsf = _unitsPerPoint/getHPixelsPerPoint(); // horizontal scale factor - vsf = _unitsPerPoint/getVPixelsPerPoint(); // vertical scale factor - } - for (potrace_path_t *path = state->plist; path; path = path->next) { - potrace_dpoint_t &p = path->curve.c[path->curve.n-1][2]; // start/end point - moveTo(hsf*(p.x+bitmap.xshift()), vsf*(p.y+bitmap.yshift())); - for (int i=0; i < path->curve.n; i++) { - if (path->curve.tag[i] == POTRACE_CURVETO) { - curveTo(hsf*(path->curve.c[i][0].x+bitmap.xshift()), vsf*(path->curve.c[i][0].y+bitmap.yshift()), - hsf*(path->curve.c[i][1].x+bitmap.xshift()), vsf*(path->curve.c[i][1].y+bitmap.yshift()), - hsf*(path->curve.c[i][2].x+bitmap.xshift()), vsf*(path->curve.c[i][2].y+bitmap.yshift())); - } - else { - lineTo(hsf*(path->curve.c[i][1].x+bitmap.xshift()), vsf*(path->curve.c[i][1].y+bitmap.yshift())); - if (i == path->curve.n-1) - closePath(); - else - lineTo(hsf*(path->curve.c[i][2].x+bitmap.xshift()), vsf*(path->curve.c[i][2].y+bitmap.yshift())); - } - } - } - } - potrace_state_free(state); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.h deleted file mode 100644 index a288284f3ab..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GFTracer.h +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* -** GFTracer.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GFTRACER_H -#define DVISVGM_GFTRACER_H - -#include -#include "GFReader.h" - -class GFTracer : public GFReader -{ - public: - GFTracer (std::istream &is); - GFTracer (std::istream &is, double upp); - virtual ~GFTracer () {} - virtual void moveTo (double x, double y) =0; - virtual void lineTo (double x, double y) =0; - virtual void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) =0; - virtual void closePath () =0; - void beginChar (UInt32 c); - void endChar (UInt32 c); - - protected: - void unitsPerPoint(double upp) {_unitsPerPoint = upp;} - - private: - double _unitsPerPoint; ///< target units per PS point -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.cpp deleted file mode 100644 index 6a58ba0c6b5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.cpp +++ /dev/null @@ -1,353 +0,0 @@ -/************************************************************************* -** Ghostscript.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "Ghostscript.h" -#if !defined(DISABLE_GS) -#include -#include -#include -#if defined(HAVE_LIBGS) - #include -#else - #include "ierrors.h" - #include "FileFinder.h" -#endif - -using namespace std; - -// name of Ghostscript shared library set by the user -string Ghostscript::LIBGS_NAME; - -#ifndef HAVE_LIBGS - -#ifdef __WIN32__ -/** Looks up the path of the Ghostscript DLL in the Windows registry and returns it. - * If there is no proper registry entry, the returned string is empty. */ -static string get_path_from_registry () { -#ifdef RRF_RT_REG_SZ // RegGetValueA and RRF_RT_REG_SZ may not be defined for some oldish MinGW - REGSAM mode = KEY_READ|KEY_QUERY_VALUE; -#ifdef KEY_WOW64_64KEY -#ifdef __WIN64__ - mode |= KEY_WOW64_64KEY; -#else - mode |= KEY_WOW64_32KEY; -#endif -#endif - static const char *gs_companies[] = {"GPL", "GNU", "AFPL", "Aladdin"}; - for (size_t i=0; i < sizeof(gs_companies)/sizeof(char*); i++) { - const string reg_path = string("SOFTWARE\\") + gs_companies[i] + " Ghostscript"; - static HKEY reg_roots[] = {HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE}; - for (size_t j=0; j < sizeof(reg_roots)/sizeof(HKEY); j++) { - HKEY hkey; - if (RegOpenKeyExA(reg_roots[j], reg_path.c_str(), 0, mode, &hkey) == ERROR_SUCCESS) { - char subkey[16]; - for (int k=0; RegEnumKeyA(hkey, k, subkey, 16) == ERROR_SUCCESS; k++) { - istringstream iss(subkey); - int major_version; - iss >> major_version; - if (major_version >= 7) { - char dll_path[256]; // path to Ghostscript DLL stored in the registry - DWORD length; - if (RegGetValueA(hkey, subkey, "GS_DLL", RRF_RT_REG_SZ, 0, dll_path, &length) == ERROR_SUCCESS) { - RegCloseKey(hkey); - return dll_path; - } - } - } - RegCloseKey(hkey); - } - } - } -#endif // RRF_RT_REG_SZ - return ""; -} -#endif // __WIN32__ - - -/** Try to detect name of the Ghostscript shared library depending on the user settings. - * @param[in] fname path/filename given by the user - * @return name of Ghostscript shared library */ -static string get_libgs (const string &fname) { - if (!fname.empty()) - return fname; -#ifdef MIKTEX -#if defined(__WIN64__) - const char *gsdll = "mgsdll64.dll"; -#else - const char *gsdll = "mgsdll32.dll"; -#endif - // try to look up the Ghostscript DLL coming with MiKTeX - if (const char *gsdll_path = FileFinder::lookup(gsdll)) - return gsdll_path; -#endif // MIKTEX -#if defined(__WIN32__) - // try to look up the path of the Ghostscript DLL in the Windows registry - string gsdll_path = get_path_from_registry(); - if (!gsdll_path.empty()) - return gsdll_path; -#endif -#if defined(__WIN64__) - return "gsdll64.dll"; -#elif defined(__WIN32__) - return "gsdll32.dll"; -#else - // try to find libgs.so.X on the user's system - const int abi_min=7, abi_max=9; // supported libgs ABI versions - for (int i=abi_max; i >= abi_min; i--) { - ostringstream oss; -#if defined(__CYGWIN__) - oss << "cyggs-" << i << ".dll"; -#else - oss << "libgs.so." << i; -#endif - DLLoader loader(oss.str().c_str()); - if (loader.loaded()) - return oss.str(); - } -#endif - // no appropriate library found - return ""; -} -#endif // !HAVE_LIBGS - - -/** Loads the Ghostscript library but does not create an instance. This - * constructor should only be used to call available() and revision(). */ -Ghostscript::Ghostscript () -#if !defined(HAVE_LIBGS) - : DLLoader(get_libgs(LIBGS_NAME).c_str()) -#endif -{ - _inst = 0; -} - - -/** Tries to load the shared library and to initialize Ghostscript. - * @param[in] argc number of parameters in array argv - * @param[in] argv parameters passed to Ghostscript - * @param[in] caller this parameter is passed to all callback functions */ -Ghostscript::Ghostscript (int argc, const char **argv, void *caller) -#if !defined(HAVE_LIBGS) - : DLLoader(get_libgs(LIBGS_NAME).c_str()) -#endif -{ - _inst = 0; - init(argc, argv, caller); -} - - -/** Exits Ghostscript and unloads the dynamic library. */ -Ghostscript::~Ghostscript () { - if (_inst) { - this->exit(); - delete_instance(); - } -} - - -bool Ghostscript::init (int argc, const char **argv, void *caller) { - if (!_inst) { - int status = new_instance(&_inst, caller); - if (status < 0) - _inst = 0; - else { - init_with_args(argc, (char**)argv); - } - } - return _inst != 0; -} - - -/** Returns true if Ghostscript library was found and can be loaded. */ -bool Ghostscript::available () { -#if defined(HAVE_LIBGS) - return true; -#else - gsapi_revision_t rev; - return loaded() && revision(&rev); -#endif -} - - -/** 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) { -#if defined(HAVE_LIBGS) - return (gsapi_revision(r, sizeof(gsapi_revision_t)) == 0); -#else - if (PFN_gsapi_revision fn = (PFN_gsapi_revision)loadSymbol("gsapi_revision")) - return (fn(r, sizeof(gsapi_revision_t)) == 0); - return false; -#endif -} - - -/** Returns product name and revision number of the GS library. - * @param[in] revonly if true, only the revision number is returned */ -string Ghostscript::revision (bool revonly) { - gsapi_revision_t r; - if (revision(&r)) { - ostringstream oss; - if (!revonly) - oss << r.product << ' '; - oss << (r.revision/100) << '.' << setfill('0') << setw(2) << (r.revision%100); - return oss.str(); - } - return ""; -} - - -/** Creates a new instance of Ghostscript. This method is called by the constructor and - * should not be used elsewhere. - * @param[out] psinst handle of newly created instance (or 0 on error) - * @param[in] caller pointer forwarded to callback functions */ -int Ghostscript::new_instance (void **psinst, void *caller) { -#if defined(HAVE_LIBGS) - return gsapi_new_instance(psinst, caller); -#else - if (PFN_gsapi_new_instance fn = (PFN_gsapi_new_instance)loadSymbol("gsapi_new_instance")) - return fn(psinst, caller); - *psinst = 0; - return 0; -#endif -} - - -/** Destroys the current instance of Ghostscript. This method is called by the destructor - * and should not be used elsewhere. */ -void Ghostscript::delete_instance () { -#if defined(HAVE_LIBGS) - gsapi_delete_instance(_inst); -#else - if (PFN_gsapi_delete_instance fn = (PFN_gsapi_delete_instance)loadSymbol("gsapi_delete_instance")) - fn(_inst); -#endif -} - - -/** Exits the interpreter. Must be called before destroying the GS instance. */ -int Ghostscript::exit () { -#if defined(HAVE_LIBGS) - return gsapi_exit(_inst); -#else - if (PFN_gsapi_exit fn = (PFN_gsapi_exit)loadSymbol("gsapi_exit")) - return fn(_inst); - return 0; -#endif -} - - -/** Sets the I/O callback functions. - * @param[in] in pointer to stdin handler - * @param[in] out pointer to stdout handler - * @param[in] err pointer to stderr handler */ -int Ghostscript::set_stdio (Stdin in, Stdout out, Stderr err) { -#if defined(HAVE_LIBGS) - return gsapi_set_stdio(_inst, in, out, err); -#else - if (PFN_gsapi_set_stdio fn = (PFN_gsapi_set_stdio)loadSymbol("gsapi_set_stdio")) - return fn(_inst, in, out, err); - return 0; -#endif -} - - -/** Initializes Ghostscript with a set of optional parameters. This - * method is called by the constructor and should not be used elsewhere. - * @param[in] argc number of paramters - * @param[in] argv parameters passed to Ghostscript */ -int Ghostscript::init_with_args (int argc, char **argv) { -#if defined(HAVE_LIBGS) - return gsapi_init_with_args(_inst, argc, argv); -#else - if (PFN_gsapi_init_with_args fn = (PFN_gsapi_init_with_args)loadSymbol("gsapi_init_with_args")) - return fn(_inst, argc, argv); - return 0; -#endif -} - - -/** Tells Ghostscript that several calls of run_string_continue will follow. */ -int Ghostscript::run_string_begin (int user_errors, int *pexit_code) { -#if defined(HAVE_LIBGS) - return gsapi_run_string_begin(_inst, user_errors, pexit_code); -#else - if (PFN_gsapi_run_string_begin fn = (PFN_gsapi_run_string_begin)loadSymbol("gsapi_run_string_begin")) - return fn(_inst, user_errors, pexit_code); - *pexit_code = 0; - return 0; -#endif -} - - -/** Executes a chunk of PostScript commands given by a buffer of characters. The size of - * this buffer must not exceed 64KB. Longer programs can be split into arbitrary smaller chunks - * and passed to Ghostscript by successive calls of run_string_continue. - * @param[in] str buffer containing the PostScript code - * @param[in] length number of characters in buffer - * @param[in] user_errors if non-negative, the default PS error values will be generated, otherwise this value is returned - * @param[out] pexit_code takes the PS error code */ -int Ghostscript::run_string_continue (const char *str, unsigned length, int user_errors, int *pexit_code) { -#if defined(HAVE_LIBGS) - return gsapi_run_string_continue(_inst, str, length, user_errors, pexit_code); -#else - if (PFN_gsapi_run_string_continue fn = (PFN_gsapi_run_string_continue)loadSymbol("gsapi_run_string_continue")) - return fn(_inst, str, length, user_errors, pexit_code); - *pexit_code = 0; - return 0; -#endif -} - - -/** Terminates the successive code feeding. Must be called after the last call of run_string_continue. */ -int Ghostscript::run_string_end (int user_errors, int *pexit_code) { -#if defined(HAVE_LIBGS) - return gsapi_run_string_end(_inst, user_errors, pexit_code); -#else - if (PFN_gsapi_run_string_end fn = (PFN_gsapi_run_string_end)loadSymbol("gsapi_run_string_end")) - return fn(_inst, user_errors, pexit_code); - *pexit_code = 0; - return 0; -#endif -} - - -const char* Ghostscript::error_name (int code) { - if (code < 0) - code = -code; - const char *error_names[] = { ERROR_NAMES }; - if (code == 0 || (size_t)code > sizeof(error_names)/sizeof(error_names[0])) - return 0; -#if defined(HAVE_LIBGS) - // use array defined in libgs to avoid linking the error strings into the binary - return gs_error_names[code-1]; -#elif defined(__WIN32__) - // gs_error_names is private in the Ghostscript DLL so we can't access it here - return error_names[code-1]; -#else - if (const char **error_names = (const char**)loadSymbol("gs_error_names")) - return error_names[code-1]; - return 0; -#endif -} - -#endif // !DISABLE_GS diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.h deleted file mode 100644 index c20c847dfbe..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Ghostscript.h +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* -** Ghostscript.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GHOSTSCRIPT_H -#define DVISVGM_GHOSTSCRIPT_H - -#include -#include - -#if defined(DISABLE_GS) - #include "iapi.h" -#elif defined(HAVE_LIBGS) - #include -#else - #include "DLLoader.h" - #include "iapi.h" -#endif - -#if defined(__WIN32__) && !defined(_Windows) - #define _Windows -#endif - -#if defined(DISABLE_GS) -struct Ghostscript -{ - typedef int (GSDLLCALLPTR Stdin) (void *caller, char *buf, int len); - typedef int (GSDLLCALLPTR Stdout) (void *caller, const char *str, int len); - typedef int (GSDLLCALLPTR Stderr) (void *caller, const char *str, int len); - - Ghostscript () {} - Ghostscript (int argc, const char **argv, void *caller=0) {} - bool init (int argc, const char **argv, void *caller=0) {return false;} - bool available () {return false;} - bool revision (gsapi_revision_t *r) {return false;} - std::string revision (bool revonly=false) {return "";} - int set_stdio (Stdin in, Stdout out, Stderr err) {return 0;} - int run_string_begin (int user_errors, int *pexit_code) {return 0;} - int run_string_continue (const char *str, unsigned int length, int user_errors, int *pexit_code) {return 0;} - int run_string_end (int user_errors, int *pexit_code) {return 0;} - int exit () {return 0;} - const char* error_name (int code) {return 0;} -}; - -#else - -/** Wrapper class of (a subset of) the Ghostscript API. */ -class Ghostscript -#if !defined(HAVE_LIBGS) -: public DLLoader -#endif -{ - public: - typedef int (GSDLLCALLPTR Stdin) (void *caller, char *buf, int len); - typedef int (GSDLLCALLPTR Stdout) (void *caller, const char *str, int len); - typedef int (GSDLLCALLPTR Stderr) (void *caller, const char *str, int len); - - public: - Ghostscript (); - Ghostscript (int argc, const char **argv, void *caller=0); - ~Ghostscript (); - bool init (int argc, const char **argv, void *caller=0); - bool available (); - bool revision (gsapi_revision_t *r); - std::string revision (bool revonly=false); - int set_stdio (Stdin in, Stdout out, Stderr err); - int run_string_begin (int user_errors, int *pexit_code); - int run_string_continue (const char *str, unsigned int length, int user_errors, int *pexit_code); - int run_string_end (int user_errors, int *pexit_code); - int exit (); - const char* error_name (int code); - - static std::string LIBGS_NAME; - - protected: - Ghostscript (const Ghostscript &gs) : _inst(0) {} - int init_with_args (int argc, char **argv); - int new_instance (void **psinst, void *caller); - void delete_instance (); - - private: - void *_inst; ///< Ghostscript handle needed to call the gsapi_foo functions -}; - -#endif // DISABLE_GS - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Glyph.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Glyph.h deleted file mode 100644 index d19f130ceaf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Glyph.h +++ /dev/null @@ -1,28 +0,0 @@ -/************************************************************************* -** Glyph.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GLYPH_H -#define DVISVGM_GLYPH_H - -#include "GraphicPath.h" - -typedef GraphicPath Glyph; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GlyphTracerMessages.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GlyphTracerMessages.h deleted file mode 100644 index c6190730ecf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GlyphTracerMessages.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* -** GlyphTracerMessages.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GLYPHTRACERMESSAGES_H -#define DVISVGM_GLYPHTRACERMESSAGES_H - -#include -#include "GFGlyphTracer.h" -#include "Message.h" -#include "types.h" - -class GlyphTracerMessages : public GFGlyphTracer::Callback -{ - public: - GlyphTracerMessages (bool sfmsg=true, bool autonl=true) : _sfmsg(sfmsg), _autonl(autonl), _traced(false) {} - - ~GlyphTracerMessages () { - if (_autonl) - Message::mstream() << '\n'; - } - - void beginChar (UInt8 c) { - if (!_traced) { - if (!_fname.empty()) - Message::mstream() << '\n'; - Message::mstream(false, Message::MC_STATE) - << "tracing glyphs of " << _fname.substr(0, _fname.length()-3) << '\n'; - _traced = true; - } - } - - void endChar (UInt8 c) { - std::ostringstream oss; - oss << '['; - if (isprint(c)) - oss << c; - else - oss << '#' << unsigned(c); - oss << ']'; - Message::mstream(false, Message::MC_TRACING) << oss.str(); - } - - void setFont (const std::string &fname) { - if (_sfmsg && fname != _fname) { - _fname = fname; - _traced = false; - } - } - - private: - std::string _fname; - bool _sfmsg, _autonl; - bool _traced; ///< true if a glyph of the current font has already been traced? -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GraphicPath.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GraphicPath.h deleted file mode 100644 index 6d377eb8a59..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/GraphicPath.h +++ /dev/null @@ -1,395 +0,0 @@ -/************************************************************************* -** GraphicPath.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_GRAPHICPATH_H -#define DVISVGM_GRAPHICPATH_H - -#include -#include -#include -#include -#include "BoundingBox.h" -#include "Matrix.h" -#include "Pair.h" -#include "XMLString.h" - - -template -class GraphicPath -{ - friend class PathClipper; - public: - enum WindingRule {WR_EVEN_ODD, WR_NON_ZERO}; - typedef Pair Point; - - struct Command { - enum Type {MOVETO, LINETO, CONICTO, CUBICTO, CLOSEPATH}; - - Command (Type t) : type(t) {} - - Command (Type t, const Point &p) : type(t) { - params[0] = p; - } - - Command (Type t, const Point &p1, const Point &p2) : type(t) { - params[0] = p1; - params[1] = p2; - } - - Command (Type t, const Point &p1, const Point &p2, const Point &p3) : type(t) { - params[0] = p1; - params[1] = p2; - params[2] = p3; - } - - int numParams () const { - switch (type) { - case CLOSEPATH : return 0; - case MOVETO : - case LINETO : return 1; - case CONICTO : return 2; - case CUBICTO : return 3; - } - return 0; - } - - void transform (const Matrix &matrix) { - for (int i=0; i < numParams(); i++) - params[i] = matrix * params[i]; - } - - Type type; - Point params[3]; - }; - - struct Actions - { - virtual ~Actions () {} - virtual void moveto (const Point &p) {} - virtual void lineto (const Point &p) {} - virtual void hlineto (const T &y) {} - virtual void vlineto (const T &x) {} - virtual void sconicto (const Point &p) {} - virtual void conicto (const Point &p1, const Point &p2) {} - virtual void scubicto (const Point &p1, const Point &p2) {} - virtual void cubicto (const Point &p1, const Point &p2, const Point &p3) {} - virtual void closepath () {} - virtual void draw (char cmd, const Point *points, int n) {} - virtual bool quit () {return false;} - virtual void finished () {} - }; - - typedef typename std::vector::iterator Iterator; - typedef typename std::vector::const_iterator ConstIterator; - typedef typename std::vector::const_reverse_iterator ConstRevIterator; - - public: - GraphicPath (WindingRule wr=WR_NON_ZERO) : _windingRule(wr) {} - - void setWindingRule (WindingRule wr) {_windingRule = wr;} - WindingRule windingRule () const {return _windingRule;} - - void clear () { - _commands.clear(); - } - - /// Returns true if the path is empty, i.e. there is nothing to draw - bool empty () const { - return _commands.empty(); - } - - /// Returns the number of path commands used to describe the path. - size_t size () const { - return _commands.size(); - } - - /// Insert another path at the beginning of this one. - void prepend (const GraphicPath &path) { - _commands.insert(_commands.begin(), path._commands.begin(), path._commands.end()); - } - - void moveto (const T &x, const T &y) { - moveto(Point(x, y)); - } - - void moveto (const Point &p) { - // avoid sequences of several MOVETOs; always use latest - if (_commands.empty() || _commands.back().type != Command::MOVETO) - _commands.push_back(Command(Command::MOVETO, p)); - else - _commands.back().params[0] = p; - } - - void lineto (const T &x, const T &y) { - lineto(Point(x, y)); - } - - void lineto (const Point &p) { - _commands.push_back(Command(Command::LINETO, p)); - } - - void conicto (const T &x1, const T &y1, const T &x2, const T &y2) { - conicto(Point(x1, y1), Point(x2, y2)); - } - - void conicto (const Point &p1, const Point &p2) { - _commands.push_back(Command(Command::CONICTO, p1, p2)); - } - - void cubicto (const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3) { - cubicto(Point(x1, y1), Point(x2, y2), Point(x3, y3)); - } - - void cubicto (const Point &p1, const Point &p2, const Point &p3) { - _commands.push_back(Command(Command::CUBICTO, p1, p2, p3)); - } - - void closepath () { - _commands.push_back(Command(Command::CLOSEPATH)); - } - - - const std::vector& commands () const { - return _commands; - } - - - /** Detects all open subpaths and closes them by adding a closePath command. - * Most font formats only support closed outline paths so there are no explicit closePath statements - * in the glyph's outline description. All open paths are automatically closed by the renderer. - * This method detects all open paths and adds the missing closePath statement. */ - void closeOpenSubPaths () { - Command *prevCommand = 0; - FORALL(_commands, Iterator, it) { - if (it->type == Command::MOVETO && prevCommand && prevCommand->type != Command::CLOSEPATH) { - prevCommand = &(*it); - it = _commands.insert(it, Command(Command::CLOSEPATH))+1; -// ++it; // skip inserted closePath command in next iteration step - } - else - prevCommand = &(*it); - } - if (!_commands.empty() && _commands.back().type != Command::CLOSEPATH) - closepath(); - } - - - /** Writes the path data as SVG path drawing command to a given output stream. - * @param[in] os output stream used to write the SVG commands to - * @param[in] relative if true, create relative rather than absolute coordinate values - * @param[in] sx horizontal scale factor - * @param[in] sy vertical scale factor - * @param[in] dx horizontal translation in PS point units - * @param[in] dy vertical translation in PS point units */ - void writeSVG (std::ostream &os, bool relative, double sx=1.0, double sy=1.0, double dx=0.0, double dy=0.0) const { - struct WriteActions : Actions { - WriteActions (std::ostream &os, bool relative, double sx, double sy, double dx, double dy) - : _os(os), _relative(relative), _sx(sx), _sy(sy), _dx(dx), _dy(dy) {} - - void draw (char cmd, const Point *points, int n) { - if (_relative) - cmd = tolower(cmd); - _os << cmd; - switch (cmd) { - case 'h': _os << XMLString(_sx*(points->x()-_currentPoint.x())+_dx); break; - case 'v': _os << XMLString(_sy*(points->y()-_currentPoint.y())+_dy); break; - case 'z': _currentPoint = _startPoint; break; - case 'H': _os << XMLString(_sx*points->x()+_dx); break; - case 'V': _os << XMLString(_sy*points->y()+_dy); break; - default : - for (int i=0; i < n; i++) { - if (i > 0) - _os << ' '; - Point p = points[i]; - if (_relative) - p -= _currentPoint; - _os << XMLString(_sx*p.x()+_dx) << ' ' << XMLString(_sy*p.y()+_dy); - } - } - if (cmd == 'm') - _startPoint = points[0]; - if (islower(cmd) && n > 0) - _currentPoint = points[n-1]; - } - std::ostream &_os; - bool _relative; - double _sx, _sy, _dx, _dy; - Point _startPoint, _currentPoint; - } actions(os, relative, sx, sy, dx, dy); - iterate(actions, true); - } - -#if 0 - void writePS (std::ostream &os, double sx=1.0, double sy=1.0, double dx=0.0, double dy=0.0) const { - struct WriteActions : Actions { - WriteActions (std::ostream &os, double sx, double sy, double dx, double dy) - : _os(os), _sx(sx), _sy(sy), _dx(dx), _dy(dy) {} - void draw (char cmd, const Point *points, int n) { - for (int i=0; i < n; i++) - _os << _sx*points[i].x()+_dx << ' ' << _sy*points[i].y()+_dy << ' '; - switch (cmd) { - case 'M': _os << "moveto"; break; - case 'L': _os << "lineto"; break; - case 'C': _os << "curveto"; break; - case 'Z': _os << "closepath"; break; - default: ; - } - _os << '\n'; - } - std::ostream &_os; - bool _relative; - double _sx, _sy, _dx, _dy; - } actions(os, sx, sy, dx, dy); - iterate(actions, false); - } -#endif - - - /** Computes the bounding box of the current path. - * @param[out] bbox the computed bounding box */ - void computeBBox (BoundingBox &bbox) const { - struct BBoxActions : Actions { - BBoxActions (BoundingBox &bb) : bbox(bb) {} - void moveto (const Point &p) {bbox.embed(p);} - void lineto (const Point &p) {bbox.embed(p);} - void conicto (const Point &p1, const Point &p2) {bbox.embed(p1); bbox.embed(p2);} - void cubicto (const Point &p1, const Point &p2, const Point &p3) {bbox.embed(p1); bbox.embed(p2); bbox.embed(p3);} - BoundingBox &bbox; - } actions(bbox); - iterate(actions, false); - } - - - /** Checks whether the current path describes a dot/point only (with no extent). - * @param[out] p coordinates of the point if path describes a dot - * @return true if path is a dot/point */ - bool isDot (Point &p) const { - struct DotActions : Actions { - DotActions () : differs(false) {} - void moveto (const Point &p) {point = p;} - void lineto (const Point &p) {differs = (p != point);} - void conicto (const Point &p1, const Point &p2) {differs = (point != p1 || point != p2);} - void cubicto (const Point &p1, const Point &p2, const Point &p3) {differs = (point != p1 || point != p2 || point != p3);} - bool quit () {return differs;} - Point point; - bool differs; - } actions; - iterate(actions, false); - p = actions.point; - return !actions.differs; - } - - - /** Transforms the path according to a given Matrix. - * @param[in] matrix Matrix describing the affine transformation */ - void transform (const Matrix &matrix) { - FORALL(_commands, Iterator, it) - it->transform(matrix); - } - - void iterate (Actions &actions, bool optimize) const; - - private: - std::vector _commands; - WindingRule _windingRule; -}; - - -/** Iterates over all commands defining this path and calls the corresponding template methods. - * In the case of successive bezier curve sequences, control points or tangent slopes are often - * identical so that the path description contains redundant information. SVG provides shorthand - * curve commands that require less parameters. If 'optimize' is true, this method detects such - * command sequences. - * @param[in] actions template methods called by each iteration step - * @param[in] optimize if true, shorthand drawing commands (sconicto, scubicto,...) are considered */ -template -void GraphicPath::iterate (Actions &actions, bool optimize) const { - ConstIterator prev = _commands.end(); // pointer to preceding command - Point fp; // first point of current path - Point cp; // current point - Point pstore[2]; - for (ConstIterator it=_commands.begin(); it != _commands.end() && !actions.quit(); ++it) { - const Point *params = it->params; - switch (it->type) { - case Command::MOVETO: - actions.moveto(params[0]); - actions.draw('M', params, 1); - fp = params[0]; - break; - case Command::LINETO: - if (optimize) { - if (cp.x() == params[0].x()) { - actions.vlineto(params[0].y()); - actions.draw('V', params, 1); - } - else if (cp.y() == params[0].y()) { - actions.hlineto(params[0].x()); - actions.draw('H', params, 1); - } - else { - actions.lineto(params[0]); - actions.draw('L', params, 1); - } - } - else { - actions.lineto(params[0]); - actions.draw('L', params, 1); - } - break; - case Command::CONICTO: - if (optimize && prev != _commands.end() && prev->type == Command::CONICTO && params[0] == pstore[1]*T(2)-pstore[0]) { - actions.sconicto(params[1]); - actions.draw('T', params+1, 1); - } - else { - actions.conicto(params[0], params[1]); - actions.draw('Q', params, 2); - } - pstore[0] = params[0]; // store control point and - pstore[1] = params[1]; // curve endpoint - break; - case Command::CUBICTO: - // is first control point reflection of preceding second control point? - if (optimize && prev != _commands.end() && prev->type == Command::CUBICTO && params[0] == pstore[1]*T(2)-pstore[0]) { - actions.scubicto(params[1], params[2]); - actions.draw('S', params+1, 2); - } - else { - actions.cubicto(params[0], params[1], params[2]); - actions.draw('C', params, 3); - } - pstore[0] = params[1]; // store second control point and - pstore[1] = params[2]; // curve endpoint - break; - case Command::CLOSEPATH: - actions.closepath(); - actions.draw('Z', params, 0); - cp = fp; - } - // update current point - const int np = it->numParams(); - if (np > 0) - cp = it->params[np-1]; - prev = it; - } - actions.finished(); -} - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.cpp deleted file mode 100644 index 894c74db665..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/************************************************************************* -** HtmlSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "HtmlSpecialHandler.h" -#include "InputReader.h" -#include "Message.h" -#include "SVGTree.h" -#include "XMLNode.h" - -using namespace std; - -// variable to select the link marker variant (none, underlined, boxed, or colored background) -HtmlSpecialHandler::MarkerType HtmlSpecialHandler::MARKER_TYPE = HtmlSpecialHandler::MT_LINE; -Color HtmlSpecialHandler::LINK_BGCOLOR; -Color HtmlSpecialHandler::LINK_LINECOLOR; -bool HtmlSpecialHandler::USE_LINECOLOR = false; - - -void HtmlSpecialHandler::preprocess (const char *prefix, istream &is, SpecialActions *actions) { - if (!actions) - return; - _actions = actions; - StreamInputReader ir(is); - ir.skipSpace(); - // collect page number and ID of named anchors - map attribs; - if (ir.check(" 0) { - map::iterator it; - if ((it = attribs.find("name")) != attribs.end()) - preprocessNameAnchor(it->second); - else if ((it = attribs.find("href")) != attribs.end()) - preprocessHrefAnchor(it->second); - } -} - - -void HtmlSpecialHandler::preprocessNameAnchor (const string &name) { - NamedAnchors::iterator it = _namedAnchors.find(name); - if (it == _namedAnchors.end()) { // anchor completely undefined? - int id = _namedAnchors.size()+1; - _namedAnchors[name] = NamedAnchor(_actions->getCurrentPageNumber(), id, 0); - } - else if (it->second.id < 0) { // anchor referenced but not defined yet? - it->second.id *= -1; - it->second.pageno = _actions->getCurrentPageNumber(); - } - else - Message::wstream(true) << "named hyperref anchor '" << name << "' redefined\n"; -} - - -void HtmlSpecialHandler::preprocessHrefAnchor (const string &uri) { - if (uri[0] != '#') - return; - string name = uri.substr(1); - NamedAnchors::iterator it = _namedAnchors.find(name); - if (it != _namedAnchors.end()) // anchor already defined? - it->second.referenced = true; - else { - int id = _namedAnchors.size()+1; - _namedAnchors[name] = NamedAnchor(0, -id, 0, true); - } -} - - -bool HtmlSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - if (!actions) - return true; - _actions = actions; - StreamInputReader ir(is); - ir.skipSpace(); - map attribs; - map::iterator it; - if (ir.check(" 0) { - if ((it = attribs.find("href")) != attribs.end()) // - processHrefAnchor(it->second); - else if ((it = attribs.find("name")) != attribs.end()) // - processNameAnchor(it->second); - else - return false; // none or only invalid attributes - } - else if (ir.check("")) - closeAnchor(); - else if (ir.check(" 0 && (it = attribs.find("href")) != attribs.end()) - _base = it->second; - return true; -} - - -/** Handles anchors with href attribute: ... - * @param uri value of href attribute */ -void HtmlSpecialHandler::processHrefAnchor (string uri) { - closeAnchor(); - string name; - if (uri[0] == '#') { // reference to named anchor? - name = uri.substr(1); - NamedAnchors::iterator it = _namedAnchors.find(name); - if (it == _namedAnchors.end() || it->second.id < 0) - Message::wstream(true) << "reference to undefined anchor '" << name << "'\n"; - else { - int id = it->second.id; - uri = "#loc"+XMLString(id); - if (_actions->getCurrentPageNumber() != it->second.pageno) { - ostringstream oss; - oss << _actions->getSVGFilename(it->second.pageno) << uri; - uri = oss.str(); - } - } - } - if (!_base.empty() && uri.find("://") != string::npos) { - if (*_base.rbegin() != '/' && uri[0] != '/' && uri[0] != '#') - uri = "/" + uri; - uri = _base + uri; - } - XMLElementNode *anchor = new XMLElementNode("a"); - anchor->addAttribute("xlink:href", uri); - anchor->addAttribute("xlink:title", XMLString(name.empty() ? uri : name, false)); - _actions->pushContextElement(anchor); - _actions->bbox("{anchor}", true); // start computing the bounding box of the linked area - _depthThreshold = _actions->getDVIStackDepth(); - _anchorType = AT_HREF; -} - - -/** Handles anchors with name attribute: ... - * @param name value of name attribute */ -void HtmlSpecialHandler::processNameAnchor (const string &name) { - closeAnchor(); - NamedAnchors::iterator it = _namedAnchors.find(name); - assert(it != _namedAnchors.end()); - it->second.pos = _actions->getY(); - _anchorType = AT_NAME; -} - - -/** Handles the closing tag ( of the current anchor element. */ -void HtmlSpecialHandler::closeAnchor () { - if (_anchorType == AT_HREF) { - markLinkedBox(); - _actions->popContextElement(); - _depthThreshold = 0; - } - _anchorType = AT_NONE; -} - - -/** Marks a single rectangular area of the linked part of the document with a line or - * a box so that it's noticeable by the user. Additionally, an invisible rectangle is - * placed over this area in order to avoid flickering of the mouse cursor when moving - * it over the hyperlinked area. */ -void HtmlSpecialHandler::markLinkedBox () { - const BoundingBox &bbox = _actions->bbox("{anchor}"); - if (bbox.width() > 0 && bbox.height() > 0) { // does the bounding box extend in both dimensions? - if (MARKER_TYPE != MT_NONE) { - const double linewidth = min(0.5, bbox.height()/15); - XMLElementNode *rect = new XMLElementNode("rect"); - double x = bbox.minX(); - double y = bbox.maxY()+linewidth; - double w = bbox.width(); - double h = linewidth; - const Color &linecolor = USE_LINECOLOR ? LINK_LINECOLOR : _actions->getColor(); - if (MARKER_TYPE == MT_LINE) - rect->addAttribute("fill", linecolor.rgbString()); - else { - x -= linewidth; - y = bbox.minY()-linewidth; - w += 2*linewidth; - h += bbox.height()+linewidth; - if (MARKER_TYPE == MT_BGCOLOR) { - rect->addAttribute("fill", LINK_BGCOLOR.rgbString()); - if (USE_LINECOLOR) { - rect->addAttribute("stroke", linecolor.rgbString()); - rect->addAttribute("stroke-width", linewidth); - } - } - else { // LM_BOX - rect->addAttribute("fill", "none"); - rect->addAttribute("stroke", linecolor.rgbString()); - rect->addAttribute("stroke-width", linewidth); - } - } - rect->addAttribute("x", x); - rect->addAttribute("y", y); - rect->addAttribute("width", w); - rect->addAttribute("height", h); - _actions->prependToPage(rect); - if (MARKER_TYPE == MT_BOX || MARKER_TYPE == MT_BGCOLOR) { - // slightly enlarge the boxed area - x -= linewidth; - y -= linewidth; - w += 2*linewidth; - h += 2*linewidth; - } - _actions->embed(BoundingBox(x, y, x+w, y+h)); - } - // 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) { - XMLElementNode *rect = new XMLElementNode("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); - _actions->appendToPage(rect); - } - } -} - - -/** This method is called every time the DVI position changes. */ -void HtmlSpecialHandler::dviMovedTo (double x, double y) { - if (_actions && _anchorType != AT_NONE) { - // Start a new box if the current depth of the DVI stack underruns - // the initial threshold which indicates a line break. - if (_actions->getDVIStackDepth() < _depthThreshold) { - markLinkedBox(); - _depthThreshold = _actions->getDVIStackDepth(); - _actions->bbox("{anchor}", true); // start a new box on the new line - } - } -} - - -void HtmlSpecialHandler::dviEndPage (unsigned pageno) { - if (_actions) { - // create views for all collected named anchors defined on the recent page - const BoundingBox &pagebox = _actions->bbox(); - for (NamedAnchors::iterator it=_namedAnchors.begin(); it != _namedAnchors.end(); ++it) { - if (it->second.pageno == pageno && it->second.referenced) { // current anchor referenced? - ostringstream oss; - oss << pagebox.minX() << ' ' << it->second.pos << ' ' - << pagebox.width() << ' ' << pagebox.height(); - XMLElementNode *view = new XMLElementNode("view"); - view->addAttribute("id", "loc"+XMLString(it->second.id)); - view->addAttribute("viewBox", oss.str()); - _actions->appendToDefs(view); - } - } - closeAnchor(); - _actions = 0; - } -} - - -/** Sets the appearance of the link markers. - * @param[in] marker string specifying the marker (format: type[:linecolor]) - * @return true on success */ -bool HtmlSpecialHandler::setLinkMarker (const string &marker) { - string type; // "none", "box", "line", or a background color specifier - string color; // optional line color specifier - size_t seppos = marker.find(":"); - if (seppos == string::npos) - type = marker; - else { - type = marker.substr(0, seppos); - color = marker.substr(seppos+1); - } - if (type.empty() || type == "none") - MARKER_TYPE = MT_NONE; - else if (type == "line") - MARKER_TYPE = MT_LINE; - else if (type == "box") - MARKER_TYPE = MT_BOX; - else { - if (!LINK_BGCOLOR.setName(type, false)) - return false; - MARKER_TYPE = MT_BGCOLOR; - } - USE_LINECOLOR = false; - if (MARKER_TYPE != MT_NONE && !color.empty()) { - if (!LINK_LINECOLOR.setName(color, false)) - return false; - USE_LINECOLOR = true; - } - return true; -} - - -const char** HtmlSpecialHandler::prefixes () const { - static const char *pfx[] = {"html:", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.h deleted file mode 100644 index 4c5893c0306..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/HtmlSpecialHandler.h +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* -** HtmlSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_HTMLSPECIALHANDLER_H -#define DVISVGM_HTMLSPECIALHANDLER_H - -#include -#include -#include "Color.h" -#include "SpecialHandler.h" - -struct SpecialActions; - -class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, public DVIPositionListener -{ - struct NamedAnchor { - NamedAnchor () : pageno(0), id(0), pos(0), referenced(false) {} - NamedAnchor (unsigned pn, int i, double p, bool r=false) : pageno(pn), id(i), pos(p), referenced(r) {} - unsigned pageno; ///< page number where the anchor is located - int id; ///< unique numerical ID (< 0 if anchor is undefined yet) - double pos; ///< vertical position of named anchor (in PS point units) - bool referenced; ///< true if a reference to this anchor exists - }; - - enum AnchorType {AT_NONE, AT_HREF, AT_NAME}; - typedef std::map NamedAnchors; - - public: - HtmlSpecialHandler () : _actions(0), _anchorType(AT_NONE), _depthThreshold(0) {} - void preprocess(const char *prefix, std::istream &is, SpecialActions *actions); - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - const char* name () const {return "html";} - const char* info () const {return "hyperref specials";} - const char** prefixes () const; - - static bool setLinkMarker (const std::string &marker); - - protected: - void preprocessHrefAnchor (const std::string &uri); - void preprocessNameAnchor (const std::string &name); - void processHrefAnchor (std::string uri); - void processNameAnchor (const std::string &name); - void dviEndPage (unsigned pageno); - void dviMovedTo (double x, double y); - void closeAnchor (); - void markLinkedBox (); - - enum MarkerType {MT_NONE, MT_LINE, MT_BOX, MT_BGCOLOR}; - static MarkerType MARKER_TYPE; ///< selects how to mark linked areas - static Color LINK_BGCOLOR; ///< background color if linkmark type == LT_BGCOLOR - static Color LINK_LINECOLOR; ///< line color if linkmark type is LM_LINE or LM_BOX - static bool USE_LINECOLOR; ///< if true, LINK_LINECOLOR is applied - - private: - SpecialActions *_actions; - AnchorType _anchorType; ///< type of active anchor - int _depthThreshold; ///< break anchor box if the DVI stack depth underruns this threshold - std::string _base; ///< base URL that is prepended to all relative targets - NamedAnchors _namedAnchors; ///< information about all named anchors processed -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.cpp deleted file mode 100644 index acf19e2f1c2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* -** InputBuffer.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "InputBuffer.h" - -using namespace std; - - -StreamInputBuffer::StreamInputBuffer (istream &is, size_t bufsize) - : _is(is), _bufsize(bufsize), _buf1(new UInt8[_bufsize]), _buf2(new UInt8[_bufsize]), _bufptr(_buf1) -{ - _size1 = fillBuffer(_buf1); - _size2 = fillBuffer(_buf2); -} - - -StreamInputBuffer::~StreamInputBuffer () { - delete [] _buf1; - delete [] _buf2; -} - - -int StreamInputBuffer::get () { - if (pos() == _size1) { - if (_size2 == 0) - return -1; - swap(_buf1, _buf2); - _size1 = _size2; - _bufptr = _buf1; - _size2 = fillBuffer(_buf2); - } - UInt8 c = *_bufptr++; - return c; -} - - -/** Returns the next character to be read without skipping it. - * Same as peek(0). */ -int StreamInputBuffer::peek () const { - if (pos() < _size1) - return *_bufptr; - return _size2 > 0 ? *_buf2 : -1; -} - - -/** Returns the n-th next character without skipping it. */ -int StreamInputBuffer::peek (size_t n) const { - if (pos()+n < _size1) - return *(_bufptr+n); - if (pos()+n < _size1+_size2) - return *(_buf2 + pos()+n-_size1); - return -1; -} - - -/** Fills the buffer by reading a sequence of characters from the assigned - * input stream. - * @param[in] buf pointer to character buffer to be filled - * @return number of characters read */ -int StreamInputBuffer::fillBuffer (UInt8 *buf) { - if (_is && !_is.eof()) { - _is.read((char*)buf, _bufsize); - return _is.gcount(); - } - return 0; -} - -/////////////////////////////////////////////// - -SplittedCharInputBuffer::SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2) { - _buf[0] = buf1; - _buf[1] = buf2; - _size[0] = buf1 ? s1 : 0; - _size[1] = buf2 ? s2 : 0; - _index = _size[0] ? 0 : 1; -} - - -int SplittedCharInputBuffer::get () { - if (_size[_index] == 0) - return -1; - int ret = *_buf[_index]++; - _size[_index]--; - if (_index == 0 && _size[0] == 0) - _index++; - return ret; -} - - -int SplittedCharInputBuffer::peek () const { - return _size[_index] ? *_buf[_index] : -1; -} - - -int SplittedCharInputBuffer::peek (size_t n) const { - if (n < _size[_index]) - return _buf[_index][n]; - n -= _size[_index]; - if (_index == 0 && n < _size[1]) - return _buf[1][n]; - return -1; -} - -/////////////////////////////////////////////// - - -int TextStreamInputBuffer::get () { - int c = StreamInputBuffer::get(); - if (c == '\n') { - _line++; - _col = 1; - } - else - _col++; - return c; -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.h deleted file mode 100644 index 35ea9401a6e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputBuffer.h +++ /dev/null @@ -1,145 +0,0 @@ -/************************************************************************* -** InputBuffer.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_INPUTBUFFER_H -#define DVISVGM_INPUTBUFFER_H - -#include -#include -#include -#include -#include -#include "types.h" - -struct InputBuffer -{ - virtual ~InputBuffer () {} - virtual int get () =0; - virtual int peek () const =0; - virtual int peek (size_t n) const =0; - virtual bool eof () const =0; - virtual void invalidate () =0; -}; - - -class StreamInputBuffer : public InputBuffer -{ - public: - StreamInputBuffer (std::istream &is, size_t bufsize=1024); - ~StreamInputBuffer (); - int get (); - int peek () const; - int peek (size_t n) const; - bool eof () const {return pos() == _size1 && _size2 == 0;} - void invalidate () {_bufptr = _buf1+_size1; _size2 = 0;} - - protected: - int fillBuffer (UInt8 *buf); - size_t pos () const {return _bufptr-_buf1;} - - private: - std::istream &_is; - const size_t _bufsize; ///< maximal number of bytes each buffer can hold - UInt8 *_buf1; ///< pointer to first buffer - UInt8 *_buf2; ///< pointer to second buffer - size_t _size1; ///< number of bytes in buffer 1 - size_t _size2; ///< number of bytes in buffer 2 - UInt8 *_bufptr; ///< pointer to next byte to read -}; - - -class StringInputBuffer : public InputBuffer -{ - public: - StringInputBuffer (const std::string &str) : _str(str), _pos(0) {} - int get () {return _pos < _str.length() ? _str[_pos++] : -1;} - int peek () const {return _pos < _str.length() ? _str[_pos] : -1;} - int peek (size_t n) const {return _pos+n < _str.length() ? _str[_pos+n] : -1;} - bool eof () const {return _pos >= _str.length();} - void invalidate () {_pos = _str.length();} - - private: - const std::string &_str; - size_t _pos; -}; - - -class CharInputBuffer : public InputBuffer -{ - public: - CharInputBuffer (const char *buf, size_t size) : _pos(buf), _size(buf ? size : 0) {} - - int get () { - if (_size == 0) - return -1; - else { - _size--; - return *_pos++; - } - } - - - void assign (const char *buf, size_t size) { - _pos = buf; - _size = size; - } - - void assign (const char *buf) {assign(buf, std::strlen(buf));} - int peek () const {return _size > 0 ? *_pos : -1;} - int peek (size_t n) const {return _size >= n ? _pos[n] : -1;} - bool eof () const {return _size == 0;} - void invalidate () {_size = 0;} - - private: - const char *_pos; - size_t _size; -}; - - -class SplittedCharInputBuffer : public InputBuffer -{ - public: - SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2); - int get (); - int peek () const; - int peek (size_t n) const; - bool eof () const {return _size[_index] == 0;} - void invalidate () {_size[_index] = 0;} - - private: - const char *_buf[2]; - size_t _size[2]; - int _index; -}; - - -class TextStreamInputBuffer : public StreamInputBuffer -{ - public: - TextStreamInputBuffer (std::istream &is) : StreamInputBuffer(is), _line(1), _col(1) {} - int get (); - int line () const {return _line;} - int col () const {return _col;} - - private: - int _line, _col; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.cpp deleted file mode 100644 index cfe46f9d87f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/************************************************************************* -** InputReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "InputReader.h" - -using namespace std; - - -/** Skips n characters. */ -void InputReader::skip (size_t n) { - while (n-- > 0) - get(); -} - - -/** Moves the buffer pointer to the next non-space character. A following call - * of get() returns this character. */ -void InputReader::skipSpace () { - while (isspace(peek())) - get(); -} - - -/** Tries to find a given string and skips all characters preceding that string. - * @param[in] s string to look for (must not be longer than the maximal buffer size) - * @param[in] consume if true, the buffer pointer is moved to the first character following string s - * @return true if s was found */ -bool InputReader::skipUntil (const char *s, bool consume) { - bool found = false; - while (!eof() && !(found = check(s, consume))) - get(); - return found; -} - - -/** Looks for the first occurrence of a given character. - * @param[in] c character to lookup - * @return position of character relative to current location, -1 if character was not found */ -int InputReader::find (char c) const { - int pos = 0; - int cc; - while ((cc = peek(pos)) >= 0 && cc != c) - pos++; - return cc < 0 ? -1 : pos; -} - - -/** Checks if the next characters to be read match a given string. - * @param[in] s string to be matched - * @param[in] consume if true, the characters of the matched string are skipped - * @return true if s matches */ -bool InputReader::check (const char *s, bool consume) { - size_t count = 0; - for (const char *p=s; *p; p++) { - if (peek(count++) != *p) - return false; - } - if (consume) - skip(count); - return true; -} - - -int InputReader::compare (const char *s, bool consume) { - size_t count = 0; - for (const char *p=s; *p; p++) { - int c = peek(count++); - if (c != *p) - return c < *p ? -1 : 1; - } - int c = peek(count); - if (c < 0 || !isspace(c)) - return 1; - if (consume) - skip(count); - return 0; -} - - -/** Reads an integer from the buffer. All characters that are part of - * the read integer constant are skipped. If this function returns false, - * the buffer pointer points to the same position as before the function call. - * @param[out] val contains the read integer value on success - * @param[in] accept_sign if false, only positive integers (without sign) are accepted - * @return true if integer could be read */ -bool InputReader::parseInt (int &val, bool accept_sign) { - val = 0; - int fac=1; - char sign; // explicitly given sign - if (accept_sign && ((sign = peek()) == '+' || sign == '-')) { - if (isdigit(peek(1))) { - get(); // skip sign - if (sign == '-') - fac = -1; - } - else - return false; - } - else if (!isdigit(peek())) - return false; - - while (isdigit(peek())) - val = val*10 + (get()-'0'); - val *= fac; - return true; -} - - -bool InputReader::parseUInt (unsigned &val) { - val = 0; - if (!isdigit(peek())) - return false; - while (isdigit(peek())) - val = val*10 + (get()-'0'); - return true; -} - - -bool InputReader::parseInt (int base, int &val) { - if (base < 2 || base > 32) - return false; - - const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; - const char maxdigit = digits[base-1]; - char c; - if (!isalnum(c = tolower(peek())) || c > maxdigit) - return false; - - val = 0; - while (isalnum(c = tolower(peek())) && c <= maxdigit) { - get(); - int digit = c - (c <= '9' ? '0' : 'a'-10); - val = val*base + digit; - } - return true; -} - - -/** Reads a double from the buffer. All characters that are part of - * the read double constant are skipped. If this function returns false, - * the buffer pointer points to the same position as before the function call. - * @param[out] val contains the read double value on success - * @return number details: 0=no number, 'i'=integer, 'f'=floating point number */ -char InputReader::parseDouble (double &val) { - int fac=1; - int int_part=0; - bool is_float = false; - skipSpace(); - char sign = peek(); - if (parseInt(int_part)) { // match [+-]?[0-9]+\.? - if (peek() == '.') { - get(); - is_float = true; - } - if (int_part < 0 || sign == '-') { - fac = -1; - int_part = -int_part; - } - } - else { // match [+-]?\. - char sign; // explicitly given sign - if ((sign = peek()) == '+' || sign == '-') { // match [+-]?\.[0-9] - if (peek(1) != '.' || !isdigit(peek(2))) - return 0; - if (sign == '-') - fac = -1; - skip(2); // skip sign and dot - } - else if (peek() == '.' && isdigit(peek(1))) - get(); - else - return 0; - is_float = true; - } - // parse fractional part - double frac_part=0.0; - for (double u=10; isdigit(peek()); u*=10) - frac_part += (get()-'0')/u; - val = (int_part + frac_part) * fac; - // parse exponent - char c; - if (tolower(peek()) == 'e' && (isdigit(c=peek(1)) || ((c == '+' || c == '-') && isdigit(peek(2))))) { - get(); // skip 'e' - int exp; - parseInt(exp); - val *= pow(10.0, exp); - is_float = true; - } - return is_float ? 'f' : 'i'; -} - - -/** Reads an integer value from the buffer. If no valid integer constant - * could be found at the current position 0 is returned. */ -int InputReader::getInt () { - skipSpace(); - int val; - return parseInt(val) ? val : 0; -} - - -/** Reads an double value from the buffer. If no valid double constant - * could be found at the current position 0 is returned. */ -double InputReader::getDouble () { - skipSpace(); - double val; - return parseDouble(val) ? val : 0.0; -} - - -/** Reads a string that consists of alphabetic letters only. Reading stops as - * soon as a non-alphabetic character is found or EOF is reached. */ -string InputReader::getWord () { - string ret; - skipSpace(); - while (isalpha(peek())) - ret += get(); - return ret; -} - - -/** Reads a single punctuation character. - * @return the read character or 0 if there's no punctuation character at the current position */ -char InputReader::getPunct () { - skipSpace(); - if (ispunct(peek())) - return get(); - return 0; -} - - -/** Reads a string delimited by a given quotation character. - * Before reading the string, all leading whitespace is skipped. Then, the function checks - * for the given quotation character. If it is found, all characters until the second - * appearance of the quotation char are appended to the result. Otherwise, an empty string - * is returned. If the quotation character is 0, the behavior of this function is identical to - * a call of getString(). - * @param[in] quotechar the quotation character bounding the string to be read - * @return the string read */ -string InputReader::getQuotedString (char quotechar) { - if (quotechar == 0) - return getString(); - - string ret; - skipSpace(); - if (peek() == quotechar) { - get(); - while (!eof() && peek() != quotechar) - ret += get(); - get(); - } - return ret; -} - - -/** Reads a string delimited by whitespace and/or invisible characters. - * Before reading the string, all leading whitespace is skipped. Then, the function adds - * all printable characters to the result until a whitespace, an unprintable character, or - * EOF is found. - * @return the string read */ -string InputReader::getString () { - string ret; - skipSpace(); - while (!eof() && !isspace(peek()) && isprint(peek())) - ret += get(); - return ret; -} - - -/** Reads a given number of characters and returns the resulting string. - * @param n number of character to read - * @return the string read */ -string InputReader::getString (size_t n) { - string ret; - while (n-- > 0) - ret += get(); - return ret; -} - - -string InputReader::getLine () { - string ret; - skipSpace(); - while (!eof() && peek() > 0 && peek() != '\n') - ret += get(); - // trim trailing whitespace - ret.erase(std::find_if(ret.rbegin(), ret.rend(), not1(ptr_fun(isspace))).base(), ret.end()); - return ret; -} - - -/** Parses a sequence of key-value pairs of the form KEY=VALUE or KEY="VALUE" - * @param[out] attr the scanned atributes - * @param[in] quotechar quote character used to enclose the attribute values - * @return number of attributes scanned */ -int InputReader::parseAttributes (map &attr, char quotechar) { - bool ready=false; - while (!eof() && !ready) { - string key; - skipSpace(); - while (isalnum(peek())) - key += get(); - skipSpace(); - if (peek() == '=') { - get(); - skipSpace(); - string val = getQuotedString(quotechar); - attr[key] = val; - } - else - ready = true; - } - return attr.size(); -} - -////////////////////////////////////////// - - -int StreamInputReader::peek (size_t n) const { - if (n == 0) - return peek(); - vector chars(n); - _is.read(&chars[0], n); - int ret = peek(); - for (int i=n-1; i >= 0; i--) - _is.putback(chars[i]); - return ret; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.h deleted file mode 100644 index 5cf43b6142d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/InputReader.h +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* -** InputReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_INPUTREADER_H -#define DVISVGM_INPUTREADER_H - -#include -#include -#include -#include "InputBuffer.h" - - -class InputReader -{ - public: - virtual ~InputReader() {} - virtual int get () =0; - virtual int peek () const =0; - virtual int peek (size_t n) const =0; - virtual bool eof () const =0; - virtual bool check (char c) const {return peek() == c;} - virtual bool check (const char *s, bool consume=true); - virtual int compare (const char *s, bool consume=true); - virtual void skip (size_t n); - virtual bool skipUntil (const char *s, bool consume=true); - virtual int find (char c) const; - virtual void skipSpace (); - virtual int getInt (); - virtual bool parseInt (int &val, bool accept_sign=true); - virtual bool parseInt (int base, int &val); - virtual bool parseUInt (unsigned &val); - virtual char parseDouble (double &val); - virtual double getDouble (); - virtual std::string getWord (); - virtual char getPunct (); - virtual std::string getQuotedString (char quotechar); - virtual std::string getString (); - virtual std::string getString (size_t n); - virtual std::string getLine (); - virtual int parseAttributes (std::map &attr, char quotechar=0); - virtual operator bool () const {return !eof();} -}; - - -class StreamInputReader : public InputReader -{ - public: - StreamInputReader (std::istream &is) : _is(is) {} - int get () {return _is.get();} - int peek () const {return _is.peek();} - int peek (size_t n) const; - bool eof () const {return !_is || _is.eof();} - - private: - std::istream &_is; -}; - - -class BufferInputReader : public InputReader -{ - public: - BufferInputReader (InputBuffer &ib) : _ib(&ib) {} - void assign (InputBuffer &ib) {_ib = &ib;} - int get () {return _ib->get();} - int peek () const {return _ib->peek();} - int peek (size_t n) const {return _ib->peek(n);} - bool eof () const {return _ib->eof();} - - private: - InputBuffer *_ib; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.cpp deleted file mode 100644 index fb93b716d01..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* -** JFM.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "JFM.h" -#include "StreamReader.h" - -using namespace std; - - -JFM::JFM (istream &is) { - is.seekg(0); - StreamReader sr(is); - UInt16 id = UInt16(sr.readUnsigned(2)); // JFM ID (9 or 11) - if (id != 9 && id != 11) { - ostringstream oss; - oss << "invalid JFM identifier " << id << " (9 or 11 expected)"; - throw FontMetricException(oss.str()); - } - _vertical = (id == 9); - UInt16 nt = UInt16(sr.readUnsigned(2)); // length of character type table - UInt16 lf = UInt16(sr.readUnsigned(2)); // length of entire file in 4 byte words - UInt16 lh = UInt16(sr.readUnsigned(2)); // length of header in 4 byte words - UInt16 bc = UInt16(sr.readUnsigned(2)); // smallest character code in font - UInt16 ec = UInt16(sr.readUnsigned(2)); // largest character code in font - UInt16 nw = UInt16(sr.readUnsigned(2)); // number of words in width table - UInt16 nh = UInt16(sr.readUnsigned(2)); // number of words in height table - UInt16 nd = UInt16(sr.readUnsigned(2)); // number of words in depth table - UInt16 ni = UInt16(sr.readUnsigned(2)); // number of words in italic corr. table - UInt16 nl = UInt16(sr.readUnsigned(2)); // number of words in glue/kern table - UInt16 nk = UInt16(sr.readUnsigned(2)); // number of words in kern table - UInt16 ng = UInt16(sr.readUnsigned(2)); // number of words in glue table - UInt16 np = UInt16(sr.readUnsigned(2)); // number of font parameter words - - if (7+nt+lh+(ec-bc+1)+nw+nh+nd+ni+nl+nk+ng+np != lf) - throw FontMetricException("inconsistent length values"); - - setCharRange(bc, ec); - readHeader(sr); - is.seekg(28+lh*4); - readTables(sr, nt, nw, nh, nd, ni); -} - - -void JFM::readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni) { - // determine smallest charcode with chartype > 0 - UInt16 minchar=0xFFFF, maxchar=0; - for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)sr.readUnsigned(2); - UInt16 t = (UInt16)sr.readUnsigned(2); - if (t > 0) { - minchar = min(minchar, c); - maxchar = max(maxchar, c); - } - } - // build charcode to chartype map - if (minchar <= maxchar) { - _minchar = minchar; - _charTypeTable.resize(maxchar-minchar+1); - memset(&_charTypeTable[0], 0, nt*sizeof(UInt16)); - sr.seek(-nt*4, ios::cur); - for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)sr.readUnsigned(2); - UInt16 t = (UInt16)sr.readUnsigned(2); - if (c >= minchar) - _charTypeTable[c-minchar] = t; - } - } - TFM::readTables(sr, nw, nh, nd, ni); -} - - -int JFM::charIndex (int c) const { - UInt16 chartype = 0; - if (!_charTypeTable.empty() && c >= _minchar && size_t(c) < _minchar+_charTypeTable.size()) - chartype = _charTypeTable[c-_minchar]; - return TFM::charIndex(chartype); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.h deleted file mode 100644 index e3a98e8e94c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/JFM.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* -** JFM.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_JFM_H -#define DVISVGM_JFM_H - -#include -#include "TFM.h" - - -class JFM : public TFM -{ - public: - JFM (std::istream &is); - bool verticalLayout () const {return _vertical;} - - protected: - void readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni); - int charIndex (int c) const; - - private: - UInt16 _minchar; ///< character code of first entry in character type table - bool _vertical; ///< true if metrics refer to vertical text layout - std::vector _charTypeTable; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.cpp deleted file mode 100644 index 7ed0a4d1dfe..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* -** Length.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "InputReader.h" -#include "Length.h" - -#define UNIT(c1,c2) ((c1 << 8)|c2) - -using namespace std; - - -void Length::set (const string &len) { - switch (len.length()) { - case 0: - _pt = 0; - break; - case 1: - if (isdigit(len[0])) - _pt = len[0] - '0'; - else - throw UnitException("invalid length: "+len); - break; - default: - istringstream iss(len); - StreamInputReader ir(iss); - double val; - if (!ir.parseDouble(val)) - throw UnitException("invalid length: "+len); - string unit = ir.getWord(); - set(val, unit); - } -} - - -void Length::set (double val, Unit unit) { - switch (unit) { - case PT: _pt = val; break; - case BP: _pt = val*72.27/72; break; - case IN: _pt = val*72.27; break; - case CM: _pt = val/2.54*72.27; break; - case MM: _pt = val/25.4*72.27; break; - case PC: _pt = val/12*72.27; break; - } -} - - -void Length::set (double val, string unitstr) { - if (unitstr.empty()) - unitstr = "pt"; - else if (unitstr.length() != 2) - throw UnitException("invalid length unit: "+unitstr); - - Unit unit; - switch (UNIT(unitstr[0], unitstr[1])) { - case UNIT('p','t'): unit = PT; break; - case UNIT('b','p'): unit = BP; break; - case UNIT('i','n'): unit = IN; break; - case UNIT('c','m'): unit = CM; break; - case UNIT('m','m'): unit = MM; break; - case UNIT('p','c'): unit = PC; break; - default: - throw UnitException("invalid length unit: "+unitstr); - } - set(val, unit); -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.h deleted file mode 100644 index b4782cb8b23..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Length.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* -** Length.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_LENGTH_H -#define DVISVGM_LENGTH_H - -#include -#include "MessageException.h" - -#ifdef IN -#undef IN -#endif - -struct UnitException : MessageException -{ - UnitException (const std::string &msg) : MessageException(msg) {} -}; - - -class Length -{ - public: - enum Unit {PT, BP, CM, MM, IN, PC}; - - public: - Length () : _pt(0) {} - Length (double val, Unit unit=PT) {set(val, unit);} - Length (double val, const std::string &unit) {set(val, unit);} - Length (const std::string &len) {set(len);} - void set (double val, Unit unit); - void set (double val, std::string unit); - void set (const std::string &len); - - double pt () const {return _pt;} - double in () const {return _pt/72.27;} - double bp () const {return in()*72;} - double cm () const {return in()*2.54;} - double mm () const {return cm()*10;} - double pc () const {return in()*12;} - - private: - double _pt; // length in TeX point units -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Makefile.am deleted file mode 100644 index 837dd0cd633..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Makefile.am +++ /dev/null @@ -1,233 +0,0 @@ -:## This file is part of dvisvgm -## Copyright (C) 2005-2015 Martin Gieseking -## -## Process this file with automake. - -bin_PROGRAMS = dvisvgm -noinst_LIBRARIES = libdvisvgm.a - -dvisvgm_SOURCES = gzstream.h \ - dvisvgm.cpp gzstream.cpp - -dvisvgm_LDADD = \ - $(noinst_LIBRARIES) \ - ../clipper/libclipper.a \ - ../xxHash/libxxhash.a \ - $(FREETYPE_LIBS) \ - $(ZLIB_LIBS) - -dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) - -libdvisvgm_a_SOURCES = \ - BasicDVIReader.cpp \ - BasicDVIReader.h \ - Bezier.cpp \ - Bezier.h \ - BgColorSpecialHandler.cpp \ - BgColorSpecialHandler.h \ - Bitmap.cpp \ - Bitmap.h \ - BoundingBox.cpp \ - BoundingBox.h \ - Calculator.cpp \ - Calculator.h \ - Character.h \ - CharMapID.cpp \ - CharMapID.h \ - CMap.cpp \ - CMap.h \ - CMapManager.cpp \ - CMapManager.h \ - CMapReader.cpp \ - CMapReader.h \ - CmdLineParserBase.cpp \ - CmdLineParserBase.h \ - Color.cpp \ - Color.h \ - ColorSpecialHandler.cpp \ - ColorSpecialHandler.h \ - CommandLine.cpp \ - CommandLine.h \ - CRC32.cpp \ - CRC32.h \ - DependencyGraph.h \ - Directory.cpp \ - Directory.h \ - DLLoader.cpp \ - DLLoader.h \ - DVIActions.h \ - DVIReader.cpp \ - DVIReader.h \ - DvisvgmSpecialHandler.cpp \ - DvisvgmSpecialHandler.h \ - DVIToSVG.cpp \ - DVIToSVG.h \ - DVIToSVGActions.cpp \ - DVIToSVGActions.h \ - EmSpecialHandler.cpp \ - EmSpecialHandler.h \ - EncFile.cpp \ - EncFile.h \ - EPSFile.cpp \ - EPSFile.h \ - EPSToSVG.cpp \ - EPSToSVG.h \ - FileFinder.cpp \ - FileFinder.h \ - FilePath.cpp \ - FilePath.h \ - FileSystem.cpp \ - FileSystem.h \ - Font.cpp \ - Font.h \ - FontCache.cpp \ - FontCache.h \ - FontEncoding.cpp \ - FontEncoding.h \ - FontEngine.cpp \ - FontEngine.h \ - FontManager.cpp \ - FontManager.h \ - FontMap.cpp \ - FontMap.h \ - FontMetrics.cpp \ - FontMetrics.h \ - FontStyle.h \ - GFGlyphTracer.cpp \ - GFGlyphTracer.h \ - GFReader.cpp \ - GFReader.h \ - GFTracer.cpp \ - GFTracer.h \ - Ghostscript.cpp \ - Ghostscript.h \ - Glyph.h \ - GlyphTracerMessages.h \ - GraphicPath.h \ - HtmlSpecialHandler.cpp \ - HtmlSpecialHandler.h \ - InputBuffer.cpp \ - InputBuffer.h \ - InputReader.cpp \ - InputReader.h \ - JFM.cpp \ - JFM.h \ - Length.cpp \ - Length.h \ - macros.h \ - MapLine.cpp \ - MapLine.h \ - Matrix.cpp \ - Matrix.h \ - Message.cpp \ - Message.h \ - MessageException.h \ - MetafontWrapper.cpp \ - MetafontWrapper.h \ - NoPsSpecialHandler.cpp \ - NoPsSpecialHandler.h \ - NumericRanges.h \ - PageRanges.cpp \ - PageRanges.h \ - PageSize.cpp \ - PageSize.h \ - Pair.h \ - PathClipper.cpp \ - PathClipper.h \ - PdfSpecialHandler.cpp \ - PdfSpecialHandler.h \ - PreScanDVIReader.cpp \ - PreScanDVIReader.h \ - Process.cpp \ - Process.h \ - psdefs.cpp \ - PSFilter.h \ - PSInterpreter.cpp \ - PSInterpreter.h \ - PSPattern.cpp \ - PSPattern.h \ - PSPreviewFilter.cpp \ - PSPreviewFilter.h \ - PsSpecialHandler.cpp \ - PsSpecialHandler.h \ - RangeMap.cpp \ - RangeMap.h \ - ShadingPatch.cpp \ - ShadingPatch.h \ - SignalHandler.cpp \ - SignalHandler.h \ - SpecialActions.h \ - SpecialHandler.h \ - SpecialManager.cpp \ - SpecialManager.h \ - StreamReader.cpp \ - StreamReader.h \ - StreamWriter.cpp \ - StreamWriter.h \ - Subfont.cpp \ - Subfont.h \ - SVGOutput.cpp \ - SVGOutput.h \ - SVGTree.cpp \ - SVGTree.h \ - System.cpp \ - System.h \ - TensorProductPatch.cpp \ - TensorProductPatch.h \ - Terminal.cpp \ - Terminal.h \ - TFM.cpp \ - TFM.h \ - ToUnicodeMap.cpp \ - ToUnicodeMap.h \ - TpicSpecialHandler.cpp \ - TpicSpecialHandler.h \ - TriangularPatch.cpp \ - TriangularPatch.h \ - types.h \ - Unicode.cpp \ - Unicode.h \ - VectorIterator.h \ - VectorStream.h \ - VFActions.h \ - VFReader.cpp \ - VFReader.h \ - XMLDocument.cpp \ - XMLDocument.h \ - XMLNode.cpp \ - XMLNode.h \ - XMLString.cpp \ - XMLString.h - -EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.h MiKTeXCom.cpp - -AM_CXXFLAGS = -Wall -Wnon-virtual-dtor \ - -I$(top_srcdir)/clipper \ - -I$(top_srcdir)/xxHash \ - $(FREETYPE_CFLAGS) \ - $(ZLIB_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) - -# the command-line parser is generated from options.xml by opt2cpp -$(srcdir)/CommandLine.cpp: options.xml - if test -f opt2cpp.xsl; then \ - rm -f $@ $*.h; \ - xsltproc opt2cpp.xsl $<; \ - elif test -f $(srcdir)/opt2cpp.py; then \ - rm -f $@ $*.h; \ - python2 $(srcdir)/opt2cpp.py $< $@ $*.h; \ - fi - -# Create a C string definition containing the PostScript routines psdefs.ps needed by class PSInterpreter -$(srcdir)/psdefs.cpp: psdefs.ps - if test -f $<; then \ - ps2c PSInterpreter::PSDEFS $< >$@; \ - fi - -psdefs.ps: ; - -@CODE_COVERAGE_RULES@ - -CLEANFILES = *.gcda *.gcno diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.cpp deleted file mode 100644 index d65649a4c34..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/************************************************************************* -** MapLine.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "InputBuffer.h" -#include "InputReader.h" -#include "MapLine.h" -#include "Subfont.h" - -using namespace std; - - -/** Constructs a MapLine object by parsing a single mapline from the given stream. */ -MapLine::MapLine (istream &is) - : _sfd(0), _fontindex(0), _slant(0), _bold(0), _extend(1) -{ - char buf[256]; - is.getline(buf, 256); - parse(buf); -} - - -// Some of the following functions have been derived from the dvipdfmx source file fontmap.c: -// http://cvs.ktug.or.kr/viewcvs/dvipdfmx/src/fontmap.c?revision=1.43&view=markup - - -/** Returns true if the given string is in dvips mapline format, and false if it's in dvipdfm format. - @param[in] line string to check */ -bool MapLine::isDVIPSFormat (const char *line) const { - if (strchr(line, '"') || strchr(line, '<')) // these chars are only present in dvips maps - return true; - char prevchar = ' '; - int entry_count=0; - for (const char *p=line; *p; ++p) { - if (isspace(prevchar)) { - if (*p == '-') // options starting with '-' are only present in dvipdfm map files - return false; - if (!isspace(*p)) - entry_count++; - } - prevchar = *p; - } - // tfm_name and ps_name only => dvips map - return entry_count == 2; -} - - -/** Separates main font name and subfont definition name from a given combined name. - * Example: "basename@sfdname@10" => {"basename10", "sfdname"} - * @param[in,out] fontname complete fontname; after separation: main fontname only - * @param[out] sfdname name of subfont definition - * @return true on success */ -static bool split_fontname (string &fontname, string &sfdname) { - size_t pos1; // index of first '@' - if ((pos1 = fontname.find('@')) != string::npos && pos1 > 0) { - size_t pos2; // index of second '@' - if ((pos2 = fontname.find('@', pos1+1)) != string::npos && pos2 > pos1+1) { - sfdname = fontname.substr(pos1+1, pos2-pos1-1); - fontname = fontname.substr(0, pos1) + fontname.substr(pos2+1); - return true; - } - } - return false; -} - - -/** Parses a single mapline and stores the scanned data in member variables. - * The line may either be given in dvips or dvipdfmx mapfile format. - * @param[in] line the mapline */ -void MapLine::parse (const char *line) { - CharInputBuffer ib(line, strlen(line)); - BufferInputReader ir(ib); - _texname = ir.getString(); - string sfdname; - split_fontname(_texname, sfdname); - if (!sfdname.empty()) - _sfd = SubfontDefinition::lookup(sfdname); - if (isDVIPSFormat(line)) - parseDVIPSLine(ir); - else - parseDVIPDFMLine(ir); -} - - -/** Parses a single line in dvips mapfile format. - * @param[in] ir the input stream must be assigned to this reader */ -void MapLine::parseDVIPSLine (InputReader &ir) { - ir.skipSpace(); - if (ir.peek() != '<' && ir.peek() != '"') - _psname = ir.getString(); - ir.skipSpace(); - while (ir.peek() == '<' || ir.peek() == '"') { - if (ir.peek() == '<') { - ir.get(); - if (ir.peek() == '[') - ir.get(); - string name = ir.getString(); - if (name.length() > 4 && name.substr(name.length()-4) == ".enc") - _encname = name.substr(0, name.length()-4); - else - _fontfname = name; - } - else { // ir.peek() == '"' => list of PS font operators - string options = ir.getQuotedString('"'); - StringInputBuffer sib(options); - BufferInputReader sir(sib); - while (!sir.eof()) { - double number; - if (sir.parseDouble(number)) { - // operator with preceding numeric parameter (value opstr) - string opstr = sir.getString(); - if (opstr == "SlantFont") - _slant = number; - else if (opstr == "ExtendFont") - _extend = number; - } - else { - // operator without parameter => skip for now - sir.getString(); - } - } - } - ir.skipSpace(); - } -} - - -static void throw_number_expected (char opt, bool integer_only=false) { - ostringstream oss; - oss << "option -" << opt << ": " << (integer_only ? "integer" : "floating point") << " value expected"; - throw MapLineException(oss.str()); -} - - -/** Parses a single line in dvipdfmx mapfile format. - * @param[in] ir the input stream must be assigned to this reader */ -void MapLine::parseDVIPDFMLine (InputReader &ir) { - ir.skipSpace(); - if (ir.peek() != '-') { - _encname = ir.getString(); - if (_encname == "default" || _encname == "none") - _encname.clear(); - } - ir.skipSpace(); - if (ir.peek() != '-') - _fontfname = ir.getString(); - if (!_fontfname.empty()) { - parseFilenameOptions(_fontfname); - } - ir.skipSpace(); - while (ir.peek() == '-') { - ir.get(); - char option = ir.get(); - if (!isprint(option)) - throw MapLineException("option character expected"); - ir.skipSpace(); - switch (option) { - case 's': // slant - if (!ir.parseDouble(_slant)) - throw_number_expected('s'); - break; - case 'e': // extend - if (!ir.parseDouble(_extend)) - throw_number_expected('e'); - break; - case 'b': // bold - if (!ir.parseDouble(_bold)) - throw_number_expected('b'); - break; - case 'r': //remap (deprecated) - break; - case 'i': // ttc index - if (!ir.parseInt(_fontindex, false)) - throw_number_expected('i', true); - break; - case 'p': // UCS plane - int dummy; - if (!ir.parseInt(dummy, false)) - throw_number_expected('p', true); - break; - case 'u': // to unicode - ir.getString(); - break; - case 'v': // stemV - int stemv; - if (!ir.parseInt(stemv, true)) - throw_number_expected('v', true); - break; - case 'm': // map single chars - ir.skipUntil("-"); - break; - case 'w': // writing mode (horizontal=0, vertical=1) - int vertical; - if (!ir.parseInt(vertical, false)) - throw_number_expected('w', true); - break; - default: - ostringstream oss; - oss << "invalid option: -" << option; - throw MapLineException(oss.str()); - } - ir.skipSpace(); - } -} - - -/** [:INDEX:][!]FONTNAME[/CSI][,VARIANT] */ -void MapLine::parseFilenameOptions (string fname) { - _fontfname = fname; - StringInputBuffer ib(fname); - BufferInputReader ir(ib); - if (ir.peek() == ':' && isdigit(ir.peek(1))) { // index given? - ir.get(); - _fontindex = ir.getInt(); // font index of file with multiple fonts - if (ir.peek() == ':') - ir.get(); - else - _fontindex = 0; - } - if (ir.peek() == '!') // no embedding - ir.get(); - - bool csi_given=false, style_given=false; - int pos; - if ((pos = ir.find('/')) >= 0) { // csi delimiter - csi_given = true; - _fontfname = ir.getString(pos); - } - else if ((pos = ir.find(',')) >= 0) { - style_given = true; - _fontfname = ir.getString(pos); - } - else - _fontfname = ir.getString(); - - if (csi_given) { - if ((pos = ir.find(',')) >= 0) { - style_given = true; - ir.getString(pos); // charcoll - } - else if (ir.eof()) - throw MapLineException("CSI specifier expected"); - else - ir.getString(); // charcoll - } - if (style_given) { - ir.get(); // skip ',' - if (ir.check("BoldItalic")) { - } - else if (ir.check("Bold")) { - } - else if (ir.check("Italic")) { - } - if (!ir.eof()) - throw MapLineException("invalid style given"); - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.h deleted file mode 100644 index ea3f92e526e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MapLine.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* -** MapLine.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MAPLINE_H -#define DVISVGM_MAPLINE_H - -#include -#include -#include "MessageException.h" - - -class InputReader; -class SubfontDefinition; - - -struct MapLineException : MessageException -{ - MapLineException (const std::string &msg) : MessageException(msg) {} -}; - - -class MapLine -{ - public: - MapLine (std::istream &is); - const std::string& texname () const {return _texname;} - const std::string& psname () const {return _psname;} - const std::string& fontfname () const {return _fontfname;} - const std::string& encname () const {return _encname;} - int fontindex () const {return _fontindex;} - double bold () const {return _bold;} - double slant () const {return _slant;} - double extend () const {return _extend;} - SubfontDefinition* sfd () const {return _sfd;} - - protected: - void init (); - bool isDVIPSFormat (const char *line) const; - void parse (const char *line); - void parseDVIPSLine (InputReader &ir); - void parseDVIPDFMLine (InputReader &ir); - void parseFilenameOptions (std::string opt); - - private: - std::string _texname; ///< TeX font name - std::string _psname; ///< PS font name - std::string _fontfname; ///< name of fontfile - std::string _encname; ///< name of encoding (without file suffix ".enc") - SubfontDefinition *_sfd; ///< subfont definition to be used - int _fontindex; ///< font index of file with multiple fonts (e.g. ttc files) - double _slant, _bold, _extend; -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.cpp deleted file mode 100644 index 06537689c3f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/************************************************************************* -** Matrix.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#define _USE_MATH_DEFINES -#include -#include -#include -#include -#include -#include "Calculator.h" -#include "Matrix.h" -#include "XMLString.h" - -using namespace std; - - - -/** Computes the determinant of a given matrix */ -double det (const Matrix &m) { - double sum=0; - for (int i=0; i < 3; ++i) { - sum += m._values[0][i] * m._values[1][(i+1)%3] * m._values[2][(i+2)%3] - - m._values[0][2-i] * m._values[1][(4-i)%3] * m._values[2][(3-i)%3]; - } - return sum; -} - - -/** Computes the determinant of the 2x2 submatrix of m where a given - * row and column were removed. - * @param[in] m base matrix - * @param[in] row row to remove - * @param[in] col column to remove */ -double det (const Matrix &m, int row, int col) { - int c1 = (col+1)%3, c2 = (col+2)%3; - int r1 = (row+1)%3, r2 = (row+2)%3; - if (c1 > c2) - swap(c1, c2); - if (r1 > r2) - swap(r1, r2); - return m._values[r1][c1] * m._values[r2][c2] - - m._values[r1][c2] * m._values[r2][c1]; -} - - -static inline double deg2rad (double deg) { - return M_PI*deg/180.0; -} - - -/** Creates a diagonal matrix ((d,0,0),(0,d,0),(0,0,d)). - * @param[in] d value of diagonal elements */ -Matrix::Matrix (double d) { - set(d); -} - - -/** Creates the matrix ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). - * Expects that array v consists of 'size' elements. If size is less than 9, the - * remaining matrix components will be set to those of the identity matrix. - * @param[in] v array containing the matrix components - * @param[in] size size of array v */ -Matrix::Matrix (double v[], unsigned size) { - set(v, size); -} - - -/** Creates the matrix ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). - * If vector v has less than 9 elements, the remaining matrix components will be set to - * those of the identity matrix. - * @param[in] v array containing the matrix components - * @param[in] start use vector components start,...,start+8 */ -Matrix::Matrix (const std::vector &v, int start) { - set(v, start); -} - - -Matrix::Matrix (const string &cmds, Calculator &calc) { - parse(cmds, calc); -} - - -Matrix& Matrix::set (double d) { - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) - _values[i][j] = (i==j ? d : 0); - return *this; -} - - -Matrix& Matrix::set (double v[], unsigned size) { - size = min(size, 9u); - for (unsigned i=0; i < size; i++) - _values[i/3][i%3] = v[i]; - for (unsigned i=size; i < 9; i++) - _values[i/3][i%3] = (i%4 ? 0 : 1); - return *this; -} - - -/** Set matrix values ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). - * If vector v has less than 9 elements, the remaining matrix components will be set to - * those of the identity matrix. - * @param[in] v array containing the matrix components - * @param[in] start use vector components start,...,start+8 */ -Matrix& Matrix::set (const vector &v, int start) { - unsigned size = min((unsigned)v.size()-start, 9u); - for (unsigned i=0; i < size; i++) - _values[i/3][i%3] = v[i+start]; - for (unsigned i=size; i < 9; i++) - _values[i/3][i%3] = (i%4 ? 0 : 1); - return *this; -} - - -Matrix& Matrix::set(const string &cmds, Calculator &calc) { - parse(cmds, calc); - return *this; -} - - -Matrix& Matrix::translate (double tx, double ty) { - if (tx != 0 || ty != 0) { - TranslationMatrix t(tx, ty); - rmultiply(t); - } - return *this; -} - - -Matrix& Matrix::scale (double sx, double sy) { - if (sx != 1 || sy != 1) { - ScalingMatrix s(sx, sy); - rmultiply(s); - } - return *this; -} - - -/** Multiplies this matrix by ((cos d, -sin d, 0), (sin d, cos d, 0), (0,0,1)) that - * describes an anti-clockwise rotation by d degrees. - * @param[in] deg rotation angle in degrees */ -Matrix& Matrix::rotate (double deg) { - RotationMatrix r(deg); - rmultiply(r); - return *this; -} - - -Matrix& Matrix::xskewByAngle (double deg) { - if (fmod(fabs(deg)-90, 180) != 0) - return xskewByRatio(tan(deg2rad(deg))); - return *this; -} - - -Matrix& Matrix::xskewByRatio (double xyratio) { - if (xyratio != 0) { - double v[] = {1, xyratio}; - Matrix t(v, 2); - rmultiply(t); - } - return *this; -} - - -Matrix& Matrix::yskewByAngle (double deg) { - if (fmod(fabs(deg)-90, 180) != 0) - return yskewByRatio(tan(deg2rad(deg))); - return *this; -} - - -Matrix& Matrix::yskewByRatio (double xyratio) { - if (xyratio != 0) { - double v[] = {1, 0, 0, xyratio}; - Matrix t(v, 4); - rmultiply(t); - } - return *this; -} - - -Matrix& Matrix::flip (bool haxis, double a) { - double s = 1; - if (haxis) // mirror at horizontal axis? - s = -1; - double v[] = {-s, 0, (haxis ? 0 : 2*a), 0, s, (haxis ? 2*a : 0), 0, 0, 1}; - Matrix t(v); - rmultiply(t); - return *this; -} - - -/** Swaps rows and columns of the matrix. */ -Matrix& Matrix::transpose () { - for (int i=0; i < 3; i++) - for (int j=i+1; j < 3; j++) - swap(_values[i][j], _values[j][i]); - return *this; -} - - -/** Multiplies this matrix M with matrix tm (tm is the factor on the left side): M := tm * M */ -Matrix& Matrix::lmultiply (const Matrix &tm) { - Matrix ret; - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) - for (int k=0; k < 3; k++) - ret._values[i][j] += _values[i][k] * tm._values[k][j]; - return *this = ret; -} - - -/** Multiplies this matrix M with matrix tm (tm is the factor on the right side): M := M * tm */ -Matrix& Matrix::rmultiply (const Matrix &tm) { - Matrix ret; - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) - for (int k=0; k < 3; k++) - ret._values[i][j] += tm._values[i][k] * _values[k][j]; - return *this = ret; -} - - -Matrix& Matrix::invert () { - Matrix ret; - if (double denom = det(*this)) { - for (int i=0; i < 3; ++i) { - for (int j=0; j < 3; ++j) { - ret._values[i][j] = det(*this, i, j)/denom; - if ((i+j)%2 != 0) - ret._values[i][j] *= -1; - } - } - return *this = ret; - } - throw exception(); -} - - -Matrix& Matrix::operator *= (double c) { - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) - _values[i][j] *= c; - return *this; -} - - -DPair Matrix::operator * (const DPair &p) const { - double pp[] = {p.x(), p.y(), 1}; - double ret[]= {0, 0}; - for (int i=0; i < 2; i++) - for (int j=0; j < 3; j++) - ret[i] += _values[i][j] * pp[j]; - return DPair(ret[0], ret[1]); -} - - -/** Returns true if this matrix equals. Checks equality by comparing the matrix components. */ -bool Matrix::operator == (const Matrix &m) const { - for (int i=0; i < 2; i++) - for (int j=0; j < 3; j++) - if (_values[i][j] != m._values[i][j]) - return false; - return true; -} - - -/** Returns true if this matrix doesn't equal m. Checks inequality by comparing the matrix components. */ -bool Matrix::operator != (const Matrix &m) const { - for (int i=0; i < 2; i++) - for (int j=0; j < 3; j++) - if (_values[i][j] != m._values[i][j]) - return true; - return false; -} - - -/** Returns true if this matrix is the identity matrix ((1,0,0),(0,1,0),(0,0,1)). */ -bool Matrix::isIdentity() const { - for (int i=0; i < 2; i++) - for (int j=0; j < 3; j++) { - const double &v = _values[i][j]; - if ((i == j && v != 1) || (i != j && v != 0)) - return false; - } - return true; -} - - -/** Checks whether this matrix describes a plain translation (without any other transformations). - * If so, the parameters tx and ty are filled with the translation components. - * @param[out] tx horizontal translation - * @param[out] ty vertical translation - * @return true if matrix describes a pure translation */ -bool Matrix::isTranslation (double &tx, double &ty) const { - tx = _values[0][2]; - ty = _values[1][2]; - for (int i=0; i < 3; i++) - for (int j=0; j < 2; j++) { - const double &v = _values[i][j]; - if ((i == j && v != 1) || (i != j && v != 0)) - return false; - } - return _values[2][2] == 1; -} - - -/** Gets a parameter for the transformation command. - * @param[in] is parameter chars are read from this stream - * @param[in] calc parameters can be arithmetic expressions, so we need a calculator to evaluate them - * @param[in] def default value if parameter is optional - * @param[in] optional true if parameter is optional - * @param[in] leadingComma true if first non-blank must be a comma - * @return value of argument */ -static double getArgument (istream &is, Calculator &calc, double def, bool optional, bool leadingComma) { - while (isspace(is.peek())) - is.get(); - if (!optional && leadingComma && is.peek() != ',') - throw ParserException("',' expected"); - if (is.peek() == ',') { - is.get(); // skip comma - optional = false; // now we expect a parameter - } - string expr; - while (is && !isupper(is.peek()) && is.peek() != ',') - expr += (char)is.get(); - if (expr.length() == 0) { - if (optional) - return def; - else - throw ParserException("parameter expected"); - } - return calc.eval(expr); -} - - -Matrix& Matrix::parse (istream &is, Calculator &calc) { - *this = Matrix(1); - while (is) { - while (isspace(is.peek())) - is.get(); - int cmd = is.get(); - switch (cmd) { - case 'T': { - double tx = getArgument(is, calc, 0, false, false); - double ty = getArgument(is, calc, 0, true, true); - translate(tx, ty); - break; - } - case 'S': { - double sx = getArgument(is, calc, 1, false, false); - double sy = getArgument(is, calc, sx, true, true ); - scale(sx, sy); - break; - } - case 'R': { - double a = getArgument(is, calc, 0, false, false); - double x = getArgument(is, calc, calc.getVariable("ux")+calc.getVariable("w")/2, true, true); - double y = getArgument(is, calc, calc.getVariable("uy")+calc.getVariable("h")/2, true, true); - translate(-x, -y); - rotate(a); - translate(x, y); - break; - } - case 'F': { - int c = is.get(); - if (c != 'H' && c != 'V') - throw ParserException("'H' or 'V' expected"); - double a = getArgument(is, calc, 0, false, false); - flip(c == 'H', a); - break; - } - case 'K': { - int c = is.get(); - if (c != 'X' && c != 'Y') - throw ParserException("transformation command 'K' must be followed by 'X' or 'Y'"); - double a = getArgument(is, calc, 0, false, false); - if (fabs(cos(deg2rad(a))) <= numeric_limits::epsilon()) { - ostringstream oss; - oss << "illegal skewing angle: " << a << " degrees"; - throw ParserException(oss.str()); - } - if (c == 'X') - xskewByAngle(a); - else - yskewByAngle(a); - break; - } - case 'M': { - double v[9]; - for (int i=0; i < 6; i++) - v[i] = getArgument(is, calc, i%4 ? 0 : 1, i!=0, i!=0); - // third row (0, 0, 1) - v[6] = v[7] = 0; - v[8] = 1; - Matrix tm(v); - rmultiply(tm); - break; - } - default: - ostringstream oss; - oss << "transformation command expected (found '" << cmd << "' instead)"; - throw ParserException(oss.str()); - } - } - return *this; -} - - -Matrix& Matrix::parse (const string &cmds, Calculator &calc) { - istringstream iss; - iss.str(cmds); - return parse(iss, calc); -} - - -/** Returns an SVG matrix expression that can be used in transform attributes. - * ((a,b,c),(d,e,f),(0,0,1)) => matrix(a d b e c f) */ -string Matrix::getSVG () const { - ostringstream oss; - oss << "matrix("; - for (int i=0; i < 3; i++) { - for (int j=0; j < 2; j++) { - if (i > 0 || j > 0) - oss << ' '; - oss << XMLString(_values[j][i]); - } - } - oss << ')'; - return oss.str(); -} - - -ostream& Matrix::write (ostream &os) const { - os << '('; - for (int i=0; i < 3; i++) { - os << '(' << _values[i][0]; - for (int j=1; j < 3; j++) - os << ',' << _values[i][j]; - os << ')'; - if (i < 2) - os << ','; - } - os << ')'; - return os; -} - - -////////////////////////////////////////////////////////////////// - - -TranslationMatrix::TranslationMatrix (double tx, double ty) { - double v[] = {1, 0, tx, 0, 1, ty}; - set(v, 6); -} - - -ScalingMatrix::ScalingMatrix (double sx, double sy) { - double v[] = {sx, 0, 0, 0, sy}; - set(v, 5); -} - - -RotationMatrix::RotationMatrix (double deg) { - double rad = deg2rad(deg); - double c = cos(rad); - double s = sin(rad); - double v[] = {c, -s, 0, s, c}; - set(v, 5); -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.h deleted file mode 100644 index 02b94299fd5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Matrix.h +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* -** Matrix.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MATRIX_H -#define DVISVGM_MATRIX_H - -#include -#include -#include -#include "MessageException.h" -#include "Pair.h" - - -struct ParserException : public MessageException -{ - ParserException (const std::string &msg) : MessageException(msg) {} -}; - -class Calculator; - -class Matrix -{ - friend double det (const Matrix &m); - friend double det (const Matrix &m, int row, int col); - - public: - Matrix (const std::string &cmds, Calculator &calc); - Matrix (double d=0); - Matrix (double v[], unsigned size=9); - Matrix (const std::vector &v, int start=0); - Matrix& set (double d); - Matrix& set (double v[], unsigned size); - Matrix& set (const std::vector &v, int start=0); - Matrix& set (const std::string &cmds, Calculator &calc); - double get (int row, int col) const {return _values[row][col];} - Matrix& transpose (); - Matrix& invert (); - Matrix& parse (std::istream &is, Calculator &c); - Matrix& parse (const std::string &cmds, Calculator &c); - Matrix& lmultiply (const Matrix &tm); - Matrix& rmultiply (const Matrix &tm); - Matrix& translate (double tx, double ty); - Matrix& scale (double sx, double sy); - Matrix& rotate (double deg); - Matrix& xskewByAngle (double deg); - Matrix& yskewByAngle (double deg); - Matrix& xskewByRatio (double xyratio); - Matrix& yskewByRatio (double xyratio); - Matrix& flip (bool h, double a); - Matrix& operator *= (double c); - DPair operator * (const DPair &p) const; - bool operator == (const Matrix &m) const; - bool operator != (const Matrix &m) const; - bool isIdentity() const; - bool isTranslation (double &tx, double &ty) const; - std::string getSVG () const; - std::ostream& write (std::ostream &os) const; - - private: - double _values[3][3]; // row x col -}; - - -struct TranslationMatrix : public Matrix -{ - TranslationMatrix (double tx, double ty); -}; - - -struct ScalingMatrix : public Matrix -{ - ScalingMatrix (double sx, double sy); -}; - - -struct RotationMatrix : public Matrix -{ - RotationMatrix (double deg); -}; - - -inline std::ostream& operator << (std::ostream &os, const Matrix &m) { - return m.write(os); -} - - -double det (const Matrix &m); -double det (const Matrix &m, int row, int col); - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.cpp deleted file mode 100644 index 17b9b526f9e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/************************************************************************* -** Message.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "Message.h" -#include "Terminal.h" - -using namespace std; - -MessageStream::MessageStream () : _os(0), _nl(false), _col(1), _indent(0) { -} - - -MessageStream::MessageStream (std::ostream &os) - : _os(&os), _nl(true), _col(1), _indent(0) -{ - Terminal::init(os); -} - - -MessageStream::~MessageStream () { - if (_os && Message::COLORIZE) - Terminal::finish(*_os); -} - - -void MessageStream::putChar (const char c, ostream &os) { - switch (c) { - case '\r': - os << '\r'; - _nl = true; - _col = 1; - return; - case '\n': - if (!_nl) { - _col = 1; - _nl = true; - os << '\n'; - } - return; - default: - if (_nl) { - os << string(_indent, ' '); - _col += _indent; - } - else { - const int cols = Terminal::columns(); - if (cols > 0 && _col >= cols) { -#ifndef __WIN32__ - // move cursor to next line explicitly (not necessary in Windows/DOS terminal) - os << '\n'; -#endif - os << string(_indent, ' '); - _col = _indent+1; - } - else - _col++; - } - _nl = false; - if (!_nl || c != '\n') - os << c; - } -} - - -MessageStream& MessageStream::operator << (const char *str) { - if (_os && str) { - const char *first = str; - while (*first) { - const char *last = strchr(first, '\n'); - if (!last) - last = first+strlen(first)-1; -#ifndef __WIN32__ - // move cursor to next line explicitly (not necessary in Windows/DOS terminal) - const int cols = Terminal::columns(); - int len = last-first+1; - if (cols > 0 && _col+len > cols && _indent+len <= cols) - putChar('\n', *_os); -#endif - while (first <= last) - putChar(*first++, *_os); - first = last+1; - } - } - return *this; -} - - -MessageStream& MessageStream::operator << (const char &c) { - if (_os) - putChar(c, *_os); - return *this; -} - - -void MessageStream::indent (bool reset) { - if (reset) - _indent = 0; - _indent += 2; -} - - -void MessageStream::outdent (bool all) { - if (all) - _indent = 0; - else if (_indent > 0) - _indent -= 2; -} - - -void MessageStream::clearline () { - if (_os) { - int cols = Terminal::columns(); - *_os << '\r' << string(cols ? cols-1 : 79, ' ') << '\r'; - _nl = true; - _col = 1; - } -} - -static MessageStream nullStream; -static MessageStream messageStream(cerr); - - -////////////////////////////// - -// maximal verbosity -int Message::LEVEL = Message::MESSAGES | Message::WARNINGS | Message::ERRORS; -bool Message::COLORIZE = false; -bool Message::_initialized = false; -Message::Color Message::_classColors[9]; - - -/** Returns the stream for usual messages. */ -MessageStream& Message::mstream (bool prefix, MessageClass mclass) { - init(); - MessageStream *ms = (LEVEL & MESSAGES) ? &messageStream : &nullStream; - if (COLORIZE && ms && ms->os()) { - Terminal::fgcolor(_classColors[mclass].foreground, *ms->os()); - Terminal::bgcolor(_classColors[mclass].background, *ms->os()); - } - if (prefix) - *ms << "\nMESSAGE: "; - return *ms; -} - - -/** Returns the stream for warning messages. */ -MessageStream& Message::wstream (bool prefix) { - init(); - MessageStream *ms = (LEVEL & WARNINGS) ? &messageStream : &nullStream; - if (COLORIZE && ms && ms->os()) { - Terminal::fgcolor(_classColors[MC_WARNING].foreground, *ms->os()); - Terminal::bgcolor(_classColors[MC_WARNING].background, *ms->os()); - } - if (prefix) - *ms << "\nWARNING: "; - return *ms; -} - - -/** Returns the stream for error messages. */ -MessageStream& Message::estream (bool prefix) { - init(); - MessageStream *ms = (LEVEL & ERRORS) ? &messageStream : &nullStream; - if (COLORIZE && ms && ms->os()) { - Terminal::fgcolor(_classColors[MC_ERROR].foreground, *ms->os()); - Terminal::bgcolor(_classColors[MC_ERROR].background, *ms->os()); - } - if (prefix) - *ms << "\nERROR: "; - return *ms; -} - - -static bool colorchar2int (char colorchar, int *val) { - colorchar = tolower(colorchar); - if (colorchar >= '0' && colorchar <= '9') - *val = int(colorchar-'0'); - else if (colorchar >= 'a' && colorchar <= 'f') - *val = int(colorchar-'a'+10); - else if (colorchar == '*') - *val = -1; - else - return false; - return true; -} - - -/** Initializes the Message class. Sets the colors for each message set. - * The colors can be changed via environment variable DVISVGM_COLORS. Its - * value must be a sequence of color entries of the form gg:BF where the - * two-letter ID gg specifies a message set, B the hex digit of the - * background, and F the hex digit of the foreground/text color. - * Color codes: - * - 1: red, 2: green, 4: blue - * - 0-7: dark colors - * - 8-F: light colors - * - *: default color - * Example: num:01 sets page number messages to red on black background */ -void Message::init () { - if (_initialized || !Message::COLORIZE) - return; - - // set default message colors - _classColors[MC_ERROR] = Color(Terminal::RED, true); - _classColors[MC_WARNING] = Color(Terminal::YELLOW); - _classColors[MC_PAGE_NUMBER] = Color(Terminal::BLUE, true); - _classColors[MC_PAGE_SIZE] = Color(Terminal::MAGENTA); - _classColors[MC_PAGE_WRITTEN] = Color(Terminal::GREEN); - _classColors[MC_STATE] = Color(Terminal::CYAN); - _classColors[MC_TRACING] = Color(Terminal::BLUE); - _classColors[MC_PROGRESS] = Color(Terminal::MAGENTA); - - if (const char *color_str = getenv("DVISVGM_COLORS")) { - map classes; - classes["er"] = MC_ERROR; - classes["wn"] = MC_WARNING; - classes["pn"] = MC_PAGE_NUMBER; - classes["ps"] = MC_PAGE_SIZE; - classes["fw"] = MC_PAGE_WRITTEN; - classes["sm"] = MC_STATE; - classes["tr"] = MC_TRACING; - classes["pi"] = MC_PROGRESS; - const char *p=color_str; - - // skip leading whitespace - while (isspace(*p)) - ++p; - - // iterate over color assignments - while (strlen(p) >= 5) { - map::iterator it = classes.find(string(p, 2)); - if (it != classes.end() && p[2] == '=') { - int bgcolor, fgcolor; - if (colorchar2int(p[3], &bgcolor) && colorchar2int(p[4], &fgcolor)) { - _classColors[it->second].background = bgcolor; - _classColors[it->second].foreground = fgcolor; - } - } - p += 5; - - // skip trailing characters in a malformed entry - while (!isspace(*p) && *p != ':' && *p != ';') - ++p; - // skip separation characters - while (isspace(*p) || *p == ':' || *p == ';') - ++p; - } - } - _initialized = true; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.h deleted file mode 100644 index e9ab6bf116b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Message.h +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* -** Message.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MESSAGE_H -#define DVISVGM_MESSAGE_H - -#include -#include -#include -#include -#include "Terminal.h" -#include "types.h" - - -class Message; - -class MessageStream -{ - friend class Message; - - public: - MessageStream (); - MessageStream (std::ostream &os); - ~MessageStream (); - - template - MessageStream& operator << (const T &obj) { - std::ostringstream oss; - oss << obj; - (*this) << oss.str(); - return *this; - } - - MessageStream& operator << (const char *str); - MessageStream& operator << (const char &c); - MessageStream& operator << (const std::string &str) {return (*this) << str.c_str();} - - void indent (int level) {_indent = std::max(0, level*2);} - void indent (bool reset=false); - void outdent (bool all=false); - void clearline (); - - protected: - void putChar (const char c, std::ostream &os); - std::ostream* os () {return _os;} - - private: - std::ostream *_os; - bool _nl; ///< true if previous character was a newline - int _col; ///< current terminal column - int _indent; ///< indentation width (number of columns/characters) -}; - - -class Message -{ - struct Color { - Color () : foreground(-1), background(-1) {} - Color (Int8 fgcolor) : foreground(fgcolor), background(-1) {} - Color (Int8 fgcolor, bool light) : foreground(fgcolor + (light ? 8 : 0)), background(-1) {} - Color (Int8 fgcolor, Int8 bgcolor) : foreground(fgcolor), background(bgcolor) {} - Int8 foreground; - Int8 background; - }; - - public: - enum MessageClass { - MC_ERROR, - MC_WARNING, - MC_MESSAGE, - MC_PAGE_NUMBER, - MC_PAGE_SIZE, - MC_PAGE_WRITTEN, - MC_STATE, - MC_TRACING, - MC_PROGRESS, - }; - - public: - static MessageStream& mstream (bool prefix=false, MessageClass mclass=MC_MESSAGE); - static MessageStream& estream (bool prefix=false); - static MessageStream& wstream (bool prefix=false); - - enum {ERRORS=1, WARNINGS=2, MESSAGES=4}; - static int LEVEL; - static bool COLORIZE; - - protected: - static void init (); - - - private: - static Color _classColors[]; - static bool _initialized; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MessageException.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MessageException.h deleted file mode 100644 index c7a84b4b13c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MessageException.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* -** MessageException.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MESSAGEEXCEPTION_H -#define DVISVGM_MESSAGEEXCEPTION_H - -#include -#include - - -class MessageException : public std::exception -{ - public: - MessageException (const std::string &msg) : _message(msg) {} - virtual ~MessageException () throw() {} - const char* what () const throw() {return _message.c_str();} - - private: - std::string _message; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.cpp deleted file mode 100644 index 42fcaa266b0..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* -** MetafontWrapper.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "FileSystem.h" -#include "FileFinder.h" -#include "Message.h" -#include "MetafontWrapper.h" -#include "Process.h" -#include "SignalHandler.h" -#include "macros.h" - -using namespace std; - - -MetafontWrapper::MetafontWrapper (const string &fname) : _fontname(fname) -{ -} - - -/** Calls Metafont and evaluates the logfile. If a gf file was successfully - * generated the dpi value is stripped from the filename - * (e.g. cmr10.600gf => cmr10.gf). This makes life easier... - * @param[in] mode Metafont mode, e.g. "ljfour" - * @param[in] mag magnification factor - * @return true on success */ -bool MetafontWrapper::call (const string &mode, double mag) { - if (!FileFinder::lookup(_fontname+".mf")) - return false; // mf file not available => no need to call the "slow" Metafont - FileSystem::remove(_fontname+".gf"); - -#ifdef __WIN32__ -#ifdef TEXLIVEWIN32 - const char *mfname = "mf-nowin.exe"; -#else - const char *mfname = "mf.exe"; -#endif - const char *cmd = FileFinder::lookup(mfname, false); - if (!cmd) { - Message::estream(true) << "can't run Metafont (" << mfname << " not found)\n"; - return false; - } -#else - const char *cmd = "mf"; -#endif - ostringstream oss; - oss << "\"\\mode=" << mode << ";" - "mag:=" << mag << ";" - "batchmode;" - "input " << _fontname << "\""; - Message::mstream(false, Message::MC_STATE) << "\nrunning Metafont for " << _fontname << '\n'; - Process mf_process(cmd, oss.str().c_str()); - mf_process.run(); - - // try to read Metafont's logfile and get name of created GF file - ifstream ifs((_fontname+".log").c_str()); - if (ifs) { - char buf[128]; - while (ifs) { - ifs.getline(buf, 128); - string line = buf; - if (line.substr(0, 15) == "! Interruption.") - SignalHandler::instance().trigger(true); - if (line.substr(0, 17) == "Output written on") { - size_t pos = line.find("gf ", 18+_fontname.length()); - if (pos != string::npos) { - string gfname = line.substr(18, pos-16); // GF filename found - FileSystem::rename(gfname, _fontname+".gf"); - } - break; - } - } - } - ifstream gf((_fontname+".gf").c_str()); - return (bool)gf; -} - - -/** Calls Metafont if output files (tfm and gf) don't already exist. - * @param[in] mode Metafont mode to be used (e.g. 'ljfour') - * @param[in] mag magnification factor - * @return true on success */ -bool MetafontWrapper::make (const string &mode, double mag) { - ifstream tfm((_fontname+".tfm").c_str()); - ifstream gf((_fontname+".gf").c_str()); - if (gf && tfm) // @@ distinguish between gf and tfm - return true; - return call(mode, mag); -} - - -bool MetafontWrapper::success () const { - ifstream tfm((_fontname+".tfm").c_str()); - ifstream gf((_fontname+".gf").c_str()); - return tfm && gf; -} - - -/** Remove all files created by a Metafont call (tfm, gf, log). - * @param[in] keepGF if true, GF files won't be removed */ -void MetafontWrapper::removeOutputFiles (bool keepGF) { - removeOutputFiles(_fontname, keepGF); -} - - -/** Remove all files created by a Metafont call for a given font (tfm, gf, log). - * @param[in] fontname name of font whose temporary files should be removed - * @param[in] keepGF if true, GF files will be kept */ -void MetafontWrapper::removeOutputFiles (const string &fontname, bool keepGF) { - const char *ext[] = {"gf", "tfm", "log", 0}; - for (const char **p = keepGF ? ext+2 : ext; *p; ++p) - FileSystem::remove(fontname + "." + *p); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.h deleted file mode 100644 index 93266c5122e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MetafontWrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* -** MetafontWrapper.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_METAFONTWRAPPER_H -#define DVISVGM_METAFONTWRAPPER_H - -#include - - -struct FileFinder; - -class MetafontWrapper -{ - public: - MetafontWrapper (const std::string &fontname); - bool call (const std::string &mode, double mag); - bool make (const std::string &mode, double mag); - bool success () const; - void removeOutputFiles (bool keepGF=false); - static void removeOutputFiles (const std::string &fontname, bool keepGF=false); - - private: - std::string _fontname; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.cpp deleted file mode 100644 index bf43c038035..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* -** MiKTeXCom.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "MessageException.h" -#include "MiKTeXCom.h" -#include "macros.h" - -using namespace std; - - -/** Constructs a COM object representing a MiKTeX session. */ -MiKTeXCom::MiKTeXCom () : _session(0) { - if (FAILED(CoInitialize(0))) - throw MessageException("COM library could not be initialized\n"); - // try to initialize the MiKTeX session object -#ifdef _MSC_VER - HRESULT hres = _session.CreateInstance(L"MiKTeX.Session"); -#elif defined(__WIN64__) - HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_LOCAL_SERVER, IID_ISession2, (void**)&_session); -#else - HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_INPROC_SERVER, IID_ISession2, (void**)&_session); -#endif - if (FAILED(hres)) { - CoUninitialize(); - throw MessageException("MiKTeX session could not be initialized"); - } -} - - -MiKTeXCom::~MiKTeXCom () { - if (_session) { -#ifdef _MSC_VER - _session.Release(); -#else - _session->Release(); -#endif - _session = 0; // prevent automatic call of Release() after CoUninitialize() - } - CoUninitialize(); -} - - -/** Returns the MiKTeX version number. */ -string MiKTeXCom::getVersion () { -#ifdef _MSC_VER - MiKTeXSetupInfo info = _session->GetMiKTeXSetupInfo(); -#else - MiKTeXSetupInfo info; - _session->GetMiKTeXSetupInfo(&info); -#endif - _bstr_t version = info.version; - return string(version); -} - - -/** Returns the path of the directory where the MiKTeX binaries are located. */ -string MiKTeXCom::getBinDir () { -#ifdef _MSC_VER - MiKTeXSetupInfo info = _session->GetMiKTeXSetupInfo(); -#else - MiKTeXSetupInfo info; - _session->GetMiKTeXSetupInfo(&info); -#endif - _bstr_t bindir = info.binDirectory; - return string(bindir); -} - - -/** Try to lookup a given file in the MiKTeX directory tree. - * @param[in] fname name of file to lookup - * @return path of the file or 0 if it can't be found */ -const char* MiKTeXCom::findFile (const char *fname) { - try { - _bstr_t path; - static string ret; -#ifdef _MSC_VER - HRESULT hres = _session->FindFile(fname, path.GetAddress()); - bool found = (hres != 0); -#else - VARIANT_BOOL found_var; - _session->FindFile(_bstr_t(fname), path.GetAddress(), &found_var); - bool found = (found_var == VARIANT_TRUE); -#endif - if (found) { - ret = _bstr_t(path); - return ret.c_str(); - } - return 0; - } - catch (_com_error &e) { - throw MessageException((const char*)e.Description()); - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.h deleted file mode 100644 index c278840c9c8..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/MiKTeXCom.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* -** MiKTeXCom.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MIKTEXCOM_H -#define DVISVGM_MIKTEXCOM_H - -#include - -#ifdef _MSC_VER -#import -using namespace MiKTeXSession2_9; -#else -#include "miktex209-session.h" -#endif - - -class MiKTeXCom -{ - public: - MiKTeXCom (); - ~MiKTeXCom (); - std::string getBinDir (); - std::string getVersion (); - const char* findFile (const char* fname); - - private: -#ifdef _MSC_VER - ISession2Ptr _session; -#else - ISession2 *_session; -#endif -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.cpp deleted file mode 100644 index 659cd81818b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* -** NoPsSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "Message.h" -#include "NoPsSpecialHandler.h" - -using namespace std; - - -bool NoPsSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - _count++; - return true; -} - - -void NoPsSpecialHandler::dviEndPage (unsigned pageno) { - if (_count > 0) { - string suffix = (_count > 1 ? "s" : ""); - Message::wstream(true) << _count << " PostScript special" << suffix << " ignored. The resulting SVG might look wrong.\n"; - _count = 0; - } -} - - -const char** NoPsSpecialHandler::prefixes () const { - static const char *pfx[] = {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.h deleted file mode 100644 index 5176d87a2a4..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NoPsSpecialHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* -** NoPsSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_NOPSSPECIALHANDLER_H -#define DVISVGM_NOPSSPECIALHANDLER_H - -#include "SpecialHandler.h" - -class NoPsSpecialHandler : public SpecialHandler, public DVIEndPageListener -{ - public: - NoPsSpecialHandler () : _count(0) {} - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - const char* name () const {return 0;} - const char* info () const {return 0;} - const char** prefixes () const; - - protected: - void dviEndPage (unsigned pageno); - - private: - unsigned _count; // number of PS specials skipped -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NumericRanges.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NumericRanges.h deleted file mode 100644 index 34be8486fb2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/NumericRanges.h +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* -** NumericRanges.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_NUMERICRANGES_H -#define DVISVGM_NUMERICRANGES_H - -#include -#include -#include - -template -class NumericRanges -{ - public: - typedef std::pair Range; - typedef std::list Container; - typedef typename Container::iterator Iterator; - typedef typename Container::const_iterator ConstIterator; - - public: - void addRange (T value) {addRange(value, value);} - void addRange (T first, T last); - bool valueExists (T value) const; - size_t size () const {return _ranges.size();} - ConstIterator begin () const {return _ranges.begin();} - ConstIterator end () const {return _ranges.end();} - const Container& ranges () const {return _ranges;} - - protected: - static bool isLess (const Range &r1, const Range &r2) {return r1.first < r2.first;} - - private: - Container _ranges; -}; - - -/** Adds a numeric range to the collection. - * @param[in] first left bound of new range - * @param[in] last right bound of new range */ -template -void NumericRanges::addRange (T first, T last) { - if (first > last) - std::swap(first, last); - typename Container::iterator it = _ranges.begin(); - while (it != _ranges.end() && first > it->first+1 && first > it->second+1) - ++it; - if (it == _ranges.end() || last < it->first-1 || first > it->second+1) - it = _ranges.insert(it, Range(first, last)); - else if ((first < it->first && last >= it->first-1) || (first <= it->second+1 && last > it->second)) { - it->first = std::min(it->first, first); - it->second = std::max(it->second, last); - } - // merge adjacent ranges - if (it != _ranges.end()) { - typename Container::iterator l = it; - typename Container::iterator r = it; - if (l == _ranges.begin()) - l = _ranges.end(); - else - --l; - ++r; - bool l_modified = false; - bool r_modified = false; - if (l != _ranges.end() && l->second >= it->first-1) { - l->first = std::min(l->first, it->first); - l->second = std::max(l->second, it->second); - l_modified = true; - } - if (r != _ranges.end() && r->first <= it->second+1) { - r->first = std::min(r->first, it->first); - r->second = std::max(r->second, it->second); - r_modified = true; - } - if (l_modified || r_modified) { - _ranges.erase(it); - if (l_modified && r_modified && l->second >= r->first-1) { - l->first = std::min(l->first, r->first); - l->second = std::max(l->second, r->second); - _ranges.erase(r); - } - } - } -} - - -template -bool NumericRanges::valueExists (T value) const { - ConstIterator it = std::lower_bound(_ranges.begin(), _ranges.end(), Range(value, 0), &isLess); - return (it != _ranges.end() && it->first <= value && it->second >= value); -} - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSFilter.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSFilter.h deleted file mode 100644 index 3b2a9391250..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* -** PSFilter.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PSFILTER_H -#define DVISVGM_PSFILTER_H - -class PSInterpreter; - -class PSFilter -{ - public: - PSFilter (PSInterpreter &psi) : _psi(psi) {} - virtual ~PSFilter () {} - virtual void execute (const char *code, size_t len) =0; - virtual bool active () const =0; - - protected: - PSInterpreter& psInterpreter () {return _psi;} - - private: - PSInterpreter &_psi; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.cpp deleted file mode 100644 index a297bd2bb9b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.cpp +++ /dev/null @@ -1,359 +0,0 @@ -/************************************************************************* -** PSInterpreter.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "FileFinder.h" -#include "InputReader.h" -#include "Message.h" -#include "PSFilter.h" -#include "PSInterpreter.h" -#include "SignalHandler.h" - -using namespace std; - - -const char *PSInterpreter::GSARGS[] = { - "gs", // dummy name - "-q", // be quiet, suppress gs banner - "-dSAFER", // disallow writing of files - "-dNODISPLAY", // we don't need a display device - "-dNOPAUSE", // keep going - "-dWRITESYSTEMDICT", // leave systemdict writable as some operators must be replaced - "-dNOPROMPT", -// "-dNOBIND", -}; - - -/** Constructs a new PSInterpreter object. - * @param[in] actions template methods to be executed after recognizing the corresponding PS operator. */ -PSInterpreter::PSInterpreter (PSActions *actions) - : _mode(PS_NONE), _actions(actions), _filter(0), _bytesToRead(0), _inError(false), _initialized(false) -{ -} - - -void PSInterpreter::init () { - if (!_initialized) { - _gs.init(sizeof(GSARGS)/sizeof(char*), GSARGS, this); - _gs.set_stdio(input, output, error); - _initialized = true; - // Before executing any random PS code redefine some operators and run - // initializing PS code. This cannot be done in the constructor because we - // need the completely initialized PSInterpreter object here. - execute(PSDEFS); - } -} - - -PSActions* PSInterpreter::setActions (PSActions *actions) { - PSActions *old_actions = _actions; - _actions = actions; - return old_actions; -} - - -/** Checks if the given status value returned by Ghostscript indicates an error. - * @param[in] status status value returned by Ghostscript after the execution of a PS snippet - * @throw PSException if the status value indicates a PostScript error */ -void PSInterpreter::checkStatus (int status) { - if (status < 0) { - _mode = PS_QUIT; - if (status < -100) - throw PSException("fatal error"); - if (_errorMessage.empty()) - throw PSException(_gs.error_name(status)); - throw PSException(_errorMessage); - } -} - - -/** Executes a chunk of PostScript code. - * @param[in] str buffer containing the code - * @param[in] len number of characters in buffer - * @param[in] flush If true, a final 'flush' is sent which forces the output buffer to be written immediately. - * @return true if the assigned number of bytes have been read */ -bool PSInterpreter::execute (const char *str, size_t len, bool flush) { - init(); - if (_mode == PS_QUIT) - return false; - - int status=0; - if (_mode == PS_NONE) { - _gs.run_string_begin(0, &status); - _mode = PS_RUNNING; - } - checkStatus(status); - - bool complete=false; - if (_bytesToRead > 0 && len >= _bytesToRead) { - len = _bytesToRead; - complete = true; - } - - if (_filter && _filter->active()) { - PSFilter *filter = _filter; - _filter = 0; // prevent recursion when filter calls execute() - filter->execute(str, len); - if (filter->active()) // filter still active after execution? - _filter = filter; - return complete; - } - - // 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) { - SignalHandler::instance().check(); - size_t chunksize = min(len, (size_t)0xffff); - _gs.run_string_continue(p, chunksize, 0, &status); - p += chunksize; - len -= chunksize; - if (_bytesToRead > 0) - _bytesToRead -= chunksize; - if (status == -101) // e_Quit - _mode = PS_QUIT; - else - checkStatus(status); - } - if (flush) { - // force writing contents of output buffer - _gs.run_string_continue("\nflush ", 7, 0, &status); - } - return complete; -} - - -/** Executes a chunk of PostScript code read from a stream. The method returns on EOF. - * @param[in] is the input stream - * @param[in] flush If true, a final 'flush' is sent which forces the output buffer to be written immediately. - * @return true if the assigned number of bytes have been read */ -bool PSInterpreter::execute (istream &is, bool flush) { - char buf[4096]; - bool finished = false; - while (is && !is.eof() && !finished) { - is.read(buf, 4096); - finished = execute(buf, is.gcount(), false); - } - execute("\n", 1, flush); - return finished; -} - - -bool PSInterpreter::executeRaw (const string &str, int n) { - _rawData.clear(); - ostringstream oss; - oss << str << ' ' << n << " (raw) prcmd\n"; - execute(oss.str()); - return !_rawData.empty(); -} - - -/** This callback function handles input from stdin to Ghostscript. Currently not needed. - * @param[in] inst pointer to calling instance of PSInterpreter - * @param[in] buf takes the read characters - * @param[in] len size of buffer buf - * @return number of characters read */ -int GSDLLCALL PSInterpreter::input (void *inst, char *buf, int len) { - return 0; -} - - -/** This callback function handles output from Ghostscript to stdout. It looks for - * emitted commands staring with "dvi." and executes them by calling method callActions. - * Ghostscript sends the text in chunks by several calls of this function. - * Unfortunately, the PostScript specification wants error messages also to be sent to stdout - * instead of stderr. Thus, we must collect and concatenate the chunks until an evaluable text - * snippet is completely received. Furthermore, error messages have to be recognized and to be - * filtered out. - * @param[in] inst pointer to calling instance of PSInterpreter - * @param[in] buf contains the characters to be output - * @param[in] len number of characters in buf - * @return number of processed characters (equals 'len') */ -int GSDLLCALL PSInterpreter::output (void *inst, const char *buf, int len) { - PSInterpreter *self = static_cast(inst); - if (self && self->_actions) { - const size_t MAXLEN = 512; // maximal line length (longer lines are of no interest) - const char *end = buf+len-1; // last position of buf - for (const char *first=buf, *last=buf; first <= end; last++, first=last) { - // move first and last to begin and end of the next line, respectively - while (last < end && *last != '\n') - last++; - size_t linelength = last-first+1; - if (linelength > MAXLEN) // skip long lines since they don't contain any relevant information - continue; - - vector &linebuf = self->_linebuf; // just a shorter name... - if ((*last == '\n' || !self->active()) || self->_inError) { - if (linelength + linebuf.size() > 1) { // prefix "dvi." plus final newline - SplittedCharInputBuffer ib(linebuf.empty() ? 0 : &linebuf[0], linebuf.size(), first, linelength); - BufferInputReader in(ib); - if (self->_inError) - self->_errorMessage += string(first, linelength); - else { - in.skipSpace(); - if (in.check("Unrecoverable error: ")) { - self->_errorMessage.clear(); - while (!in.eof()) - self->_errorMessage += in.get(); - self->_inError = true; - } - else if (in.check("dvi.")) - self->callActions(in); - } - } - linebuf.clear(); - } - else { // no line end found => - // save remaining characters and prepend them to the next incoming chunk of characters - if (linebuf.size() + linelength > MAXLEN) - linebuf.clear(); // don't care for long lines - else { - size_t currsize = linebuf.size(); - linebuf.resize(currsize+linelength); - memcpy(&linebuf[currsize], first, linelength); - } - } - } - } - return len; -} - - -/** Converts a vector of strings to a vector of doubles. - * @param[in] str the strings to be converted - * @param[out] d the resulting doubles */ -static void str2double (const vector &str, vector &d) { - for (size_t i=0; i < str.size(); i++) { - istringstream iss(str[i]); - iss >> d[i]; - } -} - - -/** Evaluates a command emitted by Ghostscript and invokes the corresponding - * method of interface class PSActions. - * @param[in] in reader pointing to the next command */ -void PSInterpreter::callActions (InputReader &in) { - // array of currently supported operators (must be ascendingly sorted) - static const struct Operator { - const char *name; // name of operator - int pcount; // number of parameters (< 0 : variable number of parameters) - void (PSActions::*op)(vector &p); // operation handler - } operators [] = { - {"applyscalevals", 3, &PSActions::applyscalevals}, - {"clip", 0, &PSActions::clip}, - {"clippath", 0, &PSActions::clippath}, - {"closepath", 0, &PSActions::closepath}, - {"curveto", 6, &PSActions::curveto}, - {"eoclip", 0, &PSActions::eoclip}, - {"eofill", 0, &PSActions::eofill}, - {"fill", 0, &PSActions::fill}, - {"grestore", 0, &PSActions::grestore}, - {"grestoreall", 0, &PSActions::grestoreall}, - {"gsave", 0, &PSActions::gsave}, - {"initclip", 0, &PSActions::initclip}, - {"lineto", 2, &PSActions::lineto}, - {"makepattern", -1, &PSActions::makepattern}, - {"moveto", 2, &PSActions::moveto}, - {"newpath", 1, &PSActions::newpath}, - {"querypos", 2, &PSActions::querypos}, - {"raw", -1, 0}, - {"restore", 1, &PSActions::restore}, - {"rotate", 1, &PSActions::rotate}, - {"save", 1, &PSActions::save}, - {"scale", 2, &PSActions::scale}, - {"setcmykcolor", 4, &PSActions::setcmykcolor}, - {"setdash", -1, &PSActions::setdash}, - {"setgray", 1, &PSActions::setgray}, - {"sethsbcolor", 3, &PSActions::sethsbcolor}, - {"setlinecap", 1, &PSActions::setlinecap}, - {"setlinejoin", 1, &PSActions::setlinejoin}, - {"setlinewidth", 1, &PSActions::setlinewidth}, - {"setmatrix", 6, &PSActions::setmatrix}, - {"setmiterlimit", 1, &PSActions::setmiterlimit}, - {"setopacityalpha", 1, &PSActions::setopacityalpha}, - {"setpattern", -1, &PSActions::setpattern}, - {"setrgbcolor", 3, &PSActions::setrgbcolor}, - {"shfill", -1, &PSActions::shfill}, - {"stroke", 0, &PSActions::stroke}, - {"translate", 2, &PSActions::translate}, - }; - if (_actions) { - in.skipSpace(); - // binary search - int first=0, last=sizeof(operators)/sizeof(Operator)-1; - while (first <= last) { - int mid = first+(last-first)/2; - int cmp = in.compare(operators[mid].name); - if (cmp < 0) - last = mid-1; - else if (cmp > 0) - first = mid+1; - else { - if (!operators[mid].op) { // raw string data received - _rawData.clear(); - in.skipSpace(); - while (!in.eof()) { - _rawData.push_back(in.getString()); - in.skipSpace(); - } - } - else { - // collect parameters and call handler - vector params; - int pcount = operators[mid].pcount; - if (pcount < 0) { // variable number of parameters? - in.skipSpace(); - while (!in.eof()) { // read all available parameters - params.push_back(in.getString()); - in.skipSpace(); - } - } - else { // fix number of parameters - for (int i=0; i < pcount; i++) { - in.skipSpace(); - params.push_back(in.getString()); - } - } - vector v(params.size()); - str2double(params, v); - (_actions->*operators[mid].op)(v); - _actions->executed(); - } - break; - } - } - } -} - - -/** This callback function handles output from Ghostscript to stderr. - * @param[in] inst pointer to calling instance of PSInterpreter - * @param[in] buf contains the characters to be output - * @param[in] len number of chars in buf - * @return number of processed characters */ -int GSDLLCALL PSInterpreter::error (void *inst, const char *buf, int len) { - return len; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.h deleted file mode 100644 index 528e95ca83c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSInterpreter.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* -** PSInterpreter.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PSINTERPRETER_H -#define DVISVGM_PSINTERPRETER_H - -#include -#include -#include -#include -#include "Ghostscript.h" -#include "InputReader.h" -#include "MessageException.h" - - -struct PSException : public MessageException -{ - PSException (const std::string &msg) : MessageException(msg) {} -}; - - -/** This interface provides the template methods called by PSInterpreter when executing a PS snippet. - * Each method corresponds to a PostScript operator of the same name. */ -struct PSActions -{ - virtual ~PSActions () {} - virtual void applyscalevals (std::vector &p) =0; - virtual void clip (std::vector &p) =0; - virtual void clippath (std::vector &p) =0; - virtual void closepath (std::vector &p) =0; - virtual void curveto (std::vector &p) =0; - virtual void eoclip (std::vector &p) =0; - virtual void eofill (std::vector &p) =0; - virtual void fill (std::vector &p) =0; - virtual void gsave (std::vector &p) =0; - virtual void grestore (std::vector &p) =0; - virtual void grestoreall (std::vector &p) =0; - virtual void initclip (std::vector &p) =0; - virtual void lineto (std::vector &p) =0; - virtual void makepattern (std::vector &p) =0; - virtual void moveto (std::vector &p) =0; - virtual void newpath (std::vector &p) =0; - virtual void querypos (std::vector &p) =0; - virtual void restore (std::vector &p) =0; - virtual void rotate (std::vector &p) =0; - virtual void save (std::vector &p) =0; - virtual void scale (std::vector &p) =0; - virtual void setcmykcolor (std::vector &cmyk) =0; - virtual void setdash (std::vector &p) =0; - virtual void setgray (std::vector &p) =0; - virtual void sethsbcolor (std::vector &hsb) =0; - virtual void setlinecap (std::vector &p) =0; - virtual void setlinejoin (std::vector &p) =0; - virtual void setlinewidth (std::vector &p) =0; - virtual void setmatrix (std::vector &p) =0; - virtual void setmiterlimit (std::vector &p) =0; - virtual void setopacityalpha (std::vector &p) =0; - virtual void setpattern (std::vector &p) =0; - virtual void setrgbcolor (std::vector &rgb) =0; - virtual void shfill (std::vector &rgb) =0; - virtual void stroke (std::vector &p) =0; - virtual void translate (std::vector &p) =0; - virtual void executed () {} // triggered if one of the above PS operators has been executed -}; - -class PSFilter; - -/** This class provides methods to execute chunks of PostScript code and calls - * several template methods on invocation of selected PS operators (see PSActions). */ -class PSInterpreter -{ - enum Mode {PS_NONE, PS_RUNNING, PS_QUIT}; - - public: - PSInterpreter (PSActions *actions=0); - bool execute (const char *str, size_t len, bool flush=true); - bool execute (const char *str, bool flush=true) {return execute(str, std::strlen(str), flush);} - bool execute (const std::string &str, bool flush=true) {return execute(str.c_str(), flush);} - bool execute (std::istream &is, bool flush=true); - bool executeRaw (const std::string &str, int n); - bool active () const {return _mode != PS_QUIT;} - void limit (size_t max_bytes) {_bytesToRead = max_bytes;} - void setFilter (PSFilter *filter) {_filter = filter;} - PSActions* setActions (PSActions *actions); - const std::vector& rawData () const {return _rawData;} - - protected: - void init (); - // callback functions - static int GSDLLCALL input (void *inst, char *buf, int len); - static int GSDLLCALL output (void *inst, const char *buf, int len); - static int GSDLLCALL error (void *inst, const char *buf, int len); - - void checkStatus (int status); - void callActions (InputReader &cib); - - private: - Ghostscript _gs; - Mode _mode; ///< current execution mode - PSActions *_actions; ///< actions to be performed - PSFilter *_filter; ///< active filter used to process PS code - size_t _bytesToRead; ///< if > 0, maximal number of bytes to be processed by following calls of execute() - std::vector _linebuf; - std::string _errorMessage; ///< text of error message - bool _inError; ///< true if scanning error message - bool _initialized; ///< true if PSInterpreter has been completely initialized - std::vector _rawData; ///< raw data received - static const char *GSARGS[]; ///< parameters passed to Ghostscript - static const char *PSDEFS; ///< initial PostScript definitions -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.cpp deleted file mode 100644 index 99c60c29827..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* -** PSPattern.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "BoundingBox.h" -#include "PSPattern.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "XMLNode.h" - -using namespace std; - - -string PSPattern::svgID () const { - return XMLString("pat")+XMLString(_id); -} - - -/** Appends the definition of this pattern to the "def" section of the SVG tree. */ -void PSPattern::apply (SpecialActions *actions) { - if (XMLElementNode *pattern = createPatternNode()) - actions->appendToDefs(pattern); -} - - -///////////////////////////////////////////////////////////////////////////// - -PSTilingPattern::PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) - : PSPattern(id), _bbox(bbox), _matrix(matrix), _xstep(xstep), _ystep(ystep), _groupNode(0) -{ - _groupNode = PSTilingPattern::createGroupNode(); -} - - -PSTilingPattern::~PSTilingPattern () { - delete _groupNode; -} - - -/** Creates a new pattern element representing the pattern defined in the PS code. */ -XMLElementNode* PSTilingPattern::createPatternNode () const { - if (!_groupNode) - return 0; - BoundingBox box(_bbox.minX(), _bbox.minY(), _bbox.minX()+_xstep, _bbox.minY()+_ystep); - XMLElementNode *pattern = new XMLElementNode("pattern"); - pattern->addAttribute("id", svgID()); - pattern->addAttribute("x", box.minX()); - pattern->addAttribute("y", box.minY()); - pattern->addAttribute("width", box.width()); - pattern->addAttribute("height", box.height()); - pattern->addAttribute("viewBox", box.toSVGViewBox()); - pattern->addAttribute("patternUnits", "userSpaceOnUse"); - if (!_matrix.isIdentity()) - pattern->addAttribute("patternTransform", _matrix.getSVG()); - if (_xstep < _bbox.width() || _ystep < _bbox.height()) { // overlapping tiles? - // disable clipping at the tile borders => tiles become "transparent" - pattern->addAttribute("overflow", "visible"); - } - if (XMLElementNode *clip=createClipNode()) - pattern->append(clip); - pattern->append(_groupNode); - return pattern; -} - - -/** Creates a new clip element restricting the drawing area to the - * dimensions given in the definition of the pattern. */ -XMLElementNode* PSTilingPattern::createClipNode() const { - XMLElementNode *clip = new XMLElementNode("clipPath"); - clip->addAttribute("id", "pc"+XMLString(psID())); - XMLElementNode *rect = new XMLElementNode("rect"); - rect->addAttribute("x", _bbox.minX()); - rect->addAttribute("y", _bbox.minY()); - rect->addAttribute("width", _bbox.width()); - rect->addAttribute("height", _bbox.height()); - clip->append(rect); - return clip; -} - - -/** Creates a new group element that contains all "drawing" elements that - * define the pattern graphic. */ -XMLElementNode* PSTilingPattern::createGroupNode () const { - // add all succeeding path elements to this group - XMLElementNode *group = new XMLElementNode("g"); - group->addAttribute("clip-path", XMLString("url(#pc")+XMLString(psID())+")"); - return group; -} - - -void PSTilingPattern::apply (SpecialActions *actions) { - PSPattern::apply(actions); - _groupNode = 0; -} - - -///////////////////////////////////////////////////////////////////////////// - -PSColoredTilingPattern::PSColoredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) - : PSTilingPattern(id, bbox, matrix, xstep, ystep) -{ -} - - -///////////////////////////////////////////////////////////////////////////// - -PSUncoloredTilingPattern::PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) - : PSTilingPattern(id, bbox, matrix, xstep, ystep), _applied(false) -{ -} - - -PSUncoloredTilingPattern::~PSUncoloredTilingPattern () { - if (_applied) - setGroupNode(0); // prevent deleting the group node in the parent destructor -} - - -/** Returns an SVG id value that identifies this pattern with the current color applied. */ -string PSUncoloredTilingPattern::svgID () const { - ostringstream oss; - oss << PSPattern::svgID() << '-' << hex << _currentColor; - return oss.str(); -} - - -/** Appends the definition of this pattern with the current color applied - * to the "def" section of the SVG tree. */ -void PSUncoloredTilingPattern::apply (SpecialActions* actions) { - set::iterator it=_colors.find(_currentColor); - if (it == _colors.end()) { - if (_applied) - setGroupNode(static_cast(getGroupNode()->clone())); - // assign current color to the pattern graphic - vector colored_elems; - const char *attribs[] = {"fill", "stroke"}; - for (int i=0; i < 2; i++) { - getGroupNode()->getDescendants(0, attribs[i], colored_elems); - for (vector::iterator it=colored_elems.begin(); it != colored_elems.end(); ++it) - if (string((*it)->getAttributeValue(attribs[i])) != "none") - (*it)->addAttribute(attribs[i], _currentColor.rgbString()); - colored_elems.clear(); - } - PSPattern::apply(actions); - _colors.insert(_currentColor); - _applied = true; - } -} - - -XMLElementNode* PSUncoloredTilingPattern::createClipNode() const { - // only the first instance of this patterns get a clip element - if (_colors.empty()) - return PSTilingPattern::createClipNode(); - return 0; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.h deleted file mode 100644 index d394f5a65ab..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPattern.h +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* -** PSPattern.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PSPATTERN_H -#define DVISVGM_PSPATTERN_H - -#include -#include -#include "BoundingBox.h" -#include "Color.h" -#include "Matrix.h" - - -struct SpecialActions; -class SVGTree; -class XMLElementNode; - -class PSPattern -{ - public: - virtual ~PSPattern () {} - virtual int psID () const {return _id;} - virtual std::string svgID () const; - virtual void apply (SpecialActions *actions); - - protected: - PSPattern (int id) : _id(id) {} - virtual XMLElementNode* createPatternNode () const =0; - - private: - int _id; ///< PostSCript ID of this pattern -}; - - -class PSTilingPattern : public PSPattern -{ - public: - ~PSTilingPattern (); - virtual XMLElementNode* getContainerNode () {return _groupNode;} - void apply (SpecialActions *actions); - - protected: - PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); - XMLElementNode* createPatternNode () const; - virtual XMLElementNode* createClipNode () const; - virtual XMLElementNode* createGroupNode () const; - virtual XMLElementNode* getGroupNode () const {return _groupNode;} - virtual void setGroupNode (XMLElementNode *node) {_groupNode = node;} - - private: - BoundingBox _bbox; ///< bounding box of the tile graphics - Matrix _matrix; ///< tile transformation - double _xstep, _ystep; ///< horizontal and vertical distance between neighboured tiles - XMLElementNode *_groupNode; ///< group containing the drawing elements -}; - - -class PSColoredTilingPattern : public PSTilingPattern -{ - public: - PSColoredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); -}; - - -class PSUncoloredTilingPattern : public PSTilingPattern -{ - public: - PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); - ~PSUncoloredTilingPattern (); - std::string svgID () const; - void setColor (Color color) {_currentColor = color;} - void apply (SpecialActions *actions); - - protected: - XMLElementNode* createClipNode () const; - - private: - std::set _colors; ///< colors this pattern has already been drawn with - Color _currentColor; ///< current color to be applied - bool _applied; ///< has pattern with current group node already been applied to the SVG tree? -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.cpp deleted file mode 100644 index 5029874c681..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* -** PSPreviewFilter.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "InputBuffer.h" -#include "InputReader.h" -#include "PSInterpreter.h" -#include "PSPreviewFilter.h" -#include "SpecialActions.h" - - -using namespace std; - -PSPreviewFilter::PSPreviewFilter (PSInterpreter &psi) - : PSFilter(psi), _active(false), _tightpage(false), _dvi2bp(1.0/65536.0) -{ -} - - -/** Activates this filter so that the PS code will be redirected through it if - * it's hooked into the PSInterpreter. */ -void PSPreviewFilter::activate () { - if (_tightpage) // reactivate filter? - _active = true; - else { // first activation? - _tightpage = _active = false; - // try to retrieve version string of preview package set in the PS header section - if (psInterpreter().executeRaw("SDict begin currentdict/preview@version known{preview@version}{0}ifelse end", 1)) - _version = psInterpreter().rawData()[0]; - // check if tightpage option was set - if (_version != "0" && psInterpreter().executeRaw("SDict begin preview@tightpage end", 1)) { - _tightpage = (psInterpreter().rawData()[0] == "true"); - _active = true; - } - } - _boxExtents.clear(); -} - - -/** Tries to extract the bounding box information from a chunk of PostScript code. - * @param[in] code pointer to buffer with PS code to filter - * @param[in] len number of bytes in buffer */ -void PSPreviewFilter::execute (const char *code, size_t len) { - // If the "tightpage" option was set in the TeX file, 7 integers representing the - // extent of the bounding box are present at the begin of each page. - if (!_tightpage) - psInterpreter().execute(code, len); - else { - CharInputBuffer ib(code, len); - BufferInputReader ir(ib); - ir.skipSpace(); - int val; - while (ir.parseInt(val) && _boxExtents.size() <= 7) { - _boxExtents.push_back(val); - ir.skipSpace(); - } - } - _active = false; // no further processing required -} - - -/** Returns the bounding box defined by the preview package. */ -bool PSPreviewFilter::getBoundingBox (BoundingBox &bbox) const { - if (_boxExtents.size() < 7) - return false; - double left = -_boxExtents[0]*_dvi2bp; - bbox = BoundingBox(-left, -height(), width()-left, depth()); - return true; -} - - -/** Gets the 4 border values set by the preview package. - * @return true if the border data is available */ -bool PSPreviewFilter::getBorders (double &left, double &right, double &top, double &bottom) const { - if (_boxExtents.size() < 4) - return false; - left = -_boxExtents[0]*_dvi2bp; - top = -_boxExtents[1]*_dvi2bp; - right = _boxExtents[2]*_dvi2bp; - bottom = _boxExtents[3]*_dvi2bp; - return true; -} - - -/** Returns the box height in PS points, or -1 if no data was found or read yet. */ -double PSPreviewFilter::height () const { - return _boxExtents.size() > 4 ? (_boxExtents[4]-_boxExtents[1])*_dvi2bp : -1; -} - - -/** Returns the box depth in PS points, or -1 if no data was found or read yet. */ -double PSPreviewFilter::depth () const { - return _boxExtents.size() > 5 ? (_boxExtents[5]+_boxExtents[3])*_dvi2bp : -1; -} - - -/** Returns the box width in PS points, or -1 if no data was found or read yet. */ -double PSPreviewFilter::width () const { - return _boxExtents.size() > 6 ? (_boxExtents[6]+_boxExtents[2]-_boxExtents[0])*_dvi2bp : -1; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.h deleted file mode 100644 index 3e9f9ad2052..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PSPreviewFilter.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* -** PSPreviewFilter.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PSPREVIEWFILTER_H -#define DVISVGM_PSPREVIEWFILTER_H - -#include -#include -#include "BoundingBox.h" -#include "PSFilter.h" - -struct SpecialActions; - -class PSPreviewFilter : public PSFilter -{ - public: - PSPreviewFilter (PSInterpreter &psi); - void activate (); - void execute (const char *code, size_t len); - bool active () const {return _active;} - std::string version () const {return _version;} - bool tightpage () const {return _tightpage;} - void setDviScaleFactor (double dvi2bp) {_dvi2bp = dvi2bp;} - bool getBorders (double &left, double &right, double &top, double &bottom) const; - void assignBorders (BoundingBox &bbox) const; - bool getBoundingBox (BoundingBox &bbox) const; - double height () const; - double depth () const; - double width () const; - - private: - std::string _version; ///< version string of preview package - bool _active; ///< true if filter is active - bool _tightpage; ///< true if tightpage option was given - double _dvi2bp; ///< factor to convert dvi units to PS points - std::vector _boxExtents; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.cpp deleted file mode 100644 index 8e6339c72e8..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* -** PageRanges.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "InputBuffer.h" -#include "InputReader.h" -#include "PageRanges.h" - -#include "macros.h" - -using namespace std; - - -/** Analyzes a string describing a range sequence. - * Syntax: ([0-9]+(-[0-9]*)?)|(-[0-9]+)(,([0-9]+(-[0-9]*)?)|(-[0-9]+))* - * @param[in] str string to parse - * @param[in] max_page greatest allowed value - * @return true on success; false denotes a syntax error */ -bool PageRanges::parse (string str, int max_page) { - StringInputBuffer ib(str); - BufferInputReader ir(ib); - while (ir) { - int first=1; - int last=max_page; - ir.skipSpace(); - if (!isdigit(ir.peek()) && ir.peek() != '-') - return false; - - if (isdigit(ir.peek())) - first = ir.getInt(); - ir.skipSpace(); - if (ir.peek() == '-') { - while (ir.peek() == '-') - ir.get(); - ir.skipSpace(); - if (isdigit(ir.peek())) - last = ir.getInt(); - } - else - last = first; - ir.skipSpace(); - if (ir.peek() == ',') { - ir.get(); - if (ir.eof()) - return false; - } - else if (!ir.eof()) - return false; - if (first > last) - swap(first, last); - first = max(1, first); - last = max(first, last); - if (max_page > 0) { - first = min(first, max_page); - last = min(last, max_page); - } - addRange(first, last); - } - return true; -} - - -/** Returns the number of pages. */ -size_t PageRanges::numberOfPages () const { - size_t sum=0; - for (NumericRanges::ConstIterator it=begin(); it != end(); ++it) - sum += it->second - it->first + 1; - return sum; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.h deleted file mode 100644 index 0f5e2faafa3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageRanges.h +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* -** PageRanges.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PAGERANGES_H -#define DVISVGM_PAGERANGES_H - -#include -#include -#include -#include "NumericRanges.h" - -class PageRanges : public NumericRanges -{ - public: - bool parse (std::string str, int max_page=0); - size_t numberOfPages () const; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.cpp deleted file mode 100644 index d3e60571d06..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* -** PageSize.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "PageSize.h" - -using namespace std; - -// make sure tolower is a function (and not a macro) -// so that 'transform' can be applied -static int my_tolower (int c) { - return tolower(c); -} - - -/** Computes width and height of ISO/DIN An in millimeters. - * @param[in] n the A level (e.g. n=4 => DIN A4) - * @param[out] width contains the page width when function returns - * @param[out] height contains the page height when function returns */ -static void computeASize (int n, double &width, double &height) { - double sqrt2 = sqrt(2.0); - height = floor(1189.0/pow(sqrt2, n)+0.5); - width = floor(height/sqrt2+0.5); -} - - -/** Computes width and height of ISO/DIN Bn in millimeters. - * @param[in] n the B level (e.g. n=4 => DIN B4) - * @param[out] width contains the page width when function returns - * @param[out] height contains the page height when function returns */ -static void computeBSize (int n, double &width, double &height) { - double w, h; - computeASize(n, width, height); - computeASize(n-1, w, h); - width = floor(sqrt(width * w)+0.5); - height = floor(sqrt(height * h)+0.5); -} - - -/** Computes width and height of ISO/DIN Cn in millimeters. - * @param[in] n the C level (e.g. n=4 => DIN C4) - * @param[out] width contains the page width when function returns - * @param[out] height contains the page height when function returns */ -static void computeCSize (int n, double &width, double &height) { - double w, h; - computeASize(n, width, height); - computeBSize(n, w, h); - width = floor(sqrt(width * w)+0.5); - height = floor(sqrt(height * h)+0.5); -} - - -/** Computes width and height of ISO/DIN Dn in millimeters. - * @param[in] n the D level (e.g. n=4 => DIN D4) - * @param[out] width contains the page width when function returns - * @param[out] height contains the page height when function returns */ -static void computeDSize (int n, double &width, double &height) { - double w, h; - computeASize(n, width, height); - computeBSize(n+1, w, h); - width = floor(sqrt(width * w)+0.5); - height = floor(sqrt(height * h)+0.5); -} - - -/** Constructs a PageSize object of given size. - * @param[in] name specifies the page size, e.g. "A4" or "letter" */ -PageSize::PageSize (string name) : _width(0), _height(0) { - resize(name); -} - - -void PageSize::resize (double w, double h) { - _width = w; - _height = h; -} - -void PageSize::resize (string name) { - if (name.length() < 2) - throw PageSizeException("unknown page format: "+name); - - transform(name.begin(), name.end(), name.begin(), my_tolower); - // extract optional suffix - size_t pos = name.rfind("-"); - bool landscape = false; - if (pos != string::npos) { - string suffix = name.substr(pos); - name = name.substr(0, pos); - if (suffix == "-l" || suffix == "-landscape") - landscape = true; - else if (suffix != "-p" && suffix != "-portrait") - throw PageSizeException("invalid page format suffix: " + suffix); - } - - if (name == "invoice") { - _width = 140; - _height = 216; - } - else if (name == "executive") { - _width = 184; - _height = 267; - } - else if (name == "legal") { - _width = 216; - _height = 356; - } - else if (name == "letter") { - _width = 216; - _height = 279; - } - else if (name == "ledger") { - _width = 279; - _height = 432; - } - else if (isdigit(name[1]) && name.length() < 5) { // limit length of number to prevent arithmetic errors - istringstream iss(name.substr(1)); - int n; - iss >> n; - switch (name[0]) { - case 'a' : computeASize(n, _width, _height); break; - case 'b' : computeBSize(n, _width, _height); break; - case 'c' : computeCSize(n, _width, _height); break; - case 'd' : computeDSize(n, _width, _height); break; - default : throw PageSizeException("invalid page format: "+name); - } - } - if (_width == 0 || _height == 0) - throw PageSizeException("unknown page format: "+name); - if (landscape) - swap(_width, _height); - - const double bppmm = 72/25.4; // PS points per millimeter (72pt = 1in = 25.4mm) - _width *= bppmm; - _height *= bppmm; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.h deleted file mode 100644 index b86218393c1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PageSize.h +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* -** PageSize.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PAGESIZE_H -#define DVISVGM_PAGESIZE_H - -#include "MessageException.h" - -struct PageSizeException : public MessageException -{ - PageSizeException (const std::string &msg) : MessageException(msg) {} -}; - -class PageSize -{ - public: - PageSize (double w=0, double h=0) : _width(w), _height(h) {} - PageSize (std::string name); - void resize (std:: string name); - void resize (double w, double h); - double widthInBP () const {return _width;} - double heightInBP () const {return _height;} - double widthInMM () const {return _width*25.4/72;} - double heightInMM () const {return _height*25.4/72;} - bool valid () const {return _width > 0 && _height > 0;} - - private: - double _width, _height; // in PS points -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Pair.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Pair.h deleted file mode 100644 index fa27033b199..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Pair.h +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* -** Pair.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PAIR_H -#define DVISVGM_PAIR_H - -#include -#include -#include "macros.h" -#include "types.h" - -template -class Pair -{ - public: - Pair (T x=0, T y=0) : _x(x), _y(y) {} - Pair operator += (const Pair &p) {_x += p._x; _y += p._y; return *this;} - Pair operator -= (const Pair &p) {_x -= p._x; _y -= p._y; return *this;} - Pair operator *= (T c) {_x *= c; _y *= c; return *this;} - Pair operator /= (T c) {_x /= c; _y /= c; return *this;} - Pair ortho () const {return Pair(-_y, _x);} - double length () const {return std::sqrt(_x*_x + _y*_y);} - bool operator == (const Pair &p) const {return _x == p._x && _y == p._y;} - bool operator != (const Pair &p) const {return _x != p._x || _y != p._y;} - T x () const {return _x;} - T y () const {return _y;} - void x (const T &xx) {_x = xx;} - void y (const T &yy) {_y = yy;} - std::ostream& write (std::ostream &os) const {return os << '(' << _x << ',' << _y << ')';} - - private: - T _x, _y; -}; - - -struct Pair32 : public Pair -{ - Pair32 (Int32 x=0, Int32 y=0) : Pair(x, y) {} - explicit Pair32 (double x, double y) : Pair(Int32(x+0.5), Int32(y+0.5)) {} - Pair32 (const Pair &p) : Pair(p) {} -// operator Pair () {return *this;} -}; - -typedef Pair DPair; - -template -IMPLEMENT_ARITHMETIC_OPERATOR(Pair, +) - -template -IMPLEMENT_ARITHMETIC_OPERATOR(Pair, -) - -template -IMPLEMENT_ARITHMETIC_OPERATOR2(Pair, T, *) - -template -IMPLEMENT_ARITHMETIC_OPERATOR2(Pair, T, /) - -template -IMPLEMENT_OUTPUT_OPERATOR(Pair) - -IMPLEMENT_ARITHMETIC_OPERATOR2(Pair32, Int32, *) -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.cpp deleted file mode 100644 index 02816ecac18..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/************************************************************************* -** PathClipper.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "Bezier.h" -#include "PathClipper.h" -#include "types.h" - -using namespace std; -using namespace ClipperLib; - -typedef ClipperLib::Path Polygon; -typedef ClipperLib::Paths Polygons; -typedef PathClipper::CurvedPath CurvedPath; - -const int SCALE_FACTOR = 1000; - -inline cInt to_cInt (double x) { - if (x < 0) - return static_cast(x*SCALE_FACTOR - 0.5); - return static_cast(x*SCALE_FACTOR + 0.5); -} - - -inline double to_double (cInt x) { - return static_cast(x)/SCALE_FACTOR; -} - - -inline DPair to_DPair (const IntPoint &p) { - return DPair(to_double(p.X), to_double(p.Y)); -} - - -/** In order to flatten a curved path, all path segements are processed sequentially. - * Depending on the type of the segment, one of the methods provided by this class - * is called. */ -class FlattenActions : public CurvedPath::Actions { - public: - FlattenActions (vector &curves, Polygons &polygons, int &numLines) - : _polygons(polygons), _curves(curves), _numLines(numLines) {} - - void moveto (const CurvedPath::Point &p) { - if (p == _currentPoint && !_currentPoly.empty()) - return; - closepath(); - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), 0)); - _currentPoint = _startPoint = p; - } - - void lineto (const CurvedPath::Point &p) { - if (p == _currentPoint && !_currentPoly.empty()) - return; - if (_currentPoly.empty()) // this shouldn't happen but in case it does... - _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first - _numLines--; - _currentPoly.back().Z.label2 = _numLines; - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(_numLines, 0))); - _currentPoint = p; - } - - void conicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2) { - Bezier bezier(_currentPoint, p1, p2); - addCurvePoints(bezier); - } - - void cubicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2, const CurvedPath::Point &p3) { - Bezier bezier(_currentPoint, p1, p2, p3); - addCurvePoints(bezier); - } - - void closepath () { - if (_currentPoly.empty()) - return; - _numLines--; - _currentPoly.back().Z.label2 = ZLabel(_numLines, 0); - _currentPoly.front().Z.label1 = ZLabel(_numLines, 0); - _polygons.push_back(_currentPoly); - _currentPoly.clear(); - } - - void finished () { - closepath(); - } - - protected: - void addCurvePoints (const Bezier &bezier) { - if (_currentPoly.empty()) // this shouldn't happen but in case it does, ... - _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first - vector points; // points of flattened curve - vector t; // corresponding 'time' parameters - bezier.approximate(0.01, points, &t); - if (points.size() < 2) - return; - _curves.push_back(bezier); - for (size_t i=1; i < points.size(); i++) { - const DPair &p = points[i]; - if (p == _currentPoint) - continue; - _currentPoly.back().Z.label2 = ZLabel(_curves.size(), t[i-1]); - ZLabel label(_curves.size(), t[i]); - _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(label, label))); - _currentPoint = p; - } - } - - private: - CurvedPath::Point _startPoint, _currentPoint; - Polygon _currentPoly; ///< polygon being created - Polygons &_polygons; ///< all polygons created - vector &_curves; - int &_numLines; -}; - - -/** Removes adjacent polygon vertices that equal their predecessor. */ -static void remove_redundant_vertices (Polygon &polygon) { - Polygon::iterator it1=polygon.begin(); - while (it1 != polygon.end()) { - Polygon::iterator it2 = it1+1; - if (it2 == polygon.end()) - it2 = polygon.begin(); - if (it1 == it2) - return; - - if (*it1 != *it2) - ++it1; - else { - it1->Z.label2 = it2->Z.label2; - polygon.erase(it2); - } - } -} - - -/** Approximates a curved path by a set of polygons and stores information - * to reconstruct the curved segments later. The z component of each - * polygon vertex holds two integers representing information about the two - * adjacent edges the vertex belongs to. This is required to identify the - * affected edges and thus the former (curve/line) segment of the path during - * the intersection process. - * @param[in] curvedPath curved path to be flattened - * @param[out] polygons the flattened path (set of polygons) */ -void PathClipper::flatten (const CurvedPath &curvedPath, Polygons &polygons) { - FlattenActions flattenActions(_curves, polygons, _numLines); - curvedPath.iterate(flattenActions, false); - for (size_t i=0; i < polygons.size(); i++) - remove_redundant_vertices(polygons[i]); -} - - -/** Returns the ID of the path segment the polygon edge defined by its start - * and end point belongs to. The z component of a polygon vertex holds a pair - * of labels that allows to identify the original path segments the point belongs to. - * Since always two adjacent segments share a point, each point gets two values assigned. - * Negative numbers denote line segments, positive ones Bézier curves. - * There are only these two segment types, so we don't need further flags in - * order to distinguish them. By comparing the labels of two adjacent polygon - * vertexes it's possible to identify the original path segment the corresponding - * edge belongs to. - * @param[in] p1 first of two adjacent vertices - * @param[in] p2 second of two adjacent vertices - * @param[out] t1 time paramater of p1 - * @param[out] t2 time paramater of p2 - * @return id of edge between p1 and p2, or 0 if it's not possible to identify the segment */ -static Int32 segment_id (const IntPoint &p1, const IntPoint &p2, double &t1, double &t2) { - const ZType &z1=p1.Z, &z2=p2.Z; - if (z1 == z2 && z1.minLabel().id < 0) return z1.minLabel().id; - if (z1.label1 == z2.label2) {t1=z1.label1.t; t2=z2.label2.t; return z1.label1.id;} - if (z1.label2 == z2.label1) {t1=z1.label2.t; t2=z2.label1.t; return z1.label2.id;} - if (z1.label1 == z2.label1) {t1=z1.label1.t; t2=z2.label1.t; return z1.label1.id;} - if (z1.label2 == z2.label2) {t1=z1.label2.t; t2=z2.label2.t; return z1.label2.id;} - // if we get here, it's not possible to identify the segment - // => the edge is going to be handled as line segment - return 0; -} - - -inline Int32 edge_id (const IntPoint &p1, const IntPoint &p2) { - double t; - return segment_id(p1, p2, t, t); -} - - -/** This function expects 3 colinear points p1, p2, and q where q lies between p1 and p2, - * i.e. q divides the line \f$ \overline{p_1 p_2} \f$ somewhere. The function returns - * the corresponding division ratio. */ -static double division_ratio (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { - if (p1 == p2 || q == p1) - return 0; - if (q == p2) - return 1; - if (p1.X == p2.X) - return double(q.Y-p1.Y)/(p2.Y-p1.Y); - return double(q.X-p1.X)/(p2.X-p1.X); -} - - -/** Returns the label of point q that lies on the line between points p1 and p2. */ -inline ZLabel division_label (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { - double t1, t2; - double s=0; - Int32 id = segment_id(p1, p2, t1, t2); - if (id > 0) - s = t1+(t2-t1)*division_ratio(p1, p2, q); - return ZLabel(id, s); -} - - -/** This method is called if the clipper library finds an intersection between two polygon edges. - * It populates the z coordinate of the intersection point with the idexes of the two edges. - * @param[in] e1bot first endpoint of edge 1 - * @param[in] e1top second endpoint of edge 1 - * @param[in] e2bot first endpoint of edge 2 - * @param[in] e2top second endpoint of edge 2 - * @param[in] ip intersection point of edge 1 and 2 */ -void PathClipper::callback (IntPoint &e1bot, IntPoint &e1top, IntPoint &e2bot, IntPoint &e2top, IntPoint &ip) { - ZLabel label1 = division_label(e1bot, e1top, ip); - ZLabel label2 = division_label(e2bot, e2top, ip); - ip.Z = ZType(label1, label2); -} - - -/** Iterates along the polygon edges until the endpoint of the current - * path segment is found and returns its vector index afterwards. - * @param[in] polygon the polygon to be processed - * @param[in] start index of the vertex where the iteration starts - * @param[out] label if not 0, retrieves the label of the endpoint - * @param[in] startLabel if true, the found endpoint is treated as start point and - * parameter 'label' gets the corresponding value */ -static size_t find_segment_endpoint (const Polygon &polygon, size_t start, ZLabel *label=0, bool startLabel=false) { - if (polygon.empty()) - return 0; - - const size_t num_points = polygon.size(); - int i = start%num_points; - double t1, t2; // time parameters of start and endpoint of current edge - Int32 id1 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); - Int32 id2 = id1; - double t = t2; // time parameter of resulting endpoint - for (size_t j=1; id1 == id2 && j < num_points; j++) { - t = t2; - i = (i+1)%num_points; - if (id1 == 0) - break; - id2 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); - } - if (label) { - *label = ZLabel(id1, id1 < 0 ? 0 : t); - if (startLabel && id1 != 0) - *label = polygon[i].Z.otherLabel(*label); - } - return i; -} - - -/** Reconstructs a curved path from the set of polygons. - * @param[in] polygons set of polygons to reconstruct - * @param[out] path the reconstructed curved path */ -void PathClipper::reconstruct (const Polygons &polygons, CurvedPath &path) { - for (size_t i=0; i < polygons.size(); i++) - reconstruct(polygons[i], path); -} - - -/** Reconstructs a curved path from a single polygon. - * @param[in] polygon polygon to reconstruct - * @param[out] path the reconstructed curved path */ -void PathClipper::reconstruct (const Polygon &polygon, CurvedPath &path) { - size_t num_points = polygon.size(); - if (num_points < 2) - return; - - ZLabel label1, label2; // labels of the current segment's start and endpoint - int index1 = find_segment_endpoint(polygon, 0, &label1, true); - int index2 = find_segment_endpoint(polygon, index1, &label2); - int diff = (num_points+index2-index1)%num_points; - path.moveto(to_DPair(polygon[index1])); - for (size_t count = diff; count <= num_points; count += diff) { - if (diff == 1 || label1.id <= 0) // line segment? - path.lineto(to_DPair(polygon[index2])); - else { // Bézier curve segment - Bezier bezier(_curves[label1.id-1], label1.t, label2.t); - if (label1.t > label2.t) - bezier.reverse(); - path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); - } - if (label1.id == 0) - find_segment_endpoint(polygon, index2, &label1, true); - else - label1 = polygon[index2].Z.otherLabel(label2); - index1 = index2; - index2 = find_segment_endpoint(polygon, index1, &label2); - diff = (num_points+index2-index1)%num_points; - } - path.closepath(); -} - - -inline PolyFillType polyFillType (CurvedPath::WindingRule wr) { - return (wr == CurvedPath::WR_NON_ZERO) ? pftNonZero : pftEvenOdd; -} - - -/** Computes the intersection of to curved path. - * @param[in] p1 first curved path - * @param[in] p2 second curved path - * @param[out] result intersection of p1 and p2 */ -void PathClipper::intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result) { - if (p1.size() < 2 || p2.size() < 2) - return; - Clipper clipper; - Polygons polygons; - flatten(p1, polygons); - clipper.AddPaths(polygons, ptSubject, true); - polygons.clear(); - flatten(p2, polygons); - clipper.AddPaths(polygons, ptClip, true); - clipper.ZFillFunction(callback); - Polygons flattenedPath; - clipper.Execute(ctIntersection, flattenedPath, polyFillType(p1.windingRule()), polyFillType(p2.windingRule())); - reconstruct(flattenedPath, result); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.h deleted file mode 100644 index b9c9158a228..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PathClipper.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* -** PathClipper.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PATHCLIPPER_H -#define DVISVGM_PATHCLIPPER_H - -#include -#include -#include -#include "Bezier.h" -#include "GraphicPath.h" -#include "MessageException.h" - - -using ClipperLib::IntPoint; - -class PathClipper -{ - public: - typedef GraphicPath CurvedPath; - - public: - PathClipper () : _numLines(0) {} - void intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result); - - protected: - void flatten (const CurvedPath &gp, ClipperLib::Paths &polygons); -// void divide (IntPoint &p1, IntPoint &p2, IntPoint &ip); - void reconstruct (const ClipperLib::Path &polygon, CurvedPath &path); - void reconstruct (const ClipperLib::Paths &polygons, CurvedPath &path); - static void callback (IntPoint &e1bot, IntPoint &e1top, IntPoint &e2bot, IntPoint &e2top, IntPoint &ip); - - private: - std::vector _curves; - int _numLines; ///< negative number of straight line segments in path been processed -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.cpp deleted file mode 100644 index 848d38b562d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* -** PdfSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "InputReader.h" -#include "MapLine.h" -#include "PdfSpecialHandler.h" -#include "FontMap.h" -#include "Message.h" - -using namespace std; - - -PdfSpecialHandler::PdfSpecialHandler () : _maplineProcessed(false) -{ -} - - -bool PdfSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - if (!actions) - return true; - StreamInputReader ir(is); - ir.skipSpace(); - string cmd = ir.getWord(); - ir.skipSpace(); - if (cmd == "mapline" || cmd == "mapfile") { - // read mode selector ('+', '-', or '=') - char modechar = '+'; // default mode (append if new, do not replace existing mapping) - if (strchr("=+-", ir.peek())) // leading modifier given? - modechar = ir.get(); - else if (!_maplineProcessed) { // no modifier given? - // remove default map entries if this is the first mapline/mapfile special called - FontMap::instance().clear(); - } - - if (cmd == "mapline") { - try { - MapLine mapline(is); - FontMap::instance().apply(mapline, modechar); - } - catch (const MapLineException &ex) { - Message::wstream(true) << "pdf:mapline: " << ex.what() << '\n'; - } - } - else { // mapfile - string fname = ir.getString(); - if (!FontMap::instance().read(fname, modechar)) - Message::wstream(true) << "can't open map file " << fname << '\n'; - } - _maplineProcessed = true; - } - return true; -} - - -const char** PdfSpecialHandler::prefixes () const { - static const char *pfx[] = {"pdf:", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.h deleted file mode 100644 index cdb24b6ad76..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PdfSpecialHandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* -** PdfSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PDFSPECIALHANDLER_H -#define DVISVGM_PDFSPECIALHANDLER_H - -#include "SpecialHandler.h" - -class PdfSpecialHandler : public SpecialHandler -{ - public: - PdfSpecialHandler (); - const char* info () const {return "pdfTeX font map specials";} - const char* name () const {return "pdf";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - - private: - bool _maplineProcessed; ///< true if a mapline or mapfile special has already been processed -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.cpp deleted file mode 100644 index 9d45be980f1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* -** PreScanDVIReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include "DVIActions.h" -#include "PreScanDVIReader.h" - -using namespace std; - - -PreScanDVIReader::PreScanDVIReader (std::istream &is, DVIActions *actions) - : BasicDVIReader(is), _actions(actions), _currentPageNumber(0) -{ -} - - -void PreScanDVIReader::cmdBop (int) { - _currentPageNumber++; - BasicDVIReader::cmdBop(0); -} - - -void PreScanDVIReader::cmdXXX (int len) { - UInt32 numBytes = readUnsigned(len); - string s = readString(numBytes); - if (_actions) - _actions->special(s, 0, true); // pre-process special -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.h deleted file mode 100644 index 6e1642548f5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PreScanDVIReader.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* -** PreScanDVIReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef PRESCANDVIREADER_H -#define PRESCANDVIREADER_H - -#include "BasicDVIReader.h" - -struct DVIActions; - -class PreScanDVIReader : public BasicDVIReader -{ - public: - PreScanDVIReader (std::istream &is, DVIActions *actions); - unsigned getCurrentPageNumber () const {return _currentPageNumber;} - - protected: - void cmdBop (int); - void cmdXXX (int len); - - private: - DVIActions *_actions; - unsigned _currentPageNumber; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.cpp deleted file mode 100644 index b79331f4fab..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* -** Process.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include - -#ifdef __WIN32__ - #include -#else - #include - #include - #include - #include -#endif - -#include -#include "FileSystem.h" -#include "Process.h" -#include "SignalHandler.h" -#include "macros.h" - -using namespace std; - -Process::Process (const string &cmd, const string ¶mstr) - : _cmd(cmd), _paramstr(paramstr) -{ -} - - -#ifdef __WIN32__ -static void pipe_read (HANDLE handle, string &out) { - char buf[4096]; - out.clear(); - for (;;) { - DWORD num_chars; - bool success = ReadFile(handle, buf, 1024, &num_chars, NULL); - if (!success || num_chars == 0) - break; - out.append(buf, num_chars); - } - // remove trailing space - if (!out.empty()) { - int pos = out.size()-1; - while (pos >= 0 && isspace(out[pos])) - pos--; - out.erase(pos+1); - } -} - - -static inline void close_handle (HANDLE handle) { - if (handle != NULL) - CloseHandle(handle); -} - -#else - -/** Extracts whitespace-sparated parameters from a string. - * @param[in] paramstr the parameter string - * @param[out] params vector holding the extracted parameters */ -static void split_paramstr (string paramstr, vector ¶ms) { - size_t left=0, right=0; // index of first and last character of current parameter - char quote=0; // current quote character, 0=none - const size_t len = paramstr.length(); - while (left <= right && right < len) { - while (left < len && isspace(paramstr[left])) - ++left; - if (left < len && (paramstr[left] == '"' || paramstr[left] == '\'')) - quote = paramstr[left++]; - right = left; - while (right < len && (quote || !isspace(paramstr[right]))) { - if (quote && paramstr[right] == quote) { - quote=0; - break; - } - else - ++right; - } - if (right < len) - paramstr[right]=0; - if (left < len) - params.push_back(¶mstr[left]); - left = ++right; - } -} - -#endif - - -/** Runs the process and waits until it's finished. - * @param[out] out takes the output written to stdout by the executed process - * @return true if process terminated properly - * @throw SignalException if CTRL-C was pressed during execution */ -bool Process::run (string *out) { -#ifdef __WIN32__ - SECURITY_ATTRIBUTES sa; - ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); - sa.nLength = sizeof(SECURITY_ATTRIBUTES); - sa.bInheritHandle = true; - - STARTUPINFO si; - ZeroMemory(&si, sizeof(STARTUPINFO)); - si.cb = sizeof(STARTUPINFO); - si.dwFlags = STARTF_USESTDHANDLES; - HANDLE devnull = NULL; - HANDLE proc_read_handle = NULL; - HANDLE proc_write_handle = NULL; - if (out) { - CreatePipe(&proc_read_handle, &proc_write_handle, &sa, 0); - SetHandleInformation(proc_read_handle, HANDLE_FLAG_INHERIT, 0); - si.hStdOutput = proc_write_handle; - } - else { - devnull = CreateFile("nul", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - si.hStdOutput = devnull; - } - si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); - si.hStdError = GetStdHandle(STD_ERROR_HANDLE); - - PROCESS_INFORMATION pi; - ZeroMemory(&pi, sizeof(pi)); - DWORD exitcode = DWORD(-1); - string cmdline = _cmd+" "+_paramstr; - bool success = CreateProcess(NULL, (LPSTR)cmdline.c_str(), NULL, NULL, true, 0, NULL, NULL, &si, &pi); - if (success) { - WaitForSingleObject(pi.hProcess, INFINITE); - GetExitCodeProcess(pi.hProcess, &exitcode); - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - close_handle(proc_write_handle); // must be closed before reading from pipe to prevent blocking - if (success && out) - pipe_read(proc_read_handle, *out); - close_handle(proc_read_handle); - close_handle(devnull); - return exitcode == 0; -#else - pid_t pid = fork(); - if (pid == 0) { // child process - if (!out) { - int devnull = open(FileSystem::DEVNULL, O_WRONLY); - if (devnull >= 0) { - dup2(devnull, STDOUT_FILENO); - dup2(devnull, STDERR_FILENO); - close(devnull); - } - } - vector params; - params.push_back(_cmd.c_str()); - split_paramstr(_paramstr, params); - params.push_back(0); // trailing NULL marks end - execvp(_cmd.c_str(), const_cast(¶ms[0])); - exit(1); - } - if (pid > 0) { // main process - int status; - for (;;) { - waitpid(pid, &status, WNOHANG); - if (WIFEXITED(status)) // child process exited normally - return WEXITSTATUS(status) == 0; - - try { - SignalHandler::instance().check(); - } - catch (SignalException &e) { // caught ctrl-c - kill(pid, SIGKILL); - throw; - } - } - } - return false; -#endif -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.h deleted file mode 100644 index bf6deb28a51..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Process.h +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* -** Process.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PROCESS_H -#define DVISVGM_PROCESS_H - -#include - -class Process -{ - public: - Process (const std::string &cmd, const std::string ¶mstr); - bool run (std::string *out=0); - - protected: - Process (const Process& orig) {} - - private: - std::string _cmd; - std::string _paramstr; -}; - -#endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.cpp deleted file mode 100644 index 9e02f353e4b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.cpp +++ /dev/null @@ -1,1190 +0,0 @@ -/************************************************************************* -** PsSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "EPSFile.h" -#include "FileFinder.h" -#include "Ghostscript.h" -#include "Message.h" -#include "PathClipper.h" -#include "PSPattern.h" -#include "PSPreviewFilter.h" -#include "PsSpecialHandler.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "TensorProductPatch.h" -#include "VectorIterator.h" -#include "XMLNode.h" -#include "XMLString.h" -#include "TriangularPatch.h" - - -using namespace std; - - -static inline double str2double (const string &str) { - double ret; - istringstream iss(str); - iss >> ret; - return ret; -} - - -bool PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = false; -bool PsSpecialHandler::SHADING_SEGMENT_OVERLAP = false; -int PsSpecialHandler::SHADING_SEGMENT_SIZE = 20; -double PsSpecialHandler::SHADING_SIMPLIFY_DELTA = 0.01; - - -PsSpecialHandler::PsSpecialHandler () : _psi(this), _actions(0), _previewFilter(_psi), _psSection(PS_NONE), _xmlnode(0) -{ -} - - -PsSpecialHandler::~PsSpecialHandler () { - _psi.setActions(0); // ensure no further PS actions are performed - for (map::iterator it=_patterns.begin(); it != _patterns.end(); ++it) - delete it->second; -} - - -/** Initializes the PostScript handler. It's called by the first use of process(). The - * deferred initialization speeds up the conversion of DVI files that doesn't contain - * PS specials. */ -void PsSpecialHandler::initialize () { - if (_psSection == PS_NONE) { - // initial values of graphics state - _linewidth = 1; - _linecap = _linejoin = 0; - _miterlimit = 4; - _xmlnode = _savenode = 0; - _opacityalpha = 1; // fully opaque - _sx = _sy = _cos = 1.0; - _pattern = 0; - - // execute dvips prologue/header files - const char *headers[] = {"tex.pro", "texps.pro", "special.pro", /*"color.pro",*/ 0}; - for (const char **p=headers; *p; ++p) - processHeaderFile(*p); - // disable bop/eop operators to prevent side-effects by - // unexpected bobs/eops present in PS specials - _psi.execute("\nTeXDict begin /bop{pop pop}def /eop{}def end "); - _psSection = PS_HEADERS; // allow to process header specials now - } -} - - -void PsSpecialHandler::processHeaderFile (const char *name) { - if (const char *path = FileFinder::lookup(name, false)) { - ifstream ifs(path); - _psi.execute(string("%%BeginProcSet: ")+name+" 0 0\n", false); - _psi.execute(ifs, false); - _psi.execute("%%EndProcSet\n", false); - } - else - Message::wstream(true) << "PostScript header file " << name << " not found\n"; -} - - -void PsSpecialHandler::enterBodySection () { - if (_psSection == PS_HEADERS) { - _psSection = PS_BODY; // don't process any PS header code - ostringstream oss; - // process collected header code - if (!_headerCode.empty()) { - oss << "\nTeXDict begin @defspecial " << _headerCode << "\n@fedspecial end"; - _headerCode.clear(); - } - // push dictionary "TeXDict" with dvips definitions on dictionary stack - // and initialize basic dvips PostScript variables - oss << "\nTeXDict begin 0 0 1000 72 72 () @start 0 0 moveto "; - _psi.execute(oss.str(), false); - // Check for information generated by preview.sty. If the tightpage options - // was set, don't execute the bop-hook but allow the PS filter to read - // the bbox data present at the beginning of the page. - _psi.setFilter(&_previewFilter); - _previewFilter.activate(); - if (!_previewFilter.tightpage()) - _psi.execute("userdict/bop-hook known{bop-hook}if\n", false); - } -} - - -/** Move PS graphic position to current DVI location. */ -void PsSpecialHandler::moveToDVIPos () { - if (_actions) { - const double x = _actions->getX(); - const double y = _actions->getY(); - ostringstream oss; - oss << '\n' << x << ' ' << y << " moveto "; - _psi.execute(oss.str()); - _currentpoint = DPair(x, y); - } -} - - -/** Executes a PS snippet and optionally synchronizes the DVI cursor position - * with the current PS point. - * @param[in] is stream to read the PS code from - * @param[in] updatePos if true, move the DVI drawing position to the current PS point */ -void PsSpecialHandler::executeAndSync (istream &is, bool updatePos) { - if (_actions && _actions->getColor() != _currentcolor) { - // update the PS graphics state if the color has been changed by a color special - double r, g, b; - _actions->getColor().getRGB(r, g, b); - ostringstream oss; - oss << '\n' << r << ' ' << g << ' ' << b << " setrgbcolor "; - _psi.execute(oss.str(), false); - } - _psi.execute(is); - if (updatePos) { - // retrieve current PS position (stored in _currentpoint) - _psi.execute("\nquerypos "); - if (_actions) { - _actions->setX(_currentpoint.x()); - _actions->setY(_currentpoint.y()); - } - } -} - - -void PsSpecialHandler::preprocess (const char *prefix, istream &is, SpecialActions *actions) { - initialize(); - if (_psSection != PS_HEADERS) - return; - - _actions = actions; - if (*prefix == '!') { - _headerCode += "\n"; - _headerCode += string(istreambuf_iterator(is), istreambuf_iterator()); - } - else if (strcmp(prefix, "header=") == 0) { - // read and execute PS header file - string fname; - is >> fname; - processHeaderFile(fname.c_str()); - } -} - - -bool PsSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - // process PS headers only once (in prescan) - if (*prefix == '!' || strcmp(prefix, "header=") == 0) - return true; - - _actions = actions; - initialize(); - if (_psSection != PS_BODY) - enterBodySection(); - - if (*prefix == '"') { - // read and execute literal PostScript code (isolated by a wrapping save/restore pair) - moveToDVIPos(); - _psi.execute("\n@beginspecial @setspecial "); - executeAndSync(is, false); - _psi.execute("\n@endspecial "); - } - else if (strcmp(prefix, "psfile=") == 0 || strcmp(prefix, "PSfile=") == 0) { - if (_actions) { - StreamInputReader in(is); - string fname = in.getQuotedString(in.peek() == '"' ? '"' : 0); - map attr; - in.parseAttributes(attr); - psfile(fname, attr); - } - } - else if (strcmp(prefix, "ps::") == 0) { - if (_actions) - _actions->finishLine(); // reset DVI position on next DVI command - if (is.peek() == '[') { - // collect characters inside the brackets - string code; - for (int i=0; i < 9 && is.peek() != ']' && !is.eof(); ++i) - code += is.get(); - if (is.peek() == ']') - code += is.get(); - - if (code == "[begin]" || code == "[nobreak]") { - moveToDVIPos(); - executeAndSync(is, true); - } - else { - // no move to DVI position here - if (code != "[end]") // PS array? - _psi.execute(code); - executeAndSync(is, true); - } - } - else { // ps:: behaves like ps::[end] - // no move to DVI position here - executeAndSync(is, true); - } - } - else { // ps: ... - if (_actions) - _actions->finishLine(); - moveToDVIPos(); - StreamInputReader in(is); - if (in.check(" plotfile ")) { // ps: plotfile fname - string fname = in.getString(); - ifstream ifs(fname.c_str()); - if (ifs) - _psi.execute(ifs); - else - Message::wstream(true) << "file '" << fname << "' not found in ps: plotfile\n"; - } - else { - // ps: is almost identical to ps::[begin] but does - // a final repositioning to the current DVI location - executeAndSync(is, true); - moveToDVIPos(); - } - } - return true; -} - - -/** Handles psfile special. - * @param[in] fname EPS file to be included - * @param[in] attr attributes given with \\special psfile */ -void PsSpecialHandler::psfile (const string &fname, const map &attr) { - EPSFile epsfile(fname); - istream &is = epsfile.istream(); - if (!is) - Message::wstream(true) << "file '" << fname << "' not found in special 'psfile'\n"; - else { - map::const_iterator it; - - // bounding box of EPS figure - double llx = (it = attr.find("llx")) != attr.end() ? str2double(it->second) : 0; - double lly = (it = attr.find("lly")) != attr.end() ? str2double(it->second) : 0; - double urx = (it = attr.find("urx")) != attr.end() ? str2double(it->second) : 0; - double ury = (it = attr.find("ury")) != attr.end() ? str2double(it->second) : 0; - - // desired width/height of resulting figure - double rwi = (it = attr.find("rwi")) != attr.end() ? str2double(it->second)/10.0 : -1; - double rhi = (it = attr.find("rhi")) != attr.end() ? str2double(it->second)/10.0 : -1; - if (rwi == 0 || rhi == 0 || urx-llx == 0 || ury-lly == 0) - return; - - // user transformations (default values chosen according to dvips manual) - double hoffset = (it = attr.find("hoffset")) != attr.end() ? str2double(it->second) : 0; - double voffset = (it = attr.find("voffset")) != attr.end() ? str2double(it->second) : 0; -// double hsize = (it = attr.find("hsize")) != attr.end() ? str2double(it->second) : 612; -// double vsize = (it = attr.find("vsize")) != attr.end() ? str2double(it->second) : 792; - double hscale = (it = attr.find("hscale")) != attr.end() ? str2double(it->second) : 100; - double vscale = (it = attr.find("vscale")) != attr.end() ? str2double(it->second) : 100; - double angle = (it = attr.find("angle")) != attr.end() ? str2double(it->second) : 0; - - Matrix m(1); - m.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); - BoundingBox bbox(llx, lly, urx, ury); - bbox.transform(m); - - double sx = rwi/bbox.width(); - double sy = rhi/bbox.height(); - if (sx < 0) sx = sy; - if (sy < 0) sy = sx; - if (sx < 0) sx = sy = 1.0; - - // save current DVI position (in pt units) - const double x = _actions->getX(); - const double y = _actions->getY(); - - // all following drawings are relative to (0,0) - _actions->setX(0); - _actions->setY(0); - moveToDVIPos(); - - _xmlnode = new XMLElementNode("g"); - _psi.execute("\n@beginspecial @setspecial "); // enter \special environment - _psi.limit(epsfile.pslength()); // limit the number of bytes to be processed - _psi.execute(is); // process EPS file - _psi.limit(0); // disable limitation - _psi.execute("\n@endspecial "); // leave special environment - if (!_xmlnode->empty()) { // has anything been drawn? - Matrix m(1); - m.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); - m.translate(-llx, lly); - m.scale(sx, sy); // resize image to width "rwi" and height "rhi" - m.translate(x, y); // move image to current DVI position - _xmlnode->addAttribute("transform", m.getSVG()); - _actions->appendToPage(_xmlnode); - } - else - delete _xmlnode; - _xmlnode = 0; - - // restore DVI position - _actions->setX(x); - _actions->setY(y); - moveToDVIPos(); - - // update bounding box - m.scale(sx, -sy); - m.translate(x, y); - bbox = BoundingBox(0, 0, fabs(urx-llx), fabs(ury-lly)); - bbox.transform(m); - _actions->embed(bbox); - } -} - - -/** Apply transformation to width, height, and depth set by preview package. - * @param[in] matrix transformation matrix to apply - * @param[out] w width - * @param[out] h height - * @param[out] d depth - * @return true if the baseline is still horizontal after the transformation */ -static bool transform_box_extents (const Matrix &matrix, double &w, double &h, double &d) { - DPair shift = matrix*DPair(0,0); // the translation component of the matrix - DPair ex = matrix*DPair(1,0)-shift; - DPair ey = matrix*DPair(0,1)-shift; - if (ex.y() != 0 && ey.x() != 0) // rotation != mod 90 degrees? - return false; // => non-horizontal baseline, can't compute meaningful extents - - if (ex.y() == 0) // horizontal scaling or skewing? - w *= fabs(ex.x()); - if (ey.x()==0 || ex.y()==0) { // vertical scaling? - if (ey.y() < 0) swap(h, d); - if (double sy = fabs(ey.y())/ey.length()) { - h *= fabs(ey.y()/sy); - d *= fabs(ey.y()/sy); - } - else - h = d = 0; - } - return true; -} - - -void PsSpecialHandler::dviEndPage (unsigned) { - BoundingBox bbox; - if (_previewFilter.getBoundingBox(bbox)) { - double w = _previewFilter.width(); - double h = _previewFilter.height(); - double d = _previewFilter.depth(); - bool horiz_baseline = true; - if (_actions) { - _actions->bbox() = bbox; - // apply page transformations to box extents - Matrix pagetrans; - _actions->getPageTransform(pagetrans); - horiz_baseline = transform_box_extents(pagetrans, w, h, d); - _actions->bbox().lock(); - } - Message::mstream() << "\napplying bounding box set by preview package (version " << _previewFilter.version() << ")\n"; - if (horiz_baseline) { - const double bp2pt = 72.27/72.0; - Message::mstream() << - "width=" << XMLString(w*bp2pt) << "pt, " - "height=" << XMLString(h*bp2pt) << "pt, " - "depth=" << XMLString(d*bp2pt) << "pt\n"; - } - else - Message::mstream() << "can't determine height, width, and depth due to non-horizontal baseline\n"; - } - // close dictionary TeXDict and execute end-hook if defined - if (_psSection == PS_BODY) { - _psi.execute("\nend userdict/end-hook known{end-hook}if "); - _psSection = PS_HEADERS; - } -} - -/////////////////////////////////////////////////////// - -void PsSpecialHandler::gsave (vector &p) { - _clipStack.dup(); -} - - -void PsSpecialHandler::grestore (vector &p) { - _clipStack.pop(); -} - - -void PsSpecialHandler::grestoreall (vector &p) { - _clipStack.pop(-1, true); -} - - -void PsSpecialHandler::save (vector &p) { - _clipStack.dup(static_cast(p[0])); -} - - -void PsSpecialHandler::restore (vector &p) { - _clipStack.pop(static_cast(p[0])); -} - - -void PsSpecialHandler::moveto (vector &p) { - _path.moveto(p[0], p[1]); -} - - -void PsSpecialHandler::lineto (vector &p) { - _path.lineto(p[0], p[1]); -} - - -void PsSpecialHandler::curveto (vector &p) { - _path.cubicto(p[0], p[1], p[2], p[3], p[4], p[5]); -} - - -void PsSpecialHandler::closepath (vector &p) { - _path.closepath(); -} - - -/** Draws the current path recorded by previously executed path commands (moveto, lineto,...). - * @param[in] p not used */ -void PsSpecialHandler::stroke (vector &p) { - if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) - return; - - BoundingBox bbox; - if (!_actions->getMatrix().isIdentity()) { - _path.transform(_actions->getMatrix()); - if (!_xmlnode) - bbox.transform(_actions->getMatrix()); - } - if (_clipStack.clippathLoaded() && _clipStack.top()) - _path.prepend(*_clipStack.top()); - XMLElementNode *path=0; - Pair 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 = new XMLElementNode("circle"); - path->addAttribute("cx", x); - path->addAttribute("cy", y); - path->addAttribute("r", r); - path->addAttribute("fill", _actions->getColor().rgbString()); - bbox = BoundingBox(x-r, y-r, x+r, y+r); - } - } - else { - // compute bounding box - _path.computeBBox(bbox); - bbox.expand(_linewidth/2); - - ostringstream oss; - _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - path = new XMLElementNode("path"); - path->addAttribute("d", oss.str()); - path->addAttribute("stroke", _actions->getColor().rgbString()); - 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 (_opacityalpha < 1) - path->addAttribute("stroke-opacity", _opacityalpha); - if (!_dashpattern.empty()) { - ostringstream oss; - for (size_t i=0; i < _dashpattern.size(); i++) { - if (i > 0) - oss << ','; - oss << XMLString(_dashpattern[i]); - } - path->addAttribute("stroke-dasharray", oss.str()); - if (_dashoffset != 0) - path->addAttribute("stroke-dashoffset", _dashoffset); - } - } - if (path && _clipStack.top()) { - // assign clipping path and clip bounding box - path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); - BoundingBox clipbox; - _clipStack.top()->computeBBox(clipbox); - bbox.intersect(clipbox); - _clipStack.setClippathLoaded(false); - } - if (_xmlnode) - _xmlnode->append(path); - else { - _actions->appendToPage(path); - _actions->embed(bbox); - } - _path.clear(); -} - - -/** Draws a closed path filled with the current color. - * @param[in] p not used - * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ -void PsSpecialHandler::fill (vector &p, bool evenodd) { - if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) - return; - - // compute bounding box - BoundingBox bbox; - _path.computeBBox(bbox); - if (!_actions->getMatrix().isIdentity()) { - _path.transform(_actions->getMatrix()); - if (!_xmlnode) - bbox.transform(_actions->getMatrix()); - } - if (_clipStack.clippathLoaded() && _clipStack.top()) - _path.prepend(*_clipStack.top()); - - ostringstream oss; - _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - XMLElementNode *path = new XMLElementNode("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().rgbString()); - if (_clipStack.top()) { - // assign clipping path and clip bounding box - path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); - BoundingBox clipbox; - _clipStack.top()->computeBBox(clipbox); - bbox.intersect(clipbox); - _clipStack.setClippathLoaded(false); - } - if (evenodd) // SVG default fill rule is "nonzero" algorithm - path->addAttribute("fill-rule", "evenodd"); - if (_opacityalpha < 1) - path->addAttribute("fill-opacity", _opacityalpha); - if (_xmlnode) - _xmlnode->append(path); - else { - _actions->appendToPage(path); - _actions->embed(bbox); - } - _path.clear(); -} - - -/** Creates a Matrix object out of a given sequence of 6 double values. - * The given values must be arranged in PostScript matrix order. - * @param[in] v vector containing the matrix values - * @param[in] startindex vector index of first component - * @param[out] matrix the generated matrix */ -static void create_matrix (vector &v, int startindex, Matrix &matrix) { - // Ensure vector p has 6 elements. If necessary, add missing ones - // using corresponding values of the identity matrix. - if (v.size()-startindex < 6) { - v.resize(6+startindex); - for (int i=v.size()-startindex; i < 6; ++i) - v[i+startindex] = (i%3 ? 0 : 1); - } - // PS matrix [a b c d e f] equals ((a,b,0),(c,d,0),(e,f,1)). - // Since PS uses left multiplications, we must transpose and reorder - // the matrix to ((a,c,e),(b,d,f),(0,0,1)). This is done by the - // following swaps. - swap(v[startindex+1], v[startindex+2]); // => (a, c, b, d, e, f) - swap(v[startindex+2], v[startindex+4]); // => (a, c, e, d, b, f) - swap(v[startindex+3], v[startindex+4]); // => (a, c, e, b, d, f) - matrix.set(v, startindex); -} - - -/** Starts the definition of a new fill pattern. This operator - * expects 9 parameters for tiling patterns (see PS reference 4.9.2): - * @param[in] p the 9 values defining a tiling pattern (see PS reference 4.9.2): - * 0: pattern type (0:none, 1:tiling, 2:shading) - * 1: pattern ID - * 2-5: lower left and upper right coordinates of pattern box - * 6: horizontal distance of adjacent tiles - * 7: vertical distance of adjacent tiles - * 8: paint type (1: colored pattern, 2: uncolored pattern) - * 9-14: pattern matrix */ -void PsSpecialHandler::makepattern (vector &p) { - int pattern_type = static_cast(p[0]); - int id = static_cast(p[1]); - switch (pattern_type) { - case 0: - // pattern definition completed - if (_savenode) { - _xmlnode = _savenode; - _savenode = 0; - } - break; - case 1: { // tiling pattern - BoundingBox bbox(p[2], p[3], p[4], p[5]); - const double &xstep=p[6], &ystep=p[7]; // horizontal and vertical distance of adjacent tiles - int paint_type = static_cast(p[8]); - - Matrix matrix; // transformation matrix given together with pattern definition - create_matrix(p, 9, matrix); - matrix.rmultiply(_actions->getMatrix()); - - PSTilingPattern *pattern=0; - if (paint_type == 1) - pattern = new PSColoredTilingPattern(id, bbox, matrix, xstep, ystep); - else - pattern = new PSUncoloredTilingPattern(id, bbox, matrix, xstep, ystep); - _patterns[id] = pattern; - _savenode = _xmlnode; - _xmlnode = pattern->getContainerNode(); // insert the following SVG elements into this node - break; - } - case 2: { - // define a shading pattern - } - } -} - - -/** Selects a previously defined fill pattern. - * 0: pattern ID - * 1-3: (optional) RGB values for uncolored tiling patterns - * further parameters depend on the pattern type */ -void PsSpecialHandler::setpattern (vector &p) { - int pattern_id = p[0]; - Color color; - if (p.size() == 4) - color.setRGB(p[1], p[2], p[3]); - map::iterator it = _patterns.find(pattern_id); - if (it == _patterns.end()) - _pattern = 0; - else { - if (PSUncoloredTilingPattern *pattern = dynamic_cast(it->second)) - pattern->setColor(color); - it->second->apply(_actions); - if (PSTilingPattern *pattern = dynamic_cast(it->second)) - _pattern = pattern; - else - _pattern = 0; - } -} - - -/** Clears the current clipping path. - * @param[in] p not used */ -void PsSpecialHandler::initclip (vector &) { - _clipStack.pushEmptyPath(); -} - - -/** Assigns the current clipping path to the graphics path. */ -void PsSpecialHandler::clippath (std::vector&) { - if (!_clipStack.empty()) { - _clipStack.setClippathLoaded(true); - _path.clear(); - } -} - - -/** Assigns a new clipping path to the graphics state using the current path. - * If the graphics state already contains a clipping path, the new one is - * computed by intersecting the current clipping path with the current graphics - * path (see PS language reference, 3rd edition, pp. 193, 542) - * @param[in] p not used - * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ -void PsSpecialHandler::clip (vector &, bool evenodd) { - clip(_path, evenodd); -} - - -/** Assigns a new clipping path to the graphics state using the current path. - * If the graphics state already contains a clipping path, the new one is - * computed by intersecting the current one with the given path. - * @param[in] path path used to restrict the clipping region - * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ -void PsSpecialHandler::clip (Path &path, bool evenodd) { - // when this method is called, _path contains the clipping path - if (path.empty() || !_actions) - return; - - Path::WindingRule windingRule = evenodd ? Path::WR_EVEN_ODD : Path::WR_NON_ZERO; - path.setWindingRule(windingRule); - - if (!_actions->getMatrix().isIdentity()) - path.transform(_actions->getMatrix()); - - int oldID = _clipStack.topID(); - - ostringstream oss; - if (!COMPUTE_CLIPPATHS_INTERSECTIONS || oldID < 1) { - _clipStack.replace(path); - path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - } - else { - // compute the intersection of the current clipping path with the current graphics path - Path *oldPath = _clipStack.getPath(oldID); - Path intersectedPath(windingRule); - PathClipper clipper; - clipper.intersect(*oldPath, path, intersectedPath); - _clipStack.replace(intersectedPath); - intersectedPath.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - } - - XMLElementNode *pathElem = new XMLElementNode("path"); - pathElem->addAttribute("d", oss.str()); - if (evenodd) - pathElem->addAttribute("clip-rule", "evenodd"); - - int newID = _clipStack.topID(); - XMLElementNode *clipElem = new XMLElementNode("clipPath"); - clipElem->addAttribute("id", XMLString("clip")+XMLString(newID)); - if (!COMPUTE_CLIPPATHS_INTERSECTIONS && oldID) - clipElem->addAttribute("clip-path", XMLString("url(#clip")+XMLString(oldID)+")"); - - clipElem->append(pathElem); - _actions->appendToDefs(clipElem); -} - - -/** Applies a gradient fill to the current graphics path. Vector p contains the shading parameters - * in the following order: - * - shading type (6=Coons, 7=tensor product) - * - color space (1=gray, 3=rgb, 4=cmyk) - * - 1.0 followed by the background color components based on the declared color space, or 0.0 - * - 1.0 followed by the bounding box coordinates, or 0.0 - * - geometry and color parameters depending on the shading type */ -void PsSpecialHandler::shfill (vector ¶ms) { - if (params.size() < 9) - return; - - // collect common data relevant for all shading types - int shadingTypeID = static_cast(params[0]); - ColorSpace colorSpace = Color::RGB_SPACE; - switch (static_cast(params[1])) { - case 1: colorSpace = Color::GRAY_SPACE; break; - case 3: colorSpace = Color::RGB_SPACE; break; - case 4: colorSpace = Color::CMYK_SPACE; break; - } - VectorIterator it = params; - it += 2; // skip shading type and color space - // Get color to fill the whole mesh area before drawing the gradient colors on top of that background. - // This is an optional parameter to shfill. - bool bgcolorGiven = static_cast(*it++); - Color bgcolor; - if (bgcolorGiven) - bgcolor.set(colorSpace, it); - // Get clipping rectangle to limit the drawing area of the gradient mesh. - // This is an optional parameter to shfill too. - bool bboxGiven = static_cast(*it++); - if (bboxGiven) { // bounding box given - Path bboxPath; - const double &x1 = *it++; - const double &y1 = *it++; - const double &x2 = *it++; - const double &y2 = *it++; - bboxPath.moveto(x1, y1); - bboxPath.lineto(x2, y1); - bboxPath.lineto(x2, y2); - bboxPath.lineto(x1, y2); - bboxPath.closepath(); - clip(bboxPath, false); - } - try { - if (shadingTypeID == 5) - processLatticeTriangularPatchMesh(colorSpace, it); - else - processSequentialPatchMesh(shadingTypeID, colorSpace, it); - } - catch (ShadingException &e) { - Message::estream(false) << "PostScript error: " << e.what() << '\n'; - it.invalidate(); // stop processing the remaining patch data - } - catch (IteratorException &e) { - Message::estream(false) << "PostScript error: incomplete shading data\n"; - } - if (bboxGiven) - _clipStack.pop(); -} - - -/** Reads position and color data of a single shading patch from the data vector. - * @param[in] shadingTypeID PS shading type ID identifying the format of the subsequent patch data - * @param[in] edgeflag edge flag specifying how to connect the current patch to the preceding one - * @param[in] cspace color space used to compute the color gradient - * @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, - VectorIterator &it, vector &points, vector &colors) -{ - // number of control points and colors required to define a single patch - int numPoints = patch.numPoints(edgeflag); - int numColors = patch.numColors(edgeflag); - points.resize(numPoints); - colors.resize(numColors); - if (patch.psShadingType() == 4) { - // format of a free-form triangular patch definition, where eN denotes - // the edge of the corresponding vertex: - // edge flag = 0, x1, y1, {color1}, e2, x2, y2, {color2}, e3, x3, y3, {color3} - // edge flag > 0, x1, y1, {color1} - for (int i=0; i < numPoints; i++) { - if (i > 0) ++it; // skip redundant edge flag from free-form triangular patch - double x = *it++; - double y = *it++; - points[i] = DPair(x, y); - colors[i].set(patch.colorSpace(), it); - } - } - else if (patch.psShadingType() == 6 || patch.psShadingType() == 7) { - // format of each Coons/tensor product patch definition: - // edge flag = 0, x1, y1, ... , xn, yn, {color1}, {color2}, {color3}, {color4} - // edge flag > 0, x5, y5, ... , xn, yn, {color3}, {color4} - for (int i=0; i < numPoints; i++) { - double x = *it++; - double y = *it++; - points[i] = DPair(x, y); - } - for (int i=0; i < numColors; i++) - colors[i].set(patch.colorSpace(), it); - } -} - - -class ShadingCallback : public ShadingPatch::Callback { - public: - ShadingCallback (SpecialActions *actions, XMLElementNode *parent, int clippathID) - : _actions(actions), _group(new XMLElementNode("g")) - { - if (parent) - parent->append(_group); - else - actions->appendToPage(_group); - if (clippathID > 0) - _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")"); - } - - void patchSegment (GraphicPath &path, const Color &color) { - if (!_actions->getMatrix().isIdentity()) - path.transform(_actions->getMatrix()); - - // draw a single patch segment - ostringstream oss; - path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - XMLElementNode *pathElem = new XMLElementNode("path"); - pathElem->addAttribute("d", oss.str()); - pathElem->addAttribute("fill", color.rgbString()); - _group->append(pathElem); - } - - private: - SpecialActions *_actions; - XMLElementNode *_group; -}; - - -/** Handle all patch meshes whose patches and their connections can be processed sequentially. - * This comprises free-form triangular, Coons, and tensor-product patch meshes. */ -void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace colorSpace, VectorIterator &it) { - auto_ptr previousPatch; - while (it.valid()) { - int edgeflag = static_cast(*it++); - vector points; - vector colors; - auto_ptr patch; - - patch = auto_ptr(ShadingPatch::create(shadingTypeID, colorSpace)); - read_patch_data(*patch, edgeflag, it, points, colors); - patch->setPoints(points, edgeflag, previousPatch.get()); - patch->setColors(colors, edgeflag, previousPatch.get()); - ShadingCallback callback(_actions, _xmlnode, _clipStack.topID()); -#if 0 - if (bgcolorGiven) { - // fill whole patch area with given background color - GraphicPath outline; - patch->getBoundaryPath(outline); - callback.patchSegment(outline, bgcolor); - } -#endif - patch->approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); - if (!_xmlnode) { - // update bounding box - BoundingBox bbox; - patch->getBBox(bbox); - bbox.transform(_actions->getMatrix()); - _actions->embed(bbox); - } - previousPatch = patch; - } -} - - -struct PatchVertex { - DPair point; - Color color; -}; - - -void PsSpecialHandler::processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator &it) { - int verticesPerRow = static_cast(*it++); - if (verticesPerRow < 2) - return; - - // hold two adjacent rows of vertices and colors - vector row1(verticesPerRow); - vector row2(verticesPerRow); - vector *rowptr1 = &row1; - vector *rowptr2 = &row2; - // read data of first row - for (int i=0; i < verticesPerRow; i++) { - PatchVertex &vertex = (*rowptr1)[i]; - vertex.point.x(*it++); - vertex.point.y(*it++); - vertex.color.set(colorSpace, it); - } - LatticeTriangularPatch patch(colorSpace); - ShadingCallback callback(_actions, _xmlnode, _clipStack.topID()); - while (it.valid()) { - // read next row - for (int i=0; i < verticesPerRow; i++) { - PatchVertex &vertex = (*rowptr2)[i]; - vertex.point.x(*it++); - vertex.point.y(*it++); - vertex.color.set(colorSpace, it); - } - // create triangular patches for the vertices of the two rows - for (int i=0; i < verticesPerRow-1; i++) { - const PatchVertex &v1 = (*rowptr1)[i], &v2 = (*rowptr1)[i+1]; - const PatchVertex &v3 = (*rowptr2)[i], &v4 = (*rowptr2)[i+1]; - patch.setPoints(v1.point, v2.point, v3.point); - patch.setColors(v1.color, v2.color, v3.color); - patch.approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); - - patch.setPoints(v2.point, v3.point, v4.point); - patch.setColors(v2.color, v3.color, v4.color); - patch.approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); - } - swap(rowptr1, rowptr2); - } -} - - -/** Clears current path */ -void PsSpecialHandler::newpath (vector &p) { - bool drawing = (p[0] > 0); - if (!drawing || !_clipStack.clippathLoaded()) { - _path.clear(); - _clipStack.setClippathLoaded(false); - } -} - - -void PsSpecialHandler::setmatrix (vector &p) { - if (_actions) { - Matrix m; - create_matrix(p, 0, m); - _actions->setMatrix(m); - } -} - - -// In contrast to SVG, PostScript transformations are applied in -// reverse order (M' = T*M). Thus, the transformation matrices must be -// left-multiplied in the following methods scale(), translate() and rotate(). - - -void PsSpecialHandler::scale (vector &p) { - if (_actions) { - Matrix m = _actions->getMatrix(); - ScalingMatrix s(p[0], p[1]); - m.lmultiply(s); - _actions->setMatrix(m); - } -} - - -void PsSpecialHandler::translate (vector &p) { - if (_actions) { - Matrix m = _actions->getMatrix(); - TranslationMatrix t(p[0], p[1]); - m.lmultiply(t); - _actions->setMatrix(m); - } -} - - -void PsSpecialHandler::rotate (vector &p) { - if (_actions) { - Matrix m = _actions->getMatrix(); - RotationMatrix r(p[0]); - m.lmultiply(r); - _actions->setMatrix(m); - } -} - - -void PsSpecialHandler::setgray (vector &p) { - _pattern = 0; - _currentcolor.setGray(p[0]); - if (_actions) - _actions->setColor(_currentcolor); -} - - -void PsSpecialHandler::setrgbcolor (vector &p) { - _pattern= 0; - _currentcolor.setRGB(p[0], p[1], p[2]); - if (_actions) - _actions->setColor(_currentcolor); -} - - -void PsSpecialHandler::setcmykcolor (vector &p) { - _pattern = 0; - _currentcolor.setCMYK(p[0], p[1], p[2], p[3]); - if (_actions) - _actions->setColor(_currentcolor); -} - - -void PsSpecialHandler::sethsbcolor (vector &p) { - _pattern = 0; - _currentcolor.setHSB(p[0], p[1], p[2]); - if (_actions) - _actions->setColor(_currentcolor); -} - - -/** Sets the dash parameters used for stroking. - * @param[in] p dash pattern array m1,...,mn plus trailing dash offset */ -void PsSpecialHandler::setdash (vector &p) { - _dashpattern.clear(); - for (size_t i=0; i < p.size()-1; i++) - _dashpattern.push_back(scale(p[i])); - _dashoffset = scale(p.back()); -} - - -/** This method is called by the PSInterpreter if an PS operator has been executed. */ -void PsSpecialHandler::executed () { - if (_actions) - _actions->progress("ps"); -} - -//////////////////////////////////////////// - -void PsSpecialHandler::ClippingStack::pushEmptyPath () { - if (!_stack.empty()) - _stack.push(Entry(0, -1)); -} - - -void PsSpecialHandler::ClippingStack::push (const Path &path, int saveID) { - if (path.empty()) - _stack.push(Entry(0, saveID)); - else { - _paths.push_back(path); - _stack.push(Entry(_paths.size(), saveID)); - } -} - - -/** Pops a single or several elements from the clipping stack. - * The method distingushes between the following cases: - * 1) saveID < 0 and grestoreall == false: - * pop top element if it was pushed by gsave (its saveID is < 0 as well) - * 2) saveID < 0 and grestoreall == true - * repeat popping until stack is empty or the top element was pushed - * by save (its saveID is >= 0) - * 3) saveID >= 0: - * pop all elements until the saveID of the top element equals parameter saveID */ -void PsSpecialHandler::ClippingStack::pop (int saveID, bool grestoreall) { - if (!_stack.empty()) { - if (saveID < 0) { // grestore? - if (_stack.top().saveID < 0) // pushed by 'gsave'? - _stack.pop(); - // pop all further elements pushed by 'gsave' if grestoreall == true - while (grestoreall && !_stack.empty() && _stack.top().saveID < 0) - _stack.pop(); - } - else { - // pop elements pushed by 'gsave' - while (!_stack.empty() && _stack.top().saveID != saveID) - _stack.pop(); - // pop element pushed by 'save' - if (!_stack.empty()) - _stack.pop(); - } - } -} - - -/** Returns a pointer to the path on top of the stack, or 0 if the stack is empty. */ -const PsSpecialHandler::Path* PsSpecialHandler::ClippingStack::top () const { - return (!_stack.empty() && _stack.top().pathID) - ? &_paths[_stack.top().pathID-1] - : 0; -} - - -PsSpecialHandler::Path* PsSpecialHandler::ClippingStack::getPath (size_t id) { - return (id > 0 && id <= _paths.size()) ? &_paths[id-1] : 0; -} - - -/** Returns true if the clipping path was loaded into the graphics path (via PS operator 'clippath') */ -bool PsSpecialHandler::ClippingStack::clippathLoaded () const { - return !_stack.empty() && _stack.top().cpathLoaded; -} - - -void PsSpecialHandler::ClippingStack::setClippathLoaded (bool loaded) { - if (_stack.empty()) - return; - _stack.top().cpathLoaded = loaded; -} - - -/** Pops all elements from the stack. */ -void PsSpecialHandler::ClippingStack::clear() { - _paths.clear(); - while (!_stack.empty()) - _stack.pop(); -} - - -/** Replaces the top element by a new one. - * @param[in] path new path to be on top of the stack */ -void PsSpecialHandler::ClippingStack::replace (const Path &path) { - if (_stack.empty()) - push(path, -1); - else { - _paths.push_back(path); - _stack.top().pathID = _paths.size(); - } -} - - -/** Duplicates the top element, i.e. the top element is pushed again. */ -void PsSpecialHandler::ClippingStack::dup (int saveID) { - _stack.push(_stack.empty() ? Entry(0, -1) : _stack.top()); - _stack.top().saveID = saveID; -} - - -const char** PsSpecialHandler::prefixes () const { - static const char *pfx[] = {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.h deleted file mode 100644 index 38c04c50afa..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/PsSpecialHandler.h +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* -** PsSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_PSSPECIALHANDLER_H -#define DVISVGM_PSSPECIALHANDLER_H - -#include -#include -#include -#include -#include "GraphicPath.h" -#include "PSInterpreter.h" -#include "SpecialHandler.h" -#include "PSPattern.h" -#include "PSPreviewFilter.h" - - -class PSPattern; -class XMLElementNode; - -class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, protected PSActions -{ - typedef GraphicPath Path; - typedef std::vector::const_iterator DoubleVecIt; - typedef Color::ColorSpace ColorSpace; - - class ClippingStack - { - public: - void pushEmptyPath (); - void push (const Path &path, int saveID=-1); - void replace (const Path &path); - void dup (int saveID=-1); - void pop (int saveID=-1, bool grestore=false); - void clear (); - bool empty () const {return _stack.empty();} - bool clippathLoaded () const; - void setClippathLoaded (bool loaded); - const Path* top () const; - Path* getPath (size_t id); - int topID () const {return _stack.empty() ? 0 : _stack.top().pathID;} - - private: - struct Entry { - int pathID; ///< index referencing a path of the pool - int saveID; ///< if >=0, path was pushed by 'save', and saveID holds the ID of the - bool cpathLoaded; ///< true if clipping path was loaded into current path - Entry (int pid, int sid) : pathID(pid), saveID(sid), cpathLoaded(false) {} - }; - std::vector _paths; ///< pool of all clipping paths - std::stack _stack; - }; - - enum PsSection {PS_NONE, PS_HEADERS, PS_BODY}; - - public: - PsSpecialHandler (); - ~PsSpecialHandler (); - const char* name () const {return "ps";} - const char* info () const {return "dvips PostScript specials";} - const char** prefixes () const; - void preprocess (const char *prefix, std::istream &is, SpecialActions *actions); - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - void setDviScaleFactor (double dvi2bp) {_previewFilter.setDviScaleFactor(dvi2bp);} - void enterBodySection (); - - public: - static bool COMPUTE_CLIPPATHS_INTERSECTIONS; - static bool SHADING_SEGMENT_OVERLAP; - static int SHADING_SEGMENT_SIZE; - static double SHADING_SIMPLIFY_DELTA; - - protected: - void initialize (); - void moveToDVIPos (); - void executeAndSync (std::istream &is, bool updatePos); - void processHeaderFile (const char *fname); - void psfile (const std::string &fname, const std::map &attr); - void dviEndPage (unsigned pageno); - void clip (Path &path, bool evenodd); - void processSequentialPatchMesh (int shadingTypeID, ColorSpace cspace, VectorIterator &it); - void processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator &it); - - /// scale given value by current PS scale factors - double scale (double v) const {return v*(_sx*_cos*_cos + _sy*(1-_cos*_cos));} - - void applyscalevals (std::vector &p) {_sx = p[0]; _sy = p[1]; _cos = p[2];} - void clip (std::vector &p) {clip(p, false);} - void clip (std::vector &p, bool evenodd); - void clippath (std::vector &p); - void closepath (std::vector &p); - void curveto (std::vector &p); - void eoclip (std::vector &p) {clip(p, true);} - void eofill (std::vector &p) {fill(p, true);} - void fill (std::vector &p, bool evenodd); - void fill (std::vector &p) {fill(p, false);} - void grestore (std::vector &p); - void grestoreall (std::vector &p); - void gsave (std::vector &p); - void initclip (std::vector &p); - void lineto (std::vector &p); - void makepattern (std::vector &p); - void moveto (std::vector &p); - void newpath (std::vector &p); - void querypos (std::vector &p) {_currentpoint = DPair(p[0], p[1]);} - void restore (std::vector &p); - void rotate (std::vector &p); - void save (std::vector &p); - void scale (std::vector &p); - void setcmykcolor (std::vector &cmyk); - void setdash (std::vector &p); - void setgray (std::vector &p); - void sethsbcolor (std::vector &hsb); - void setlinecap (std::vector &p) {_linecap = UInt8(p[0]);} - void setlinejoin (std::vector &p) {_linejoin = UInt8(p[0]);} - void setlinewidth (std::vector &p) {_linewidth = p[0] ? scale(p[0])*1.00375 : 0.5;} - void setmatrix (std::vector &p); - void setmiterlimit (std::vector &p) {_miterlimit = p[0]*1.00375;} - void setopacityalpha (std::vector &p){_opacityalpha = p[0];} - void setpattern (std::vector &p); - void setrgbcolor (std::vector &rgb); - void shfill (std::vector &p); - void stroke (std::vector &p); - void translate (std::vector &p); - void executed (); - - private: - PSInterpreter _psi; - SpecialActions *_actions; - PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package - PsSection _psSection; ///< current section processed (nothing yet, headers, or body specials) - XMLElementNode *_xmlnode; ///< if != 0, created SVG elements are appended to this node - XMLElementNode *_savenode; ///< pointer to temporaryly store _xmlnode - std::string _headerCode; ///< collected literal PS header code - Path _path; - DPair _currentpoint; ///< current PS position in bp units - Color _currentcolor; ///< current stroke/fill color - double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" - double _cos; ///< cosine of angle between (1,0) and transform(1,0) - double _linewidth; ///< current linewidth - double _miterlimit; ///< current miter limit - double _opacityalpha; ///< opacity level (0=fully transparent, ..., 1=opaque) - UInt8 _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) - UInt8 _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) - double _dashoffset; ///< current dash offset - std::vector _dashpattern; - ClippingStack _clipStack; - std::map _patterns; - PSTilingPattern *_pattern; ///< current pattern -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.cpp deleted file mode 100644 index ba9a9463b70..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/************************************************************************* -** RangeMap.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include "RangeMap.h" - -using namespace std; - - -/** Tries to merge range r into this one. This is only possible if the ranges - * touch or overlap and if the assigned values match at the junction points. - * @param[in] r range to join - * @return true if join was successful */ -bool RangeMap::Range::join (const Range &r) { - // check most common cases first - if (_max+1 < r._min || _min-1 > r._max) // disjoint ranges? - return false; - if (r._min-1 == _max) { // does r touch *this on the right? - if (valueAt(r._min) == r._minval) { - _max = r._max; - return true; - } - return false; - } - if (r._max+1 == _min) { // does r touch *this on the left - if (r.valueAt(_min) == _minval) { - setMinAndAdaptValue(r._min); - return true; - } - return false; - } - // the following cases should be pretty rare - if (r._min <= _min && r._max >= _max) { // does r overlap *this on both sides? - *this = r; - return true; - } - if (r._min < _min) { // left overlap only? - if (r.valueAt(_min) == _minval) { - _min = r._min; - _minval = r._minval; - return true; - } - return false; - } - if (r._max > _max) { // right overlap only? - if (valueAt(r._min) == r._minval) { - _max = r._max; - return true; - } - return false; - } - // r completely inside *this - return valueAt(r._min) == r._minval; -} - - -/** Adds a new number range. The range describes a mapping from c to v(c), where - * \f$c \in [cmin,cmax]\f$ and \f$v(cmin):=vmin, v(c):=vmin+c-cmin\f$. - * @param[in] cmin smallest number in the range - * @param[in] cmax largest number in the range - * @param[in] vmin map value of cmin */ -void RangeMap::addRange (UInt32 cmin, UInt32 cmax, UInt32 vmin) { - if (cmin > cmax) - swap(cmin, cmax); - - Range range(cmin, cmax, vmin); - if (_ranges.empty()) - _ranges.push_back(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.push_back(range); - } - else if (cmax < lrange.min()) { // non-overlapping range at begin of vector? - if (!lrange.join(range)) - _ranges.insert(_ranges.begin(), range); - } - else { - // ranges overlap and/or must be inserted somewhere inside the vector - Ranges::iterator it = lower_bound(_ranges.begin(), _ranges.end(), range); - const bool at_end = (it == _ranges.end()); - if (at_end) - --it; - if (!it->join(range) && (it == _ranges.begin() || !(it-1)->join(range))) { - if (it->min() < cmin && it->max() > cmax) { // new range completely inside an existing range? - //split existing range - UInt32 itmax = it->max(); - it->max(cmin-1); - it = _ranges.insert(it+1, Range(cmax+1, itmax, it->valueAt(cmax+1))); - } - else if (at_end) // does new range overlap right side of last range in vector? - it = _ranges.end(); // => append new range at end of vector - it = _ranges.insert(it, range); - } - adaptNeighbors(it); // resolve overlaps - } - } -} - - -/** Adapts the left and right neighbor elements of a newly inserted range. - * The new range could overlap ranges in the neighborhood so that those must be - * adapted or removed. All ranges in the range vector are ordered ascendingly, i.e. - * [min_1, max_1],...,[min_n, max_n] where min_i < min_j for all i < j. - * @param[in] it pointer to the newly inserted range */ -void RangeMap::adaptNeighbors (Ranges::iterator it) { - if (it != _ranges.end()) { - // adapt left neighbor - Ranges::iterator lit = it-1; // points to left neighbor - if (it != _ranges.begin() && it->min() <= lit->max()) { - bool left_neighbor_valid = (it->min() > 0 && it->min()-1 >= lit->min()); - if (left_neighbor_valid) // is adapted left neighbor valid? - lit->max(it->min()-1); // => assign new max value - if (!left_neighbor_valid || it->join(*lit)) - it = _ranges.erase(lit); - } - // remove right neighbors completely overlapped by *it - Ranges::iterator rit = it+1; // points to right neighbor - while (rit != _ranges.end() && it->max() >= rit->max()) { // complete overlap? - _ranges.erase(rit); - rit = it+1; - } - // adapt rightmost range partially overlapped by *it - if (rit != _ranges.end()) { - if (it->max() >= rit->min()) - rit->setMinAndAdaptValue(it->max()+1); - // try to merge right neighbor into *this - if (it->join(*rit)) - _ranges.erase(rit); // remove merged neighbor - } - } -} - - -/** Finds the index of the range that contains a given value c. - * @param[in] c find range that contains this value - * @return index of the range found, or -1 if range was not found */ -int RangeMap::lookup (UInt32 c) const { - // simple binary search - int left=0, right=_ranges.size()-1; - while (left <= right) { - int mid = (left+right)/2; - if (c < _ranges[mid].min()) - right = mid-1; - else if (c > _ranges[mid].max()) - left = mid+1; - else - return mid; - } - return -1; -} - - -UInt32 RangeMap::valueAt (UInt32 c) const { - int pos = lookup(c); - return pos < 0 ? 0 : _ranges[pos].valueAt(c); -} - - -ostream& RangeMap::Range::write (ostream& os) const { - return os << '[' << _min << ',' << _max << "] => " << _minval; -} - - -ostream& RangeMap::write (ostream& os) const { - for (size_t i=0; i < _ranges.size(); i++) - _ranges[i].write(os) << '\n'; - return os; -} \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.h deleted file mode 100644 index a1d2f139070..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/RangeMap.h +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* -** RangeMap.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_RANGEMAP_H -#define DVISVGM_RANGEMAP_H - -#include -#include -#include -#include "types.h" - - -class RangeMap { - class Range - { - friend class RangeMap; - - public: - Range () : _min(0), _max(0), _minval(0) {} - - Range (UInt32 min, UInt32 max, UInt32 minval) : _min(min), _max(max), _minval(minval) { - if (_min > _max) - std::swap(_min, _max); - } - - UInt32 min () const {return _min;} - UInt32 max () const {return _max;} - UInt32 minval () const {return _minval;} - UInt32 maxval () const {return valueAt(_max);} - UInt32 valueAt (UInt32 c) const {return c-_min+_minval;} - bool operator < (const Range &r) const {return _min < r._min;} - std::ostream& write (std::ostream &os) const; - - protected: - void min (UInt32 m) {_min = m;} - void max (UInt32 m) {_max = m;} - void setMinAndAdaptValue (UInt32 c) {_minval = valueAt(c); _min = c;} - bool join (const Range &r); - - private: - UInt32 _min, _max; - UInt32 _minval; - }; - - typedef std::vector Ranges; - - public: - void addRange (UInt32 first, UInt32 last, UInt32 cid); - bool valueExists (UInt32 c) const {return lookup(c) >= 0;} - UInt32 valueAt (UInt32 c) const; - size_t size () const {return _ranges.size();} - bool empty () const {return _ranges.empty();} - void clear () {_ranges.clear();} - std::ostream& write (std::ostream &os) const; - - protected: - void adaptNeighbors (Ranges::iterator it); - int lookup (UInt32 c) const; - const Range& rangeAt (size_t n) const {return _ranges[n];} - - private: - Ranges _ranges; -}; - - -inline std::ostream& operator << (std::ostream& os, const RangeMap &rangemap) { - return rangemap.write(os); -} - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.cpp deleted file mode 100644 index 26621d49303..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* -** SVGOutput.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "gzstream.h" -#include "Calculator.h" -#include "FileSystem.h" -#include "Message.h" -#include "SVGOutput.h" - - -using namespace std; - -SVGOutput::SVGOutput (const char *base, string pattern, int zipLevel) - : _path(base ? base : ""), - _pattern(pattern), - _stdout(base == 0), - _zipLevel(zipLevel), - _page(-1), - _os(0) -{ -} - - -/** Returns an output stream for the given page. - * @param[in] page number of current page - * @param[in] numPages total number of pages in the DVI file - * @return output stream for the given page */ -ostream& SVGOutput::getPageStream (int page, int numPages) const { - string fname = filename(page, numPages); - if (fname.empty()) { - delete _os; - _os = 0; - return cout; - } - if (page == _page) - return *_os; - - _page = page; - delete _os; - if (_zipLevel > 0) - _os = new ogzstream(fname.c_str(), _zipLevel); - else - _os = new ofstream(fname.c_str()); - if (!_os || !*_os) { - delete _os; - _os = 0; - throw MessageException("can't open file "+fname+" for writing"); - } - return *_os; -} - - -/** Returns the name of the SVG file containing the given page. - * @param[in] page number of current page - * @param[in] numPages total number of pages */ -string SVGOutput::filename (int page, int numPages) const { - if (_stdout) - return ""; - string pattern = _pattern; - expandFormatString(pattern, page, numPages); - // remove leading and trailing whitespace - stringstream trim; - trim << pattern; - pattern.clear(); - trim >> pattern; - // set and expand default pattern if necessary - if (pattern.empty()) { - pattern = numPages > 1 ? "%f-%p" : "%f"; - expandFormatString(pattern, page, numPages); - } - // append suffix if necessary - FilePath outpath(pattern, true); - if (outpath.suffix().empty()) - outpath.suffix(_zipLevel > 0 ? "svgz" : "svg"); - string abspath = outpath.absolute(); - string relpath = outpath.relative(); - return abspath.length() < relpath.length() ? abspath : relpath; -} - - -static int ilog10 (int n) { - int result = 0; - while (n >= 10) { - result++; - n /= 10; - } - return result; -} - - -/** Replace expressions in a given string by the corresponing values. - * Supported constructs: - * %f: basename of the current file (filename without suffix) - * %[0-9]?p: current page number - * %[0-9]?P: number of pages in DVI file - * %[0-9]?(expr): arithmetic expression */ -void SVGOutput::expandFormatString (string &str, int page, int numPages) const { - string result; - while (!str.empty()) { - size_t pos = str.find('%'); - if (pos == string::npos) { - result += str; - str.clear(); - } - else { - result += str.substr(0, pos); - str = str.substr(pos); - pos = 1; - ostringstream oss; - if (isdigit(str[pos])) { - oss << setw(str[pos]-'0') << setfill('0'); - pos++; - } - else { - oss << setw(ilog10(numPages)+1) << setfill('0'); - } - switch (str[pos]) { - case 'f': - result += _path.basename(); - break; - case 'p': - case 'P': - oss << (str[pos] == 'p' ? page : numPages); - result += oss.str(); - break; - case '(': { - size_t endpos = str.find(')', pos); - if (endpos == string::npos) - throw MessageException("missing ')' in filename pattern"); - else if (endpos-pos-1 > 1) { - try { - Calculator calculator; - calculator.setVariable("p", page); - calculator.setVariable("P", numPages); - oss << floor(calculator.eval(str.substr(pos, endpos-pos+1))); - result += oss.str(); - } - catch (CalculatorException &e) { - oss.str(""); - oss << "error in filename pattern (" << e.what() << ")"; - throw MessageException(oss.str()); - } - pos = endpos; - } - break; - } - } - str = str.substr(pos+1); - } - } - str = result; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.h deleted file mode 100644 index b696a32b8f8..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGOutput.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* -** SVGOutput.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SVGOUTPUT_H -#define DVISVGM_SVGOUTPUT_H - -#include -#include -#include "FilePath.h" - - -struct SVGOutputBase { - virtual ~SVGOutputBase () {} - virtual std::ostream& getPageStream (int page, int numPages) const =0; - virtual std::string filename (int page, int numPages) const =0; -}; - - -class SVGOutput : public SVGOutputBase -{ - public: - SVGOutput (const char *base=0, std::string pattern="", int zipLevel=0); - ~SVGOutput () {delete _os;} - std::ostream& getPageStream (int page, int numPages) const; - std::string filename (int page, int numPages) const; - - protected: - void expandFormatString (std::string &str, int page, int numPages) const; - - private: - FilePath _path; - std::string _pattern; - bool _stdout; ///< write to STDOUT? - int _zipLevel; ///< compression level - mutable int _page; ///< number of current page being written - mutable std::ostream *_os; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.cpp deleted file mode 100644 index 32a4e1cfe6a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/************************************************************************* -** SVGTree.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "BoundingBox.h" -#include "DependencyGraph.h" -#include "DVIToSVG.h" -#include "Font.h" -#include "FontManager.h" -#include "SVGTree.h" -#include "XMLDocument.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -// static class variables -bool SVGTree::CREATE_STYLE=true; -bool SVGTree::USE_FONTS=true; -bool SVGTree::CREATE_USE_ELEMENTS=false; -bool SVGTree::RELATIVE_PATH_CMDS=false; -bool SVGTree::MERGE_CHARS=true; -double SVGTree::ZOOM_FACTOR=1.0; - - -SVGTree::SVGTree () : _vertical(false), _font(0), _color(Color::BLACK), _matrix(1) { - _xchanged = _ychanged = false; - _fontnum = 0; - reset(); -} - - -/** Clears the SVG tree and initializes the root element. */ -void SVGTree::reset () { - _doc.clear(); - _root = new XMLElementNode("svg"); - _root->addAttribute("version", "1.1"); - _root->addAttribute("xmlns", "http://www.w3.org/2000/svg"); - _root->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); - _doc.setRootNode(_root); - _page = _text = _span = _defs = 0; -} - - -/** Sets the bounding box of the document. - * @param[in] bbox bounding box in PS point units */ -void SVGTree::setBBox (const BoundingBox &bbox) { - if (ZOOM_FACTOR >= 0) { - _root->addAttribute("width", XMLString(bbox.width()*ZOOM_FACTOR)+"pt"); - _root->addAttribute("height", XMLString(bbox.height()*ZOOM_FACTOR)+"pt"); - } - _root->addAttribute("viewBox", bbox.toSVGViewBox()); -} - - -void SVGTree::setColor (const Color &c) { - if (!_font.get() || _font.get()->color() == Color::BLACK) - _color.set(c); -} - - -void SVGTree::setFont (int num, const Font *font) { - _font.set(font); - _fontnum = num; - // set default color assigned to the font - if (font->color() != Color::BLACK && _color.get() != font->color()) - _color.set(font->color()); -} - - -/** Starts a new page. - * @param[in] pageno number of new page */ -void SVGTree::newPage (int pageno) { - _page = new XMLElementNode("g"); - if (pageno >= 0) - _page->addAttribute("id", string("page")+XMLString(pageno)); - _root->append(_page); - _text = _span = 0; - while (!_pageContainerStack.empty()) - _pageContainerStack.pop(); -} - - -void SVGTree::appendToDefs (XMLNode *node) { - if (!_defs) { - _defs = new XMLElementNode("defs"); - _root->prepend(_defs); - } - _defs->append(node); -} - - -void SVGTree::appendToPage (XMLNode *node) { - if (_pageContainerStack.empty()) - _page->append(node); - else - _pageContainerStack.top()->append(node); - if (node != _text) // if the appended node differ from text element currently in use, - _text = 0; // then force creating a new text element for the following characters -} - - -void SVGTree::prependToPage (XMLNode *node) { - if (_pageContainerStack.empty()) - _page->prepend(node); - else - _pageContainerStack.top()->prepend(node); -} - - -/** Appends a single charater to the current text node. If necessary, and depending on output mode - * and further output states, new XML elements (text, tspan, g, ...) are created. - * @param[in] c character to be added - * @param[in] x x coordinate - * @param[in] y y coordinate - * @param[in] font font to be used */ -void SVGTree::appendChar (int c, double x, double y, const Font &font) { - XMLElementNode *node=_span; - if (USE_FONTS) { - // changes of fonts and transformations require a new text element - if (!MERGE_CHARS || !_text || _font.changed() || _matrix.changed() || _vertical.changed()) { - newTextNode(x, y); - node = _text; - _color.changed(true); - } - if (MERGE_CHARS && (_xchanged || _ychanged || (_color.changed() && _color.get() != Color::BLACK))) { - // if drawing position was explicitly changed, create a new tspan element - _span = new XMLElementNode("tspan"); - if (_xchanged) { - if (_vertical) { - // align glyphs designed for horizontal layout properly - if (const PhysicalFont *pf = dynamic_cast(_font.get())) - if (!pf->getMetrics()->verticalLayout()) - x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset - } - _span->addAttribute("x", x); - _xchanged = false; - } - if (_ychanged) { - _span->addAttribute("y", y); - _ychanged = false; - } - if (_color.get() != font.color()) { - _span->addAttribute("fill", _color.get().rgbString()); - _color.changed(false); - } - _text->append(_span); - node = _span; - } - if (!node) { - if (!_text) - newTextNode(x, y); - node = _text; - } - node->append(XMLString(font.unicode(c), false)); - if (!MERGE_CHARS && _color.get() != font.color()) { - node->addAttribute("fill", _color.get().rgbString()); - _color.changed(false); - } - } - else { - if (_color.changed() || _matrix.changed()) { - bool set_color = (_color.changed() && _color.get() != Color::BLACK); - bool set_matrix = (_matrix.changed() && !_matrix.get().isIdentity()); - if (set_color || set_matrix) { - _span = new XMLElementNode("g"); - if (_color.get() != Color::BLACK) - _span->addAttribute("fill", _color.get().rgbString()); - if (!_matrix.get().isIdentity()) - _span->addAttribute("transform", _matrix.get().getSVG()); - appendToPage(_span); - node = _span; - _color.changed(false); - _matrix.changed(false); - } - else if (_color.get() == Color::BLACK && _matrix.get().isIdentity()) - node = _span = 0; - } - if (!node) - node = _pageContainerStack.empty() ? _page : _pageContainerStack.top(); - if (font.verticalLayout()) { - // move glyph graphics so that its origin is located at the top center position - GlyphMetrics metrics; - font.getGlyphMetrics(c, _vertical, metrics); - x -= metrics.wl; - if (const PhysicalFont *pf = dynamic_cast(&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); - y += exact_metrics.h+(metrics.d-exact_metrics.h-exact_metrics.d)/2; - } - else - y += metrics.d; - } - Matrix rotation(1); - if (_vertical && !font.verticalLayout()) { - // alphabetic text designed for horizontal mode - // must be rotated by 90 degrees if in vertical mode - rotation.translate(-x, -y); - rotation.rotate(90); - rotation.translate(x, y); - } - if (CREATE_USE_ELEMENTS) { - ostringstream oss; - oss << "#g" << FontManager::instance().fontID(_font) << '-' << c; - XMLElementNode *use = new XMLElementNode("use"); - use->addAttribute("x", XMLString(x)); - use->addAttribute("y", XMLString(y)); - use->addAttribute("xlink:href", oss.str()); - if (!rotation.isIdentity()) - use->addAttribute("transform", rotation.getSVG()); - node->append(use); - } - else { - Glyph glyph; - const PhysicalFont *pf = dynamic_cast(&font); - if (pf && pf->getGlyph(c, glyph)) { - double sx = pf->scaledSize()/pf->unitsPerEm(); - double sy = -sx; - ostringstream oss; - glyph.writeSVG(oss, RELATIVE_PATH_CMDS, sx, sy, x, y); - XMLElementNode *glyph_node = new XMLElementNode("path"); - glyph_node->addAttribute("d", oss.str()); - if (!rotation.isIdentity()) - glyph_node->addAttribute("transform", rotation.getSVG()); - node->append(glyph_node); - } - } - } -} - - -/** Creates a new text element. This is a helper function used by appendChar(). - * @param[in] x current x coordinate - * @param[in] y current y coordinate */ -void SVGTree::newTextNode (double x, double y) { - _text = new XMLElementNode("text"); - _span = 0; // no tspan in text element yet - if (USE_FONTS) { - const Font *font = _font.get(); - if (CREATE_STYLE || !font) - _text->addAttribute("class", string("f")+XMLString(_fontnum)); - else { - _text->addAttribute("font-family", font->name()); - _text->addAttribute("font-size", XMLString(font->scaledSize())); - if (font->color() != Color::BLACK) - _text->addAttribute("fill", font->color().rgbString()); - } - if (_vertical) { - _text->addAttribute("writing-mode", "tb"); - // align glyphs designed for horizontal layout properly - if (const PhysicalFont *pf = dynamic_cast(_font.get())) - if (!pf->getMetrics()->verticalLayout()) { // alphabetic text designed for horizontal layout? - x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset - _text->addAttribute("glyph-orientation-vertical", 90); // ensure rotation - } - } - } - _text->addAttribute("x", x); - _text->addAttribute("y", y); - if (!_matrix.get().isIdentity()) - _text->addAttribute("transform", _matrix.get().getSVG()); - appendToPage(_text); - _vertical.changed(false); - _font.changed(false); - _matrix.changed(false); - _xchanged = false; - _ychanged = false; -} - - -void SVGTree::transformPage (const Matrix *usermatrix) { - if (usermatrix && !usermatrix->isIdentity()) - _page->addAttribute("transform", usermatrix->getSVG()); -} - - -/** Creates an SVG element for a single glyph. - * @param[in] c character number - * @param[in] font font to extract the glyph from - * @param[in] cb pointer to callback object for sending feedback to the glyph tracer (may be 0) - * @return pointer to element node if glyph exists, 0 otherwise */ -static XMLElementNode* createGlyphNode (int c, const PhysicalFont &font, GFGlyphTracer::Callback *cb) { - Glyph glyph; - if (!font.getGlyph(c, glyph, cb) || (!SVGTree::USE_FONTS && !SVGTree::CREATE_USE_ELEMENTS)) - return 0; - - double sx=1.0, sy=1.0; - double upem = font.unitsPerEm(); - XMLElementNode *glyph_node=0; - if (SVGTree::USE_FONTS) { - double extend = font.style() ? font.style()->extend : 1; - glyph_node = new XMLElementNode("glyph"); - glyph_node->addAttribute("unicode", XMLString(font.unicode(c), false)); - glyph_node->addAttribute("horiz-adv-x", XMLString(font.hAdvance(c)*extend)); - glyph_node->addAttribute("vert-adv-y", XMLString(font.vAdvance(c))); - string name = font.glyphName(c); - if (!name.empty()) - glyph_node->addAttribute("glyph-name", name); - } - else { - ostringstream oss; - oss << 'g' << FontManager::instance().fontID(&font) << '-' << c; - glyph_node = new XMLElementNode("path"); - glyph_node->addAttribute("id", oss.str()); - sx = font.scaledSize()/upem; - sy = -sx; - } - ostringstream oss; - glyph.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS, sx, sy); - glyph_node->addAttribute("d", oss.str()); - return glyph_node; -} - - -void SVGTree::appendFontStyles (const set &fonts) { - if (CREATE_STYLE && USE_FONTS && !fonts.empty() && _defs) { - XMLElementNode *styleNode = new XMLElementNode("style"); - styleNode->addAttribute("type", "text/css"); - _root->insertAfter(styleNode, _defs); - typedef map SortMap; - SortMap sortmap; - FORALL(fonts, set::const_iterator, it) - if (!dynamic_cast(*it)) // skip virtual fonts - sortmap[FontManager::instance().fontID(*it)] = *it; - ostringstream style; - // add font style definitions in ascending order - FORALL(sortmap, SortMap::const_iterator, it) { - style << "text.f" << it->first << ' ' - << "{font-family:" << it->second->name() - << ";font-size:" << XMLString(it->second->scaledSize()) << "px"; - if (it->second->color() != Color::BLACK) - style << ";fill:" << it->second->color().rgbString(); - style << "}\n"; - } - XMLCDataNode *cdata = new XMLCDataNode(style.str()); - styleNode->append(cdata); - } -} - - -/** Appends glyph definitions of a given font to the defs section of the SVG tree. - * @param[in] font font to be appended - * @param[in] chars codes of the characters whose glyph outlines should be appended - * @param[in] cb pointer to callback object for sending feedback to the glyph tracer (may be 0) */ -void SVGTree::append (const PhysicalFont &font, const set &chars, GFGlyphTracer::Callback *cb) { - if (chars.empty()) - return; - - if (USE_FONTS) { - XMLElementNode *fontNode = new XMLElementNode("font"); - string fontname = font.name(); - fontNode->addAttribute("id", fontname); - fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance())); - appendToDefs(fontNode); - - XMLElementNode *faceNode = new XMLElementNode("font-face"); - faceNode->addAttribute("font-family", fontname); - faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm())); - if (font.type() != PhysicalFont::MF && !font.verticalLayout()) { - faceNode->addAttribute("ascent", XMLString(font.ascent())); - faceNode->addAttribute("descent", XMLString(font.descent())); - } - fontNode->append(faceNode); - FORALL(chars, set::const_iterator, i) - fontNode->append(createGlyphNode(*i, font, cb)); - } - else if (CREATE_USE_ELEMENTS && &font != font.uniqueFont()) { - // If the same character is used in various sizes, we don't want to embed the complete (lengthy) path - // descriptions multiple times. Because they would only differ by a scale factor, it's better to - // reference the already embedded path together with a transformation attribute and let the SVG renderer - // scale the glyphs properly. This is only necessary if we don't want to use font but path elements. - FORALL(chars, set::const_iterator, it) { - ostringstream oss; - XMLElementNode *use = new XMLElementNode("use"); - oss << 'g' << FontManager::instance().fontID(&font) << '-' << *it; - use->addAttribute("id", oss.str()); - oss.str(""); - oss << "#g" << FontManager::instance().fontID(font.uniqueFont()) << '-' << *it; - use->addAttribute("xlink:href", oss.str()); - double scale = font.scaledSize()/font.uniqueFont()->scaledSize(); - if (scale != 1.0) { - oss.str(""); - oss << "scale(" << scale << ')'; - use->addAttribute("transform", oss.str()); - } - appendToDefs(use); - } - } - else { - FORALL(chars, set::const_iterator, i) - appendToDefs(createGlyphNode(*i, font, cb)); - } -} - - -/** Pushes a new context element that will take all following nodes added to the page. */ -void SVGTree::pushContextElement (XMLElementNode *node) { - if (_pageContainerStack.empty()) - _page->append(node); - else - _pageContainerStack.top()->append(node); - _pageContainerStack.push(node); - _text = _span = 0; // ensure the creation of a new text element for the following characters added -} - - -/** Pops the current context element and restored the previous one. */ -void SVGTree::popContextElement () { - if (!_pageContainerStack.empty()) { - _pageContainerStack.pop(); - _text = _span = 0; // ensure the creation of a new text element for the following characters added - } -} - - -/** Extracts the ID from a local URL reference like url(#abcde) */ -inline string extract_id_from_url (const string &url) { - return url.substr(5, url.length()-6); -} - - -/** Removes elements present in the SVH tree that are not required. - * For now, only clipPath elements are removed. */ -void SVGTree::removeRedundantElements () { - vector clipElements; - if (!_defs || !_defs->getDescendants("clipPath", 0, clipElements)) - return; - - // collect dependencies between clipPath elements in the defs section of the SVG tree - DependencyGraph idTree; - for (vector::iterator it=clipElements.begin(); it != clipElements.end(); ++it) { - if (const char *id = (*it)->getAttributeValue("id")) { - if (const char *url = (*it)->getAttributeValue("clip-path")) - idTree.insert(extract_id_from_url(url), id); - else - idTree.insert(id); - } - } - // collect elements that reference a clipPath (have a clip-path attribute) - vector descendants; - _page->getDescendants(0, "clip-path", descendants); - // remove referenced IDs and their dependencies from the dependency graph - for (vector::iterator it=descendants.begin(); it != descendants.end(); ++it) { - string idref = extract_id_from_url((*it)->getAttributeValue("clip-path")); - idTree.removeDependencyPath(idref); - } - descendants.clear(); - vector ids; - idTree.getKeys(ids); - for (vector::iterator it=ids.begin(); it != ids.end(); ++it) { - XMLElementNode *node = _defs->getFirstDescendant("clipPath", "id", it->c_str()); - _defs->remove(node); - } -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.h deleted file mode 100644 index a8d123a013d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SVGTree.h +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* -** SVGTree.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SVGTREE_H -#define DVISVGM_SVGTREE_H - -#include -#include -#include -#include "Color.h" -#include "GFGlyphTracer.h" -#include "Matrix.h" -#include "XMLDocument.h" -#include "XMLNode.h" - -class BoundingBox; -class Color; -struct Font; -class Matrix; -class PhysicalFont; - -class SVGTree -{ - template - class Property { - public: - Property (const T &v) : _value(v), _changed(false) {} - - void set (const T &v) { - if (v != _value) { - _value = v; - _changed = true; - } - } - - const T& get () const {return _value;} - operator const T& () {return _value;} - bool changed () const {return _changed;} - void changed (bool c) {_changed = c;} - - private: - T _value; - bool _changed; - }; - - public: - SVGTree (); - void reset (); - void write (std::ostream &os) const {_doc.write(os);} - void newPage (int pageno); - void appendToDefs (XMLNode *node); - void appendToPage (XMLNode *node); - void prependToPage (XMLNode *node); - void appendToDoc (XMLNode *node) {_doc.append(node);} - void appendToRoot (XMLNode *node) {_root->append(node);} - void appendChar (int c, double x, double y, const Font &font); - void appendFontStyles (const std::set &fonts); - void append (const PhysicalFont &font, const std::set &chars, GFGlyphTracer::Callback *cb=0); - void pushContextElement (XMLElementNode *node); - void popContextElement (); - void removeRedundantElements (); - void setBBox (const BoundingBox &bbox); - void setFont (int id, const Font *font); - void setX (double x) {_xchanged = true;} - void setY (double y) {_ychanged = true;} - void setMatrix (const Matrix &m) {_matrix.set(m);} - void setColor (const Color &c); - void setVertical (bool state) {_vertical.set(state);} - void transformPage (const Matrix *m); - const Color& getColor () const {return _color.get();} - const Matrix& getMatrix () const {return _matrix.get();} - XMLElementNode* rootNode () const {return _root;} - - public: - static bool USE_FONTS; ///< if true, create font references and don't draw paths directly - static bool CREATE_STYLE; ///< use style elements and class attributes to reference fonts? - static bool CREATE_USE_ELEMENTS; ///< allow generation of elements? - static bool RELATIVE_PATH_CMDS; ///< relative path commands rather than absolute ones? - static bool MERGE_CHARS; ///< whether to merge chars with common properties into the same tag - static double ZOOM_FACTOR; ///< factor applied to width/height attribute - - protected: - void newTextNode (double x, double y); - - private: - XMLDocument _doc; - XMLElementNode *_root, *_page, *_text, *_span, *_defs; - bool _xchanged, _ychanged; - Property _vertical; ///< true if in vertical writing mode - Property _font; - Property _color; - Property _matrix; - int _fontnum; - std::stack _pageContainerStack; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.cpp deleted file mode 100644 index 057f67f3f65..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* -** ShadingPatch.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "ShadingPatch.h" -#include "TensorProductPatch.h" -#include "TriangularPatch.h" - -using namespace std; - -/** Get functions to get/set the current color depending on the assigned color space. */ -void ShadingPatch::colorQueryFuncs (ColorGetter &getter, ColorSetter &setter) const { - switch (_colorspace) { - case Color::CMYK_SPACE: - getter = &Color::getCMYK; - setter = &Color::setCMYK; - break; - case Color::LAB_SPACE: - getter = &Color::getLab; - setter = &Color::setLab; - break; - case Color::RGB_SPACE: - getter = &Color::getRGB; - setter = &Color::setRGB; - break; - case Color::GRAY_SPACE: - getter = &Color::getGray; - setter = &Color::setGray; - } -} - - -/** Factory method: Creates a shading patch object depending on the given PostScript shading type. */ -ShadingPatch* ShadingPatch::create (int psShadingType, Color::ColorSpace cspace) { - switch (psShadingType) { - case 4: return new TriangularPatch(cspace); - case 5: return new LatticeTriangularPatch(cspace); - case 6: return new CoonsPatch(cspace); - case 7: return new TensorProductPatch(cspace); - } - ostringstream oss; - if (psShadingType > 0 && psShadingType < 4) - oss << "shading type " << psShadingType << " not supported"; - else - oss << "invalid shading type " << psShadingType; - throw ShadingException(oss.str()); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.h deleted file mode 100644 index 84c44041e5e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ShadingPatch.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* -** ShadingPatch.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SHADINGPATCH_H -#define DVISVGM_SHADINGPATCH_H - -#include "Color.h" -#include "GraphicPath.h" -#include "MessageException.h" - - -class ShadingPatch -{ - public: - struct Callback { - virtual ~Callback () {} - virtual void patchSegment (GraphicPath &path, const Color &color) =0; - }; - - typedef std::vector PointVec; - typedef std::vector ColorVec; - - public: - ShadingPatch (Color::ColorSpace colorSpace) : _colorspace(colorSpace) {} - virtual ~ShadingPatch () {} - virtual int psShadingType () const =0; - virtual void approximate (int gridsize, bool overlap, double delta, Callback &callback) const =0; - virtual void getBBox (BoundingBox &bbox) const =0; - virtual void getBoundaryPath (GraphicPath &path) const =0; - virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) =0; - virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) =0; - virtual int numPoints (int edgeflag) const =0; - virtual int numColors (int edgeflag) const =0; - virtual Color averageColor() const =0; - Color::ColorSpace colorSpace () const {return _colorspace;} - static ShadingPatch* create (int psShadingType, Color::ColorSpace cspace); - - protected: - typedef void (Color::*ColorGetter)(std::valarray &va) const; - typedef void (Color::*ColorSetter)(const std::valarray &va); - void colorQueryFuncs (ColorGetter &getter, ColorSetter &setter) const; - - private: - Color::ColorSpace _colorspace; ///< color space used to compute the shading values -}; - - -struct ShadingException : public MessageException -{ - ShadingException (const std::string &msg) : MessageException(msg) {} -}; - -#endif - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.cpp deleted file mode 100644 index 3af78a66012..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* -** SignalHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "SignalHandler.h" - -using namespace std; - -bool SignalHandler::_break = false; - - -SignalHandler::~SignalHandler() { - stop(); -} - - -/** Returns the singleton handler object. */ -SignalHandler& SignalHandler::instance() { - static SignalHandler handler; - return handler; -} - - -/** Starts listening to CTRL-C signals. - * @return true if handler was activated. */ -bool SignalHandler::start () { - if (!_active) { - _break = false; - if (signal(SIGINT, SignalHandler::callback) != SIG_ERR) { - _active = true; - return true; - } - } - return false; -} - - -/** Stops listening for CTRL-C signals. */ -void SignalHandler::stop () { - if (_active) { - signal(SIGINT, SIG_DFL); - _active = false; - } -} - - -/** Checks for incoming signals and throws an exception if CTRL-C was caught. - * @throw SignalException */ -void SignalHandler::check() { - if (_break) - throw SignalException(); -} - - -void SignalHandler::trigger (bool notify) { - _break = true; - if (notify) - check(); -} - - -/** This function is called on CTRL-C signals. */ -void SignalHandler::callback (int) { - _break = true; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.h deleted file mode 100644 index 25ee5fba118..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SignalHandler.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -** SignalHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SIGNALHANDLER_H -#define DVISVGM_SIGNALHANDLER_H - -#include - -struct SignalException : public std::exception { -}; - - -class SignalHandler -{ - public: - ~SignalHandler (); - static SignalHandler& instance (); - bool start (); - void stop (); - void check (); - void trigger (bool notify); - bool active () const {return _active;} - - protected: - SignalHandler () : _active(false) {} - static void callback (int signal); - - private: - bool _active; ///< true if listening for signals - static bool _break; ///< true if signal has been caught -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialActions.h deleted file mode 100644 index e0f35c78738..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialActions.h +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* -** SpecialActions.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SPECIALACTIONS_H -#define DVISVGM_SPECIALACTIONS_H - -#include -#include "BoundingBox.h" -#include "Color.h" -#include "Matrix.h" - - -struct XMLNode; -class XMLElementNode; - -struct SpecialActions -{ - virtual ~SpecialActions () {} - virtual double getX () const =0; - virtual double getY () const =0; - virtual void setX (double x) =0; - virtual void setY (double y) =0; - virtual void finishLine () =0; - virtual void setColor (const Color &color) =0; - virtual Color getColor () const =0; - virtual void setMatrix (const Matrix &m) =0; - virtual const Matrix& getMatrix () const =0; - virtual void getPageTransform (Matrix &matrix) const =0; - virtual void setBgColor (const Color &color) =0; - virtual void appendToPage (XMLNode *node) =0; - virtual void appendToDefs (XMLNode *node) =0; - virtual void prependToPage (XMLNode *node) =0; - virtual void pushContextElement (XMLElementNode *node) =0; - virtual void popContextElement () =0; - virtual BoundingBox& bbox () =0; - virtual BoundingBox& bbox (const std::string &name, bool reset=false) =0; - virtual void embed (const BoundingBox &bbox) =0; - virtual void embed (const DPair &p, double r=0) =0; - virtual unsigned getCurrentPageNumber () const =0; - virtual std::string getSVGFilename (unsigned pageno) const =0; - virtual void progress (const char *id) {} - virtual int getDVIStackDepth () const {return 0;} - - static double PROGRESSBAR_DELAY; ///< progress bar doesn't appear before this time has elapsed (in sec) -}; - - -class EmptySpecialActions : public SpecialActions -{ - public: - double getX () const {return 0;} - double getY () const {return 0;} - void setX (double x) {} - void setY (double y) {} - void finishLine () {} - void setColor (const Color &color) {} - void setBgColor (const Color &color) {} - Color getColor () const {return Color::BLACK;} - void setMatrix (const Matrix &m) {} - const Matrix& getMatrix () const {return _matrix;} - void getPageTransform (Matrix &matrix) const {} - void appendToPage (XMLNode *node) {} - void appendToDefs (XMLNode *node) {} - void prependToPage (XMLNode *node) {} - void pushContextElement (XMLElementNode *node) {} - void popContextElement () {} - BoundingBox& bbox () {return _bbox;} - BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} - void embed (const BoundingBox &bbox) {} - void embed (const DPair &p, double r=0) {} - unsigned getCurrentPageNumber() const {return 0;} - std::string getSVGFilename (unsigned pageno) const {return "";} - - private: - BoundingBox _bbox; - Matrix _matrix; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialHandler.h deleted file mode 100644 index 1924bf12102..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialHandler.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* -** SpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SPECIALHANDLER_H -#define DVISVGM_SPECIALHANDLER_H - -#include -#include -#include "MessageException.h" - - -struct SpecialActions; -class SpecialManager; - - -struct SpecialException : public MessageException -{ - SpecialException (const std::string &msg) : MessageException(msg) {} -}; - - -struct DVIPreprocessingListener -{ - virtual ~DVIPreprocessingListener () {} - virtual void dviPreprocessingFinished () =0; -}; - - -struct DVIEndPageListener -{ - virtual ~DVIEndPageListener () {} - virtual void dviEndPage (unsigned pageno) =0; -}; - - -struct DVIPositionListener -{ - virtual ~DVIPositionListener () {} - virtual void dviMovedTo (double x, double y) =0; -}; - - -struct SpecialHandler -{ - friend class SpecialManager; - - virtual ~SpecialHandler () {} - virtual const char** prefixes () const=0; - virtual const char* info () const=0; - virtual const char* name () const=0; - virtual void setDviScaleFactor (double dvi2bp) {} - virtual void preprocess (const char *prefix, std::istream &is, SpecialActions *actions) {} - virtual bool process (const char *prefix, std::istream &is, SpecialActions *actions)=0; -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.cpp deleted file mode 100644 index 6699b9ee0c7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************* -** SpecialManager.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "SpecialActions.h" -#include "SpecialHandler.h" -#include "SpecialManager.h" -#include "PsSpecialHandler.h" -#include "macros.h" - -using namespace std; - -double SpecialActions::PROGRESSBAR_DELAY=1000; // initial delay in seconds (values >= 1000 disable the progressbar) - - -SpecialManager::~SpecialManager () { - unregisterHandlers(); -} - - -SpecialManager& SpecialManager::instance() { - static SpecialManager sm; - return sm; -} - - -/** Remove all registered handlers. */ -void SpecialManager::unregisterHandlers () { - FORALL(_pool, vector::iterator, it) - delete *it; - _pool.clear(); - _handlers.clear(); - _endPageListeners.clear(); - _positionListeners.clear(); -} - - -/** Registers a single special handler. This method doesn't check if a - * handler of the same class is already registered. - * @param[in] handler pointer to handler to be registered */ -void SpecialManager::registerHandler (SpecialHandler *handler) { - if (handler) { - // get array of prefixes this handler is responsible for - _pool.push_back(handler); - for (const char **p=handler->prefixes(); *p; ++p) - _handlers[*p] = handler; - if (DVIPreprocessingListener *listener = dynamic_cast(handler)) - _preprocListeners.push_back(listener); - if (DVIEndPageListener *listener = dynamic_cast(handler)) - _endPageListeners.push_back(listener); - if (DVIPositionListener *listener = dynamic_cast(handler)) - _positionListeners.push_back(listener); - } -} - - -/** Registers several special handlers at once. - * If ignorelist == 0, all given handlers are registered. To exclude selected sets of - * specials, the corresponding names can be given separated by non alpha-numeric characters, - * e.g. "color, ps, em" or "color: ps em" etc. - * @param[in] handlers pointer to zero-terminated array of handlers to be registered - * @param[in] ignorelist list of special names to be ignored */ -void SpecialManager::registerHandlers (SpecialHandler **handlers, const char *ignorelist) { - if (handlers) { - string ign = ignorelist ? ignorelist : ""; - FORALL(ign, string::iterator, it) - if (!isalnum(*it)) - *it = '%'; - ign = "%"+ign+"%"; - - for (; *handlers; handlers++) { - if (!(*handlers)->name() || ign.find("%"+string((*handlers)->name())+"%") == string::npos) - registerHandler(*handlers); - else - delete *handlers; - } - } -} - - -/** Looks for an appropriate handler for a given special prefix. - * @param[in] prefix the special prefix, e.g. "color" or "em" - * @return in case of success: pointer to handler, 0 otherwise */ -SpecialHandler* SpecialManager::findHandler (const string &prefix) const { - ConstIterator it = _handlers.find(prefix); - if (it != _handlers.end()) - return it->second; - return 0; -} - - -static string extract_prefix (istream &is) { - int c; - string prefix; - while (isalnum(c=is.get())) - prefix += c; - if (ispunct(c)) // also add seperation character to identifying prefix - prefix += c; - if (prefix == "ps:" && is.peek() == ':') - prefix += is.get(); - return prefix; -} - - -void SpecialManager::preprocess (const string &special, SpecialActions *actions) const { - istringstream iss(special); - string prefix = extract_prefix(iss); - if (SpecialHandler *handler = findHandler(prefix)) - handler->preprocess(prefix.c_str(), iss, actions); -} - - -/** Executes a special command. - * @param[in] special the special expression - * @param[in] dvi2bp factor to convert DVI units to PS points - * @param[in] actions actions the special handlers can perform - * @return true if the special could be processed successfully - * @throw SpecialException in case of errors during special processing */ -bool SpecialManager::process (const string &special, double dvi2bp, SpecialActions *actions) const { - istringstream iss(special); - string prefix = extract_prefix(iss); - bool success=false; - if (SpecialHandler *handler = findHandler(prefix)) { - handler->setDviScaleFactor(dvi2bp); - success = handler->process(prefix.c_str(), iss, actions); - } - return success; -} - - -void SpecialManager::notifyPreprocessingFinished () const { - FORALL(_preprocListeners, vector::const_iterator, it) - (*it)->dviPreprocessingFinished(); -} - - -void SpecialManager::notifyEndPage (unsigned pageno) const { - FORALL(_endPageListeners, vector::const_iterator, it) - (*it)->dviEndPage(pageno); -} - - -void SpecialManager::notifyPositionChange (double x, double y) const { - FORALL(_positionListeners, vector::const_iterator, it) - (*it)->dviMovedTo(x, y); -} - - -void SpecialManager::writeHandlerInfo (ostream &os) const { - ios::fmtflags osflags(os.flags()); - typedef map SortMap; - SortMap m; - FORALL(_handlers, ConstIterator, it) - if (it->second->name()) - m[it->second->name()] = it->second; - FORALL(m, SortMap::iterator, it) { - os << setw(10) << left << it->second->name() << ' '; - if (it->second->info()) - os << it->second->info(); - os << endl; - } - os.flags(osflags); // restore format flags -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.h deleted file mode 100644 index 29c325c20cc..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/SpecialManager.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* -** SpecialManager.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SPECIALMANAGER_H -#define DVISVGM_SPECIALMANAGER_H - -#include -#include -#include -#include -#include "SpecialHandler.h" - -struct SpecialActions; - -class SpecialManager -{ - private: - typedef std::vector HandlerPool; - typedef std::map HandlerMap; - typedef HandlerMap::iterator Iterator; - typedef HandlerMap::const_iterator ConstIterator; - - public: - ~SpecialManager (); - static SpecialManager& instance (); - void registerHandler (SpecialHandler *handler); - void registerHandlers (SpecialHandler **handlers, const char *ignorelist); - void unregisterHandlers (); - void preprocess (const std::string &special, SpecialActions *actions) const; - bool process (const std::string &special, double dvi2bp, SpecialActions *actions) const; - void notifyPreprocessingFinished () const; - void notifyEndPage (unsigned pageno) const; - void notifyPositionChange (double x, double y) const; - void writeHandlerInfo (std::ostream &os) const; - - protected: - SpecialManager () {} - SpecialManager (const SpecialManager &) {} - SpecialHandler* findHandler (const std::string &prefix) const; - - private: - HandlerPool _pool; ///< stores pointers to all handlers - HandlerMap _handlers; ///< pointers to handlers for corresponding prefixes - std::vector _preprocListeners; - std::vector _endPageListeners; - std::vector _positionListeners; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.cpp deleted file mode 100644 index 95722a77c87..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* -** StreamReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "CRC32.h" -#include "StreamReader.h" -#include "macros.h" - -using namespace std; - - -istream& StreamReader::replaceStream (istream &in) { - istream &ret = *_is; - _is = ∈ - return ret; -} - - -/** Reads an unsigned integer from assigned input stream. - * @param[in] bytes number of bytes to read (max. 4) - * @return read integer */ -UInt32 StreamReader::readUnsigned (int bytes) { - UInt32 ret = 0; - for (bytes--; bytes >= 0 && !_is->eof(); bytes--) { - UInt32 b = _is->get(); - ret |= b << (8*bytes); - } - return ret; -} - - -/** Reads an unsigned integer from assigned input stream and updates the CRC32 checksum. - * @param[in] bytes number of bytes to read (max. 4) - * @param[in,out] crc32 checksum to be updated - * @return read integer */ -UInt32 StreamReader::readUnsigned (int bytes, CRC32 &crc32) { - UInt32 ret = readUnsigned(bytes); - crc32.update(ret, bytes); - return ret; -} - - -/** Reads an signed integer from assigned input stream. - * @param[in] bytes number of bytes to read (max. 4) - * @return read integer */ -Int32 StreamReader::readSigned (int bytes) { - Int32 ret = _is->get(); - if (ret & 128) // negative value? - ret |= 0xffffff00; - for (bytes-=2; bytes >= 0 && !_is->eof(); bytes--) - ret = (ret << 8) | _is->get(); - return ret; -} - - -/** Reads an signed integer from assigned input stream and updates the CRC32 checksum. - * @param[in] bytes number of bytes to read (max. 4) - * @param[in,out] crc32 checksum to be updated - * @return read integer */ -Int32 StreamReader::readSigned (int bytes, CRC32 &crc32) { - Int32 ret = readSigned(bytes); - crc32.update(ret, bytes); - return ret; -} - - -/** Reads a string terminated by a 0-byte. */ -string StreamReader::readString () { - if (!_is) - throw StreamReaderException("no stream assigned"); - string ret; - while (!_is->eof() && _is->peek() > 0) - ret += _is->get(); - _is->get(); // skip 0-byte - return ret; -} - - -/** Reads a string terminated by a 0-byte and updates the CRC32 checksum. - * @param[in,out] crc32 checksum to be updated - * @param[in] finalZero consider final 0-byte in checksum - * @return the string read */ -string StreamReader::readString (CRC32 &crc32, bool finalZero) { - string ret = readString(); - crc32.update((const UInt8*)ret.c_str(), ret.length()); - if (finalZero) - crc32.update(0, 1); - return ret; -} - - -/** Reads a string of a given length. - * @param[in] length number of characters to read - * @return the string read */ -string StreamReader::readString (int length) { - if (!_is) - throw StreamReaderException("no stream assigned"); - char *buf = new char[length+1]; - if (length <= 0) - *buf = 0; - else { - _is->read(buf, length); // reads 'length' bytes - buf[length] = 0; - } - string ret = buf; - delete [] buf; - return ret; -} - - -/** Reads a string of a given length and updates the CRC32 checksum. - * @param[in] length number of characters to read - * @param[in,out] crc32 checksum to be updated - * @return the string read */ -string StreamReader::readString (int length, CRC32 &crc32) { - string ret = readString(length); - crc32.update(ret.c_str()); - return ret; -} - - -vector& StreamReader::readBytes (int n, vector &bytes) { - if (n > 0) - _is->read((char*)&bytes[0], n); - return bytes; -} - - -vector& StreamReader::readBytes (int n, vector &bytes, CRC32 &crc32) { - readBytes(n, bytes); - crc32.update(&bytes[0], bytes.size()); - return bytes; -} - - -int StreamReader::readByte (CRC32 &crc32) { - int ret = readByte(); - if (ret >= 0) { - const UInt8 c = UInt8(ret & 0xff); - crc32.update(&c, 1); - } - return ret; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.h deleted file mode 100644 index 24c37c487d2..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamReader.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* -** StreamReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_STREAMREADER_H -#define DVISVGM_STREAMREADER_H - -#include -#include -#include -#include "MessageException.h" -#include "types.h" - -class CRC32; - -class StreamReader -{ - public: - StreamReader (std::istream &is) : _is(&is) {} - virtual ~StreamReader () {} - bool isStreamValid () const {return _is;} - bool eof () const {return _is->eof();} - void clearStream () {_is->clear();} - std::istream& replaceStream (std::istream &s); - UInt32 readUnsigned (int n); - UInt32 readUnsigned (int n, CRC32 &crc32); - Int32 readSigned (int n); - Int32 readSigned (int n, CRC32 &crc32); - std::string readString (); - std::string readString (CRC32 &crc32, bool finalZero=false); - std::string readString (int length); - std::string readString (int length, CRC32 &crc32); - std::vector& readBytes (int n, std::vector &bytes); - std::vector& readBytes (int n, std::vector &bytes, CRC32 &crc32); - int readByte () {return _is->get();} - int readByte (CRC32 &crc32); - void seek (std::streampos pos, std::ios::seekdir dir) {_is->seekg(pos, dir);} - void seek (std::streampos pos) {_is->seekg(pos);} - std::streampos tell () const {return _is->tellg();} - int peek () const {return _is->peek();} - - protected: - std::istream& getInputStream () {return *_is;} - - private: - std::istream *_is; -}; - - -struct StreamReaderException : public MessageException -{ - StreamReaderException (const std::string &msg) : MessageException(msg) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.cpp deleted file mode 100644 index db336b64d5f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* -** StreamWriter.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "CRC32.h" -#include "StreamWriter.h" - -using namespace std; - - -/** Writes an unsigned integer to the output stream. - * @param[in] val the value to write - * @param[in] n number of bytes to be considered */ -void StreamWriter::writeUnsigned (UInt32 val, int n) { - for (n--; n >= 0; n--) - _os.put((val >> (8*n)) & 0xff); -} - - -/** Writes a signed integer to the output stream. - * @param[in] val the value to write - * @param[in] n number of bytes to be considered */ -void StreamWriter::writeSigned (Int32 val, int n) { - writeUnsigned((UInt32)val, n); -} - - -/** Writes a signed integer to the output stream. - * @param[in] val the value to write - * @param[in] finalZero if true, a final 0-byte is appended */ -void StreamWriter::writeString (const string &str, bool finalZero) { - for (size_t i=0; i < str.length(); i++) - _os.put(str[i]); - if (finalZero) - _os.put(0); -} - - -/** Writes an unsigned integer to the output stream. - * @param[in] val the value to write - * @param[in] n number of bytes to be considered - * @param[in,out] crc32 checksum to be updated */ -void StreamWriter::writeUnsigned (UInt32 val, int n, CRC32 &crc32) { - writeUnsigned(val, n); - crc32.update(val, n); -} - - -/** Writes a signed integer to the output stream and updates the CRC32 checksum. - * @param[in] val the value to write - * @param[in] n number of bytes to be considered - * @param[in,out] crc32 checksum to be updated */ -void StreamWriter::writeSigned (Int32 val, int n, CRC32 &crc32) { - writeUnsigned((UInt32)val, n, crc32); -} - - -/** Writes a string to the output stream and updates the CRC32 checksum. - * @param[in] str the string to write - * @param[in,out] crc32 checksum to be updated - * @param[in] finalZero if true, a final 0-byte is appended */ -void StreamWriter::writeString (const std::string &str, CRC32 &crc32, bool finalZero) { - writeString(str, finalZero); - crc32.update((const UInt8*)str.c_str(), str.length() + (finalZero ? 1 : 0)); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.h deleted file mode 100644 index a17c891e741..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/StreamWriter.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* -** StreamWriter.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_STREAMWRITER_H -#define DVISVGM_STREAMWRITER_H - -#include -#include "types.h" - - -class CRC32; - -class StreamWriter -{ - public: - StreamWriter (std::ostream &os) : _os(os) {} - virtual ~StreamWriter () {} - void writeUnsigned (UInt32 val, int n); - void writeSigned (Int32 val, int n); - void writeString (const std::string &str, bool finalZero=false); - void writeUnsigned (UInt32 val, int n, CRC32 &crc32); - void writeSigned (Int32 val, int n, CRC32 &crc32); - void writeString (const std::string &str, CRC32 &crc32, bool finalZero=false); - - private: - std::ostream &_os; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.cpp deleted file mode 100644 index b71775e9297..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/************************************************************************* -** Subfont.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "FileFinder.h" -#include "Subfont.h" -#include "Message.h" - -using namespace std; - -// helper functions - -static int skip_mapping_data (istream &is); -static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, int &pos); - - -/** Constructs a new SubfontDefinition object. - * @param[in] name name of subfont definition - * @param[in] fpath path to corresponding .sfd file*/ -SubfontDefinition::SubfontDefinition (const string &name, const char *fpath) : _sfname(name) { - // read all subfont IDs from the .sfd file but skip the mapping data - ifstream is(fpath); - while (is) { - if (is.peek() == '#') // comment line? - is.ignore(numeric_limits::max(), '\n'); // => skip it - else if (isspace(is.peek())) - is.get(); - else { - string id; - while (is && !isspace(is.peek())) - id += is.get(); - if (!id.empty()) { - pair state = _subfonts.insert(pair(id, (Subfont*)0)); - if (state.second) // id was not present in map already - state.first->second = new Subfont(*this, state.first->first); - skip_mapping_data(is); - } - } - } -} - - -SubfontDefinition::~SubfontDefinition () { - for (Iterator it=_subfonts.begin(); it != _subfonts.end(); ++it) - delete it->second; -} - - -/** Looks for a subfont definition of the given name and returns the corresponding object. - * All objects are only created once for a given name and stored in an internal cache. - * @param[in] name name of subfont definition to lookup - * @return pointer to subfont definition object or 0 if it doesn't exist */ -SubfontDefinition* SubfontDefinition::lookup (const std::string &name) { - typedef map SFDMap; - static SFDMap sfdMap; - SFDMap::iterator it = sfdMap.find(name); - if (it != sfdMap.end()) - return it->second; - SubfontDefinition *sfd=0; - if (const char *path = FileFinder::lookup(name+".sfd", false)) { - sfd = new SubfontDefinition(name, path); - sfdMap[name] = sfd; - } - return sfd; -} - - -/** Returns the full path to the corresponding .sfd file or 0 if it can't be found. */ -const char* SubfontDefinition::path () const { - return FileFinder::lookup(filename(), false); -} - - -/** Returns the subfont with the given ID, or 0 if it doesn't exist. */ -Subfont* SubfontDefinition::subfont (const string &id) const { - ConstIterator it = _subfonts.find(id); - if (it != _subfonts.end()) - return it->second; - return 0; -} - - -/** Returns all subfonts defined in this SFD. */ -int SubfontDefinition::subfonts (vector &sfs) const { - for (ConstIterator it=_subfonts.begin(); it != _subfonts.end(); ++it) - sfs.push_back(it->second); - return sfs.size(); -} - -////////////////////////////////////////////////////////////////////// - -Subfont::~Subfont () { - delete [] _mapping; -} - - -/** Reads the character mappings for a given subfont ID. - * Format of subfont definition (sfd) files: - * sfd ::= (ID entries | '#' '\n')* - * ID ::= - * entries ::= (integer | integer ':' | integer '_' integer)* - * The mapping data for a subfont is given as a sequence of 256 16-bit values where - * value v at position c defines the (global) character code that is assigned to the - * local subfont character c. The sequence v,v+1,v+2,...,v+n can be abbreviated with - * v '_' v+n, e.g. 10_55. In order to continue the sequence at a different position, - * the syntax number ':' can be used. Example: 10: 5 6 7 assigns the values v=5, 6, 7 - * to c=10, 11 and 12, respectively. - * @return true if the data has been read successfully */ -bool Subfont::read () { - if (_mapping) // if there's already a mapping assigned, we're finished here - return true; - if (const char *p = _sfd.path()) { - ifstream is(p); - if (!is) - return false; - - int lineno=1; - while (is) { - if (is.peek() == '#' || is.peek() == '\n') { - is.ignore(numeric_limits::max(), '\n'); // skip comment and empty line - lineno++; - } - else if (isspace(is.peek())) - is.get(); - else { - string id; - while (is && !isspace(is.peek())) - id += is.get(); - if (id != _id) - lineno += skip_mapping_data(is); - else { - // build mapping array - _mapping = new UInt16[256]; - memset(_mapping, 0, 256*sizeof(UInt16)); - int pos=0; - char buf[1024]; - bool complete=false; - while (!complete) { - is.getline(buf, 1024); - complete = scan_line(buf, lineno, _mapping, _sfd.filename() ,pos); - } - return true; - } - } - } - } - return false; -} - - -/** Returns the global character code of the target font for a - * (local) character code of the subfont. - * @param[in] c local character code relative to the subfont - * @return character code of the target font */ -UInt16 Subfont::decode (unsigned char c) { - if (!_mapping && !read()) - return 0; - return _mapping[c]; -} - - -////////////////////////////////////////////////////////////////////// - - -/** Skips the mapping data of a subfont entry. - * @param[in] is stream to read from - * @return number of lines skipped */ -static int skip_mapping_data (istream &is) { - char buf[1024]; - bool complete=false; - int lines=0; - while (is && !complete) { - is.getline(buf, 1024); - if (is.gcount() > 1) - lines++; - const char *p = buf+is.gcount()-2; - while (p >= buf && isspace(*p)) - p--; - complete = (p < buf || *p != '\\'); // line doesn't end with backslash - } - return lines; -} - - -/** Scans a single line of mapping data and stores the values in the given array. - * @param[in] line the line of text to be scanned - * @param[in] lineno line number used in exception messages - * @param[in,out] mapping the mapping data - * @param[in] fname name of the mapfile being scanned - * @param[in,out] offset position/index of next mapping value - * @return true if the line is the last one the current mapping sequence, i.e. the line doesn't end with a backslash */ -static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, int &offset) { - const char *p=line; - char *q; - for (; *p && isspace(*p); p++); - while (*p) { - if (*p == '\\') { - while (*++p) - if (!isspace(*p)) - throw SubfontException("unexpected backslash in mapping table", fname, lineno); - } - else { - long val1 = strtol(p, &q, 0); // first value of range - long val2; // last value of range - ostringstream oss; // output stream for exception messages - switch (*q) { - case ':': - if (val1 < 0 || val1 > 255) - throw SubfontException(oss << "offset value " << val1 << " out of range (0-255)", fname, lineno); - offset = val1; - val1 = -1; - q++; - break; - case '_': - p = q+1; - val2 = strtol(p, &q, 0); - if (val1 < 0 || val1 > 0xffffL) - throw SubfontException(oss << "table value " << val1 << " out of range", fname, lineno); - if (val2 < 0 || val2 > 0xffffL) - throw SubfontException(oss << "table value " << val2 << " out of range", fname, lineno); - if (p == q || (!isspace(*q) && *q != '\\' && *q)) - throw SubfontException(oss << "unexpected character '" << *q << "'", fname, lineno); - break; - default: - if (p == q || (!isspace(*q) && *q != '\\' && *q)) - throw SubfontException(oss << "unexpected character '" << *q << "'", fname, lineno); - if (val1 < 0 || val1 > 0xffffL) - throw SubfontException("invalid character code", fname, lineno); - val2 = val1; - } - if (val1 >= 0) { - if (val1 > val2 || offset+val2-val1 > 255) - throw SubfontException(oss << "invalid range in mapping table: " << hex << val1 << '_' << val2, fname, lineno); - for (long v=val1; v <= val2; v++) { - if (mapping[offset]) - throw SubfontException(oss << "mapping of character " << offset << " already defined", fname, lineno); - mapping[offset++] = static_cast(v); - } - } - for (p=q; *p && isspace(*p); p++); - } - } - for (p--; p >= line && isspace(*p); p--); - return p < line || *p != '\\'; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.h deleted file mode 100644 index 4585a0981df..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Subfont.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* -** Subfont.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SUBFONT_H -#define DVISVGM_SUBFONT_H - -#include -#include -#include -#include -#include -#include "MessageException.h" -#include "types.h" - - -class Subfont; - - -/** Represents a collection of subfont mappings as defined in a .sfd file, and - * encapsulates the evaluation of these files. */ -class SubfontDefinition -{ - typedef std::map Subfonts; - typedef Subfonts::iterator Iterator; - typedef Subfonts::const_iterator ConstIterator; - public: - ~SubfontDefinition (); - static SubfontDefinition* lookup (const std::string &name); -// int getIDs (std::vector &ids) const; - const std::string& name() const {return _sfname;} - std::string filename() const {return _sfname+".sfd";} - Subfont* subfont (const std::string &id) const; - int subfonts (std::vector &sfs) const; - const char* path () const; - - protected: - SubfontDefinition (const std::string &name, const char *fpath); - SubfontDefinition (const SubfontDefinition &sfd) {} - - private: - std::string _sfname; ///< name of subfont - Subfonts _subfonts; ///< all subfonts defined in the corresponding .sfd file -}; - - -/** Represents a single subfont mapping defined in a SubfontDefinition (.sfd file). */ -class Subfont -{ - friend class SubfontDefinition; - public: - ~Subfont(); - const std::string& id () const {return _id;} - UInt16 decode (unsigned char c); - - protected: - Subfont (SubfontDefinition &sfd, const std::string &id) : _sfd(sfd), _id(id), _mapping(0) {} - bool read (); - - private: - SubfontDefinition &_sfd; ///< SubfontDefinition where this Subfont belongs to - const std::string &_id; ///< id of this subfont as specified in the .sfd file - UInt16 *_mapping; ///< the character mapping table with 256 entries -}; - - -class SubfontException : public MessageException -{ - public: - SubfontException (const std::string &msg, const std::string &fname, int lineno=0) - : MessageException(msg), _fname(fname), _lineno(lineno) {} - - SubfontException (const std::ostream &oss, const std::string &fname, int lineno=0) - : MessageException(dynamic_cast(oss).str()), _fname(fname), _lineno(lineno) {} - - virtual ~SubfontException () throw() {} - - const char* filename () const {return _fname.c_str();} - int lineno () const {return _lineno;} - - private: - std::string _fname; - int _lineno; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.cpp deleted file mode 100644 index 1bbd4378df4..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -** System.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "System.h" - -#if defined (HAVE_SYS_TIME_H) -#include -#elif defined (HAVE_SYS_TIMEB_H) -#include -#endif - - -using namespace std; - - -/** Returns timestamp (wall time) in seconds. */ -double System::time () { -#if defined (HAVE_SYS_TIME_H) - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec + tv.tv_usec/1000000.0; -#elif defined (HAVE_SYS_TIMEB_H) - struct timeb tb; - ftime(&tb); - return tb.time + tb.millitm/1000.0; -#else - clock_t myclock = clock(); - return double(myclock)/CLOCKS_PER_SEC; -#endif -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.h deleted file mode 100644 index ffca48e1cd3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/System.h +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* -** System.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_SYSTEM_H -#define DVISVGM_SYSTEM_H - -namespace System -{ - double time (); -} - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.cpp deleted file mode 100644 index 6e3ad81eb9a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************* -** TFM.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include "FileFinder.h" -#include "Message.h" -#include "StreamReader.h" -#include "TFM.h" - -using namespace std; - - -/** Reads a sequence of n TFM words (4 Bytes each). - * @param[in] sr the TFM data is read from this object - * @param[out] v the read words - * @param[in] n number of words to be read */ -template -static void read_words (StreamReader &sr, vector &v, unsigned n) { - v.clear(); - v.resize(n); - for (unsigned i=0; i < n; i++) - v[i] = sr.readUnsigned(4); -} - - -/** Converts a TFM fix point value to double (PS point units). */ -static double fix2double (FixWord fix) { - const double pt2bp = 72/72.27; - return double(fix)/(1 << 20)*pt2bp; -} - - -TFM::TFM (istream &is) { - is.seekg(0); - StreamReader sr(is); - UInt16 lf = UInt16(sr.readUnsigned(2)); // length of entire file in 4 byte words - UInt16 lh = UInt16(sr.readUnsigned(2)); // length of header in 4 byte words - _firstChar= UInt16(sr.readUnsigned(2)); // smallest character code in font - _lastChar = UInt16(sr.readUnsigned(2)); // largest character code in font - UInt16 nw = UInt16(sr.readUnsigned(2)); // number of words in width table - UInt16 nh = UInt16(sr.readUnsigned(2)); // number of words in height table - UInt16 nd = UInt16(sr.readUnsigned(2)); // number of words in depth table - UInt16 ni = UInt16(sr.readUnsigned(2)); // number of words in italic corr. table - UInt16 nl = UInt16(sr.readUnsigned(2)); // number of words in lig/kern table - UInt16 nk = UInt16(sr.readUnsigned(2)); // number of words in kern table - UInt16 ne = UInt16(sr.readUnsigned(2)); // number of words in ext. char table - UInt16 np = UInt16(sr.readUnsigned(2)); // number of font parameter words - - if (6+lh+(_lastChar-_firstChar+1)+nw+nh+nd+ni+nl+nk+ne+np != lf) - throw FontMetricException("inconsistent length values"); - if (_firstChar >= _lastChar || _lastChar > 255 || ne > 256) - throw FontMetricException("character codes out of range"); - - readHeader(sr); - is.seekg(24+lh*4); // move to char info table - readTables(sr, nw, nh, nd, ni); -} - - -void TFM::readHeader (StreamReader &sr) { - _checksum = sr.readUnsigned(4); - _designSize = sr.readUnsigned(4); -} - - -void TFM::readTables (StreamReader &sr, int nw, int nh, int nd, int ni) { - read_words(sr, _charInfoTable, _lastChar-_firstChar+1); - read_words(sr, _widthTable, nw); - read_words(sr, _heightTable, nh); - read_words(sr, _depthTable, nd); - read_words(sr, _italicTable, ni); -} - - -/** Returns the design size of this font in PS point units. */ -double TFM::getDesignSize () const { - return fix2double(_designSize); -} - - -/** Returns the index to the entry of the character info table that describes the metric of a given character. - * @param[in] c character whose index is retrieved - * @return table index for character c, or -1 if there's no entry */ -int TFM::charIndex (int c) const { - if (c < _firstChar || c > _lastChar || size_t(c-_firstChar) >= _charInfoTable.size()) - return -1; - return c-_firstChar; -} - - -// the char info word for each character consists of 4 bytes holding the following information: -// width index w, height index (h), depth index (d), italic correction index (it), -// tag (tg) and a remainder: -// -// byte 1 | byte 2 | byte 3 | byte 4 -// xxxxxxxx | xxxx xxxx | xxxxxx xx | xxxxxxxx -// w | h d | it tg | remainder - -/** Returns the width of char c in PS point units. */ -double TFM::getCharWidth (int c) const { - int index = charIndex(c); - if (index < 0) - return 0; - index = (_charInfoTable[index] >> 24) & 0xFF; - return fix2double(_widthTable[index]) * fix2double(_designSize); -} - - -/** Returns the height of char c in PS point units. */ -double TFM::getCharHeight (int c) const { - int index = charIndex(c); - if (index < 0) - return 0; - index = (_charInfoTable[index] >> 20) & 0x0F; - return fix2double(_heightTable[index]) * fix2double(_designSize); -} - - -/** Returns the depth of char c in PS point units. */ -double TFM::getCharDepth (int c) const { - int index = charIndex(c); - if (index < 0) - return 0; - index = (_charInfoTable[index] >> 16) & 0x0F; - return fix2double(_depthTable[index]) * fix2double(_designSize); -} - - -/** Returns the italic correction of char c in PS point units. */ -double TFM::getItalicCorr (int c) const { - int index = charIndex(c); - if (index < 0) - return 0; - index = (_charInfoTable[index] >> 10) & 0x3F; - return fix2double(_italicTable[index]) * fix2double(_designSize); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.h deleted file mode 100644 index 3afc88ec83d..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TFM.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* -** TFM.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_TFM_H -#define DVISVGM_TFM_H - -#include -#include -#include -#include "FontMetrics.h" -#include "types.h" -#include "StreamReader.h" - -class StreamReader; - -class TFM : public FontMetrics -{ - public: -// TFM (const char *fname); - TFM (std::istream &is); - double getDesignSize () const; - double getCharWidth (int c) const; - double getCharHeight (int c) const; - double getCharDepth (int c) const; - double getItalicCorr (int c) const; - bool verticalLayout () const {return false;} - UInt32 getChecksum () const {return _checksum;} - UInt16 firstChar () const {return _firstChar;} - UInt16 lastChar () const {return _lastChar;} - - protected: - TFM () : _checksum(0), _firstChar(0), _lastChar(0), _designSize(0) {} - void readHeader (StreamReader &sr); - void readTables (StreamReader &sr, int nw, int nh, int nd, int ni); - virtual int charIndex (int c) const; - void setCharRange (int firstchar, int lastchar) {_firstChar=firstchar; _lastChar=lastchar;} - - private: - UInt32 _checksum; - UInt16 _firstChar, _lastChar; - FixWord _designSize; ///< design size of the font in TeX points (7227 pt = 254 cm) - std::vector _charInfoTable; - std::vector _widthTable; ///< character widths in design size units - std::vector _heightTable; ///< character height in design size units - std::vector _depthTable; ///< character depth in design size units - std::vector _italicTable; ///< italic corrections in design size units -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.cpp deleted file mode 100644 index 2ad8a4c29dc..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/************************************************************************* -** TensorProductPatch.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "TensorProductPatch.h" - -using namespace std; - - -TensorProductPatch::TensorProductPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TensorProductPatch *patch) - : ShadingPatch(cspace) -{ - setPoints(points, edgeflag, patch); - setColors(colors, edgeflag, patch); -} - - -void TensorProductPatch::setFirstMatrixColumn (const DPair source[4], bool reverse) { - for (int i=0; i < 4; i++) - _points[i][0] = source[reverse ? 3-i : i]; -} - - -void TensorProductPatch::setFirstMatrixColumn (DPair source[4][4], int col, bool reverse) { - for (int i=0; i < 4; i++) - _points[i][0] = source[reverse ? 3-i : i][col]; -} - - -/*void TensorProductPatch::setPoints (const DPair points[4][4]) { - for (int i=0; i < 4; i++) - for (int j=0; j < 4; j++) - _points[i][j] = points[i][j]; -}*/ - - -/** Sets the control points defining the structure of the patch. If the edge flag is 0, - * the point vector must contain all 16 control points of the 4x4 matrix in "spiral" order: - * 0 11 10 9 - * 1 12 15 8 - * 2 13 14 7 - * 3 4 5 6 - * If the edge flag is 1,2, or 3, the points of the first matrix collumn - * are omitted, and taken from a reference patch instead. - * @param[in] points the control points in "spiral" order as described in the PS reference, p. 286 - * @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) { - TensorProductPatch *tpPatch = dynamic_cast(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)) - throw ShadingException("invalid number of control points in tensor-product patch definition"); - - // assign the 12 control points that are invariant for all edge flag values - int i = (edgeflag == 0 ? 4 : 0); - _points[3][1] = points[i++]; - _points[3][2] = points[i++]; - _points[3][3] = points[i++]; - _points[2][3] = points[i++]; - _points[1][3] = points[i++]; - _points[0][3] = points[i++]; - _points[0][2] = points[i++]; - _points[0][1] = points[i++]; - _points[1][1] = points[i++]; - _points[2][1] = points[i++]; - _points[2][2] = points[i++]; - _points[1][2] = points[i]; - // populate the first column of the control point matrix - switch (edgeflag) { - case 0: setFirstMatrixColumn(&points[0], false); break; - case 1: setFirstMatrixColumn(tpPatch->_points[3], false); break; - case 2: setFirstMatrixColumn(tpPatch->_points, 3, true); break; - case 3: setFirstMatrixColumn(tpPatch->_points[0], true); break; - } -} - - -/** Sets the vertex colors of the patch. If the edge flag is 0, - * the color vector must contain all 4 colors in the following order: - * c00, c30, c33, c03, where cXY belongs to the vertex pXY of the control - * point matrix. - * c00 ---- c03 - * | | - * | | - * c30 ---- c33 - * If the edge flag is 1,2, or 3, the colors c00 and c30 are omitted, - * and taken from a reference patch instead. - * @param[in] points the color values in the order c00, c30, c33, c03 - * @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) { - TensorProductPatch *tpPatch = dynamic_cast(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)) - throw ShadingException("invalid number of colors in tensor-product patch definition"); - - int i = (edgeflag == 0 ? 2 : 0); - _colors[3] = colors[i]; - _colors[1] = colors[i+1]; - switch (edgeflag) { - case 0: _colors[0] = colors[0]; _colors[2] = colors[1]; break; - case 1: _colors[0] = tpPatch->_colors[2]; _colors[2] = tpPatch->_colors[3]; break; - case 2: _colors[0] = tpPatch->_colors[3]; _colors[2] = tpPatch->_colors[1]; break; - case 3: _colors[0] = tpPatch->_colors[1]; _colors[2] = tpPatch->_colors[0]; break; - } -} - - -/** Returns the point P(u,v) of the patch. */ -DPair TensorProductPatch::valueAt (double u, double v) const { - // check if we can return one of the vertices - if (u == 0) { - if (v == 0) - return _points[0][0]; - else if (v == 1) - return _points[3][0]; - } - else if (u == 1) { - if (v == 0) - return _points[0][3]; - else if (v == 1) - return _points[3][3]; - } - // compute tensor product - DPair p[4]; - for (int i=0; i < 4; i++) { - Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); - p[i] = bezier.valueAt(u); - } - Bezier bezier(p[0], p[1], p[2], p[3]); - return bezier.valueAt(v); -} - - -/** Returns the color at point P(u,v) which is bilinearly interpolated from - * the colors assigned to vertices of the patch. */ -Color TensorProductPatch::colorAt (double u, double v) const { - // check if we can return one of the vertex colors - if (u == 0) { - if (v == 0) - return _colors[0]; - else if (v == 1) - return _colors[2]; - } - else if (u == 1) { - if (v == 0) - return _colors[1]; - else if (v == 1) - return _colors[3]; - } - // interpolate color - ColorGetter getComponents; - ColorSetter setComponents; - colorQueryFuncs(getComponents, setComponents); - valarray comp[4]; - for (int i=0; i < 4; i++) - (_colors[i].*getComponents)(comp[i]); - Color color; - (color.*setComponents)((1-u)*(1-v)*comp[0] + u*(1-v)*comp[1] + (1-u)*v*comp[2] + u*v*comp[3]); - return color; -} - - -Color TensorProductPatch::averageColor () const { - return averageColor(_colors[0], _colors[1], _colors[2], _colors[3]); -} - - -/** Compute the average of four given colors depending on the assigned color space. */ -Color TensorProductPatch::averageColor (const Color &c1, const Color &c2, const Color &c3, const Color &c4) const { - ColorGetter getComponents; - ColorSetter setComponents; - colorQueryFuncs(getComponents, setComponents); - valarray va1, va2, va3, va4; - (c1.*getComponents)(va1); - (c2.*getComponents)(va2); - (c3.*getComponents)(va3); - (c4.*getComponents)(va4); - Color averageColor; - (averageColor.*setComponents)((va1+va2+va3+va4)/4.0); - return averageColor; -} - - -void TensorProductPatch::getBoundaryPath (GraphicPath &path) const { - // Simple approach: Use the outer curves as boundary path. This doesn't always lead - // to correct results since, depending on the control points, P(u,v) might exceed - // the simple boundary. - path.moveto(_points[0][0]); - path.cubicto(_points[0][1], _points[0][2], _points[0][3]); - path.cubicto(_points[1][3], _points[2][3], _points[3][3]); - path.cubicto(_points[3][2], _points[3][1], _points[3][0]); - path.cubicto(_points[2][0], _points[1][0], _points[0][0]); - path.closepath(); -} - - -/** Computes the bicubically interpolated isoparametric Bézier curve P(u,t) that - * runs "vertically" from P(u,0) to P(u,1) through the patch P. - * @param[in] u "horizontal" parameter in the range from 0 to 1 - * @param[out] bezier the resulting Bézier curve */ -void TensorProductPatch::verticalCurve (double u, Bezier &bezier) const { - // check for simple cases (boundary curves) first - if (u == 0) - bezier.setPoints(_points[0][0], _points[1][0], _points[2][0], _points[3][0]); - else if (u == 1) - bezier.setPoints(_points[0][3], _points[1][3], _points[2][3], _points[3][3]); - else { - // compute "inner" curve - DPair p[4]; - for (int i=0; i < 4; i++) { - Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); - p[i] = bezier.valueAt(u); - } - bezier.setPoints(p[0], p[1], p[2], p[3]); - } -} - - -/** Computes the bicubically interpolated isoparametric Bézier curve P(t,v) that - * runs "horizontally" from P(0,v) to P(1,v) through the patch P. - * @param[in] v "vertical" parameter in the range from 0 to 1 - * @param[out] bezier the resulting Bézier curve */ -void TensorProductPatch::horizontalCurve (double v, Bezier &bezier) const { - // check for simple cases (boundary curves) first - if (v == 0) - bezier.setPoints(_points[0][0], _points[0][1], _points[0][2], _points[0][3]); - else if (v == 1) - bezier.setPoints(_points[3][0], _points[3][1], _points[3][2], _points[3][3]); - else { - // compute "inner" curve - DPair p[4]; - for (int i=0; i < 4; i++) { - Bezier bezier(_points[0][i], _points[1][i], _points[2][i], _points[3][i]); - p[i] = bezier.valueAt(v); - } - bezier.setPoints(p[0], p[1], p[2], p[3]); - } -} - - -/** Computes the sub-patch that maps the unit square [0,1]x[0,1] to - * the area P([u1,u2],[v1,v2]) of patch P. The control points of the sub-patch - * can easily be calculated using the tensor product blossom of patch P. - * See G. Farin: Curves and Surfaces for CAGD, p. 259 for example. */ -void TensorProductPatch::subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const { - if (u1 > u2) swap(u1, u2); - if (v1 > v2) swap(v1, v2); - // compute control points - double u[] = {u1, u1, u1, 0}; // blossom parameters of the "horizontal" domain (plus dummy value 0) - for (int i=0; i < 4; i++) { - u[3-i] = u2; - double v[] = {v1, v1, v1, 0}; // blossom parameters of the "vertical" domain (plus dummy value 0) - for (int j=0; j < 4; j++) { - v[3-j] = v2; - patch._points[i][j] = blossomValue(u, v); - } - } - // assign color values - patch._colors[0] = colorAt(u1, v1); - patch._colors[1] = colorAt(u2, v1); - patch._colors[2] = colorAt(u1, v2); - patch._colors[3] = colorAt(u2, v2); -} - - -/** Computes the value b(u1,u2,u3;v1,v2,v3) where b is tensor product blossom of the patch. */ -DPair TensorProductPatch::blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const { - DPair p[4]; - for (int i=0; i < 4; i++) { - Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); - p[i] = bezier.blossomValue(u1, u2, u3); - } - Bezier bezier(p[0], p[1], p[2], p[3]); - return bezier.blossomValue(v1, v2, v3); -} - - -/** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values - * greater than or near 1 are mapped to 1. */ -static inline double snap (double x) { - if (fabs(x) < 0.001) - return 0; - if (fabs(1-x) < 0.001) - return 1; - return x; -} - - -/** Computes a single row of segments approximating the patch region between v1 and v1+inc. */ -void TensorProductPatch::approximateRow (double v1, double inc, bool overlap, double delta, const vector &vbeziers, Callback &callback) const { - double v2 = snap(v1+inc); - double ov2 = (overlap && v2 < 1) ? snap(v2+inc) : v2; - Bezier hbezier1, hbezier2; - horizontalCurve(v1, hbezier1); - horizontalCurve(ov2, hbezier2); - double u1 = 0; - for (size_t i=1; i < vbeziers.size(); i++) { - double u2 = snap(u1+inc); - double ou2 = (overlap && u2 < 1) ? snap(u2+inc) : u2; - // compute segment boundaries - Bezier b1(hbezier1, u1, ou2); - Bezier b2(vbeziers[i + (overlap && i < vbeziers.size()-1 ? 1 : 0)], v1, ov2); - Bezier b3(hbezier2, u1, ou2); - Bezier b4(vbeziers[i-1], v1, ov2); - GraphicPath path; - path.moveto(b1.point(0)); - if (inc > delta) { - path.cubicto(b1.point(1), b1.point(2), b1.point(3)); - path.cubicto(b2.point(1), b2.point(2), b2.point(3)); - path.cubicto(b3.point(2), b3.point(1), b3.point(0)); - path.cubicto(b4.point(2), b4.point(1), b4.point(0)); - } - else { - path.lineto(b1.point(3)); - path.lineto(b2.point(3)); - path.lineto(b3.point(0)); - } - path.closepath(); - callback.patchSegment(path, averageColor(colorAt(u1, v1), colorAt(u2, v1), colorAt(u1, v2), colorAt(u2, v2))); - u1 = u2; - } -} - - -/** Approximate the patch by dividing it into a grid of segments that are filled with the - * average color of the corresponding region. The boundary of each segment consists of - * four Bézier curves, too. In order to prevent visual gaps between neighbored segments due - * to anti-aliasing, the flag 'overlap' can be set. It enlarges the segments so that they overlap - * with their right and bottom neighbors (which are drawn on top of the overlapping regions). - * @param[in] gridsize number of segments per row/column - * @param[in] overlap if true, enlarge each segment to overlap with its right and bottom neighbors - * @param[in] delta reduce level of detail if the segment size is smaller than the given value - * @param[in] callback object notified */ -void TensorProductPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { - if (_colors[0] == _colors[1] && _colors[1] == _colors[2] && _colors[2] == _colors[3]) { - // simple case: monochromatic patch - GraphicPath path; - getBoundaryPath(path); - callback.patchSegment(path, _colors[0]); - } - else { - const double inc = 1.0/gridsize; - // collect curves dividing the patch into several columns (curved vertical stripes) - vector vbeziers(gridsize+1); - double u=0; - for (int i=0; i <= gridsize; i++) { - verticalCurve(u, vbeziers[i]); - u = snap(u+inc); - } - // compute the segments row by row - double v=0; - for (int i=0; i < gridsize; i++) { - approximateRow(v, inc, overlap, delta, vbeziers, callback); - v = snap(v+inc); - } - } -} - - -void TensorProductPatch::getBBox (BoundingBox &bbox) const { - Bezier bezier; - BoundingBox bezierBox; - for (int i=0; i <= 1; i++) { - horizontalCurve(i, bezier); - bezier.getBBox(bezierBox); - bbox.embed(bezierBox); - verticalCurve(i, bezier); - bezier.getBBox(bezierBox); - bbox.embed(bezierBox); - } -} - - -#if 0 -void TensorProductPatch::approximate (int gridsize, Callback &callback) const { - const double inc = 1.0/gridsize; - Bezier ubezier0; verticalCurve(0, ubezier0); - Bezier ubezier1; verticalCurve(1, ubezier1); - Bezier vbezier0; horizontalCurve(0, vbezier0); - Bezier vbezier1; horizontalCurve(1, vbezier1); - for (double v1=0; v1 < 1; v1=snap(v1+inc)) { - double v2 = snap(v1+inc); - DPair p0 = valueAt(0, v1); - DPair p2 = valueAt(0, v2); - Color c0 = colorAt(0, v1); - Color c2 = colorAt(0, v2); - double u1 = 0; - for (double u2=inc; u2 <= 1; u2=snap(u2+inc)) { - DPair p1 = valueAt(u2, v1); - DPair p3 = valueAt(u2, v2); - Color c1 = colorAt(u2, v1); - Color c3 = colorAt(u2, v2); - // Compute a single patch segment. Only those segment edges that lay on the - // patch boundary are drawn as Bézier curves, all other edges are approximated - // with straight lines. This ensures a smooth outline and reduces the number of - // time consuming computations. - GraphicPath path; - path.moveto(p0); - if (v1 > 0) - path.lineto(p1); - else { - Bezier bezier(vbezier0, u1, u2); - path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); - } - if (u2 < 1) - path.lineto(p3); - else { - Bezier bezier(ubezier1, v1, v2); - path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); - } - if (v2 < 1) - path.lineto(p2); - else { - Bezier bezier(vbezier1, u1, u2); - path.cubicto(bezier.point(2), bezier.point(1), bezier.point(0)); - } - if (u1 > 0) - path.closepath(); - else { - Bezier bezier(ubezier0, v1, v2); - path.cubicto(bezier.point(2), bezier.point(1), bezier.point(0)); - path.closepath(); - } - callback.patchSegment(path, averageColor(c0, c1, c2, c3)); - p0 = p1; - p2 = p3; - c0 = c1; - c2 = c3; - u1 = u2; - } - } -} -#endif - - -///////////////////////////////////////////////////////////////////////////////////// - - -CoonsPatch::CoonsPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, CoonsPatch *patch) - : TensorProductPatch(cspace) -{ - setPoints(points, edgeflag, patch); - setColors(colors, edgeflag, patch); -} - - -DPair CoonsPatch::valueAt (double u, double v) const { - // Compute the value of P(u,v) using the Coons equation rather than the - // tensor product since the "inner" control points of the tensor matrix - // might not be set yet. - Bezier bezier1(_points[3][0], _points[3][1], _points[3][2], _points[3][3]); - Bezier bezier2(_points[0][0], _points[0][1], _points[0][2], _points[0][3]); - Bezier bezier3(_points[3][0], _points[2][0], _points[1][0], _points[0][0]); - Bezier bezier4(_points[3][3], _points[2][3], _points[1][3], _points[0][3]); - DPair ph = bezier1.valueAt(u)*(1-v) + bezier2.valueAt(u)*v; - DPair pv = bezier3.valueAt(v)*(1-u) + bezier4.valueAt(v)*u; - DPair pc = (_points[3][0]*(1-u) + _points[3][3]*u)*(1-v) + (_points[0][0]*(1-u) + _points[0][3]*u)*v; - return ph+pv-pc; -} - - -/** Sets the 12 control points defining the geometry of the coons patch. The points - * must be given in the following order: - * 3 4 5 6 - * 2 7 - * 1 8 - * 0 11 10 9 - * where each edge of the square represents the four control points of a cubic Bézier curve. - * If the edge flag is 1, 2, or 3, the points 0 to 3 are omitted, and taken from a reference - * patch instead. - * @param[in] points the control points in cyclic order as described in the PS reference, p. 281 - * @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) { - CoonsPatch *coonsPatch = dynamic_cast(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)) - throw ShadingException("invalid number of control points in Coons patch definition"); - - // Since a Coons patch is a special tensor product patch, we only have to reorder the - // control points and compute the additional "inner" points of the 4x4 point tensor matrix. - - // set outer control points of the tensor matrix except those of the first column - // because these points depend on the edge flag - int i = (edgeflag == 0 ? 4 : 0); - _points[3][1] = points[i++]; - _points[3][2] = points[i++]; - _points[3][3] = points[i++]; - _points[2][3] = points[i++]; - _points[1][3] = points[i++]; - _points[0][3] = points[i++]; - _points[0][2] = points[i++]; - _points[0][1] = points[i]; - - // set control points of first matrix column - switch (edgeflag) { - case 0: setFirstMatrixColumn(&points[0], false); break; - case 1: setFirstMatrixColumn(coonsPatch->_points[3], false); break; - case 2: setFirstMatrixColumn(coonsPatch->_points, 3, true); break; - case 3: setFirstMatrixColumn(coonsPatch->_points[0], true); break; - } - // compute inner control points of the tensor matrix - _points[1][1] = valueAt(1.0/3.0, 2.0/3.0); - _points[1][2] = valueAt(2.0/3.0, 2.0/3.0); - _points[2][1] = valueAt(1.0/3.0, 1.0/3.0); - _points[2][2] = valueAt(2.0/3.0, 1.0/3.0); -} - - -void CoonsPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { - CoonsPatch *coonsPatch = dynamic_cast(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)) - throw ShadingException("invalid number of colors in Coons patch definition"); - - int i = (edgeflag == 0 ? 2 : 0); - _colors[3] = colors[i]; - _colors[1] = colors[i+1]; - switch (edgeflag) { - case 0: _colors[0] = colors[0]; _colors[2] = colors[1]; break; - case 1: _colors[0] = coonsPatch->_colors[2]; _colors[2] = coonsPatch->_colors[3]; break; - case 2: _colors[0] = coonsPatch->_colors[3]; _colors[2] = coonsPatch->_colors[1]; break; - case 3: _colors[0] = coonsPatch->_colors[1]; _colors[2] = coonsPatch->_colors[0]; break; - } -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.h deleted file mode 100644 index 50fcac5a1e5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TensorProductPatch.h +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* -** TensorProductPatch.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef TENSORPRODUCTPATCH_H -#define TENSORPRODUCTPATCH_H - -#include -#include -#include -#include "Bezier.h" -#include "Color.h" -#include "MessageException.h" -#include "Pair.h" -#include "ShadingPatch.h" - - -/** This class represents a single tensor product patch P which is defined by 16 control points - * and 4 color values. The mapping of the unit square to the patch surface is defined as the sum - * \f[P(u,v):=\sum_{i=0}^3\sum_{j=0}^3 p_{ij} B_i(u) B_j(v)\f] - * where \f$B_k(t)={3\choose k}(1-t)^k t^k\f$ and \f$u,v \in [0,1]\f$. The four colors assigned - * to the vertices are interpolated bilinearily over the unit square. */ -class TensorProductPatch : public ShadingPatch -{ - friend class CoonsPatch; - - public: - TensorProductPatch () : ShadingPatch(Color::RGB_SPACE) {} - TensorProductPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} - TensorProductPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TensorProductPatch *patch); - int psShadingType() const {return 7;} - void setPoints (const DPair points[4][4], int edgeflag, TensorProductPatch *patch); - void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); - void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); - virtual DPair valueAt (double u, double v) const; - Color colorAt (double u, double v) const; - Color averageColor () const; - void horizontalCurve (double v, Bezier &bezier) const; - void verticalCurve (double u, Bezier &bezier) const; - void getBoundaryPath (GraphicPath &path) const; - void subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const; - DPair blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const; - DPair blossomValue (double u[3], double v[3]) const {return blossomValue(u[0], u[1], u[2], v[0], v[1], v[2]);} - void approximate (int gridsize, bool overlap, double delta, Callback &callback) const; - void getBBox (BoundingBox &bbox) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 16 : 12;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} - - protected: - Color averageColor (const Color &c1, const Color &c2, const Color &c3, const Color &c4) const; - void approximateRow (double v1, double inc, bool overlap, double delta, const std::vector &beziers, Callback &callback) const; - void setFirstMatrixColumn (const DPair source[4], bool reverse); - void setFirstMatrixColumn (DPair source[4][4], int col, bool reverse); - - private: - DPair _points[4][4]; ///< control point matrix defining the patch surface - Color _colors[4]; ///< vertex colors cK (c0->p00, c1->p03, c2->p30, c3->p33) -}; - - -/** Coons patches are special tensor product patches where the four "inner" control points - * depend on the outer ones, i.e. they are computed automatically and can't be set by the user. - * Thus, a Coons patch is defined by 12 control points, 4 vertex colors and a corresponding - * color space. */ -class CoonsPatch : public TensorProductPatch -{ - public: - CoonsPatch () {} - CoonsPatch (Color::ColorSpace cspace) : TensorProductPatch(cspace) {} - CoonsPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, CoonsPatch *patch); - int psShadingType() const {return 6;} - virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); - virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); - virtual DPair valueAt (double u, double v) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 12 : 8;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.cpp deleted file mode 100644 index c0d74a5c16e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************* -** Terminal.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "Terminal.h" - -#ifdef HAVE_TERMIOS_H -#include -#endif - -#ifdef GWINSZ_IN_SYS_IOCTL -#include -#endif - -#ifdef __WIN32__ -#include -#endif - -#include - - -using namespace std; - - -const int Terminal::RED = 1; -const int Terminal::GREEN = 2; -const int Terminal::BLUE = 4; - -const int Terminal::CYAN = GREEN|BLUE; -const int Terminal::YELLOW = RED|GREEN; -const int Terminal::MAGENTA = RED|BLUE; -const int Terminal::WHITE = RED|GREEN|BLUE; -const int Terminal::DEFAULT = -1; -const int Terminal::BLACK = 0; - -#ifdef __WIN32__ -int Terminal::_defaultColor; -int Terminal::_cursorHeight; -#endif - -int Terminal::_fgcolor = Terminal::DEFAULT; -int Terminal::_bgcolor = Terminal::DEFAULT; - - -/** Initializes the terminal. This method should be called before any of the others. - * @param[in,out] os terminal output stream (currently unused) */ -void Terminal::init (ostream &os) { -#ifdef __WIN32__ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - if (h != INVALID_HANDLE_VALUE) { - CONSOLE_SCREEN_BUFFER_INFO buffer_info; - GetConsoleScreenBufferInfo(h, &buffer_info); - _defaultColor = (buffer_info.wAttributes & 0xff); - CONSOLE_CURSOR_INFO cursor_info; - GetConsoleCursorInfo(h, &cursor_info); - _cursorHeight = cursor_info.dwSize; - } -#endif -} - - -/** Finishes the terminal output. Should be called after last terminal action. - * @param[in,out] os terminal output stream */ -void Terminal::finish (ostream &os) { - fgcolor(DEFAULT, os); - bgcolor(DEFAULT, os); - cursor(true); -} - - -/** Returns the number of terminal columns (number of characters per row). - * If it's not possible to retrieve information about the terminal size, 0 is returned. */ -int Terminal::columns () { -#if defined(TIOCGWINSZ) - struct winsize ws; - if (ioctl(fileno(stderr), TIOCGWINSZ, &ws) < 0) - return 0; - return ws.ws_col; -#elif defined(__WIN32__) - CONSOLE_SCREEN_BUFFER_INFO info; - if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &info)) - return 0; - return info.dwSize.X; -#else - return 0; -#endif -} - - -/** Returns the number of terminal rows. - * If it's not possible to retrieve information about the terminal size, 0 is returned. */ -int Terminal::rows () { -#if defined(TIOCGWINSZ) - struct winsize ws; - if (ioctl(fileno(stderr), TIOCGWINSZ, &ws) < 0) - return 0; - return ws.ws_row; -#elif defined(__WIN32__) - CONSOLE_SCREEN_BUFFER_INFO info; - if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &info)) - return 0; - return info.dwSize.Y; -#else - return 0; -#endif -} - - -/** Sets the foreground color. - * @param[in] color color code - * @param[in] os terminal output stream */ -void Terminal::fgcolor (int color, ostream &os) { - _fgcolor = color; - -#ifdef __WIN32__ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - if (h != INVALID_HANDLE_VALUE) { - CONSOLE_SCREEN_BUFFER_INFO info; - GetConsoleScreenBufferInfo(h, &info); - if (_fgcolor == DEFAULT) - color = _defaultColor & 0x0f; - else { - // swap red and blue bits - color = (color & 0x0a) | ((color & 1) << 2) | ((color & 4) >> 2); - } - color = (info.wAttributes & 0xf0) | (color & 0x0f); - SetConsoleTextAttribute(h, (DWORD)color); - } -#else - bool light = false; - if (color != DEFAULT && color > 7) { - light = true; - color %= 8; - } - if (color == DEFAULT) { - os << "\x1B[0m"; - if (_bgcolor != DEFAULT) - bgcolor(_bgcolor, os); - } - else - os << "\x1B[" << (light ? '1': '0') << ';' << (30+(color & 0x07)) << 'm'; -#endif -} - - -/** Sets the background color. - * @param[in] color color code - * @param[in] os terminal output stream */ -void Terminal::bgcolor (int color, ostream &os) { - _bgcolor = color; -#ifdef __WIN32__ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - if (h != INVALID_HANDLE_VALUE) { - CONSOLE_SCREEN_BUFFER_INFO info; - GetConsoleScreenBufferInfo(h, &info); - if (_bgcolor == DEFAULT) - color = (_defaultColor & 0xf0) >> 4; - else { - // swap red and blue bits - color = (color & 0x0a) | ((color & 1) << 2) | ((color & 4) >> 2); - } - color = (info.wAttributes & 0x0f) | ((color & 0x0f) << 4); - SetConsoleTextAttribute(h, (DWORD)color); - } -#else - if (color != DEFAULT && color > 7) - color %= 8; - if (color == DEFAULT) { - os << "\x1B[0m"; - if (_fgcolor != DEFAULT) - fgcolor(_fgcolor, os); - } - else - os << "\x1B[" << (40+(color & 0x07)) << 'm'; -#endif -} - - -/** Disables or enables the console cursor - * @param[in] visible if false, the cursor is disabled, and enabled otherwise */ -void Terminal::cursor (bool visible) { -#ifdef __WIN32__ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - if (h != INVALID_HANDLE_VALUE) { - CONSOLE_CURSOR_INFO cursor_info; - cursor_info.bVisible = visible; - cursor_info.dwSize = _cursorHeight; - SetConsoleCursorInfo(h, &cursor_info); - } -#endif -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.h deleted file mode 100644 index 8998e054f77..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Terminal.h +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* -** Terminal.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_TERMINAL_H -#define DVISVGM_TERMINAL_H - -#include - -class Terminal -{ - public: - static const int DEFAULT; - static const int BLACK; - static const int RED; - static const int GREEN; - static const int BLUE; - static const int CYAN; - static const int YELLOW; - static const int MAGENTA; - static const int WHITE; - - public: - static void init (std::ostream &os); - static void finish (std::ostream &os); - static int columns (); - static int rows (); - static void fgcolor (int color, std::ostream &os); - static void bgcolor (int color, std::ostream &os); - static void cursor (bool visible); - - private: - static int _fgcolor; ///< current foreground color - static int _bgcolor; ///< current background color - -#ifdef __WIN32__ - static int _defaultColor; - static int _cursorHeight; ///< current height of the cursor in percent -#endif -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.cpp deleted file mode 100644 index fa749d31f38..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* -** ToUnicodeMap.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "ToUnicodeMap.h" -#include "Unicode.h" - -using namespace std; - - -/** Adds valid but random mappings for all missing character indexes. - * If a font's cmap table doesn't provide Unicode mappings for some - * glyphs in the font, it's necessary to fill the gaps in order to - * handle all characters correctly. This functions assumes that the - * characters are numbered from 1 to maxIndex. - * @param[in] maxIndex largest character index to consider - * @return true on success */ -bool ToUnicodeMap::addMissingMappings (UInt32 maxIndex) { - bool success=true; - // collect Unicode points already in assigned - NumericRanges codepoints; - for (size_t i=0; i < size() && success; i++) - codepoints.addRange(rangeAt(i).minval(), rangeAt(i).maxval()); - // fill unmapped ranges - if (empty()) // no Unicode mapping present at all? - success = fillRange(1, maxIndex, 1, codepoints, true); - else { // (partial) Unicode mapping present? - success = fillRange(1, rangeAt(0).min()-1, rangeAt(0).minval()-1, codepoints, false); - for (size_t i=0; i < size()-1 && success; i++) - success = fillRange(rangeAt(i).max()+1, rangeAt(i+1).min()-1, rangeAt(i).maxval()+1, codepoints, true); - if (success) - success = fillRange(rangeAt(size()-1).max()+1, maxIndex, rangeAt(size()-1).maxval()+1, codepoints, true); - } - return success; -} - - -/** Checks if a given codepoint is valid and unused. Otherwise, try to find an alternative. - * @param[in,out] ucp codepoint to fix - * @param[in] used_codepoints codepoints already in use - * @param[in] ascending if true, increase ucp to look for valid/unused codepoints - * @return true on success */ -static bool fix_codepoint (UInt32 &ucp, const NumericRanges &used_codepoints, bool ascending) { - UInt32 start = ucp; - while (!Unicode::isValidCodepoint(ucp) && used_codepoints.valueExists(ucp)) { - if (ascending) - ucp = (ucp == numeric_limits::max()) ? 0 : ucp+1; - else - ucp = (ucp == 0) ? numeric_limits::max() : ucp-1; - if (ucp == start) // no free Unicode point found - return false; - } - return true; -} - - -static bool is_less_or_equal (UInt32 a, UInt32 b) {return a <= b;} -static bool is_greater_or_equal (UInt32 a, UInt32 b) {return a >= b;} - - -/** Adds index to Unicode mappings for a given range of character indexes. - * @param[in] minIndex lower bound of range to fill - * @param[in] maxIndex upper bound of range to fill - * @param[in] ucp first Unicode point to add (if possible) - * @param[in,out] used_ucps Unicode points already in use - * @param[in] ascending if true, fill range from lower to upper bound - * @return true on success */ -bool ToUnicodeMap::fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges &used_ucps, bool ascending) { - if (minIndex <= maxIndex) { - UInt32 first=minIndex, last=maxIndex; - int inc=1; - bool (*cmp)(UInt32, UInt32) = is_less_or_equal; - if (!ascending) { - swap(first, last); - inc = -1; - cmp = is_greater_or_equal; - } - for (UInt32 i=first; cmp(i, last); i += inc) { - if (!fix_codepoint(ucp, used_ucps, ascending)) - return false; - else { - addRange(i, i, ucp); - used_ucps.addRange(ucp); - ucp += inc; // preferred Unicode point for the next character of the current range - } - } - } - return true; -} \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.h deleted file mode 100644 index bf7788b7b98..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ToUnicodeMap.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* -** ToUnicodeMap.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef TOUNICODEMAP_H -#define TOUNICODEMAP_H - -#include "NumericRanges.h" -#include "RangeMap.h" - - -/** Represents a mapping from character indexes to unicode points. */ -class ToUnicodeMap : public RangeMap -{ - public: - bool addMissingMappings (UInt32 maxIndex); - - protected: - bool fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges &used_ucps, bool ascending); -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.cpp deleted file mode 100644 index de769352019..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/************************************************************************* -** TpicSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#define _USE_MATH_DEFINES -#include -#include -#include -#include -#include "Color.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "GraphicPath.h" -#include "SpecialActions.h" -#include "SVGTree.h" -#include "TpicSpecialHandler.h" -#include "XMLNode.h" -#include "XMLString.h" -#include "types.h" - -using namespace std; - - -TpicSpecialHandler::TpicSpecialHandler () { - reset(); -} - - -void TpicSpecialHandler::dviEndPage (unsigned pageno) { - reset(); -} - - -void TpicSpecialHandler::reset () { - _points.clear(); - _penwidth = 1.0; - _fill = -1.0; // no fill -} - - -/** Creates SVG elements that draw lines through the recorded points. - * @param[in] stroke if true, the (out)line is drawn (in black) - * @param[in] fill if true, enclosed area is filled with current color - * @param[in] ddist dash/dot distance of line in PS point units - * (0:solid line, >0:dashed line, <0:dotted line) - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -void TpicSpecialHandler::drawLines (bool stroke, bool fill, double ddist, SpecialActions *actions) { - if (actions && !_points.empty()) { - XMLElementNode *elem=0; - if (_points.size() == 1) { - const DPair &p = _points.back(); - elem = new XMLElementNode("circle"); - elem->addAttribute("cx", p.x()+actions->getX()); - elem->addAttribute("cy", p.y()+actions->getY()); - elem->addAttribute("r", _penwidth/2.0); - actions->embed(p, _penwidth/2.0); - } - else { - if (_points.size() == 2 || (!fill && _points.front() != _points.back())) { - elem = new XMLElementNode("polyline"); - elem->addAttribute("fill", "none"); - elem->addAttribute("stroke-linecap", "round"); - } - else { - if (_points.front() == _points.back()) - _points.pop_back(); - if (_fill < 0) - _fill = 1; - Color color = actions->getColor(); - color *= _fill; - elem = new XMLElementNode("polygon"); - elem->addAttribute("fill", fill ? color.rgbString() : "none"); - } - ostringstream oss; - FORALL(_points, vector::iterator, it) { - if (it != _points.begin()) - oss << ' '; - double x = it->x()+actions->getX(); - double y = it->y()+actions->getY(); - oss << XMLString(x) << ',' << XMLString(y); - actions->embed(DPair(x, y)); - } - elem->addAttribute("points", oss.str()); - if (stroke) { // draw outline? - elem->addAttribute("stroke", "black"); - elem->addAttribute("stroke-width", XMLString(_penwidth)); - } - } - if (ddist > 0) - elem->addAttribute("stroke-dasharray", XMLString(ddist)); - else if (ddist < 0) - elem->addAttribute("stroke-dasharray", XMLString(_penwidth) + ' ' + XMLString(-ddist)); - actions->appendToPage(elem); - } - reset(); -} - - -/** Stroke a quadratic spline through the midpoints of the lines defined by - * the previously recorded points. The spline starts with a straight line - * from the first point to the mid-point of the first line. The spline ends - * with a straight line from the mid-point of the last line to the last point. - * If ddist=0, the spline is stroked solid. Otherwise ddist denotes the length - * of the dashes and the gaps inbetween. - * @param[in] ddist length of dashes and gaps - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -void TpicSpecialHandler::drawSplines (double ddist, SpecialActions *actions) { - if (!actions || _points.empty()) - return; - const size_t size = _points.size(); - if (size < 3) - drawLines(true, false, ddist, actions); - else { - DPair p(actions->getX(), actions->getY()); - GraphicPath path; - path.moveto(p+_points[0]); - DPair mid = p+_points[0]+(_points[1]-_points[0])/2.0; - path.lineto(mid); - actions->embed(p+_points[0]); - for (size_t i=1; i < size-1; i++) { - const DPair p0 = p+_points[i-1]; - const DPair p1 = p+_points[i]; - const DPair p2 = p+_points[i+1]; - mid = p1+(p2-p1)/2.0; - path.conicto(p1, mid); - actions->embed(mid); - actions->embed((p0+p1*6.0+p2)/8.0, _penwidth); - } - if (_points[0] == _points[size-1]) // closed path? - path.closepath(); - else { - path.lineto(p+_points[size-1]); - actions->embed(p+_points[size-1]); - } - - Color color = actions->getColor(); - color *= _fill; - XMLElementNode *pathElem = new XMLElementNode("path"); - if (_fill >= 0) { - if (_points[0] != _points[size-1]) - path.closepath(); - pathElem->addAttribute("fill", color.rgbString()); - } - else - pathElem->addAttribute("fill", "none"); - - ostringstream oss; - path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); - pathElem->addAttribute("d", oss.str()); - pathElem->addAttribute("stroke", actions->getColor().rgbString()); - pathElem->addAttribute("stroke-width", XMLString(_penwidth)); - if (ddist > 0) - pathElem->addAttribute("stroke-dasharray", XMLString(ddist)); - else if (ddist < 0) - pathElem->addAttribute("stroke-dasharray", XMLString(_penwidth) + ' ' + XMLString(-ddist)); - actions->appendToPage(pathElem); - } - reset(); -} - - -/** Draws an elliptical arc. - * @param[in] cx x-coordinate of arc center - * @param[in] cy y-coordinate of arc center - * @param[in] rx length of horizonal semi-axis - * @param[in] ry length of vertical semi-axis - * @param[in] angle1 starting angle (clockwise) relative to x-axis - * @param[in] angle2 ending angle (clockwise) relative to x-axis - * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ -void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions *actions) { - if (actions) { - const double PI2 = 2*M_PI; - angle1 *= -1; - angle2 *= -1; - if (fabs(angle1) > PI2) { - int n = (int)(angle1/PI2); - angle1 = angle1 - n*PI2; - angle2 = angle2 - n*PI2; - } - - double x = cx + actions->getX(); - double y = cy + actions->getY(); - XMLElementNode *elem=0; - if (fabs(angle1-angle2) >= PI2) { // closed ellipse? - elem = new XMLElementNode("ellipse"); - elem->addAttribute("cx", XMLString(x)); - elem->addAttribute("cy", XMLString(y)); - elem->addAttribute("rx", XMLString(rx)); - elem->addAttribute("ry", XMLString(ry)); - } - else { - if (angle1 < 0) - angle1 = PI2+angle1; - if (angle2 < 0) - angle2 = PI2+angle2; - elem = new XMLElementNode("path"); - int large_arg = fabs(angle1-angle2) > M_PI ? 0 : 1; - int sweep_flag = angle1 > angle2 ? 0 : 1; - if (angle1 > angle2) { - large_arg = 1-large_arg; - sweep_flag = 1-sweep_flag; - } - ostringstream oss; - oss << 'M' << XMLString(x+rx*cos(angle1)) << ',' << XMLString(y+ry*sin(-angle1)) - << 'A' << XMLString(rx) << ',' << XMLString(ry) - << " 0 " - << large_arg << ' ' << sweep_flag << ' ' - << XMLString(x+rx*cos(angle2)) << ',' << XMLString(y-ry*sin(angle2)); - if (_fill >= 0) - oss << 'Z'; - elem->addAttribute("d", oss.str()); - } - elem->addAttribute("stroke-width", _penwidth); - elem->addAttribute("stroke", actions->getColor().rgbString()); - elem->addAttribute("stroke-linecap", "round"); - elem->addAttribute("fill", "none"); - if (_fill >= 0) { - Color color=actions->getColor(); - color *= _fill; - elem->addAttribute("fill", color.rgbString()); - } - else - elem->addAttribute("fill", "none"); - actions->appendToPage(elem); - actions->embed(BoundingBox(cx-rx, cy-ry, cx+rx, cy+ry)); - } - reset(); -} - - -#define cmd_id(c1,c2) ((c1 << 8) | c2) - -bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - if (!prefix || strlen(prefix) != 2) - return false; - - const double mi2bp=0.072; // factor for milli-inch to PS points - StreamInputBuffer ib(is); - BufferInputReader in(ib); - switch (cmd_id(prefix[0], prefix[1])) { - case cmd_id('p','n'): // set pen width in milli-inches - _penwidth = in.getDouble()*mi2bp; - break; - case cmd_id('b','k'): // set fill color to black - _fill = 0; - break; - case cmd_id('w','h'): // set fill color to white - _fill = 1; - break; - case cmd_id('s','h'): // set fill color to given gray level - in.skipSpace(); - _fill = in.eof() ? 0.5 : max(0.0, min(1.0, in.getDouble())); - break; - case cmd_id('t','x'): // set fill pattern - break; - case cmd_id('p','a'): { // add point to path - double x = in.getDouble()*mi2bp; - double y = in.getDouble()*mi2bp; - _points.push_back(DPair(x,y)); - break; - } - case cmd_id('f','p'): // draw solid lines through recorded points; close and fill path if fill color was defined - drawLines(true, _fill >= 0, 0, actions); - break; - case cmd_id('i','p'): // don't draw outlines but close the recorded path and fill the resulting polygon - drawLines(false, true, 0, actions); - break; - case cmd_id('d','a'): // as fp but draw dashed lines - drawLines(true, _fill >= 0, in.getDouble()*72, actions); - break; - case cmd_id('d','t'): // as fp but draw dotted lines - drawLines(true, _fill >= 0, -in.getDouble()*72, actions); - break; - case cmd_id('s','p'): { // draw quadratic splines through recorded points - double ddist = in.getDouble(); - drawSplines(ddist, actions); - break; - } - case cmd_id('a','r'): { // draw elliptical arc - double cx = in.getDouble()*mi2bp; - double cy = in.getDouble()*mi2bp; - double rx = in.getDouble()*mi2bp; - double ry = in.getDouble()*mi2bp; - double a1 = in.getDouble(); - double a2 = in.getDouble(); - drawArc(cx, cy, rx, ry, a1, a2, actions); - break; - } - case cmd_id('i','a'): { // fill elliptical arc - double cx = in.getDouble()*mi2bp; - double cy = in.getDouble()*mi2bp; - double rx = in.getDouble()*mi2bp; - double ry = in.getDouble()*mi2bp; - double a1 = in.getDouble(); - double a2 = in.getDouble(); - if (_fill < 0) - _fill = 1; - drawArc(cx, cy, rx, ry, a1, a2, actions); - if (_fill < 0) - _fill = -1; - break; - } - default: - return false; - } - return true; -} - - -const char** TpicSpecialHandler::prefixes () const { - static const char *pfx[] = {"ar", "bk", "da", "dt", "fp", "ia", "ip", "pa", "pn", "sh", "sp", "tx", "wh", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.h deleted file mode 100644 index 3c5ea9fa876..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TpicSpecialHandler.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -** TpicSpecialHandler.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_TPICSPECIALHANDLER_H -#define DVISVGM_TPICSPECIALHANDLER_H - -#include -#include "Pair.h" -#include "SpecialHandler.h" - -class TpicSpecialHandler : public SpecialHandler, public DVIEndPageListener -{ - public: - TpicSpecialHandler (); - const char* info () const {return "TPIC specials";} - const char* name () const {return "tpic";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions *actions); - - protected: - void dviEndPage (unsigned pageno); - void reset (); - void drawLines (bool stroke, bool fill, double ddist, SpecialActions *actions); - void drawSplines (double ddist, SpecialActions *actions); - void drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions *actions); - - private: - double _penwidth; ///< pen width in PS point units - double _fill; ///< fill intensity [0,1]; if < 0, we don't fill anything - std::vector _points; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.cpp deleted file mode 100644 index 75b3132345b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/************************************************************************* -** TriangularPatch.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include "TriangularPatch.h" - -using namespace std; - -TriangularPatch::TriangularPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TriangularPatch *patch) - : ShadingPatch(cspace) -{ - setPoints(points, edgeflag, patch); - setColors(colors, edgeflag, patch); -} - - -void TriangularPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) { - TriangularPatch *triangularPatch = dynamic_cast(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)) - throw ShadingException("invalid number of vertices in triangular patch definition"); - - _points[0] = points[0]; - switch (edgeflag) { - case 0: - _points[1] = points[1]; - _points[2] = points[2]; - break; - case 1: - _points[1] = triangularPatch->_points[1]; - _points[2] = triangularPatch->_points[2]; - break; - case 2: - _points[1] = triangularPatch->_points[2]; - _points[2] = triangularPatch->_points[0]; - } -} - - -void TriangularPatch::setPoints (const DPair &p1, const DPair &p2, const DPair &p3) { - _points[0] = p1; - _points[1] = p2; - _points[2] = p3; -} - - -void TriangularPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { - TriangularPatch *triangularPatch = dynamic_cast(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)) - throw ShadingException("invalid number of colors in triangular patch definition"); - - _colors[0] = colors[0]; - switch (edgeflag) { - case 0: - _colors[1] = colors[1]; - _colors[2] = colors[2]; - break; - case 1: - _colors[1] = triangularPatch->_colors[1]; - _colors[2] = triangularPatch->_colors[2]; - break; - case 2: - _colors[1] = triangularPatch->_colors[2]; - _colors[2] = triangularPatch->_colors[0]; - } -} - - -void TriangularPatch::setColors (const Color &c1, const Color &c2, const Color &c3) { - _colors[0] = c1; - _colors[1] = c2; - _colors[2] = c3; -} - - -/** Returns the Cartesian coordinates for the barycentric coordinates \f$(u, v, 1-u-v)\f$ - * of a point of the triangle, where \f$u, v \in [0,1]\f$ and \f$u+v \le 1\f$. - * The relation between the vertices of the triangle and their barycentric coordinates - * is as follows: \f$(1,0,0)=p_1, (0,1,0)=p_2, (0,0,1)=p_0\f$. */ -DPair TriangularPatch::valueAt (double u, double v) const { - return _points[0] + (_points[1]-_points[0])*u + (_points[2]-_points[0])*v; -} - - -/** Returns the color at a given point of the triangle. The point must be given - * in barycentric coordinates \f$(u, v, 1-u-v)\f$, where \f$u, v \in [0,1]\f$ - * and \f$u+v \le 1\f$. - * The relation between the vertices of the triangle and their barycentric coordinates - * is as follows: \f$(1,0,0)=p_1, (0,1,0)=p_2, (0,0,1)=p_0\f$. */ -Color TriangularPatch::colorAt (double u, double v) const { - ColorGetter getComponents; - ColorSetter setComponents; - colorQueryFuncs(getComponents, setComponents); - valarray comp[3]; - for (int i=0; i < 3; i++) - (_colors[i].*getComponents)(comp[i]); - Color color; - (color.*setComponents)(comp[0]*(1-u-v) + comp[1]*u + comp[2]*v); - return color; -} - - -Color TriangularPatch::averageColor () const { - return averageColor(_colors[0], _colors[1], _colors[2]); -} - - -/** Compute the average of three given colors depending on the assigned color space. */ -Color TriangularPatch::averageColor (const Color &c1, const Color &c2, const Color &c3) const { - ColorGetter getComponents; - ColorSetter setComponents; - colorQueryFuncs(getComponents, setComponents); - valarray va1, va2, va3; - (c1.*getComponents)(va1); - (c2.*getComponents)(va2); - (c3.*getComponents)(va3); - Color averageColor; - (averageColor.*setComponents)((va1+va2+va3)/3.0); - return averageColor; -} - - -/** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values - * greater than or near 1 are mapped to 1. */ -static inline double snap (double x) { - if (fabs(x) < 0.001) - return 0; - if (fabs(1-x) < 0.001) - return 1; - return x; -} - - -/** Approximate the patch by dividing it into a grid of triangular segments that are filled - * with the average color of the corresponding region. In order to prevent visual gaps between - * adjacent segments due to anti-aliasing, the flag 'overlap' can be set. It enlarges the - * segments so that they overlap with their right and bottom neighbors (which are drawn on - * top of the overlapping regions). - * @param[in] gridsize number of segments per row/column - * @param[in] overlap if true, enlarge each segment to overlap with its right and bottom neighbors - * @param[in] delta reduce level of detail if the segment size is smaller than the given value - * @param[in] callback object notified */ -void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { - if (_colors[0] == _colors[1] && _colors[1] == _colors[2]) { - GraphicPath path; - getBoundaryPath(path); - callback.patchSegment(path, _colors[0]); - } - else { - const double inc = 1.0/gridsize; - for (double u1=0; u1 < 1; u1=snap(u1+inc)) { - double u2 = snap(u1+inc); - double ou2 = (overlap && snap(u2+inc) <= 1 ? snap(u2+inc) : u2); - for (double v1=0; snap(u1+v1) < 1; v1=snap(v1+inc)) { - double v2 = snap(v1+inc); - double ov2 = (overlap && snap(v2+inc) <= 1 ? snap(v2+inc) : v2); - if (!overlap || (snap(u1+ov2) <= 1 && snap(ou2+v1) <= 1)) { - // create triangular segments pointing in the same orientation as the whole patch - GraphicPath path; - path.moveto(valueAt(u1, v1)); - path.lineto(valueAt(ou2, v1)); - path.lineto(valueAt(u1, ov2)); - path.closepath(); - callback.patchSegment(path, averageColor(colorAt(u1, v1), colorAt(u2, v1), colorAt(u1, v2))); - if (snap(u2+v2) <= 1 && (!overlap || inc > delta)) { - // create triangular segments pointing in the opposite direction as the whole patch - path.clear(); - path.moveto(valueAt(u1, v2)); - path.lineto(valueAt(u2, v1)); - path.lineto(valueAt(u2, v2)); - path.closepath(); - callback.patchSegment(path, averageColor(colorAt(u1, v2), colorAt(u2, v1), colorAt(u2, v2))); - } - } - } - } - } -} - - -void TriangularPatch::getBoundaryPath(GraphicPath &path) const { - path.clear(); - path.moveto(_points[0]); - path.lineto(_points[1]); - path.lineto(_points[2]); - path.closepath(); -} - - -void TriangularPatch::getBBox (BoundingBox &bbox) const { - bbox.invalidate(); - bbox.embed(_points[0]); - bbox.embed(_points[1]); - bbox.embed(_points[2]); -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.h deleted file mode 100644 index d18d76ebb0a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/TriangularPatch.h +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* -** TriangularPatch.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_TRIANGULARPATCH_H -#define DVISVGM_TRIANGULARPATCH_H - -#include "Color.h" -#include "Pair.h" -#include "ShadingPatch.h" - -class TriangularPatch : public ShadingPatch -{ - public: - TriangularPatch (); - TriangularPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} - TriangularPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TriangularPatch *patch); - int psShadingType() const {return 4;} - DPair valueAt (double u, double v) const; - Color colorAt (double u, double v) const; - Color averageColor() const; - void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); - void setPoints (const DPair &p1, const DPair &p2, const DPair &p3); - void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); - void setColors (const Color &c1, const Color &c2, const Color &c3); - void approximate (int gridsize, bool overlap, double delta, Callback &listener) const; - void getBBox (BoundingBox &bbox) const; - void getBoundaryPath(GraphicPath &path) const; - int numPoints (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} - int numColors (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} - - protected: - Color averageColor (const Color &c1, const Color &c2, const Color &c3) const; - - private: - DPair _points[3]; - Color _colors[3]; -}; - - -class LatticeTriangularPatch : public TriangularPatch -{ - public: - LatticeTriangularPatch (Color::ColorSpace cspace) : TriangularPatch(cspace) {} - int psShadingType() const {return 5;} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.cpp deleted file mode 100644 index b0a8ace7f3b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.cpp +++ /dev/null @@ -1,4553 +0,0 @@ -/************************************************************************* -** Unicode.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "Unicode.h" - -using namespace std; - - -/** Returns true if c is a valid Unicode point in XML documents. - * XML version 1.0 doesn't allow various Unicode character references - * ( for example). */ -bool Unicode::isValidCodepoint (UInt32 c) { - if ((c & 0xffff) == 0xfffe || (c & 0xffff) == 0xffff) - return false; - - UInt32 ranges[] = { - 0x0000, 0x0020, // basic control characters + space - 0x007f, 0x009f, // use of control characters is discouraged by the XML standard - 0x202a, 0x202e, // bidi control characters - 0xd800, 0xdfff, // High Surrogates are not allowed in XML - 0xfdd0, 0xfdef, // non-characters for internal use by applications - }; - for (size_t i=0; i < sizeof(ranges)/sizeof(UInt32) && c >= ranges[i]; i+=2) - if (c <= ranges[i+1]) - return false; - return true; -} - - -/** Returns a valid Unicode point for the given character code. Character codes - * that are invalid code points because the XML standard forbids or discourages - * their usage, are mapped to the Private Use Zone U+E000-U+F8FF. */ -UInt32 Unicode::charToCodepoint (UInt32 c) { - UInt32 ranges[] = { - 0x0000, 0x0020, 0xe000, // basic control characters + space - 0x007f, 0x009f, 0xe021, // use of control characters is discouraged by the XML standard - 0x202a, 0x202e, 0xe042, // bidi control characters - 0xd800, 0xdfff, 0xe047, // High Surrogates are not allowed in XML - 0xfdd0, 0xfdef, 0xe847, // non-characters for internal use by applications - 0xfffe, 0xffff, 0xe867, - 0x1fffe, 0x1ffff, 0xe869, - 0x2fffe, 0x2ffff, 0xe86b, - 0x3fffe, 0x3ffff, 0xe86d, - 0x4fffe, 0x4ffff, 0xe86f, - 0x5fffe, 0x5ffff, 0xe871, - 0x6fffe, 0x6ffff, 0xe873, - 0x7fffe, 0x7ffff, 0xe875, - 0x8fffe, 0x8ffff, 0xe877, - 0x9fffe, 0x9ffff, 0xe879, - 0xafffe, 0xaffff, 0xe87b, - 0xbfffe, 0xbffff, 0xe87d, - 0xcfffe, 0xcffff, 0xe87f, - 0xdfffe, 0xdffff, 0xe881, - 0xefffe, 0xeffff, 0xe883, - 0xffffe, 0xfffff, 0xe885, - 0x10fffe, 0x10ffff, 0xe887 - }; - for (size_t i=0; i < sizeof(ranges)/sizeof(unsigned) && c >= ranges[i]; i+=3) - if (c <= ranges[i+1]) - return ranges[i+2]+c-ranges[i]; - return c; -} - - -/** Converts a Unicode value to a UTF-8 byte sequence. - * @param[in] c character code - * @return utf8 sequence consisting of 1-4 bytes */ -string Unicode::utf8 (Int32 c) { - string utf8; - if (c >= 0) { - if (c < 0x80) - utf8 += c; - else if (c < 0x800) { - utf8 += 0xC0 + (c >> 6); - utf8 += 0x80 + (c & 0x3F); - } - else if (c < 0x10000) { - utf8 += 0xE0 + (c >> 12); - utf8 += 0x80 + ((c >> 6) & 0x3F); - utf8 += 0x80 + (c & 0x3F); - } - else if (c < 0x110000) { - utf8 += 0xF0 + (c >> 18); - utf8 += 0x80 + ((c >> 12) & 0x3F); - utf8 += 0x80 + ((c >> 6) & 0x3F); - utf8 += 0x80 + (c & 0x3F); - } - // UTF-8 does not support codepoints >= 0x110000 - } - return utf8; -} - - -/* The following table provides a compact mapping from PostScript character names - * to Unicode points. Instead of using the character names directly it maps the - * hash values (xxhash32) of the names to the corresponding code points. - * The character mapping is derived from - * http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt and - * http://tug.ctan.org/macros/latex/contrib/pdfx/glyphtounicode-cmr.tex */ -static struct Hash2Unicode { - UInt32 hash; - UInt32 codepoint; -} hash2unicode[] = { - {0x001cf4a9, 0x0118}, // Eogonek - {0x003b11fb, 0x055f}, // abbreviationmarkarmenian - {0x0050a316, 0x0444}, // afii10086 - {0x0066ddfe, 0x03a5}, // Upsilon - {0x0067a87d, 0x0026}, // ampersand - {0x007399ea, 0x2118}, // weierstrass - {0x009a8cbc, 0x30c8}, // tokatakana - {0x00a8ecc1, 0xfb93}, // gaffinalarabic - {0x00b0f8d6, 0x05b2}, // hatafpatahwidehebrew - {0x00b1b890, 0x2486}, // nineteenparen - {0x00b92975, 0x05a7}, // dargalefthebrew - {0x00c458a3, 0x2154}, // twothirds - {0x00e73988, 0x09b8}, // sabengali - {0x00f475c4, 0x03ee}, // Deicoptic - {0x00fa9974, 0x0303}, // tildecmb - {0x01012c9a, 0x05b4}, // hiriq - {0x0107d6e3, 0x0933}, // lladeva - {0x01127238, 0x3237}, // ideographiccongratulationparen - {0x011abc50, 0x0547}, // Shaarmenian - {0x01297545, 0x25aa}, // H18543 - {0x012d44bc, 0x05d6}, // afii57670 - {0x013044fb, 0x2205}, // emptyset - {0x01422ce1, 0x0486}, // psilipneumatacyrilliccmb - {0x01532d0f, 0x002f}, // slashBig - {0x01571757, 0xfe6b}, // atsmall - {0x01678eeb, 0x066b}, // decimalseparatorpersian - {0x018643fe, 0x091a}, // cadeva - {0x019e6772, 0x3148}, // cieuckorean - {0x019fa822, 0x05de}, // mem - {0x01a69c0c, 0x221a}, // radicalbigg - {0x01cfa7b3, 0x0a3e}, // aamatragurmukhi - {0x01d7c979, 0x3007}, // ideographiczero - {0x02057d9e, 0x05e8}, // reshhatafsegol - {0x0209914d, 0xf7fe}, // Thornsmall - {0x020d70ad, 0x278b}, // twocircleinversesansserif - {0x0239eab1, 0x3131}, // kiyeokkorean - {0x023b0c79, 0xff87}, // nukatakanahalfwidth - {0x023deac8, 0x3183}, // yesieungpansioskorean - {0x02409db2, 0x1ed1}, // ocircumflexacute - {0x02574652, 0x0e1b}, // poplathai - {0x025b8acc, 0x0a47}, // eematragurmukhi - {0x02610d57, 0x2668}, // hotsprings - {0x0292f83b, 0x0e11}, // thonangmonthothai - {0x0293c9db, 0xff49}, // imonospace - {0x029e63cc, 0x21e7}, // arrowupwhite - {0x02a32a9d, 0x0275}, // obarred - {0x02a97908, 0x09f7}, // fournumeratorbengali - {0x02abe0be, 0x2556}, // SF210000 - {0x02acd87a, 0x2461}, // twocircle - {0x02bb8927, 0x0154}, // Racute - {0x02bd043f, 0x3392}, // mhzsquare - {0x02bdc138, 0x304a}, // ohiragana - {0x02c40de7, 0xffe6}, // wonmonospace - {0x02dab625, 0x310c}, // lbopomofo - {0x02df8edf, 0x30e7}, // yosmallkatakana - {0x02e3dfc8, 0x3062}, // dihiragana - {0x02f13fd7, 0x0029}, // parenrightbig - {0x02f32b9b, 0x002f}, // slashbigg - {0x0306380d, 0xff35}, // Umonospace - {0x03170204, 0x0495}, // ghemiddlehookcyrillic - {0x03182c9f, 0x25b4}, // blackuppointingsmalltriangle - {0x0319d343, 0x329e}, // ideographicprintcircle - {0x031ad266, 0x331e}, // kooposquare - {0x03274b72, 0x0018}, // controlCAN - {0x032ef9aa, 0xf7f6}, // Odieresissmall - {0x0334c4d5, 0x0aa7}, // dhagujarati - {0x03396436, 0x1ed0}, // Ocircumflexacute - {0x033b64c4, 0x047f}, // otcyrillic - {0x033e74dc, 0x1e44}, // Ndotaccent - {0x034ec8b1, 0x30b0}, // gukatakana - {0x037b5e30, 0x00b9}, // onesuperior - {0x03993e60, 0xff57}, // wmonospace - {0x03a136c3, 0x0e0b}, // sosothai - {0x03b0103c, 0x2270}, // notlessnorequal - {0x03c2a8d8, 0x1eb3}, // abrevehookabove - {0x03d234c7, 0xfea7}, // khahinitialarabic - {0x03f4da1a, 0x05b8}, // qamatsnarrowhebrew - {0x040b8001, 0x230a}, // floorleftBig - {0x0410b525, 0x0138}, // kgreenlandic - {0x0433eb22, 0x014e}, // Obreve - {0x043f3fc5, 0x040a}, // afii10059 - {0x044589fe, 0x0646}, // afii57446 - {0x044ba421, 0x0585}, // oharmenian - {0x0454dddc, 0x0432}, // afii10067 - {0x048b164e, 0x01c3}, // clickretroflex - {0x048e8b97, 0x0161}, // scaron - {0x0491732e, 0x3186}, // yeorinhieuhkorean - {0x049c65ac, 0x2121}, // telephone - {0x04a45907, 0x041a}, // afii10028 - {0x04c4d94b, 0x05b5}, // tsere1e - {0x04c8ee7d, 0x042d}, // Ereversedcyrillic - {0x04de1db0, 0x0950}, // omdeva - {0x04f4d676, 0x0027}, // quotesingle - {0x04fb1584, 0xf6c4}, // afii10063 - {0x0500f909, 0x0407}, // Yicyrillic - {0x0503fcb5, 0x00b1}, // plusminus - {0x05116c6a, 0x30fc}, // prolongedkana - {0x05302abd, 0x2025}, // twodotleader - {0x053ece0c, 0x3050}, // guhiragana - {0x05574c05, 0x09a3}, // nnabengali - {0x056bac6c, 0x30a3}, // ismallkatakana - {0x058218bb, 0x0386}, // Alphatonos - {0x058691a9, 0x33d2}, // squarelog - {0x059c61cd, 0x0436}, // zhecyrillic - {0x059eb4a3, 0x2085}, // fiveinferior - {0x05a47299, 0x320d}, // hieuhparenkorean - {0x05a53e96, 0x0282}, // shook - {0x05b0f8c3, 0x02b5}, // rhookturnedsuperior - {0x05c5a128, 0xf76b}, // Ksmall - {0x05cee53c, 0x201d}, // quotedblright - {0x05de47fd, 0x1e7f}, // vdotbelow - {0x05e340f3, 0x1e70}, // Tcircumflexbelow - {0x05e8321d, 0x0325}, // ringbelowcmb - {0x05ec5d36, 0x2471}, // eighteencircle - {0x05f03fff, 0x0ae0}, // rrvocalicgujarati - {0x060beb03, 0x0175}, // wcircumflex - {0x0618af48, 0x005c}, // backslashBig - {0x061ad8fc, 0x24ca}, // Ucircle - {0x061f0bd8, 0x2a00}, // circledotdisplay - {0x062d146d, 0xf88b}, // maieklowrightthai - {0x0642035b, 0x0010}, // controlDLE - {0x0646584a, 0x003d}, // equal - {0x064874b1, 0x05d3}, // afii57667 - {0x066433cf, 0x20a4}, // lira - {0x06823c6b, 0xfb4d}, // kafrafehebrew - {0x06894954, 0xff5e}, // asciitildemonospace - {0x069a405d, 0x00e6}, // ae - {0x06b00ffc, 0x0101}, // amacron - {0x06b72f51, 0x27e8}, // angbracketleftbig - {0x06be8647, 0x0442}, // afii10084 - {0x06e56a17, 0x05dc}, // lamedholamdagesh - {0x06ec3366, 0xfe42}, // cornerbracketrightvertical - {0x0700a693, 0x0475}, // izhitsacyrillic - {0x07019244, 0xfb02}, // fl - {0x07072da3, 0x2299}, // circleot - {0x07099ef9, 0xfeae}, // rehfinalarabic - {0x0710dd39, 0x02de}, // rhotichookmod - {0x074aba74, 0x09af}, // yabengali - {0x07562010, 0x09bc}, // nuktabengali - {0x075a830a, 0x21e6}, // arrowleftwhite - {0x076312db, 0x2497}, // sixteenperiod - {0x0767cf10, 0x1ea8}, // Acircumflexhookabove - {0x076c3b34, 0x1ec3}, // ecircumflexhookabove - {0x076dbf41, 0x05b7}, // patah11 - {0x07726745, 0x0e25}, // lolingthai - {0x078184fa, 0x00f7}, // divide - {0x0790751c, 0x2466}, // sevencircle - {0x0793d50d, 0x30bb}, // sekatakana - {0x07a1ce35, 0x0906}, // aadeva - {0x07ab20a8, 0x0ab3}, // llagujarati - {0x07b2b22c, 0x02c6}, // hatwidest - {0x07e20c30, 0x017b}, // Zdot - {0x07e38c67, 0x33bb}, // nwsquare - {0x081dd122, 0x0a38}, // sagurmukhi - {0x082543e5, 0x33a0}, // cmsquaredsquare - {0x083d0b54, 0x3227}, // eightideographicparen - {0x08429fa7, 0x2591}, // ltshade - {0x084b888b, 0x311a}, // abopomofo - {0x085499c4, 0x0925}, // thadeva - {0x086a99d9, 0x01af}, // Uhorn - {0x087038eb, 0xfb20}, // ayinaltonehebrew - {0x08729ac0, 0xed18}, // bracehtipdownright - {0x08905fd6, 0x230b}, // floorrightbigg - {0x089d739a, 0x005a}, // Z - {0x08a131c8, 0x096d}, // sevendeva - {0x08a6b099, 0x02a6}, // ts - {0x08b5de5a, 0x038a}, // Iotatonos - {0x08b78f6b, 0xff86}, // nikatakanahalfwidth - {0x08d57b6a, 0x0019}, // controlEM - {0x08ddb521, 0x3226}, // sevenideographicparen - {0x092aa224, 0x0a90}, // aigujarati - {0x092cd86d, 0x03d6}, // omega1 - {0x09310ab8, 0x027f}, // rfishhookreversed - {0x094ceadc, 0x0047}, // G - {0x09751504, 0x038c}, // Omicrontonos - {0x09790f28, 0x33be}, // kwsquare - {0x09853aa3, 0x01c1}, // clicklateral - {0x099430b2, 0xf7f5}, // Otildesmall - {0x09a03740, 0xfe5b}, // braceleftsmall - {0x09a4b050, 0x0ae8}, // twogujarati - {0x09adf253, 0xf721}, // exclamsmall - {0x09d4b5eb, 0x3388}, // calsquare - {0x09f2217d, 0x00a9}, // copyright - {0x09f9df24, 0x1e0c}, // Ddotbelow - {0x0a040d76, 0x098a}, // uubengali - {0x0a1d800c, 0x0291}, // zcurl - {0x0a3a2809, 0xf767}, // Gsmall - {0x0a3b8eb5, 0x044b}, // yericyrillic - {0x0a46f2f1, 0x0284}, // dotlessjstrokehook - {0x0a5cb3b1, 0x30d6}, // bukatakana - {0x0a5ff1a8, 0xff6b}, // osmallkatakanahalfwidth - {0x0a67f8fb, 0x24b2}, // wparen - {0x0a704676, 0xfccc}, // lammeeminitialarabic - {0x0a8ba8e8, 0x0112}, // Emacron - {0x0a9b47dd, 0x306f}, // hahiragana - {0x0aa2156d, 0xfc0c}, // tehhahisolatedarabic - {0x0abb4ec1, 0x0441}, // afii10083 - {0x0ac66fc0, 0x005b}, // bracketleftBigg - {0x0adbba15, 0x21c0}, // harpoonrightbarbup - {0x0ae79191, 0x01e1}, // adotmacron - {0x0aecd30e, 0x05e8}, // reshpatahhebrew - {0x0af77d49, 0x09ea}, // fourbengali - {0x0b1d2d0d, 0xf6f3}, // tsuperior - {0x0b367d7a, 0x0421}, // Escyrillic - {0x0b4b7082, 0xff62}, // cornerbracketlefthalfwidth - {0x0b6abf22, 0x20aa}, // sheqel - {0x0b7f2b2d, 0x0a5a}, // ghhagurmukhi - {0x0b92d660, 0x32a6}, // ideographiclowcircle - {0x0b9e2621, 0x2665}, // heartsuitblack - {0x0ba5f00c, 0x03cc}, // omicrontonos - {0x0bae12ff, 0xff2a}, // Jmonospace - {0x0bd4abb3, 0x0254}, // oopen - {0x0bd8d304, 0x3215}, // ieungaparenkorean - {0x0bdad647, 0x0970}, // abbreviationsigndeva - {0x0bdb550e, 0x0669}, // ninehackarabic - {0x0be3cda3, 0x1e0b}, // ddotaccent - {0x0bf8ed4a, 0x09f2}, // rupeemarkbengali - {0x0bfa9d4e, 0x05b6}, // afii57795 - {0x0c138c8e, 0x308f}, // wahiragana - {0x0c17017e, 0x02a5}, // dzcurl - {0x0c19fd92, 0x037a}, // ypogegrammeni - {0x0c255ae5, 0x0553}, // Piwrarmenian - {0x0c356707, 0x0625}, // afii57413 - {0x0c678de3, 0x032a}, // bridgebelowcmb - {0x0c810887, 0x0a88}, // iigujarati - {0x0c83c594, 0x1e63}, // sdotbelow - {0x0c8f5261, 0x0164}, // Tcaron - {0x0cacee48, 0xfba8}, // hehinitialaltonearabic - {0x0cbb507c, 0x3036}, // circlepostalmark - {0x0cd99820, 0x05c0}, // paseqhebrew - {0x0cdb81c4, 0x24a2}, // gparen - {0x0ce8bb7e, 0x30d5}, // hukatakana - {0x0cf04968, 0x02be}, // ringhalfright - {0x0d0eb2f0, 0x315d}, // weokorean - {0x0d21bb72, 0x2550}, // SF430000 - {0x0d3a66b8, 0x2309}, // ceilingrightbigg - {0x0d47308f, 0x05d4}, // he - {0x0d747cfe, 0x04c3}, // Kahookcyrillic - {0x0d932b5b, 0x30d2}, // hikatakana - {0x0da4d862, 0x05b6}, // segol13 - {0x0db7d6e4, 0x05d4}, // hehebrew - {0x0dc03ecb, 0x0a9c}, // jagujarati - {0x0dd6f75d, 0x09f6}, // threenumeratorbengali - {0x0de664af, 0x01fa}, // Aringacute - {0x0deddd7b, 0x017a}, // zacute - {0x0df6966e, 0x1e4f}, // otildedieresis - {0x0e0870a7, 0x2713}, // checkmark - {0x0e0aefc5, 0x05af}, // masoracirclehebrew - {0x0e15512a, 0xff43}, // cmonospace - {0x0e157c7d, 0x0166}, // Tbar - {0x0e34eac4, 0x06ba}, // afii57514 - {0x0e359de3, 0x332b}, // paasentosquare - {0x0e35e57d, 0x01f4}, // Gacute - {0x0e6ec8aa, 0x0a40}, // iimatragurmukhi - {0x0e8140cb, 0x2318}, // propellor - {0x0e8e8ac7, 0x25aa}, // blacksmallsquare - {0x0e8ed92c, 0x05b3}, // hatafqamatsquarterhebrew - {0x0e9c1a93, 0x0149}, // quoterightn - {0x0eb0ce00, 0xff30}, // Pmonospace - {0x0ec7e019, 0xfc4b}, // noonjeemisolatedarabic - {0x0ed8b040, 0x33b5}, // nvsquare - {0x0edd0c59, 0x0e35}, // saraiithai - {0x0ee06289, 0x05b0}, // shevaquarterhebrew - {0x0efc1459, 0x09b6}, // shabengali - {0x0f02712c, 0x00ea}, // ecircumflex - {0x0f066e82, 0x33b3}, // mssquare - {0x0f13ed93, 0xf7f8}, // Oslashsmall - {0x0f1a6991, 0x24c4}, // Ocircle - {0x0f2768b1, 0x05b1}, // hatafsegolwidehebrew - {0x0f332d5e, 0x002e}, // period - {0x0f35dd15, 0x04b0}, // Ustraightstrokecyrillic - {0x0f432338, 0x0020}, // space - {0x0f433f21, 0xff7d}, // sukatakanahalfwidth - {0x0f610d68, 0x1e53}, // omacronacute - {0x0f61debf, 0x33b9}, // mvmegasquare - {0x0f8de5e5, 0xff4b}, // kmonospace - {0x0f984d6e, 0xfec0}, // dadmedialarabic - {0x0fcfb12d, 0x016c}, // Ubreve - {0x0fdfc487, 0x02a8}, // tccurl - {0x0ff64b0b, 0x0665}, // fivehackarabic - {0x1001b5d7, 0xfc48}, // meemmeemisolatedarabic - {0x100f790a, 0x20ac}, // Euro - {0x101477b7, 0x216a}, // Elevenroman - {0x1030f103, 0x0918}, // ghadeva - {0x103612b8, 0x2287}, // supersetorequal - {0x10459048, 0x2217}, // asteriskmath - {0x10529f46, 0x0e59}, // ninethai - {0x10656b29, 0x042a}, // afii10044 - {0x10659a4d, 0x0041}, // A - {0x106ab99c, 0x0943}, // rvocalicvowelsigndeva - {0x10827219, 0x01e4}, // Gstroke - {0x1087cbb6, 0x318d}, // araeakorean - {0x10c49213, 0x094d}, // viramadeva - {0x10c6b04c, 0xfee8}, // noonmedialarabic - {0x10e1204e, 0x224c}, // allequal - {0x1112335e, 0x0e24}, // ruthai - {0x1113e9a7, 0x0a87}, // igujarati - {0x11140e23, 0xff50}, // pmonospace - {0x112533be, 0x0446}, // tsecyrillic - {0x1128968b, 0x03dc}, // Digammagreek - {0x113f9725, 0x1ea1}, // adotbelow - {0x11572f90, 0x3240}, // ideographicfestivalparen - {0x1159e298, 0x2484}, // seventeenparen - {0x115b5935, 0xff78}, // kukatakanahalfwidth - {0x115c3cb2, 0x3179}, // kapyeounssangpieupkorean - {0x11672a1e, 0x3051}, // kehiragana - {0x1179ac42, 0x00a0}, // nbspace - {0x1198b8ba, 0x05f1}, // vavyodhebrew - {0x11adf5a7, 0x24a9}, // nparen - {0x11aeb63a, 0x2272}, // lessorequivalent - {0x11ba40f5, 0x05ea}, // tavhebrew - {0x11c11092, 0x1e2c}, // Itildebelow - {0x11c8e4b3, 0x2660}, // spadesuitblack - {0x11d3eac3, 0x3060}, // dahiragana - {0x11d67798, 0xfb33}, // daletdagesh - {0x11e401c1, 0x05d6}, // zayin - {0x1216fef8, 0x328e}, // ideographmetalcircle - {0x1219f723, 0xff6e}, // yosmallkatakanahalfwidth - {0x1224d569, 0xfee4}, // meemmedialarabic - {0x1228548c, 0x05d0}, // alefhebrew - {0x1233afe9, 0x30df}, // mikatakana - {0x123a07fe, 0x05e6}, // tsadihebrew - {0x1242de49, 0x042b}, // Yericyrillic - {0x1246d709, 0x315f}, // wikorean - {0x126c42a3, 0x21d0}, // arrowleftdbl - {0x1278a8d5, 0x3087}, // yosmallhiragana - {0x129b0140, 0x0445}, // afii10087 - {0x12a29be8, 0x03c5}, // upsilon - {0x12bdd9c7, 0x21a6}, // mapsto - {0x12d3e8f7, 0x30c0}, // dakatakana - {0x12def4bb, 0xfeba}, // sadfinalarabic - {0x12e14144, 0xf726}, // ampersandsmall - {0x12e22bb8, 0x33c2}, // amsquare - {0x1329e467, 0x0311}, // breveinvertedcmb - {0x132b7bd0, 0x2a04}, // unionmultitext - {0x132e0697, 0x01b3}, // Yhook - {0x13402162, 0xf6be}, // dotlessj - {0x134d9c31, 0x304c}, // gahiragana - {0x13597fb3, 0x04d9}, // afii10846 - {0x135d6341, 0x33c8}, // dbsquare - {0x13635045, 0x0300}, // gravecmb - {0x1367bcdf, 0xf88a}, // maiekupperleftthai - {0x1369554a, 0x207f}, // nsuperior - {0x136e8d95, 0xf885}, // saraileftthai - {0x1376f153, 0x0403}, // afii10052 - {0x1384d3da, 0x05b4}, // hiriqnarrowhebrew - {0x13868087, 0x0636}, // afii57430 - {0x138b1601, 0x0621}, // hamzafathatanarabic - {0x138fca68, 0x0a30}, // ragurmukhi - {0x13a69297, 0x0917}, // gadeva - {0x13bc5cc6, 0xf88d}, // maithoupperleftthai - {0x13bcc567, 0x25d1}, // circlewithrighthalfblack - {0x13ccaf5f, 0x3061}, // tihiragana - {0x13dc1f9e, 0x05b1}, // hatafsegol - {0x13e2dbb5, 0x1e3a}, // Llinebelow - {0x140e7a7e, 0x0551}, // Coarmenian - {0x14117f5a, 0x1e77}, // ucircumflexbelow - {0x141d63ad, 0x1eda}, // Ohornacute - {0x142c024d, 0x013a}, // lacute - {0x142c46b3, 0x2a06}, // unionsqdisplay - {0x143d707c, 0x05a6}, // merkhakefulalefthebrew - {0x146c75cf, 0x3275}, // ieungacirclekorean - {0x146f18bb, 0xfb36}, // zayindagesh - {0x147a2240, 0x1e81}, // wgrave - {0x1486cc9b, 0x054b}, // Jheharmenian - {0x14ac715c, 0x2473}, // twentycircle - {0x14b421a5, 0x0638}, // zaharabic - {0x14c795cf, 0x0051}, // Q - {0x14d1cd4b, 0x2284}, // notsubset - {0x14d2cd8a, 0x012f}, // iogonek - {0x14eb6d31, 0x02dc}, // tildewider - {0x14f2bc91, 0x1eab}, // acircumflextilde - {0x15045632, 0x05d1}, // bet - {0x1505dc02, 0x3083}, // yasmallhiragana - {0x152785c0, 0x30a1}, // asmallkatakana - {0x1532a7b6, 0x05e7}, // qofsegolhebrew - {0x15642935, 0x23a9}, // braceleftbt - {0x1564e3f1, 0x05b9}, // holam26 - {0x15771621, 0x042c}, // Softsigncyrillic - {0x159ac6ab, 0x0591}, // etnahtafoukhlefthebrew - {0x159b9dc9, 0x24c6}, // Qcircle - {0x15d1c25e, 0x04bf}, // chedescenderabkhasiancyrillic - {0x15dd6b0c, 0x25d9}, // whitecircleinverse - {0x15f64606, 0x33c5}, // cdsquare - {0x15f8ec13, 0x037e}, // questiongreek - {0x1602acd3, 0xff38}, // Xmonospace - {0x1610c2ad, 0x3181}, // yesieungkorean - {0x161db4d0, 0xf76c}, // Lsmall - {0x16393f6d, 0xfef6}, // lamalefmaddaabovefinalarabic - {0x164a5cd1, 0x0058}, // X - {0x164b6531, 0xf7eb}, // Edieresissmall - {0x165341dd, 0x02e0}, // gammasuperior - {0x167b1fac, 0xfebc}, // sadmedialarabic - {0x168b9d05, 0x04d5}, // aiecyrillic - {0x169cceb3, 0x005b}, // bracketleft - {0x16ad260d, 0x0253}, // bhook - {0x16b23c67, 0x3135}, // nieuncieuckorean - {0x16ba0a7a, 0x30a9}, // osmallkatakana - {0x16d5ac91, 0x3018}, // whitetortoiseshellbracketleft - {0x16f9045d, 0x0a16}, // khagurmukhi - {0x17093caa, 0x01e3}, // aemacron - {0x170fc75c, 0x306c}, // nuhiragana - {0x171b516a, 0x0a39}, // hagurmukhi - {0x17301afd, 0x3023}, // threehangzhou - {0x17314b3c, 0xf7a8}, // Dieresissmall - {0x173c8456, 0x338b}, // nfsquare - {0x178d45ae, 0x337e}, // meizierasquare - {0x17a9e49b, 0x322a}, // ideographicmoonparen - {0x17ad5313, 0x09ab}, // phabengali - {0x17da2afa, 0x0335}, // strokeshortoverlaycmb - {0x17deda0e, 0x00ed}, // iacute - {0x17e36acb, 0x05b8}, // qamats - {0x17ef9c62, 0x0a05}, // agurmukhi - {0x180419cd, 0xfc62}, // shaddakasraarabic - {0x18120be8, 0x200b}, // zerowidthspace - {0x18175789, 0x05b3}, // hatafqamatswidehebrew - {0x181f5c91, 0x091f}, // ttadeva - {0x182bd096, 0x0148}, // ncaron - {0x183028bb, 0x04da}, // Schwadieresiscyrillic - {0x1840ed9a, 0xfea0}, // jeemmedialarabic - {0x18492236, 0x0e5a}, // angkhankhuthai - {0x1855a5e3, 0xfe5f}, // numbersignsmall - {0x185b816d, 0x0146}, // ncommaaccent - {0x187ab455, 0x0e42}, // saraothai - {0x1885706c, 0x3157}, // okorean - {0x18905b85, 0x05e8}, // reshsegol - {0x18923bff, 0x2135}, // aleph - {0x1892a13e, 0x005d}, // bracketrightbigg - {0x18a1a8e1, 0x02c2}, // a40 - {0x18a5c10a, 0x2584}, // dnblock - {0x18a72a69, 0xfb3a}, // finalkafdageshhebrew - {0x18b82c53, 0x045c}, // afii10109 - {0x18c46fec, 0x033c}, // seagullbelowcmb - {0x18d47bfd, 0x3298}, // ideographiclaborcircle - {0x18dbddd2, 0x0993}, // obengali - {0x18df8652, 0x2286}, // subsetorequal - {0x18ea53c7, 0x0663}, // afii57395 - {0x18ec3f78, 0x05e8}, // afii57688 - {0x18f0d507, 0xfe9f}, // jeeminitialarabic - {0x18fb8128, 0x25c1}, // a1 - {0x190a56aa, 0xfe5a}, // parenrightsmall - {0x1920c2c2, 0xff65}, // middledotkatakanahalfwidth - {0x1925bd4b, 0xf6f9}, // Lslashsmall - {0x192c8826, 0x2283}, // superset - {0x1940b4fd, 0x2251}, // geometricallyequal - {0x19427103, 0x2a01}, // circleplustext - {0x1946a31f, 0x05ae}, // zinorhebrew - {0x194ec3dd, 0xfb38}, // tetdageshhebrew - {0x195fdeed, 0x3013}, // getamark - {0x197f461f, 0x1e03}, // bdotaccent - {0x1991ce27, 0x007b}, // braceleftBigg - {0x1994a487, 0x0481}, // koppacyrillic - {0x19985117, 0x339a}, // nmsquare - {0x19a1a98b, 0x00ad}, // sfthyphen - {0x19ad4aac, 0xfef2}, // yehfinalarabic - {0x19b22272, 0x3269}, // chieuchcirclekorean - {0x19b344e4, 0x0123}, // gcedilla - {0x19b3f208, 0x05b8}, // qamats27 - {0x19d833fe, 0x02ba}, // dblprimemod - {0x19dea593, 0x0428}, // afii10042 - {0x19f7c320, 0x04d1}, // abrevecyrillic - {0x19fa29b1, 0x327f}, // koreanstandardsymbol - {0x1a00d3da, 0x032b}, // dblarchinvertedbelowcmb - {0x1a260946, 0x0447}, // checyrillic - {0x1a287ed9, 0x0922}, // ddhadeva - {0x1a28dcc1, 0x005b}, // bracketleftBig - {0x1a3b33cb, 0xfed7}, // qafinitialarabic - {0x1a3bf649, 0x05b2}, // hatafpatahhebrew - {0x1a4f3484, 0x0913}, // odeva - {0x1a533d39, 0x0306}, // brevecmb - {0x1ac76244, 0x0425}, // Khacyrillic - {0x1ac90440, 0x010f}, // dcaron - {0x1b240a74, 0x00d8}, // Oslash - {0x1b2b4015, 0xfe65}, // greatersmall - {0x1b33167a, 0xfe3e}, // dblanglebracketrightvertical - {0x1b342691, 0x017c}, // zdot - {0x1b39339b, 0x253c}, // SF050000 - {0x1b3f9c21, 0x1e72}, // Udieresisbelow - {0x1b4399b2, 0x04c7}, // Enhookcyrillic - {0x1b5874ea, 0x091b}, // chadeva - {0x1b8c8992, 0x2122}, // trademark - {0x1ba72293, 0xff03}, // numbersignmonospace - {0x1bbb8fb3, 0x0477}, // izhitsadblgravecyrillic - {0x1bcb2bfd, 0x337d}, // taisyouerasquare - {0x1be98812, 0x24d4}, // ecircle - {0x1c079308, 0x09cc}, // auvowelsignbengali - {0x1c16ebae, 0x0126}, // Hbar - {0x1c2631dd, 0x3385}, // KBsquare - {0x1c56e166, 0xfd3f}, // parenrightaltonearabic - {0x1c70f0f3, 0xf7e7}, // Ccedillasmall - {0x1c94529b, 0x21b5}, // carriagereturn - {0x1cb10674, 0x0a27}, // dhagurmukhi - {0x1cb5367a, 0x0532}, // Benarmenian - {0x1cdb3e05, 0x2514}, // SF020000 - {0x1ce17c08, 0xfea6}, // khahfinalarabic - {0x1ce29209, 0x02cc}, // verticallinelowmod - {0x1ce40996, 0xff3b}, // bracketleftmonospace - {0x1cf31612, 0x0598}, // zarqahebrew - {0x1d2559c8, 0x03b9}, // iota - {0x1d25e3ef, 0x043c}, // emcyrillic - {0x1d420ccb, 0x0430}, // afii10065 - {0x1d91efe5, 0xf6d8}, // dieresisgrave - {0x1d954d85, 0x09a4}, // tabengali - {0x1da7ae8c, 0x00d7}, // multiply - {0x1db92094, 0x053d}, // Xeharmenian - {0x1dbbea92, 0x02e6}, // tonebarhighmod - {0x1dbc2a14, 0x2245}, // congruent - {0x1dbe86c5, 0x246d}, // fourteencircle - {0x1dc0644e, 0x2012}, // figuredash - {0x1ded853e, 0x01cc}, // nj - {0x1df7638a, 0x00e4}, // adieresis - {0x1dfc2837, 0x217a}, // elevenroman - {0x1e0312fa, 0x0290}, // zretroflexhook - {0x1e065c3a, 0xf7f1}, // Ntildesmall - {0x1e1332fd, 0x0287}, // tturned - {0x1e25355a, 0x0461}, // omegacyrillic - {0x1e38c8d8, 0x012a}, // Imacron - {0x1e56afb4, 0xfc61}, // shaddadammaarabic - {0x1e645fd0, 0x00b2}, // twosuperior - {0x1e6cddcb, 0x0563}, // gimarmenian - {0x1e7c9862, 0x338f}, // squarekg - {0x1e82a7c3, 0x2302}, // house - {0x1e860782, 0x0983}, // visargabengali - {0x1e917582, 0x09a2}, // ddhabengali - {0x1ea7d113, 0x031c}, // ringhalfleftbelowcmb - {0x1eae034a, 0x3122}, // anbopomofo - {0x1eae1716, 0x0434}, // afii10069 - {0x1edf9913, 0x1e16}, // Emacronacute - {0x1ef123d5, 0x0413}, // Gecyrillic - {0x1f06ae25, 0xfb31}, // betdageshhebrew - {0x1f0c6a2a, 0x0651}, // shaddafathatanarabic - {0x1f1df6d1, 0x3381}, // nasquare - {0x1f2383d4, 0x0004}, // controlEOT - {0x1f2a4214, 0xfdfa}, // sallallahoualayhewasallamarabic - {0x1f5314ee, 0xf6fc}, // Ringsmall - {0x1f5dc79d, 0xf7b4}, // Acutesmall - {0x1f60dad4, 0x05e8}, // reshhebrew - {0x1f686fbe, 0xff2c}, // Lmonospace - {0x1f90aeb4, 0xff7b}, // sakatakanahalfwidth - {0x1f93ce2b, 0xff33}, // Smonospace - {0x1f9b52d4, 0x0323}, // dotbelowcmb - {0x1faa2fdf, 0x203e}, // overline - {0x1faf20cc, 0x02b9}, // primemod - {0x1fba9d24, 0x1e4a}, // Ncircumflexbelow - {0x1fc00e7e, 0x0050}, // P - {0x1fc99492, 0x3126}, // erbopomofo - {0x1feea4ab, 0x0623}, // afii57411 - {0x20061138, 0x1e02}, // Bdotaccent - {0x200e9513, 0x030f}, // dblgravecmb - {0x2012c16a, 0xf6d4}, // cyrbreve - {0x201a6676, 0x2310}, // logicalnotreversed - {0x201e3ee9, 0x0310}, // candrabinducmb - {0x2024cfd1, 0x0475}, // afii10196 - {0x2038e6d5, 0x307a}, // pehiragana - {0x205d0ec7, 0x03a0}, // Pi - {0x206a255a, 0xf775}, // Usmall - {0x207bf81e, 0xff84}, // tokatakanahalfwidth - {0x2086c569, 0x00d2}, // Ograve - {0x2086fb87, 0xf772}, // Rsmall - {0x208b3b40, 0xfed0}, // ghainmedialarabic - {0x209bfca6, 0x24d5}, // fcircle - {0x20a31ebd, 0x2489}, // twoperiod - {0x20abefc1, 0x0385}, // dialytikatonos - {0x20b8cfa5, 0x0443}, // afii10085 - {0x20bc528f, 0x2042}, // asterism - {0x20ca67b9, 0x09a1}, // ddabengali - {0x20ce09b9, 0xfb7b}, // tchehfinalarabic - {0x20dd36ea, 0x207e}, // parenrightsuperior - {0x20e840a0, 0x30d4}, // pikatakana - {0x2111e869, 0x092a}, // padeva - {0x21185c0e, 0x028e}, // yturned - {0x2130f98f, 0x0aa0}, // tthagujarati - {0x215fc096, 0x000d}, // controlCR - {0x21622652, 0x249e}, // cparen - {0x21669982, 0x0181}, // Bhook - {0x217143de, 0x05b3}, // hatafqamats34 - {0x2173a28b, 0x0295}, // glottalstopreversed - {0x218d5b62, 0x3232}, // ideographichaveparen - {0x21b37808, 0x2477}, // fourparen - {0x21bef9d7, 0x0e06}, // khorakhangthai - {0x21c0f31f, 0x013b}, // Lcommaaccent - {0x21ce0071, 0x2179}, // tenroman - {0x21d28f9e, 0x05e9}, // shin - {0x21f74f30, 0x043e}, // afii10080 - {0x2203033d, 0x019d}, // Nhookleft - {0x22037801, 0x044b}, // afii10093 - {0x220f1331, 0x05db}, // kafhebrew - {0x2221c36b, 0x06f6}, // sixpersian - {0x22351581, 0x059f}, // qarneyparahebrew - {0x223cb30f, 0xfc9f}, // behmeeminitialarabic - {0x225099c3, 0x3149}, // ssangcieuckorean - {0x22542ce4, 0x2207}, // nabla - {0x22702420, 0x3153}, // eokorean - {0x2274db8f, 0xff08}, // parenleftmonospace - {0x2282e86d, 0x00fa}, // uacute - {0x22a883d2, 0x25c7}, // whitediamond - {0x22b082b8, 0x005c}, // backslashBigg - {0x22c93a2b, 0x338d}, // mugsquare - {0x22e3ac9e, 0xff4c}, // lmonospace - {0x2320c842, 0x0277}, // omegalatinclosed - {0x2324e69c, 0x2665}, // heart - {0x2351e945, 0x0a8a}, // uugujarati - {0x2352b38c, 0xf6d7}, // dieresisacute - {0x2356706f, 0x0541}, // Jaarmenian - {0x23679572, 0x1ef1}, // uhorndotbelow - {0x236d79e4, 0x301e}, // quotedblprime - {0x237979f3, 0xff73}, // ukatakanahalfwidth - {0x23947e9f, 0x0266}, // hhook - {0x23b6327c, 0x304f}, // kuhiragana - {0x23b9408d, 0x2208}, // element - {0x23d291f5, 0x0639}, // ainarabic - {0x23d42e51, 0xff0b}, // plusmonospace - {0x23e15f1c, 0xff90}, // mikatakanahalfwidth - {0x23e70b3f, 0x0664}, // afii57396 - {0x23e9f46b, 0xff80}, // takatakanahalfwidth - {0x23ea33c4, 0x30f1}, // wekatakana - {0x23f0f542, 0xff2f}, // Omonospace - {0x2415f58f, 0x3069}, // dohiragana - {0x2419b09a, 0x038f}, // Omegatonos - {0x241b0583, 0x0a9e}, // nyagujarati - {0x241cc39b, 0x007b}, // braceleftbigg - {0x241f6494, 0x3105}, // bbopomofo - {0x2459d6f7, 0x0aea}, // fourgujarati - {0x24688db0, 0x02c1}, // glottalstopreversedmod - {0x24776c38, 0x0343}, // koroniscmb - {0x2479e0d2, 0x3021}, // onehangzhou - {0x249dd6ee, 0x0665}, // afii57397 - {0x24c0efcc, 0x316d}, // rieulyeorinhieuhkorean - {0x24ccbd1b, 0x09e6}, // zerobengali - {0x24d11d48, 0x02c2}, // arrowheadleftmod - {0x24d6b19b, 0xfee7}, // nooninitialarabic - {0x24deab24, 0x25a4}, // squarehorizontalfill - {0x24e9b4e5, 0x21e4}, // arrowtableft - {0x24f5be18, 0x0308}, // dieresiscmb - {0x2527d2da, 0x300c}, // cornerbracketleft - {0x252ef6ac, 0x01de}, // Adieresismacron - {0x2533ec5c, 0x05e8}, // reshtsere - {0x253f33be, 0x006e}, // n - {0x2543ce81, 0x05c1}, // shindothebrew - {0x254b8857, 0x0929}, // nnnadeva - {0x2556a01a, 0x005c}, // backslashbigg - {0x25725d01, 0x0496}, // Zhedescendercyrillic - {0x2592eb8c, 0x1e39}, // ldotbelowmacron - {0x25a29a9e, 0x000a}, // controlLF - {0x25bfabf1, 0x056c}, // liwnarmenian - {0x25c22a8d, 0x0927}, // dhadeva - {0x25c3f8ae, 0xff3e}, // asciicircummonospace - {0x25ca4638, 0x0576}, // nowarmenian - {0x25d83051, 0x0e19}, // nonuthai - {0x25e64388, 0x1ee5}, // udotbelow - {0x25eb8755, 0xff34}, // Tmonospace - {0x25ef68be, 0x0103}, // abreve - {0x25f0117e, 0x095f}, // yyadeva - {0x2614c40e, 0x0aaf}, // yagujarati - {0x262be20f, 0x0471}, // psicyrillic - {0x2637caf5, 0x0932}, // ladeva - {0x263e0b92, 0x09ac}, // babengali - {0x2652690c, 0x3137}, // tikeutkorean - {0x265be8ad, 0x01cf}, // Icaron - {0x265fdad4, 0x05b8}, // qamatshebrew - {0x26621b4d, 0x0072}, // r - {0x2669a6cb, 0x211c}, // Rfraktur - {0x26837556, 0x0048}, // H - {0x26a72a71, 0x3188}, // yoyaekorean - {0x26ab6d3a, 0x1ed9}, // ocircumflexdotbelow - {0x26af8089, 0x304e}, // gihiragana - {0x26b9c1d9, 0x0e30}, // saraathai - {0x26c43ea8, 0x0911}, // ocandradeva - {0x26caa803, 0x21d4}, // arrowdblboth - {0x26cb382e, 0xf8fc}, // bracerighttp - {0x26f6f992, 0x04e4}, // Idieresiscyrillic - {0x26fb496b, 0x3351}, // rittorusquare - {0x27075678, 0x012e}, // Iogonek - {0x271cd3fa, 0x27e8}, // angbracketleftBig - {0x2731451f, 0x0408}, // afii10057 - {0x273977ae, 0x0435}, // afii10070 - {0x27487450, 0x007e}, // asciitilde - {0x275654ea, 0x099b}, // chabengali - {0x275a3e46, 0x09a0}, // tthabengali - {0x275a5b3b, 0x1ee1}, // ohorntilde - {0x27607db6, 0x05b4}, // hiriq2d - {0x27a2d18f, 0x05b9}, // holam32 - {0x27b7bf17, 0x031f}, // plusbelowcmb - {0x27b7cc70, 0xfb2d}, // shindageshsindothebrew - {0x27d62d65, 0x200d}, // afii301 - {0x27d8dd28, 0x00e8}, // egrave - {0x27e6d9df, 0x0271}, // mhook - {0x27f31ec3, 0x3271}, // rieulacirclekorean - {0x283f3216, 0x2075}, // fivesuperior - {0x28898020, 0x0281}, // Rsmallinverted - {0x288edd59, 0x24cc}, // Wcircle - {0x2892f3ea, 0x2a02}, // circlemultiplydisplay - {0x28d9fe2f, 0x0e41}, // saraaethai - {0x28dd4931, 0x3234}, // ideographicnameparen - {0x28e31924, 0x0a6c}, // sixgurmukhi - {0x28e4057d, 0xfc58}, // yehmeemisolatedarabic - {0x28f71acd, 0x0633}, // afii57427 - {0x290ed42e, 0x1e18}, // Ecircumflexbelow - {0x2916bf1f, 0xf7ef}, // Idieresissmall - {0x29287ce1, 0x03d2}, // Upsilon1 - {0x29346ac3, 0x2021}, // daggerdbl - {0x29371ded, 0x1e8f}, // ydotaccent - {0x2951ba53, 0xf6e2}, // commasuperior - {0x29734fd7, 0x092d}, // bhadeva - {0x298e1b46, 0x01ea}, // Oogonek - {0x29958ce9, 0x0005}, // controlENQ - {0x29a8f130, 0x04d4}, // Aiecyrillic - {0x29ab0eda, 0x0146}, // ncedilla - {0x29b0158e, 0x05e7}, // qofshevahebrew - {0x29be1625, 0x0028}, // parenleftbig - {0x29c07bd0, 0x305e}, // zohiragana - {0x29d0597d, 0x262f}, // yinyang - {0x29d51dd2, 0x06d1}, // yehthreedotsbelowarabic - {0x29d5f944, 0x03e4}, // Feicoptic - {0x29e31b8f, 0x05b1}, // hatafsegolhebrew - {0x29e6e487, 0x30cc}, // nukatakana - {0x29e7f6bb, 0x0035}, // five - {0x2a0fca4c, 0x3085}, // yusmallhiragana - {0x2a239937, 0x0375}, // numeralsignlowergreek - {0x2a28d54e, 0x30aa}, // okatakana - {0x2a619f09, 0x2660}, // spade - {0x2a645de3, 0x3091}, // wehiragana - {0x2a64e363, 0x226e}, // notless - {0x2a6a5dc5, 0x3088}, // yohiragana - {0x2a72414c, 0x0e44}, // saraaimaimalaithai - {0x2a8e7779, 0x0ad0}, // omgujarati - {0x2ac0e180, 0x33a6}, // kmcubedsquare - {0x2ac17d0f, 0x00f3}, // oacute - {0x2acd450a, 0x002f}, // slashbig - {0x2ad04347, 0xed12}, // arrowvertexdbl - {0x2ae749c7, 0x00e1}, // aacute - {0x2ae8215f, 0x001d}, // controlGS - {0x2ae8c5a6, 0x21c4}, // arrowrightoverleft - {0x2aedcd2c, 0x09fa}, // issharbengali - {0x2afb134c, 0xfb03}, // ffi - {0x2b2385f1, 0xf760}, // Gravesmall - {0x2b27655e, 0x261c}, // pointingindexleftwhite - {0x2b3ff353, 0x2557}, // SF250000 - {0x2b42ad49, 0xfe55}, // colonsmall - {0x2b5ac1a6, 0x0045}, // E - {0x2b84f841, 0x30a6}, // ukatakana - {0x2b91651d, 0x0319}, // righttackbelowcmb - {0x2b93dd53, 0x0661}, // afii57393 - {0x2b9750e3, 0x2200}, // universal - {0x2b9c968a, 0x0315}, // commaaboverightcmb - {0x2bb5189c, 0x25e3}, // blacklowerlefttriangle - {0x2bb9b9bf, 0x0621}, // hamzafathaarabic - {0x2bd253b1, 0x09bf}, // ivowelsignbengali - {0x2be6415c, 0x05b3}, // hatafqamatshebrew - {0x2beb7c62, 0x013c}, // lcommaaccent - {0x2c0f9c0b, 0x0912}, // oshortdeva - {0x2c15e9f4, 0x091c}, // jadeva - {0x2c1b74f9, 0x2262}, // notidentical - {0x2c4944e4, 0x0393}, // Gamma - {0x2c91b61a, 0x0640}, // kashidaautonosidebearingarabic - {0x2c964b66, 0x334a}, // miribaarusquare - {0x2cb17e35, 0xfec6}, // zahfinalarabic - {0x2cd9d9ec, 0xfc6d}, // behnoonfinalarabic - {0x2cdfcd2a, 0x30cb}, // nikatakana - {0x2cf9daf5, 0x3228}, // nineideographicparen - {0x2d2e3883, 0x2190}, // arrowleft - {0x2d317780, 0xf778}, // Xsmall - {0x2d329c65, 0xfb3c}, // lameddageshhebrew - {0x2d39ea69, 0x019e}, // nlegrightlong - {0x2d3b565d, 0x05ea}, // afii57690 - {0x2d456f79, 0x25e2}, // blacklowerrighttriangle - {0x2d52bd2b, 0x3326}, // dorusquare - {0x2d84140a, 0x0293}, // ezhcurl - {0x2d8d5b1d, 0x33d0}, // lmsquare - {0x2d95d169, 0x3155}, // yeokorean - {0x2d975eca, 0xfb04}, // ffl - {0x2d9ae85a, 0x0661}, // onehackarabic - {0x2d9b14ff, 0xfb6d}, // vehmedialarabic - {0x2da2ea79, 0x313d}, // rieulsioskorean - {0x2daa1b6f, 0x090a}, // uudeva - {0x2db9bc28, 0xf7e3}, // Atildesmall - {0x2e04353d, 0x1ea9}, // acircumflexhookabove - {0x2e043b05, 0xff0a}, // asteriskmonospace - {0x2e10a2b1, 0x0374}, // numeralsigngreek - {0x2e1b300e, 0x05e8}, // reshpatah - {0x2e1eaa7d, 0xfb49}, // shindagesh - {0x2e2c25c0, 0x0392}, // Beta - {0x2e356485, 0x09c2}, // uuvowelsignbengali - {0x2e4224af, 0x05e4}, // afii57684 - {0x2e5e0023, 0x0a20}, // tthagurmukhi - {0x2e647759, 0x33d6}, // molsquare - {0x2e7c6436, 0x3048}, // ehiragana - {0x2e915a9d, 0xfe3b}, // blacklenticularbracketleftvertical - {0x2e9d6cac, 0xf7f0}, // Ethsmall - {0x2e9e14a6, 0x0454}, // ecyrillic - {0x2e9ef541, 0x0192}, // florin - {0x2ea8b970, 0x327a}, // phieuphacirclekorean - {0x2eb22aa1, 0x01dc}, // udieresisgrave - {0x2eb3bdc7, 0x027e}, // rfishhook - {0x2eb455b0, 0x25b6}, // blackrightpointingtriangle - {0x2ec430ea, 0x0078}, // x - {0x2ec8352a, 0x0143}, // Nacute - {0x2eea1838, 0x0170}, // Uhungarumlaut - {0x2efaa14d, 0x3015}, // tortoiseshellbracketright - {0x2f06c380, 0x0a91}, // ocandragujarati - {0x2f0e722f, 0x0021}, // exclam - {0x2f14e4ad, 0x0183}, // btopbar - {0x2f1fd59c, 0xf6d1}, // cyrBreve - {0x2f22b335, 0x305f}, // tahiragana - {0x2f247a45, 0x00b5}, // mu - {0x2f42e9c9, 0x0405}, // afii10054 - {0x2f4b01e9, 0x03e0}, // Sampigreek - {0x2f51a2a5, 0x0591}, // etnahtahebrew - {0x2f5af1cc, 0xfec4}, // tahmedialarabic - {0x2f5c74c9, 0x30a4}, // ikatakana - {0x2f5e2692, 0x033f}, // dbloverlinecmb - {0x2f7e3ce0, 0xfb35}, // vavdagesh65 - {0x2f7fe7da, 0x04ea}, // Obarreddieresiscyrillic - {0x2f8f84ed, 0x3019}, // whitetortoiseshellbracketright - {0x2f9c7ff4, 0x221f}, // orthogonal - {0x2fa13b0c, 0x0309}, // hookcmb - {0x2fa6d960, 0x0e05}, // khokhonthai - {0x2fb88e89, 0x0492}, // Ghestrokecyrillic - {0x2fe066dc, 0x24c8}, // Scircle - {0x2ff9eee3, 0x3231}, // ideographicstockparen - {0x30132e73, 0x2474}, // oneparen - {0x302d72c2, 0xfb2b}, // shinsindothebrew - {0x3033e257, 0x0416}, // Zhecyrillic - {0x3034a6d0, 0x0213}, // rinvertedbreve - {0x3043436d, 0x0208}, // Idblgrave - {0x3046485b, 0x0a41}, // umatragurmukhi - {0x30585e10, 0x0631}, // reharabic - {0x305b2089, 0x006d}, // m - {0x305dc9d7, 0x2480}, // thirteenparen - {0x3097f64c, 0x010c}, // Ccaron - {0x30b4b18c, 0x0e28}, // sosalathai - {0x30c0161e, 0x01d3}, // Ucaron - {0x30c9bc6e, 0x0a1e}, // nyagurmukhi - {0x30cd38cb, 0x33d8}, // pmsquare - {0x30d25d42, 0x2089}, // nineinferior - {0x30e6287a, 0x05e7}, // qofhatafpatah - {0x30eada85, 0x2219}, // bulletoperator - {0x30f64fef, 0x20aa}, // sheqelhebrew - {0x310a4774, 0x337f}, // corporationsquare - {0x31158bc3, 0x339f}, // mmsquaredsquare - {0x3116a838, 0x0647}, // heharabic - {0x312db4ff, 0x2040}, // tie - {0x313237dd, 0xff32}, // Rmonospace - {0x313f3c20, 0x09df}, // yyabengali - {0x3154a912, 0x04ab}, // esdescendercyrillic - {0x31f1489a, 0x0643}, // afii57443 - {0x31f928de, 0x05df}, // finalnun - {0x31fab77d, 0x1eea}, // Uhorngrave - {0x3207407e, 0x046b}, // yusbigcyrillic - {0x3225e9b9, 0x05dc}, // lamedholamhebrew - {0x3238fa28, 0x3004}, // jis - {0x323ea229, 0x33ac}, // gpasquare - {0x324496b3, 0x33bf}, // mwmegasquare - {0x3248fa12, 0xfe5e}, // tortoiseshellbracketrightsmall - {0x324bc39e, 0x22da}, // lessequalorgreater - {0x3266451e, 0x30f2}, // wokatakana - {0x326ca1fd, 0x013f}, // Ldot - {0x328fa9de, 0x230b}, // floorrightBigg - {0x32930f95, 0x046f}, // ksicyrillic - {0x329a975f, 0x0a0a}, // uugurmukhi - {0x329ed55c, 0x04e1}, // dzeabkhasiancyrillic - {0x32d855b8, 0x0ae9}, // threegujarati - {0x32e77f07, 0x22c2}, // intersectiontext - {0x32fd46a7, 0x041e}, // afii10032 - {0x32fe41c6, 0x0667}, // afii57399 - {0x330263f2, 0x3136}, // nieunhieuhkorean - {0x3303dbcb, 0x04b2}, // Hadescendercyrillic - {0x33042de7, 0x1e90}, // Zcircumflex - {0x33231bf5, 0x27e8}, // angbracketleftbigg - {0x335a816e, 0xf739}, // nineoldstyle - {0x335e3259, 0x3022}, // twohangzhou - {0x336106b8, 0x05d7}, // afii57671 - {0x33821f87, 0x05e2}, // ayinhebrew - {0x33849fcd, 0x304d}, // kihiragana - {0x339cb29c, 0x03cb}, // upsilondieresis - {0x339dfd30, 0x2200}, // forall - {0x33a4598f, 0x0e10}, // thothanthai - {0x33dd39ff, 0x0437}, // zecyrillic - {0x33ea63c8, 0x24df}, // pcircle - {0x33f59002, 0x0285}, // eshsquatreversed - {0x340746a2, 0xff4a}, // jmonospace - {0x340dcbd1, 0x21d1}, // arrowdbltp - {0x3425ba3a, 0x056d}, // xeharmenian - {0x342d52b5, 0x25cb}, // whitecircle - {0x34399add, 0x0034}, // four - {0x343b0ff5, 0x1e8b}, // xdotaccent - {0x343f59f3, 0x0437}, // afii10073 - {0x344b950b, 0x031d}, // uptackbelowcmb - {0x34515ec0, 0x01ca}, // NJ - {0x345791f2, 0x027c}, // rlongleg - {0x346086da, 0x2286}, // reflexsubset - {0x3463147c, 0x1e69}, // sdotbelowdotaccent - {0x3471790f, 0xf6f7}, // Dotaccentsmall - {0x3490ad97, 0x047a}, // Omegaroundcyrillic - {0x34a7b989, 0x006f}, // o - {0x34a88183, 0x2640}, // female - {0x34b5f401, 0x016a}, // Umacron - {0x34bab99c, 0x24e0}, // qcircle - {0x34c88fb4, 0x2312}, // arc - {0x34c908a5, 0x1eb4}, // Abrevetilde - {0x34d1f962, 0x05e8}, // reshholamhebrew - {0x34df3d1c, 0x00a1}, // exclamdown - {0x34e969fb, 0x05a0}, // telishagedolahebrew - {0x34f9cd37, 0x010b}, // cdot - {0x35188ac4, 0xfeac}, // thalfinalarabic - {0x351bf85e, 0x0257}, // dhook - {0x351e7136, 0x0482}, // thousandcyrillic - {0x352bce90, 0x00a3}, // sterling - {0x35378756, 0x2591}, // shadelight - {0x35440d94, 0x040c}, // Kjecyrillic - {0x354dad21, 0x0129}, // itilde - {0x35514624, 0x00d6}, // Odieresis - {0x357c478e, 0xf736}, // sixoldstyle - {0x3596098d, 0xfb9f}, // noonghunnafinalarabic - {0x359e9c03, 0x0418}, // Iicyrillic - {0x359f6846, 0x1ebc}, // Etilde - {0x35a9ba78, 0x0a95}, // kagujarati - {0x35b65af3, 0x33af}, // radoverssquaredsquare - {0x35ce2a2d, 0x066a}, // afii57381 - {0x35ddec6f, 0x00eb}, // edieresis - {0x35e5fe3b, 0x3118}, // cbopomofo - {0x3613bad2, 0x011b}, // ecaron - {0x361cb4c9, 0xfb6b}, // vehfinalarabic - {0x361e70b8, 0x0043}, // C - {0x362459fb, 0xfe97}, // tehinitialarabic - {0x362bfa3a, 0xf732}, // twooldstyle - {0x362c9d3a, 0x02b0}, // hsuperior - {0x36678fdf, 0x2326}, // deleteright - {0x3673a47b, 0x05e7}, // qofqamatshebrew - {0x3676afc0, 0x0ac9}, // ocandravowelsigngujarati - {0x368bf72e, 0x0038}, // eight - {0x36aaad0e, 0x307b}, // hohiragana - {0x36d3bc14, 0x0491}, // afii10098 - {0x36d54fb7, 0x015a}, // Sacute - {0x37117bac, 0x059b}, // tevirlefthebrew - {0x372986de, 0x05f3}, // gereshhebrew - {0x373e5e3f, 0xff27}, // Gmonospace - {0x37497fde, 0x25b7}, // a3 - {0x3781d925, 0xf6ed}, // isuperior - {0x37866f5c, 0x00df}, // germandbls - {0x37a73b5a, 0xfee0}, // lammedialarabic - {0x37a77cc1, 0x030b}, // hungarumlautcmb - {0x37b36429, 0xff68}, // ismallkatakanahalfwidth - {0x37b7557e, 0x001c}, // controlFS - {0x37c2175b, 0xfcca}, // lamhahinitialarabic - {0x37c23820, 0x24c5}, // Pcircle - {0x37d669b4, 0x090e}, // eshortdeva - {0x37e460db, 0x308d}, // rohiragana - {0x37e5061e, 0x04a3}, // endescendercyrillic - {0x37f67ca7, 0x029a}, // eopenclosed - {0x380974a8, 0xf735}, // fiveoldstyle - {0x381040c4, 0x310d}, // gbopomofo - {0x381640e0, 0xffe3}, // macronmonospace - {0x381c7e4d, 0x1ece}, // Ohookabove - {0x38201bde, 0x0961}, // llvocalicdeva - {0x38291591, 0x0e2e}, // honokhukthai - {0x3839681b, 0x3055}, // sahiragana - {0x3863c9a6, 0x208e}, // parenrightinferior - {0x386cda71, 0x01f0}, // jcaron - {0x38746563, 0x01b0}, // uhorn - {0x38880d1d, 0x0198}, // Khook - {0x38885f68, 0x091d}, // jhadeva - {0x3889a61f, 0x005b}, // bracketleftbigg - {0x388ccfdd, 0x30e3}, // yasmallkatakana - {0x3896be1c, 0x0025}, // percent - {0x38a80af1, 0x306d}, // nehiragana - {0x38bcbef5, 0x05b7}, // afii57798 - {0x38bebcf5, 0x2552}, // SF510000 - {0x38ce8c39, 0x059a}, // yetivhebrew - {0x38cea50a, 0x24d6}, // gcircle - {0x38d9b559, 0x3003}, // dittomark - {0x38de4662, 0x1e7c}, // Vtilde - {0x38e73ed2, 0x01c0}, // clickdental - {0x38efc9e4, 0x04a6}, // Pemiddlehookcyrillic - {0x391bc4d9, 0xf6d3}, // dblGrave - {0x391e728b, 0x099a}, // cabengali - {0x392c00af, 0x3305}, // intisquare - {0x3934b5de, 0x0e43}, // saraaimaimuanthai - {0x3946429a, 0x3010}, // blacklenticularbracketleft - {0x396642a3, 0x322d}, // ideographicwoodparen - {0x396b44dd, 0x0a3c}, // nuktagurmukhi - {0x396d8b52, 0x0930}, // radeva - {0x3989511a, 0xfc5e}, // shaddadammatanarabic - {0x39918d40, 0x30b6}, // zakatakana - {0x399ac15a, 0x0283}, // esh - {0x39aa6d90, 0x0a83}, // visargagujarati - {0x39b06752, 0x004a}, // J - {0x39d0b19b, 0x00ae}, // registered - {0x39d5a1b1, 0x019c}, // Mturned - {0x39e226d5, 0x05e3}, // afii57683 - {0x39f864d5, 0x2462}, // threecircle - {0x39fd88e8, 0x05a8}, // qadmahebrew - {0x3a029acd, 0x338e}, // squaremg - {0x3a0e66b8, 0x1ee6}, // Uhookabove - {0x3a1089b2, 0x0073}, // s - {0x3a3b69ae, 0x317c}, // siostikeutkorean - {0x3a3c0e00, 0xff9d}, // nkatakanahalfwidth - {0x3a40856d, 0x25a0}, // blacksquare - {0x3a7498f3, 0x05e2}, // ayin - {0x3a777405, 0x0945}, // ecandravowelsigndeva - {0x3a846086, 0xff9c}, // wakatakanahalfwidth - {0x3aa3cfcb, 0x0960}, // rrvocalicdeva - {0x3ab26d21, 0x062f}, // dalarabic - {0x3ade6670, 0x0440}, // afii10082 - {0x3afe4407, 0x25a9}, // squarediagonalcrosshatchfill - {0x3b0367b4, 0x0a6b}, // fivegurmukhi - {0x3b43910b, 0x0e36}, // sarauethai - {0x3b4774fb, 0xfb35}, // vavdageshhebrew - {0x3b6394a8, 0x30e0}, // mukatakana - {0x3b722aff, 0x02bf}, // ringhalfleft - {0x3b86faf7, 0x1e31}, // kacute - {0x3b8c9510, 0x0926}, // dadeva - {0x3b8f536a, 0x0564}, // daarmenian - {0x3b919910, 0x02b4}, // rturnedsuperior - {0x3b92b9ea, 0x1e4b}, // ncircumflexbelow - {0x3b9a0136, 0x2468}, // ninecircle - {0x3b9a26e8, 0x0637}, // taharabic - {0x3bf4dcc7, 0xfea3}, // hahinitialarabic - {0x3bf5a3f3, 0x301d}, // quotedblprimereversed - {0x3c2679f3, 0x25c3}, // whiteleftpointingsmalltriangle - {0x3c4101c7, 0x0a2b}, // phagurmukhi - {0x3c47c401, 0x0196}, // Iotaafrican - {0x3c5c7654, 0x0910}, // aideva - {0x3c6261b4, 0x322e}, // ideographicmetalparen - {0x3c6e58f4, 0x05d5}, // vavhebrew - {0x3c89c6b7, 0x2192}, // arrowright - {0x3c9425ca, 0x0666}, // sixhackarabic - {0x3c9b6897, 0xff0e}, // periodmonospace - {0x3c9bce6c, 0xf7ee}, // Icircumflexsmall - {0x3ca31461, 0x01d1}, // Ocaron - {0x3ca4227b, 0x0120}, // Gdot - {0x3ca9c5ab, 0x0345}, // ypogegrammenigreekcmb - {0x3cb5e1bf, 0x3146}, // ssangsioskorean - {0x3cb6098f, 0x25b9}, // whiterightpointingsmalltriangle - {0x3ccd3832, 0xfc60}, // shaddafathaarabic - {0x3cfd6c60, 0x305a}, // zuhiragana - {0x3cfe2d05, 0x018f}, // Schwa - {0x3d0581a8, 0x313c}, // rieulpieupkorean - {0x3d200141, 0x30c9}, // dokatakana - {0x3d25bc32, 0x2116}, // numero - {0x3d292466, 0x05b1}, // hatafsegol17 - {0x3d30abad, 0x0279}, // rturned - {0x3d3a35a3, 0x0252}, // ascriptturned - {0x3d3c2f4b, 0x309d}, // iterationhiragana - {0x3d44ad12, 0x3210}, // tikeutaparenkorean - {0x3d4a2f11, 0x0187}, // Chook - {0x3d50ceda, 0x21a8}, // arrowupdnbse - {0x3d59a63c, 0x30e2}, // mokatakana - {0x3d64f67d, 0xf6cd}, // DieresisGrave - {0x3d6d45f8, 0x0688}, // ddalarabic - {0x3d794ead, 0x04c8}, // enhookcyrillic - {0x3d888246, 0x300d}, // cornerbracketright - {0x3d93ad95, 0x0171}, // uhungarumlaut - {0x3d987773, 0x03c6}, // phi - {0x3da1e076, 0xfb2a}, // shinshindot - {0x3da24bf2, 0x004d}, // M - {0x3da45134, 0xff3d}, // bracketrightmonospace - {0x3dac6cb7, 0x212e}, // estimated - {0x3db24f7f, 0x04eb}, // obarreddieresiscyrillic - {0x3dc500c0, 0xf6ca}, // Caron - {0x3ddbfa17, 0xfe64}, // lesssmall - {0x3de34107, 0xf6d2}, // cyrFlex - {0x3de84dee, 0x3387}, // GBsquare - {0x3de8cd4d, 0x02c9}, // firsttonechinese - {0x3deb36dc, 0x0570}, // hoarmenian - {0x3dee4810, 0xf7a2}, // centoldstyle - {0x3e08b864, 0x1e1c}, // Ecedillabreve - {0x3e2966c3, 0x25a7}, // squareupperlefttolowerrightfill - {0x3e2ad069, 0x0125}, // hcircumflex - {0x3e2b18e7, 0x05d2}, // gimelhebrew - {0x3e2ddf1a, 0x00fb}, // ucircumflex - {0x3e4b0d7f, 0x2478}, // fiveparen - {0x3e5c6b2e, 0x2086}, // sixinferior - {0x3e78c213, 0x03f3}, // yotgreek - {0x3e7bef16, 0x063a}, // ghainarabic - {0x3e9c0cab, 0x0e0d}, // yoyingthai - {0x3ea9e6c5, 0x044e}, // afii10096 - {0x3eb04aa9, 0xf7f2}, // Ogravesmall - {0x3ec30c4d, 0x0168}, // Utilde - {0x3ed009a2, 0x05e8}, // reshhiriq - {0x3ed6d505, 0x3108}, // fbopomofo - {0x3edc9801, 0x031e}, // downtackbelowcmb - {0x3edf2653, 0x04ba}, // Shhacyrillic - {0x3edfbd48, 0x0959}, // khhadeva - {0x3ee5a28f, 0x0342}, // perispomenigreekcmb - {0x3ef03dd0, 0xf7e5}, // Aringsmall - {0x3ef2c5ca, 0x05df}, // finalnunhebrew - {0x3efcba10, 0x05d3}, // daletpatahhebrew - {0x3efcef55, 0x09a7}, // dhabengali - {0x3f19d4d4, 0x30e5}, // yusmallkatakana - {0x3f35ecb4, 0x0a0f}, // eegurmukhi - {0x3f36dce9, 0x061b}, // afii57403 - {0x3f3b739c, 0x05e7}, // qofpatahhebrew - {0x3f4e4960, 0xf76a}, // Jsmall - {0x3f5ead94, 0x0456}, // icyrillic - {0x3f61f37a, 0x1ea3}, // ahookabove - {0x3f76f3d1, 0x0214}, // Udblgrave - {0x3f77d74f, 0x05e8}, // reshqubuts - {0x3f817391, 0x314b}, // khieukhkorean - {0x3f8b0c34, 0x30c7}, // dekatakana - {0x3fa4349b, 0x0e1d}, // fofathai - {0x3fa5f151, 0x03de}, // Koppagreek - {0x3fbf7ccb, 0x01ae}, // Tretroflexhook - {0x3fddfa91, 0x22ce}, // curlyor - {0x3fe060fb, 0x0147}, // Ncaron - {0x3fe534eb, 0x0e12}, // thophuthaothai - {0x4016947c, 0x246b}, // twelvecircle - {0x401a74d3, 0x06f3}, // threepersian - {0x402ddc95, 0xed1a}, // bracehtipupright - {0x40663d0c, 0xfeb2}, // seenfinalarabic - {0x4069b3b1, 0x24ab}, // pparen - {0x407a7b83, 0x0531}, // Aybarmenian - {0x407de2ef, 0x06d5}, // afii57534 - {0x40882350, 0x0305}, // overlinecmb - {0x4096d7d2, 0x006a}, // j - {0x409d1b5a, 0xff97}, // rakatakanahalfwidth - {0x40b0365e, 0x092f}, // yadeva - {0x40e21552, 0x30de}, // makatakana - {0x40eb54f4, 0x046d}, // yusbigiotifiedcyrillic - {0x413f6e7c, 0x05b4}, // hiriq21 - {0x4144d56c, 0x016d}, // ubreve - {0x414507c4, 0x05b9}, // holamnarrowhebrew - {0x414a0074, 0x3336}, // hekutaarusquare - {0x4156eb7c, 0x3123}, // enbopomofo - {0x415d9061, 0xff42}, // bmonospace - {0x415fae27, 0x0398}, // Theta - {0x4161c806, 0x09e1}, // llvocalicbengali - {0x416a2ede, 0x0e04}, // khokhwaithai - {0x4178dd24, 0x2243}, // asymptoticallyequal - {0x41a22b2c, 0x007c}, // bar - {0x41a40813, 0xff2d}, // Mmonospace - {0x41a4780c, 0x0472}, // afii10147 - {0x41c544c2, 0x1ee7}, // uhookabove - {0x41c76cd5, 0x05d7}, // het - {0x41cb5b30, 0x02db}, // ogonek - {0x41da6e39, 0x098c}, // lvocalicbengali - {0x41e154b7, 0x1edd}, // ohorngrave - {0x41e44ef7, 0x0aaa}, // pagujarati - {0x41efdfc2, 0x33c1}, // mohmsquare - {0x42320627, 0x2495}, // fourteenperiod - {0x4235d221, 0xfecf}, // ghaininitialarabic - {0x423f9221, 0x05a7}, // dargahebrew - {0x4247685c, 0x01ff}, // oslashacute - {0x4252dd77, 0x02c7}, // caron - {0x42716524, 0x0069}, // i - {0x42737aaf, 0x3081}, // mehiragana - {0x427d3f50, 0x04a9}, // haabkhasiancyrillic - {0x42803db2, 0x0030}, // zero - {0x42813ae4, 0x1e24}, // Hdotbelow - {0x428fedda, 0xfb44}, // pedagesh - {0x42bba9f5, 0x30f0}, // wikatakana - {0x42bc1b07, 0x25c4}, // triaglf - {0x42bed72c, 0x33c0}, // kohmsquare - {0x42bf360e, 0x1e6e}, // Tlinebelow - {0x42d74152, 0x0578}, // voarmenian - {0x42e554b2, 0x013b}, // Lcedilla - {0x42ed7ca6, 0x0698}, // jeharabic - {0x42f02b62, 0xfb95}, // gafmedialarabic - {0x42f35290, 0x0064}, // d - {0x42fb2842, 0x3120}, // aubopomofo - {0x42fc57be, 0x3110}, // jbopomofo - {0x42fd43ba, 0x044c}, // afii10094 - {0x42fdb31a, 0x0070}, // p - {0x4305bc9e, 0x0920}, // tthadeva - {0x4306eed3, 0x015d}, // scircumflex - {0x430c20fb, 0x215e}, // seveneighths - {0x430ddad4, 0xff20}, // atmonospace - {0x431e0706, 0x00dc}, // Udieresis - {0x43221a39, 0x1e91}, // zcircumflex - {0x4328cb01, 0x339d}, // squarecm - {0x432e75ab, 0x055d}, // commaarmenian - {0x43399322, 0x026c}, // lbelt - {0x434b10a7, 0x0a86}, // aagujarati - {0x435f906e, 0xfb3e}, // memdageshhebrew - {0x436008b6, 0x3064}, // tuhiragana - {0x436f4b68, 0xfeaa}, // dalfinalarabic - {0x439bf74d, 0xff8b}, // hikatakanahalfwidth - {0x43a7e4d1, 0x0635}, // afii57429 - {0x43d0d1da, 0x0627}, // afii57415 - {0x43d651b4, 0x2663}, // clubsuitblack - {0x43d755d6, 0x2212}, // minus - {0x43dfb761, 0x0592}, // segoltahebrew - {0x4405f04b, 0x05be}, // afii57645 - {0x4425746a, 0x0a18}, // ghagurmukhi - {0x44317cf4, 0x2662}, // diamondsuitwhite - {0x443620cd, 0x00fe}, // thorn - {0x444b0abf, 0x0467}, // yuslittlecyrillic - {0x444f60e7, 0x007f}, // controlDEL - {0x445a3b6e, 0x0447}, // afii10089 - {0x4461957b, 0x041c}, // Emcyrillic - {0x4464a19f, 0x0acb}, // ovowelsigngujarati - {0x4483f355, 0x300f}, // whitecornerbracketright - {0x4487c491, 0x3342}, // hoonsquare - {0x4492e703, 0x0624}, // afii57412 - {0x44979567, 0x0a25}, // thagurmukhi - {0x449b4678, 0xfec3}, // tahinitialarabic - {0x44a78c72, 0x1eef}, // uhorntilde - {0x44b414b4, 0xff0c}, // commamonospace - {0x44d687fa, 0x1e06}, // Blinebelow - {0x450fad6c, 0xf6fd}, // Scaronsmall - {0x45116064, 0x2592}, // shade - {0x453aa0af, 0x09f0}, // ramiddlediagonalbengali - {0x4546a724, 0x05d0}, // afii57664 - {0x454cef44, 0x2642}, // mars - {0x455bcfc1, 0x041d}, // afii10031 - {0x457de97e, 0x3184}, // kapyeounphieuphkorean - {0x457e9e97, 0x1ee8}, // Uhornacute - {0x459f0c78, 0x23a7}, // bracelefttp - {0x45b3d9fd, 0x0a22}, // ddhagurmukhi - {0x45b6c88f, 0x029b}, // Gsmallhook - {0x45b98e95, 0x2163}, // Fourroman - {0x45c29649, 0x1ef4}, // Ydotbelow - {0x45c5ae6b, 0x0165}, // tcaron - {0x45d73e08, 0x0a09}, // ugurmukhi - {0x45e50e5b, 0x0384}, // tonos - {0x45f6e82c, 0x057f}, // tiwnarmenian - {0x45f7d5e0, 0x2084}, // fourinferior - {0x46038ece, 0x00b6}, // paragraph - {0x460c35ae, 0x05b8}, // qamats10 - {0x460ca9f0, 0x30e8}, // yokatakana - {0x4611c6d0, 0x000b}, // controlVT - {0x461bc854, 0x0194}, // Gammaafrican - {0x46271982, 0x23ac}, // bracerightmid - {0x46375ba2, 0x23d0}, // arrowvertex - {0x4652be4f, 0x1e6d}, // tdotbelow - {0x46541398, 0x0111}, // dmacron - {0x46577172, 0x22c3}, // uniondisplay - {0x465ea2f8, 0x3202}, // tikeutparenkorean - {0x46611d40, 0x05bb}, // qubuts31 - {0x466452b7, 0x321b}, // hieuhaparenkorean - {0x467a9a55, 0x055b}, // emphasismarkarmenian - {0x46ab407a, 0x322b}, // ideographicfireparen - {0x46ab921d, 0x3076}, // buhiragana - {0x46ba3911, 0x1e45}, // ndotaccent - {0x46bce40e, 0xfb4f}, // aleflamedhebrew - {0x46c4dd5b, 0x0433}, // afii10068 - {0x46ca3a49, 0x2791}, // eightcircleinversesansserif - {0x46e3006c, 0x055c}, // exclamarmenian - {0x46f10ed2, 0x222a}, // union - {0x46f3948a, 0x05d1}, // bethebrew - {0x46f5f918, 0x05c3}, // afii57658 - {0x46f9c8ca, 0x2195}, // arrowupdn - {0x470d662e, 0x042e}, // IUcyrillic - {0x470da4b8, 0x0453}, // gjecyrillic - {0x471d219d, 0x00f4}, // ocircumflex - {0x47246853, 0xf890}, // maitriupperleftthai - {0x472c971d, 0x1e4d}, // otildeacute - {0x47542f2d, 0x0107}, // cacute - {0x47849b51, 0x05e5}, // finaltsadi - {0x478eb915, 0x014f}, // obreve - {0x47a8409c, 0x05e8}, // reshqubutshebrew - {0x47b12f1d, 0x3009}, // anglebracketright - {0x47b78334, 0x09a5}, // thabengali - {0x47dfd2f2, 0xf7a1}, // exclamdownsmall - {0x47ee62a0, 0x04f1}, // udieresiscyrillic - {0x480265ce, 0x06f2}, // twopersian - {0x48175191, 0x0130}, // Idotaccent - {0x481e50de, 0xfb32}, // gimeldagesh - {0x4825c60d, 0x02c3}, // arrowheadrightmod - {0x482626d7, 0x09ee}, // eightbengali - {0x4826d3e4, 0x3391}, // khzsquare - {0x48270352, 0x1e42}, // Mdotbelow - {0x4848966d, 0x05b2}, // hatafpatah - {0x485d5052, 0x057d}, // seharmenian - {0x48908e05, 0xff28}, // Hmonospace - {0x48a3aad1, 0x1ec8}, // Ihookabove - {0x48adcc47, 0x0160}, // Scaron - {0x48b11825, 0x1e3f}, // macute - {0x48b31eb3, 0x02a3}, // dzaltone - {0x48bbab6b, 0x1e68}, // Sdotbelowdotaccent - {0x48cf810a, 0x27e8}, // angbracketleftBigg - {0x48d0cd97, 0x0460}, // Omegacyrillic - {0x48ed1289, 0x3180}, // ssangieungkorean - {0x48f1ea86, 0x007c}, // verticalbar - {0x49188fb6, 0x261d}, // pointingindexupwhite - {0x491e8c30, 0x2562}, // SF200000 - {0x4928f75b, 0x1e3d}, // lcircumflexbelow - {0x49299271, 0x1eee}, // Uhorntilde - {0x49314f7c, 0x1e96}, // hlinebelow - {0x493c6957, 0x01ec}, // Oogonekmacron - {0x497b2a29, 0x03c8}, // psi - {0x49877605, 0x1ecf}, // ohookabove - {0x49a6c904, 0x00d5}, // Otilde - {0x49a8fbe4, 0x227a}, // precedes - {0x49b28bf6, 0x011f}, // gbreve - {0x49c941c8, 0x0630}, // thalarabic - {0x49cf949f, 0x0011}, // controlDC1 - {0x49d53679, 0x053e}, // Caarmenian - {0x49de9093, 0x0029}, // parenrightBig - {0x49e41b40, 0x0117}, // edotaccent - {0x4a059748, 0x2329}, // angleleft - {0x4a0a939e, 0x02dc}, // ilde - {0x4a0dc7cd, 0x0273}, // nhookretroflex - {0x4a1b8688, 0x0a8f}, // egujarati - {0x4a26a1e2, 0xf88c}, // maieklowleftthai - {0x4a67a4cd, 0x33c6}, // coverkgsquare - {0x4a6dc3e0, 0x017c}, // zdotaccent - {0x4a8f25d9, 0x0134}, // Jcircumflex - {0x4a911686, 0x042a}, // Hardsigncyrillic - {0x4aa9a643, 0x220c}, // notcontains - {0x4ab184ff, 0x221a}, // radicalbt - {0x4ab871b2, 0x05a9}, // telishaqetanahebrew - {0x4ad4b644, 0x066c}, // thousandsseparatorpersian - {0x4ad593e8, 0x05e7}, // qofpatah - {0x4adaae02, 0x30bc}, // zekatakana - {0x4b13bfc7, 0x261f}, // pointingindexdownwhite - {0x4b146e46, 0x0076}, // v - {0x4b1cfc1b, 0x0052}, // R - {0x4b214add, 0x05e8}, // reshhatafsegolhebrew - {0x4b69c8eb, 0x3200}, // kiyeokparenkorean - {0x4b7a4380, 0x326b}, // thieuthcirclekorean - {0x4b8cb1d3, 0x315a}, // oekorean - {0x4b904ad7, 0x09ec}, // sixbengali - {0x4bc3db0d, 0xfe8e}, // aleffinalarabic - {0x4bcb1484, 0x0997}, // gabengali - {0x4bf3941c, 0x04e7}, // odieresiscyrillic - {0x4c1231bd, 0xfebe}, // dadfinalarabic - {0x4c224e3d, 0x0216}, // Uinvertedbreve - {0x4c31d446, 0x05b6}, // segolwidehebrew - {0x4c330dc7, 0x2303}, // control - {0x4c539c26, 0xff45}, // emonospace - {0x4c550d84, 0x0286}, // eshcurl - {0x4c63022b, 0x00ac}, // logicalnot - {0x4c636f96, 0xfe4c}, // overlinedblwavy - {0x4ca2293a, 0x0549}, // Chaarmenian - {0x4ca721bb, 0x24d9}, // jcircle - {0x4cbb6976, 0x054c}, // Raarmenian - {0x4cbfbcf5, 0xf6cb}, // Dieresis - {0x4cc2766b, 0x0474}, // Izhitsacyrillic - {0x4ccaa98f, 0x0292}, // ezh - {0x4cda32dd, 0x2592}, // shademedium - {0x4cf1d7c1, 0xfb2c}, // shindageshshindot - {0x4d08f8de, 0x278c}, // threecircleinversesansserif - {0x4d18f1c3, 0x01e5}, // gstroke - {0x4d3fee14, 0x2207}, // gradient - {0x4d5e2eea, 0x09c7}, // evowelsignbengali - {0x4d66ad61, 0x0259}, // schwa - {0x4d6f0f44, 0x03b6}, // zeta - {0x4d76cbca, 0x0939}, // hadeva - {0x4d773822, 0x007d}, // bracerightbig - {0x4da2ea17, 0x30f7}, // vakatakana - {0x4dad3b1f, 0xff47}, // gmonospace - {0x4db4092d, 0x05b2}, // hatafpatahquarterhebrew - {0x4dc635ef, 0x03c2}, // sigmafinal - {0x4dccadbd, 0xf6ea}, // bsuperior - {0x4dd49001, 0x04ae}, // Ustraightcyrillic - {0x4dd4e51e, 0x05e3}, // finalpe - {0x4ddb0ff8, 0x3014}, // tortoiseshellbracketleft - {0x4ddbe970, 0x0054}, // T - {0x4ddd9ef4, 0x3296}, // ideographicfinancialcircle - {0x4dedf33d, 0xff8d}, // hekatakanahalfwidth - {0x4def9c7c, 0x2327}, // clear - {0x4dfb4b2a, 0x247b}, // eightparen - {0x4e03617a, 0x0ac1}, // uvowelsigngujarati - {0x4e0fdced, 0x0a2d}, // bhagurmukhi - {0x4e1cdd9c, 0x247d}, // tenparen - {0x4e63a83b, 0x0642}, // qafarabic - {0x4e7d8096, 0xff53}, // smonospace - {0x4e8356bc, 0x0108}, // Ccircumflex - {0x4eb853e7, 0x3384}, // kasquare - {0x4ec3d2dc, 0xfccb}, // lamkhahinitialarabic - {0x4ec752cf, 0x2022}, // bullet - {0x4ef94777, 0x323b}, // ideographicstudyparen - {0x4efcaf3c, 0x01ff}, // ostrokeacute - {0x4f1d81af, 0x05bb}, // qubuts - {0x4f1d9a74, 0x1e15}, // emacrongrave - {0x4f1fbad2, 0x33b2}, // mussquare - {0x4f238367, 0x0270}, // mlonglegturned - {0x4f23d8fd, 0xfeda}, // kaffinalarabic - {0x4f2d09de, 0x0662}, // twohackarabic - {0x4f2efda5, 0xff07}, // quotesinglemonospace - {0x4f30c414, 0x01c6}, // dzcaron - {0x4f4be9c8, 0x3129}, // iubopomofo - {0x4f6c2078, 0x00e5}, // aring - {0x4f9b207b, 0x06c1}, // hehaltonearabic - {0x4f9deafc, 0x03c4}, // tau - {0x4fb92256, 0x216b}, // Twelveroman - {0x4fdd1a2b, 0x300a}, // dblanglebracketleft - {0x4feaecfe, 0x22c3}, // uniontext - {0x4fef28fa, 0xf6c3}, // commaaccent - {0x5004c9ab, 0x09ed}, // sevenbengali - {0x50166be8, 0x049a}, // Kadescendercyrillic - {0x501dd48e, 0x2229}, // intersection - {0x5024fa7b, 0x260f}, // whitetelephone - {0x5026482c, 0x228f}, // a60 - {0x502bdceb, 0x3290}, // ideographsuncircle - {0x503133b5, 0x0009}, // controlHT - {0x50604a35, 0x05e7}, // qofqubuts - {0x507713d7, 0x2a02}, // circlemultiplytext - {0x50794cf3, 0x255d}, // SF260000 - {0x508090a0, 0xff82}, // tukatakanahalfwidth - {0x50993bc3, 0x05dd}, // finalmemhebrew - {0x509ec6af, 0x0490}, // Gheupturncyrillic - {0x50a87245, 0x05b9}, // holamwidehebrew - {0x50be3a5b, 0x3189}, // yoikorean - {0x50cc5524, 0x00be}, // threequarters - {0x50cc8cef, 0x24a3}, // hparen - {0x50fb6106, 0x30c1}, // tikatakana - {0x510f444c, 0x0662}, // afii57394 - {0x511118c0, 0x05b8}, // qamatsqatanquarterhebrew - {0x51250a43, 0x0ab9}, // hagujarati - {0x5125d1fa, 0x25a1}, // whitesquare - {0x513a52c9, 0x2510}, // SF030000 - {0x51439af3, 0x064e}, // afii57454 - {0x5147986a, 0xff5b}, // braceleftmonospace - {0x514d7298, 0x3238}, // ideographiclaborparen - {0x5153d63f, 0xf895}, // maichattawalowleftthai - {0x515692ea, 0x0414}, // Decyrillic - {0x51616742, 0x328c}, // ideographwatercircle - {0x51817d65, 0xfca1}, // tehjeeminitialarabic - {0x51969939, 0x03ba}, // kappa - {0x51ca7ab6, 0x00f6}, // odieresis - {0x51cbc424, 0x014d}, // omacron - {0x51d34569, 0x00e9}, // eacute - {0x51e4f41a, 0xf6db}, // trademarkserif - {0x51e6847c, 0x05b2}, // hatafpatah16 - {0x51ed3cb2, 0x00af}, // macron - {0x51f006ea, 0x24af}, // tparen - {0x51f3c5bb, 0x2082}, // twoinferior - {0x51fee10e, 0x2210}, // coproducttext - {0x52099e7d, 0x3267}, // ieungcirclekorean - {0x5241ded3, 0x0428}, // Shacyrillic - {0x5247cafc, 0x0691}, // afii57513 - {0x524c924c, 0x02d6}, // plusmod - {0x525a3324, 0x2606}, // whitestar - {0x5282fafa, 0x0e09}, // chochingthai - {0x528afecc, 0xfb89}, // ddalfinalarabic - {0x52beac4f, 0x25bf}, // whitedownpointingsmalltriangle - {0x52e15cc8, 0x24b6}, // Acircle - {0x52f72574, 0x3322}, // sentisquare - {0x530e1856, 0x05dd}, // finalmem - {0x531472bf, 0x05bb}, // qubutswidehebrew - {0x531963a3, 0x0a73}, // uragurmukhi - {0x531c6e1f, 0x315b}, // yokorean - {0x532f469f, 0x093d}, // avagrahadeva - {0x533e9388, 0x02bc}, // afii57929 - {0x537b0d36, 0x0466}, // Yuslittlecyrillic - {0x5382e913, 0x002f}, // slashBigg - {0x5396a4ab, 0x2a04}, // unionmultidisplay - {0x53b3b784, 0xfb4a}, // tavdagesh - {0x53ca8524, 0x099d}, // jhabengali - {0x53d60270, 0x05d3}, // dalethiriqhebrew - {0x53d8dfb9, 0x3115}, // shbopomofo - {0x53e66e1a, 0x0476}, // Izhitsadblgravecyrillic - {0x53f49c2a, 0x066c}, // thousandsseparatorarabic - {0x53f951b5, 0x056f}, // kenarmenian - {0x53febc17, 0x05e8}, // reshqamatshebrew - {0x540493c8, 0x03b1}, // alpha - {0x540c5f40, 0x0552}, // Yiwnarmenian - {0x542576f9, 0x0a07}, // igurmukhi - {0x542f1e7a, 0x0151}, // ohungarumlaut - {0x54761f15, 0x0631}, // afii57425 - {0x54820079, 0x04df}, // zedieresiscyrillic - {0x548a6dde, 0x0451}, // iocyrillic - {0x5494ff15, 0x053c}, // Liwnarmenian - {0x54cc0e6b, 0x0212}, // Rinvertedbreve - {0x54d729fd, 0xf6bf}, // LL - {0x54dfda54, 0xfe44}, // whitecornerbracketrightvertical - {0x54f8c0f2, 0x1e78}, // Utildeacute - {0x55003750, 0x05b0}, // shevanarrowhebrew - {0x55021a5a, 0x0644}, // lamarabic - {0x5509dd21, 0xf7bf}, // questiondownsmall - {0x550a9f23, 0x0452}, // djecyrillic - {0x550d7456, 0x0061}, // a - {0x5512ec97, 0x0067}, // g - {0x55164cbd, 0xf7fb}, // Ucircumflexsmall - {0x552705b9, 0xf7e1}, // Aacutesmall - {0x552e72ea, 0x1e8d}, // xdieresis - {0x5532b75e, 0x3044}, // ihiragana - {0x554f67fa, 0x1e4e}, // Otildedieresis - {0x556bcf7c, 0xff1f}, // questionmonospace - {0x5575c7a8, 0x09a8}, // nabengali - {0x557f8e27, 0x1ee0}, // Ohorntilde - {0x558d2385, 0x0318}, // lefttackbelowcmb - {0x55aa99d5, 0xfe3f}, // anglebracketleftvertical - {0x55b44317, 0x1ef2}, // Ygrave - {0x55b8ceec, 0xed6b}, // radicalvertex - {0x55c6e8cd, 0x0aac}, // bagujarati - {0x55e74cbe, 0xf8fb}, // bracketrightbt - {0x55e81ebb, 0x3124}, // angbopomofo - {0x56000715, 0x33b0}, // pssquare - {0x560f90ad, 0x25e4}, // blackupperlefttriangle - {0x56200891, 0x092b}, // phadeva - {0x56217879, 0x0596}, // tipehalefthebrew - {0x56362764, 0x24d0}, // acircle - {0x565aa859, 0x30a8}, // ekatakana - {0x565d95fc, 0x3109}, // dbopomofo - {0x566af414, 0xed6a}, // radicaltp - {0x567e8709, 0xf6f4}, // Brevesmall - {0x569f0bdc, 0x05e7}, // qofqamats - {0x56a0101f, 0x04ac}, // Tedescendercyrillic - {0x56d036b9, 0x000f}, // controlSI - {0x56deae12, 0x0102}, // Abreve - {0x57050efe, 0x0145}, // Ncommaaccent - {0x5708e98e, 0x3154}, // ekorean - {0x570da3d3, 0xf8e9}, // copyrightsans - {0x5713d355, 0x2790}, // sevencircleinversesansserif - {0x575226bc, 0xf8f7}, // parenrightex - {0x57687403, 0x0e08}, // chochanthai - {0x576959da, 0x04b7}, // chedescendercyrillic - {0x577fdcc5, 0x033a}, // bridgeinvertedbelowcmb - {0x578594f4, 0x0e47}, // maitaikhuthai - {0x579e8de2, 0x2074}, // foursuperior - {0x57a10bfe, 0x0435}, // iecyrillic - {0x57a26403, 0xf6eb}, // dsuperior - {0x57c4d153, 0xfb1f}, // yodyodpatahhebrew - {0x57c8c90f, 0x313b}, // rieulmieumkorean - {0x57cea503, 0xff17}, // sevenmonospace - {0x57fc3d5e, 0x255b}, // SF280000 - {0x58064efc, 0x0448}, // shacyrillic - {0x580bc6b8, 0x2320}, // integraltop - {0x580e0aa6, 0x005e}, // asciicircum - {0x5817c838, 0x3141}, // mieumkorean - {0x581d6ffc, 0x1ef8}, // Ytilde - {0x58246165, 0x0152}, // OE - {0x582e4f2f, 0x02a1}, // glottalstopstroke - {0x58408a1e, 0x2321}, // integralbottom - {0x584e8397, 0x263a}, // whitesmilingface - {0x5855c496, 0x0465}, // eiotifiedcyrillic - {0x587d22eb, 0x208d}, // parenleftinferior - {0x58a61c85, 0x1e9a}, // arighthalfring - {0x58ab0a67, 0x0544}, // Menarmenian - {0x58ae8d36, 0x05e8}, // reshhatafpatah - {0x58ba15a9, 0x24c9}, // Tcircle - {0x58c52193, 0x221a}, // radical - {0x58df0572, 0x0301}, // acutecmb - {0x58dfd388, 0x3187}, // yoyakorean - {0x58e61a1f, 0x05e8}, // resh - {0x58ea1dd9, 0x0650}, // afii57456 - {0x59322213, 0xf7e8}, // Egravesmall - {0x593b3f38, 0x0aa1}, // ddagujarati - {0x5951351c, 0x0109}, // ccircumflex - {0x59664498, 0xff21}, // Amonospace - {0x597231b2, 0x1e00}, // Aringbelow - {0x598309ec, 0x1edc}, // Ohorngrave - {0x598631c5, 0x24c1}, // Lcircle - {0x59b5003e, 0x3274}, // siosacirclekorean - {0x59b9b187, 0x0075}, // u - {0x59be0f3a, 0xff7f}, // sokatakanahalfwidth - {0x59c46f70, 0x3299}, // ideographicsecretcircle - {0x59c80d40, 0x2482}, // fifteenparen - {0x59d6d87b, 0xff74}, // ekatakanahalfwidth - {0x59d7f689, 0x3393}, // ghzsquare - {0x59eccfd0, 0x05a3}, // munahlefthebrew - {0x5a1aca3c, 0xfe34}, // wavyunderscorevertical - {0x5a24f67c, 0x03b4}, // delta - {0x5a3b6461, 0xfeb8}, // sheenmedialarabic - {0x5a532aa6, 0x0586}, // feharmenian - {0x5a575dc4, 0x0582}, // yiwnarmenian - {0x5a62c8e8, 0x005c}, // backslash - {0x5a8d2a4a, 0x09c3}, // rvocalicvowelsignbengali - {0x5a963c7c, 0x0e02}, // khokhaithai - {0x5acd345c, 0x339c}, // squaremm - {0x5ad6e1c9, 0x05e7}, // qofsegol - {0x5af634c5, 0x059e}, // gershayimaccenthebrew - {0x5b041347, 0x0581}, // coarmenian - {0x5b0fd985, 0x0360}, // tildedoublecmb - {0x5b1907c0, 0x30a5}, // usmallkatakana - {0x5b1da33a, 0x2206}, // increment - {0x5b1dbca0, 0x0aa6}, // dagujarati - {0x5b426364, 0x30cf}, // hakatakana - {0x5b426591, 0xfeb7}, // sheeninitialarabic - {0x5b46f9e7, 0x2080}, // zeroinferior - {0x5b54a5c3, 0x05e1}, // afii57681 - {0x5b5f52e7, 0x0421}, // afii10035 - {0x5b68b5ed, 0xf892}, // maitrilowleftthai - {0x5b6ab184, 0x25ef}, // largecircle - {0x5b6f6c30, 0x0003}, // controlETX - {0x5b720455, 0x014c}, // Omacron - {0x5b72ad21, 0x03d5}, // phi1 - {0x5b785975, 0x02a7}, // tesh - {0x5b7a64f2, 0x0597}, // reviahebrew - {0x5bbfa15f, 0x25c4}, // blackleftpointingpointer - {0x5bc1fa37, 0xfb47}, // qofdageshhebrew - {0x5be94211, 0xff24}, // Dmonospace - {0x5beb1e0f, 0x24cf}, // Zcircle - {0x5c0e8b47, 0x0426}, // afii10040 - {0x5c185e06, 0x0250}, // aturned - {0x5c299659, 0x250c}, // SF010000 - {0x5c337c81, 0xff8a}, // hakatakanahalfwidth - {0x5c3478b9, 0xff3a}, // Zmonospace - {0x5c349e9d, 0x30c5}, // dukatakana - {0x5c352033, 0x092c}, // badeva - {0x5c3b9279, 0x307e}, // mahiragana - {0x5c3eecc5, 0x2561}, // SF190000 - {0x5c4a060e, 0x0e29}, // sorusithai - {0x5c6b0ced, 0x05b8}, // qamats33 - {0x5c71c76c, 0x24b8}, // Ccircle - {0x5c738b36, 0xf776}, // Vsmall - {0x5c7f4966, 0x01b8}, // Ezhreversed - {0x5c97be88, 0x0a2a}, // pagurmukhi - {0x5c9a7487, 0x30ec}, // rekatakana - {0x5c9f86aa, 0x05e8}, // reshshevahebrew - {0x5ca0edc2, 0x01e7}, // gcaron - {0x5cad2e17, 0x0679}, // tteharabic - {0x5cb64e9e, 0x0150}, // Ohungarumlaut - {0x5cb98a11, 0x05e9}, // afii57689 - {0x5cc203b0, 0x09eb}, // fivebengali - {0x5cde4fa9, 0xff39}, // Ymonospace - {0x5ce216d6, 0x02bb}, // commaturnedmod - {0x5ce89c18, 0x028c}, // vturned - {0x5cee9de2, 0x333b}, // peezisquare - {0x5d053ab9, 0x334d}, // meetorusquare - {0x5d06b34a, 0x01f5}, // gacute - {0x5d185c29, 0x0aec}, // sixgujarati - {0x5d23e967, 0x019a}, // lbar - {0x5d24fed7, 0x047d}, // omegatitlocyrillic - {0x5d26ca2e, 0x0996}, // khabengali - {0x5d32256c, 0x25c6}, // blackdiamond - {0x5d333915, 0x2234}, // therefore - {0x5d42ce05, 0x30c2}, // dikatakana - {0x5d4fa82e, 0xf724}, // dollaroldstyle - {0x5d590cb1, 0x05bb}, // qubutsnarrowhebrew - {0x5d71a05b, 0x0017}, // controlETB - {0x5d85b369, 0x05b8}, // qamats29 - {0x5d8c507f, 0xfb47}, // qofdagesh - {0x5da58253, 0x30d0}, // bakatakana - {0x5dba07ed, 0x22a5}, // perpendicular - {0x5dbeec87, 0x01cd}, // Acaron - {0x5de3b63c, 0x09cb}, // ovowelsignbengali - {0x5df717ca, 0x05e8}, // reshtserehebrew - {0x5e0aac56, 0x0200}, // Adblgrave - {0x5e1c8dfa, 0x05b0}, // sheva2e - {0x5e27fa57, 0xff6d}, // yusmallkatakanahalfwidth - {0x5e36a670, 0xfe33}, // underscorevertical - {0x5e483ddc, 0x3277}, // chieuchacirclekorean - {0x5e4f2fbb, 0x1e65}, // sacutedotaccent - {0x5ea7176f, 0x02d9}, // dotaccent - {0x5edd1e19, 0xff25}, // Emonospace - {0x5edd9086, 0x003a}, // colon - {0x5eddf92b, 0x0044}, // D - {0x5ee2af9c, 0x0e58}, // eightthai - {0x5f03252d, 0x0136}, // Kcedilla - {0x5f0ec9e9, 0x039a}, // Kappa - {0x5f1bf33a, 0x1e17}, // emacronacute - {0x5f4a5f07, 0x0abe}, // aavowelsigngujarati - {0x5f5c5d5f, 0x041b}, // Elcyrillic - {0x5f63748c, 0x03e6}, // Kheicoptic - {0x5f6ca553, 0x230a}, // floorleftbigg - {0x5f7dc76d, 0x033b}, // squarebelowcmb - {0x5f881d5c, 0x3160}, // yukorean - {0x5f8f63e2, 0x24a0}, // eparen - {0x5f99c0ac, 0x01ad}, // thook - {0x5fa5f5cc, 0xfefa}, // lamalefhamzabelowfinalarabic - {0x5fb56903, 0x095d}, // rhadeva - {0x5fbeac33, 0x028b}, // vhook - {0x5fd46519, 0xf6ef}, // msuperior - {0x5fe9065e, 0x042e}, // afii10048 - {0x6037ae88, 0x1ef3}, // ygrave - {0x603b5882, 0x2287}, // reflexsuperset - {0x603b9d93, 0x00d3}, // Oacute - {0x603ff393, 0x1e6c}, // Tdotbelow - {0x60753fe5, 0x066d}, // afii63167 - {0x607c93ed, 0x01b2}, // Vhook - {0x60a46930, 0x0197}, // Istroke - {0x60a4c80a, 0x30ee}, // wasmallkatakana - {0x60ac2314, 0x25cc}, // dottedcircle - {0x60ba7236, 0x000e}, // controlSO - {0x60d57bed, 0x0aa4}, // tagujarati - {0x60e1bf57, 0x1e0d}, // ddotbelow - {0x60ebe651, 0x1ed8}, // Ocircumflexdotbelow - {0x60f5a9fa, 0x03b7}, // eta - {0x6106119c, 0xff37}, // Wmonospace - {0x610b31e6, 0x01f1}, // DZ - {0x6114c811, 0x1ef0}, // Uhorndotbelow - {0x6121a3f6, 0x0e4d}, // nikhahitthai - {0x61239a5a, 0x01c2}, // clickalveolar - {0x6143b142, 0x1e67}, // scarondotaccent - {0x61503571, 0x027b}, // rhookturned - {0x6154bc05, 0x043b}, // afii10077 - {0x617c687c, 0x01a2}, // Oi - {0x618467d6, 0xf7f3}, // Oacutesmall - {0x6198a771, 0xfef3}, // alefmaksurainitialarabic - {0x61a21109, 0x01c9}, // lj - {0x61a2d0df, 0x258c}, // lfblock - {0x61a6f1a4, 0x0264}, // ramshorn - {0x61b4ed39, 0x25ba}, // triagrt - {0x61b7afbf, 0x05b5}, // tserenarrowhebrew - {0x61b9f022, 0x04c4}, // kahookcyrillic - {0x61ce131a, 0x0647}, // afii57470 - {0x61d46fc2, 0x1ed6}, // Ocircumflextilde - {0x61d7bcdb, 0x1e57}, // pdotaccent - {0x61e75298, 0x0417}, // afii10025 - {0x61f36361, 0x06f8}, // eightpersian - {0x61fe712f, 0x20a4}, // afii08941 - {0x621057dd, 0x1ef5}, // ydotbelow - {0x62106755, 0xf6e5}, // hypheninferior - {0x62127977, 0x266a}, // musicalnote - {0x62161c15, 0x05da}, // finalkafhebrew - {0x6229838d, 0x05d0}, // alef - {0x62447ae3, 0x0314}, // commareversedabovecmb - {0x6248b5e6, 0x33dd}, // wbsquare - {0x625320aa, 0x30b2}, // gekatakana - {0x6259e0bf, 0xf6f1}, // rsuperior - {0x6260c6fc, 0x0589}, // periodarmenian - {0x6265e881, 0x2266}, // lessoverequal - {0x626cbaa4, 0x01bf}, // wynn - {0x62724d89, 0x09ad}, // bhabengali - {0x62896f4a, 0x05f2}, // yodyodhebrew - {0x628a5951, 0xff56}, // vmonospace - {0x62a11b25, 0x1e87}, // wdotaccent - {0x62accaf5, 0xf8ed}, // parenleftbt - {0x62b2cd2d, 0x00c2}, // Acircumflex - {0x62b6e7ac, 0x01a5}, // phook - {0x62c361d5, 0x05e2}, // afii57682 - {0x62c52689, 0x05d5}, // afii57669 - {0x62ca59ed, 0x03aa}, // Iotadieresis - {0x62cfccee, 0x017d}, // Zcaron - {0x62d27ffc, 0x0567}, // eharmenian - {0x62f7161d, 0x3020}, // postalmarkface - {0x630680b1, 0x1e20}, // Gmacron - {0x63070542, 0x0401}, // afii10023 - {0x630758ff, 0x317e}, // sioscieuckorean - {0x632ae410, 0x0acc}, // auvowelsigngujarati - {0x634ac34b, 0x2297}, // timescircle - {0x634e42e5, 0xff2b}, // Kmonospace - {0x635a9554, 0x04e5}, // idieresiscyrillic - {0x636fabd5, 0x093c}, // nuktadeva - {0x637ae7ca, 0x0344}, // dialytikatonoscmb - {0x637d3539, 0x00bc}, // onequarter - {0x6389d9bb, 0x0641}, // afii57441 - {0x63a82931, 0x0297}, // cstretched - {0x63ab7e3b, 0xf6dd}, // rupiah - {0x63d84bb6, 0x2281}, // notsucceeds - {0x63dfed74, 0x311f}, // eibopomofo - {0x63e274d2, 0xfc0b}, // tehjeemisolatedarabic - {0x63e60b13, 0x0149}, // napostrophe - {0x63f6cd8f, 0x049d}, // kaverticalstrokecyrillic - {0x642b78c5, 0x1ed5}, // ocircumflexhookabove - {0x642e193e, 0x0469}, // yuslittleiotifiedcyrillic - {0x6434f04a, 0xfd88}, // lammeemhahinitialarabic - {0x64468e36, 0x0e18}, // thothongthai - {0x64517fe8, 0x004b}, // K - {0x6453c78e, 0x064e}, // fathalowarabic - {0x6454154f, 0xf6ec}, // esuperior - {0x6460d798, 0x3025}, // fivehangzhou - {0x64699e37, 0x2309}, // ceilingrightBigg - {0x646b157e, 0x3242}, // ideographicselfparen - {0x646c5c19, 0x0ab5}, // vagujarati - {0x64755597, 0x05e7}, // qofholamhebrew - {0x647eca4f, 0x09ae}, // mabengali - {0x64a1b76b, 0x30fa}, // vokatakana - {0x64d00b32, 0x0114}, // Ebreve - {0x64d7a402, 0x0e40}, // saraethai - {0x64d94f4a, 0x0e01}, // kokaithai - {0x64e7dff2, 0x09c4}, // rrvocalicvowelsignbengali - {0x64eb016b, 0x2245}, // approximatelyequal - {0x64fd7a48, 0x2078}, // eightsuperior - {0x650678be, 0x02cb}, // fourthtonechinese - {0x65070663, 0x0459}, // ljecyrillic - {0x6510d99a, 0x0938}, // sadeva - {0x651d5722, 0x04c2}, // zhebrevecyrillic - {0x6525cdb1, 0x00ad}, // softhyphen - {0x6543f12c, 0x01d5}, // Udieresismacron - {0x654d08a0, 0x0e3a}, // phinthuthai - {0x657ffabd, 0x22ee}, // ellipsisvertical - {0x6594aba1, 0x02c3}, // a41 - {0x6598fbfe, 0x3112}, // xbopomofo - {0x65a5bd1b, 0x24e1}, // rcircle - {0x65be15d1, 0x0a08}, // iigurmukhi - {0x65c095c5, 0x200e}, // afii299 - {0x65cc1f56, 0x0545}, // Yiarmenian - {0x662a6586, 0xf8f8}, // parenrightbt - {0x662a831c, 0x1eeb}, // uhorngrave - {0x663a2c1a, 0x3300}, // apaatosquare - {0x6642f834, 0x0361}, // breveinverteddoublecmb - {0x665bba62, 0x2017}, // dbllowline - {0x665e930f, 0x3264}, // mieumcirclekorean - {0x666ae75e, 0x0159}, // rcaron - {0x666e8927, 0xfc4e}, // noonmeemisolatedarabic - {0x666faf51, 0xfba5}, // hehhamzaabovefinalarabic - {0x6689dbc7, 0x33cb}, // HPsquare - {0x668e9764, 0x30a2}, // akatakana - {0x669881eb, 0xf8e5}, // radicalex - {0x66b92e17, 0x05e8}, // reshholam - {0x66bb979c, 0x246c}, // thirteencircle - {0x66c590a5, 0x2236}, // ratio - {0x66e750ef, 0xf7ec}, // Igravesmall - {0x66e9c5c7, 0x3084}, // yahiragana - {0x66ef8fdf, 0x040f}, // afii10145 - {0x66fb9b49, 0x33c9}, // gysquare - {0x67188e74, 0x0066}, // f - {0x6740a4ac, 0x25cf}, // H18533 - {0x67427e4a, 0x2079}, // ninesuperior - {0x674a0210, 0x02b6}, // Rsmallinvertedsuperior - {0x674c80b7, 0x03da}, // Stigmagreek - {0x67569fa6, 0x05b5}, // tsere - {0x6758c83c, 0x2588}, // block - {0x6776a85a, 0x0ac7}, // evowelsigngujarati - {0x6779be95, 0x3113}, // zhbopomofo - {0x6785194b, 0x221f}, // rightangle - {0x67949ab4, 0xf891}, // maitrilowrightthai - {0x679d9205, 0x02c5}, // arrowheaddownmod - {0x679dcadd, 0x0e54}, // fourthai - {0x679ffc49, 0x2024}, // onedotenleader - {0x67ea250f, 0x1e2d}, // itildebelow - {0x67ebcea4, 0x3209}, // chieuchparenkorean - {0x67f3db47, 0x3073}, // bihiragana - {0x67f3ecac, 0xfb4b}, // afii57700 - {0x67f7f220, 0x309c}, // semivoicedmarkkana - {0x67fa1db6, 0x203a}, // guilsinglright - {0x68070609, 0x0916}, // khadeva - {0x6808ec86, 0x02d8}, // breve - {0x6811e3e1, 0x0404}, // Ecyrillic - {0x6814026d, 0x02c8}, // verticallinemod - {0x682b08dd, 0x01ac}, // Thook - {0x683090d6, 0xf6f0}, // osuperior - {0x6853e235, 0x0652}, // sukunarabic - {0x685932be, 0xfe36}, // parenrightvertical - {0x68744fba, 0x220f}, // producttext - {0x68a76955, 0x00c7}, // Ccedilla - {0x68b3215e, 0x0339}, // ringhalfrightbelowcmb - {0x68b3ae0f, 0x222e}, // contintegraldisplay - {0x68b98a65, 0x0679}, // afii57511 - {0x68ccd1d8, 0x3212}, // mieumaparenkorean - {0x68eb418e, 0x3011}, // blacklenticularbracketright - {0x690f8118, 0x320b}, // thieuthparenkorean - {0x692bc1f7, 0x0a42}, // uumatragurmukhi - {0x693ccd9c, 0x0432}, // vecyrillic - {0x6962e430, 0x0322}, // hookretroflexbelowcmb - {0x6977f4b7, 0xff05}, // percentmonospace - {0x697925af, 0x05d2}, // gimel - {0x697feb80, 0x030d}, // verticallineabovecmb - {0x6991a62a, 0x0935}, // vadeva - {0x699d525a, 0x0111}, // dcroat - {0x69aabc4d, 0x06af}, // gafarabic - {0x69d31152, 0x0e51}, // onethai - {0x69faaae4, 0x33a7}, // moverssquare - {0x6a104703, 0x2569}, // SF400000 - {0x6a16e743, 0xfef0}, // alefmaksurafinalarabic - {0x6a3d8bdc, 0x0a99}, // ngagujarati - {0x6a511868, 0x03a7}, // Chi - {0x6a5f0a3f, 0x334e}, // yaadosquare - {0x6a721907, 0xfecc}, // ainmedialarabic - {0x6a8d644d, 0x1ead}, // acircumflexdotbelow - {0x6a972227, 0x0401}, // Iocyrillic - {0x6a988d53, 0x2035}, // primereversed - {0x6a9b2b92, 0x0414}, // afii10021 - {0x6aa62850, 0x0662}, // twoarabic - {0x6aa82ca6, 0x3218}, // khieukhaparenkorean - {0x6abb1490, 0x005d}, // bracketright - {0x6ad19d29, 0xfb1f}, // doubleyodpatahhebrew - {0x6b214948, 0xff6f}, // tusmallkatakanahalfwidth - {0x6b2d374c, 0xfcdd}, // yehmeeminitialarabic - {0x6b3f02ab, 0x211e}, // prescription - {0x6b58bab9, 0x0963}, // llvocalicvowelsigndeva - {0x6b83db74, 0x2295}, // circleplus - {0x6b85cd6e, 0x00a4}, // currency - {0x6b8b924f, 0x30d8}, // hekatakana - {0x6b8f0a54, 0xf6df}, // centinferior - {0x6b908b1b, 0x09e7}, // onebengali - {0x6b98f18c, 0x212b}, // angstrom - {0x6b9adcc4, 0x25cf}, // blackcircle - {0x6b9f4fbe, 0x0940}, // iivowelsigndeva - {0x6ba8c1e2, 0xf6ce}, // Grave - {0x6baa5ba4, 0x03ce}, // omegatonos - {0x6bb62dc9, 0xf77a}, // Zsmall - {0x6bbd76c8, 0x0936}, // shadeva - {0x6bca6ff5, 0xfe4a}, // overlinecenterline - {0x6bd59d12, 0x0915}, // kadeva - {0x6bd609d3, 0x00f0}, // eth - {0x6be13af7, 0x2199}, // arrowdownleft - {0x6bf10a81, 0x2015}, // horizontalbar - {0x6c0e37b1, 0x30ce}, // nokatakana - {0x6c0f6861, 0x05e7}, // qofhatafsegolhebrew - {0x6c11086e, 0x0a1c}, // jagurmukhi - {0x6c180b9f, 0x0462}, // Yatcyrillic - {0x6c23928a, 0x222e}, // contintegraltext - {0x6c429460, 0xfb40}, // nundageshhebrew - {0x6c5c9da6, 0x0457}, // yicyrillic - {0x6c781e8a, 0x25bd}, // whitedownpointingtriangle - {0x6c8584d5, 0x3065}, // duhiragana - {0x6c95b865, 0x0941}, // uvowelsigndeva - {0x6c98a67f, 0x0479}, // ukcyrillic - {0x6cbb9b7a, 0xfe5d}, // tortoiseshellbracketleftsmall - {0x6cce2d3d, 0x0aa5}, // thagujarati - {0x6cce7f58, 0x043b}, // elcyrillic - {0x6d02864a, 0x049c}, // Kaverticalstrokecyrillic - {0x6d1b554b, 0x0982}, // anusvarabengali - {0x6d3fc0d7, 0x040f}, // Dzhecyrillic - {0x6d4379b8, 0x220f}, // productdisplay - {0x6d519305, 0x2169}, // Tenroman - {0x6d63a915, 0x02bc}, // apostrophemod - {0x6d6c6ece, 0x307f}, // mihiragana - {0x6d794da3, 0x0057}, // W - {0x6d7a8d87, 0x00fd}, // yacute - {0x6d88930b, 0x044a}, // afii10092 - {0x6d89653d, 0x24e8}, // ycircle - {0x6d8f5cd4, 0xff95}, // yukatakanahalfwidth - {0x6d931b7f, 0x255c}, // SF270000 - {0x6d9b9c3e, 0x05dc}, // afii57676 - {0x6dd186b9, 0x0575}, // yiarmenian - {0x6ddcf118, 0x22a4}, // tackdown - {0x6ddd69da, 0x05b1}, // hatafsegolquarterhebrew - {0x6df68266, 0x0388}, // Epsilontonos - {0x6df8e451, 0x2203}, // existential - {0x6dfa6cea, 0x0a66}, // zerogurmukhi - {0x6dff449c, 0xff79}, // kekatakanahalfwidth - {0x6e298b2c, 0x3380}, // paampssquare - {0x6e2b4011, 0x2213}, // minusplus - {0x6e2e0a97, 0xfe66}, // equalsmall - {0x6e53b9b3, 0xfb00}, // ff - {0x6e5f0868, 0x30ed}, // rokatakana - {0x6e7cf223, 0x3071}, // pahiragana - {0x6e81816d, 0x1e5d}, // rdotbelowmacron - {0x6e897228, 0x0324}, // dieresisbelowcmb - {0x6e8ccbbb, 0xfb48}, // reshdageshhebrew - {0x6eb16a59, 0x2166}, // Sevenroman - {0x6eb40b0d, 0x04db}, // schwadieresiscyrillic - {0x6eba69ba, 0xfe9e}, // jeemfinalarabic - {0x6ebb53ea, 0x2261}, // equivalence - {0x6ecb4ba4, 0x0449}, // afii10091 - {0x6ecc1f68, 0x25bc}, // triagdn - {0x6ed918ed, 0xfcd1}, // meemmeeminitialarabic - {0x6ee27b35, 0x0321}, // hookpalatalizedbelowcmb - {0x6f028e08, 0x0571}, // jaarmenian - {0x6f1f2583, 0x25ce}, // bullseye - {0x6f2573bb, 0x30eb}, // rukatakana - {0x6f4833d3, 0x0a5c}, // rragurmukhi - {0x6f57587a, 0x227b}, // succeeds - {0x6f64edc9, 0x054f}, // Tiwnarmenian - {0x6f6b6e30, 0x0e0e}, // dochadathai - {0x6f75692f, 0x0ac8}, // aivowelsigngujarati - {0x6f7744aa, 0x2196}, // arrowupleft - {0x6fae2151, 0x0aef}, // ninegujarati - {0x6fbeef2a, 0x044d}, // ereversedcyrillic - {0x6fc01d9f, 0x00f8}, // oslash - {0x6fdfa2dc, 0xf6e7}, // periodinferior - {0x70068cb8, 0xf7ea}, // Ecircumflexsmall - {0x702ecc19, 0x3054}, // gohiragana - {0x70300d95, 0xf761}, // Asmall - {0x70534c83, 0x05a4}, // mahapakhlefthebrew - {0x7061d5ad, 0x255a}, // SF380000 - {0x707057b4, 0xfb2e}, // alefpatahhebrew - {0x7070c1c4, 0x0333}, // dbllowlinecmb - {0x7077f8df, 0x0163}, // tcommaaccent - {0x708cf64a, 0x0944}, // rrvocalicvowelsigndeva - {0x709b2bbe, 0x0056}, // V - {0x709b801f, 0x05da}, // finalkafshevahebrew - {0x70a0d365, 0xfeee}, // wawfinalarabic - {0x70a7b34b, 0x05b5}, // tsere12 - {0x70c1bcae, 0x1ede}, // Ohornhookabove - {0x70d74f05, 0x04b1}, // ustraightstrokecyrillic - {0x70d8442c, 0xff3c}, // backslashmonospace - {0x70e9d43c, 0x2202}, // partialdiff - {0x70f78dac, 0x24b5}, // zparen - {0x70f8a40d, 0x05b8}, // afii57797 - {0x71062567, 0xfeea}, // hehfinalalttwoarabic - {0x710fbfc8, 0x0179}, // Zacute - {0x712afb91, 0x310b}, // nbopomofo - {0x7138408a, 0x04cc}, // chekhakassiancyrillic - {0x71411a8f, 0x3156}, // yekorean - {0x7154079a, 0x1e50}, // Omacrongrave - {0x715a0e07, 0xfef4}, // alefmaksuramedialarabic - {0x715aaa7e, 0x0122}, // Gcommaaccent - {0x71693ad6, 0x0919}, // ngadeva - {0x718d2f07, 0xff16}, // sixmonospace - {0x71a4a95d, 0x1eaa}, // Acircumflextilde - {0x71b12b2f, 0x01e0}, // Adotmacron - {0x71b2c74d, 0x00b7}, // periodcentered - {0x71b2e09c, 0x0e32}, // saraaathai - {0x71e104c6, 0x3041}, // asmallhiragana - {0x71ebf117, 0x0640}, // afii57440 - {0x7222af0c, 0x25cb}, // circle - {0x722d9aa3, 0x2153}, // onethird - {0x72446324, 0x3164}, // hangulfiller - {0x7256dcb9, 0x0ac2}, // uuvowelsigngujarati - {0x725da2a5, 0x0548}, // Voarmenian - {0x7274464b, 0x0e31}, // maihanakatthai - {0x7276cdf0, 0x02d7}, // minusmod - {0x7278753d, 0x04d7}, // iebrevecyrillic - {0x728cf068, 0x020f}, // oinvertedbreve - {0x728f761b, 0x3111}, // qbopomofo - {0x72ad941b, 0xf733}, // threeoldstyle - {0x72b3c6a8, 0x00b4}, // acute - {0x72ba7ff6, 0x3093}, // nhiragana - {0x72c6f1c4, 0xff5c}, // barmonospace - {0x72c8f209, 0x0136}, // Kcommaaccent - {0x72e33f41, 0x0419}, // afii10027 - {0x72f1f5cf, 0x0438}, // iicyrillic - {0x72fc7974, 0x2111}, // Ifraktur - {0x72fd959a, 0x002a}, // asterisk - {0x73032cb1, 0x3268}, // cieuccirclekorean - {0x731486cf, 0xf6e1}, // commainferior - {0x731a7d35, 0xf6fb}, // Ogoneksmall - {0x731be3b3, 0x3140}, // rieulhieuhkorean - {0x73200dbd, 0x0e20}, // phosamphaothai - {0x7322d42e, 0x24b9}, // Dcircle - {0x73282fcd, 0x1ee3}, // ohorndotbelow - {0x732cf2ca, 0x2485}, // eighteenparen - {0x7338db3a, 0x066b}, // decimalseparatorarabic - {0x73392eb6, 0x1ed4}, // Ocircumflexhookabove - {0x733b0480, 0xfe94}, // tehmarbutafinalarabic - {0x734f6c6b, 0x3090}, // wihiragana - {0x7375cb46, 0x0686}, // tcheharabic - {0x73843708, 0x0434}, // decyrillic - {0x7387f092, 0x2088}, // eightinferior - {0x73b2bbd4, 0xfe63}, // hyphensmall - {0x73b70a88, 0x05d8}, // afii57672 - {0x73b7c451, 0x095a}, // ghhadeva - {0x73c3073f, 0xf6ee}, // lsuperior - {0x73c5e60b, 0x004e}, // N - {0x73e1033a, 0x22b4}, // a2 - {0x73e5498e, 0xf7fd}, // Yacutesmall - {0x73ee6902, 0x0965}, // dbldanda - {0x73f5578c, 0x093f}, // ivowelsigndeva - {0x74030714, 0x311c}, // ebopomofo - {0x7411ab47, 0x00ba}, // ordmasculine - {0x74144417, 0x311e}, // aibopomofo - {0x74157df0, 0x0667}, // sevenhackarabic - {0x741e8130, 0x00cf}, // Idieresis - {0x7435abfe, 0x057c}, // raarmenian - {0x743d1e25, 0x0456}, // afii10103 - {0x745c44bf, 0x02e3}, // xsuperior - {0x746e784f, 0xff48}, // hmonospace - {0x7476bb3d, 0x21d2}, // dblarrowright - {0x74814589, 0x05b9}, // holam19 - {0x748db30c, 0x33b1}, // nssquare - {0x7495de6c, 0x0008}, // controlBS - {0x74a2fb64, 0x2280}, // notprecedes - {0x74abeab2, 0x05ac}, // iluyhebrew - {0x74b1cbfb, 0x22c5}, // dotmath - {0x74caf1a5, 0x01b4}, // yhook - {0x74d74b92, 0x2209}, // notelement - {0x74f1fca9, 0x01db}, // Udieresisgrave - {0x7506e8c8, 0x24d1}, // bcircle - {0x751253a5, 0x2168}, // Nineroman - {0x7542c0c4, 0xf8e8}, // registersans - {0x7544678b, 0x307d}, // pohiragana - {0x754982de, 0x06a4}, // veharabic - {0x755a250b, 0x09dd}, // rhabengali - {0x755f707c, 0x1ebf}, // ecircumflexacute - {0x75811646, 0xf6e9}, // asuperior - {0x75841530, 0x2002}, // enspace - {0x75907eb0, 0x322c}, // ideographicwaterparen - {0x759ddc3d, 0x3068}, // tohiragana - {0x759f9daf, 0x00c4}, // Adieresis - {0x75aa325f, 0x3047}, // esmallhiragana - {0x75b73269, 0x27e9}, // angbracketrightbig - {0x75b9e64d, 0xff46}, // fmonospace - {0x75bf74c1, 0x0a59}, // khhagurmukhi - {0x75f4d85d, 0x0a2c}, // bagurmukhi - {0x7603459c, 0x094c}, // auvowelsigndeva - {0x760d83de, 0x222b}, // integral - {0x7612320f, 0x3273}, // pieupacirclekorean - {0x76186d8e, 0x01f3}, // dz - {0x7619aedc, 0xfb4c}, // betrafehebrew - {0x762dd6ce, 0x2260}, // notequal - {0x763e1836, 0x30c4}, // tukatakana - {0x7656c681, 0x01c4}, // DZcaron - {0x767695a3, 0xfed4}, // fehmedialarabic - {0x76811ae6, 0x0169}, // utilde - {0x7681e1d4, 0xfe9b}, // thehinitialarabic - {0x76a40aac, 0x001e}, // controlRS - {0x76a57fc1, 0x0117}, // edot - {0x76aa35a2, 0x1e27}, // hdieresis - {0x76abdb93, 0xfb41}, // samekhdageshhebrew - {0x76af2566, 0x05c1}, // afii57804 - {0x76b279b9, 0x1e76}, // Ucircumflexbelow - {0x76be5e67, 0x0389}, // Etatonos - {0x76e8986c, 0x27e9}, // angbracketrightBigg - {0x76ec167e, 0x3128}, // ubopomofo - {0x76ee8ef9, 0x326a}, // khieukhcirclekorean - {0x76fa92ba, 0x2225}, // parallel - {0x7722080a, 0x21e2}, // arrowdashright - {0x772d6b37, 0x3294}, // ideographnamecircle - {0x774eb078, 0x0328}, // ogonekcmb - {0x774fe771, 0x064d}, // kasratanarabic - {0x7752bcc4, 0xf8f6}, // parenrighttp - {0x775a46a9, 0xffe0}, // centmonospace - {0x77617e4f, 0xf762}, // Bsmall - {0x77651620, 0x007b}, // braceleft - {0x776629fd, 0x044a}, // hardsigncyrillic - {0x7766a0eb, 0x041e}, // Ocyrillic - {0x776cd4d6, 0x1e89}, // wdotbelow - {0x77741a8d, 0x0473}, // fitacyrillic - {0x7782c966, 0x1e46}, // Ndotbelow - {0x7786e0a6, 0x246f}, // sixteencircle - {0x779ce17f, 0x0390}, // iotadieresistonos - {0x77a6f721, 0x2165}, // Sixroman - {0x77aefb3f, 0x3027}, // sevenhangzhou - {0x77b3e914, 0x3106}, // pbopomofo - {0x77d27346, 0x0110}, // Dcroat - {0x77e1d263, 0x0442}, // tecyrillic - {0x77ee824a, 0xfba7}, // hehfinalaltonearabic - {0x77f415ae, 0x03eb}, // gangiacoptic - {0x77f608a5, 0x00ec}, // igrave - {0x78075c57, 0x007d}, // bracerightBig - {0x78151b28, 0x04f8}, // Yerudieresiscyrillic - {0x781b1710, 0x3175}, // pieupsiostikeutkorean - {0x782f5323, 0x2297}, // circlemultiply - {0x783bb2b4, 0xfeea}, // hehfinalarabic - {0x7849decd, 0x05f0}, // vavvavhebrew - {0x7865471d, 0x30f8}, // vikatakana - {0x7868522a, 0x0172}, // Uogonek - {0x78728968, 0x0e3f}, // bahtthai - {0x7877a9ea, 0x05d9}, // yodhebrew - {0x7878b2f0, 0x323c}, // ideographicsuperviseparen - {0x788e7d3e, 0x05b3}, // hatafqamats - {0x78965447, 0x0593}, // shalshelethebrew - {0x78a67a97, 0xf8ea}, // trademarksans - {0x78d4db12, 0x032e}, // brevebelowcmb - {0x78da6d23, 0x046e}, // Ksicyrillic - {0x78f4df25, 0x04d9}, // schwacyrillic - {0x79042ee6, 0x30e9}, // rakatakana - {0x79116479, 0x0039}, // nine - {0x7919f419, 0x0416}, // afii10024 - {0x792d6db9, 0x0272}, // nhookleft - {0x793801c3, 0x3158}, // wakorean - {0x79577113, 0x2565}, // SF480000 - {0x795917d1, 0x0583}, // piwrarmenian - {0x79638654, 0x1ecd}, // odotbelow - {0x796eb2f8, 0x3389}, // kcalsquare - {0x796edb96, 0x0387}, // anoteleia - {0x797aa124, 0x0445}, // khacyrillic - {0x7980bc25, 0x00c5}, // Aring - {0x7987b173, 0x03e8}, // Horicoptic - {0x79961e28, 0x20a7}, // peseta - {0x79c6a044, 0xfe3a}, // tortoiseshellbracketrightvertical - {0x79d35b17, 0x3229}, // tenideographicparen - {0x79dfa961, 0xfb2d}, // shindageshsindot - {0x79e5e3c1, 0x0e2f}, // paiyannoithai - {0x79fc5691, 0x24ce}, // Ycircle - {0x7a196523, 0x0451}, // afii10071 - {0x7a29214e, 0x006c}, // l - {0x7a32a546, 0x202d}, // afii61574 - {0x7a3f45e9, 0x0ab8}, // sagujarati - {0x7a49bde9, 0xfca4}, // tehmeeminitialarabic - {0x7a49dc21, 0xfee2}, // meemfinalarabic - {0x7a56cace, 0x33a1}, // squaremsquared - {0x7a6cfa6a, 0x0a3f}, // imatragurmukhi - {0x7a75be4d, 0x2559}, // SF490000 - {0x7a8736f8, 0x320c}, // phieuphparenkorean - {0x7aa071da, 0x0217}, // uinvertedbreve - {0x7aa95d24, 0xfb34}, // hedageshhebrew - {0x7aac463a, 0x0669}, // afii57401 - {0x7ab8ba14, 0x1ebe}, // Ecircumflexacute - {0x7ad78099, 0x05b5}, // afii57794 - {0x7b074f4f, 0x062c}, // jeemarabic - {0x7b0aca00, 0x3315}, // kiroguramusquare - {0x7b3db32a, 0x221a}, // radicalBig - {0x7b443626, 0x3331}, // birusquare - {0x7b5e0418, 0xff10}, // zeromonospace - {0x7b7b9d4d, 0x0424}, // afii10038 - {0x7b7fbb65, 0xf7b8}, // Cedillasmall - {0x7b80aee5, 0x05bb}, // qubutsquarterhebrew - {0x7b8c3862, 0x02b8}, // ysuperior - {0x7bac8f33, 0x0016}, // controlSYN - {0x7bc269dd, 0x0040}, // at - {0x7bd5ca88, 0x33ca}, // hasquare - {0x7bd8b82b, 0x3005}, // ideographiciterationmark - {0x7c301325, 0x0472}, // Fitacyrillic - {0x7c35d223, 0x05dc}, // lamedholam - {0x7c3e1570, 0x0028}, // parenleftbigg - {0x7c3f4566, 0x00e7}, // ccedilla - {0x7c4777ca, 0xfcc9}, // lamjeeminitialarabic - {0x7c4f7ece, 0x0ab2}, // lagujarati - {0x7c53c130, 0x0a13}, // oogurmukhi - {0x7c613499, 0x2566}, // SF410000 - {0x7c8ffdc8, 0x24e7}, // xcircle - {0x7c903e9b, 0x1ec7}, // ecircumflexdotbelow - {0x7cb539e8, 0x096e}, // eightdeva - {0x7cc006ef, 0x222c}, // dblintegral - {0x7cdf3e4a, 0x0a2f}, // yagurmukhi - {0x7cf2e5f4, 0x0029}, // parenright - {0x7cf2ebbd, 0xff96}, // yokatakanahalfwidth - {0x7cf8ce2e, 0x3394}, // thzsquare - {0x7d1ff070, 0xf896}, // thanthakhatupperleftthai - {0x7d32ca29, 0x0127}, // hbar - {0x7d44a576, 0x24b1}, // vparen - {0x7d4ddd33, 0x2554}, // SF390000 - {0x7d86a046, 0xff93}, // mokatakanahalfwidth - {0x7d8bc7c0, 0x255f}, // SF370000 - {0x7d981506, 0x0a9f}, // ttagujarati - {0x7dc79678, 0x062a}, // afii57418 - {0x7dc79708, 0x223c}, // tildeoperator - {0x7dc7cd45, 0x33b6}, // muvsquare - {0x7dcf75fb, 0x223c}, // similar - {0x7dd21a95, 0x30b5}, // sakatakana - {0x7dd63b6c, 0x1ec1}, // ecircumflexgrave - {0x7de5edf4, 0x05b9}, // afii57806 - {0x7df90cb9, 0x249c}, // aparen - {0x7e46df3d, 0x30d7}, // pukatakana - {0x7e4f805e, 0x3067}, // dehiragana - {0x7e5c9fda, 0x042f}, // IAcyrillic - {0x7e60a480, 0x0029}, // parenrightbigg - {0x7e701b6d, 0xff0d}, // hyphenmonospace - {0x7e739224, 0x3046}, // uhiragana - {0x7e7d09ba, 0xf6e4}, // dollarsuperior - {0x7e947543, 0xf773}, // Ssmall - {0x7ebf5260, 0x0031}, // one - {0x7eddac19, 0x09f4}, // onenumeratorbengali - {0x7eefb1cf, 0x05d3}, // daletshevahebrew - {0x7f0a4f83, 0x0631}, // rehyehaleflamarabic - {0x7f43cdd7, 0x0ab0}, // ragujarati - {0x7f56c599, 0x0141}, // Lslash - {0x7f5b3579, 0x1e74}, // Utildebelow - {0x7f630a55, 0x1ef9}, // ytilde - {0x7f7aa31e, 0x0648}, // afii57448 - {0x7f82e2ff, 0x098f}, // ebengali - {0x7f851974, 0x0568}, // etarmenian - {0x7f92fe37, 0x066d}, // asteriskarabic - {0x7f97f320, 0x301c}, // wavedash - {0x7f99701f, 0xfb2a}, // shinshindothebrew - {0x7fad7e30, 0xf737}, // sevenoldstyle - {0x7fbd4335, 0x2309}, // ceilingrightbig - {0x7ff2087d, 0x01df}, // adieresismacron - {0x7ffdad4c, 0x326e}, // kiyeokacirclekorean - {0x801f311e, 0x1ebb}, // ehookabove - {0x8020003f, 0x05e9}, // shinhebrew - {0x8027a085, 0x03d2}, // Upsilonhooksymbol - {0x8029e67d, 0x049b}, // kadescendercyrillic - {0x803a882f, 0x0a8b}, // rvocalicgujarati - {0x80417827, 0x33a9}, // pasquare - {0x80461d8b, 0xf6c7}, // afii10831 - {0x8048e51c, 0x24e6}, // wcircle - {0x80690312, 0x0155}, // racute - {0x8076b638, 0xfedf}, // laminitialarabic - {0x80792dfa, 0x0478}, // Ukcyrillic - {0x807bd424, 0xf886}, // saraiileftthai - {0x8082c40e, 0x251c}, // SF080000 - {0x8086d5c5, 0x0490}, // afii10050 - {0x80890e42, 0x0316}, // gravebelowcmb - {0x808de596, 0x2492}, // elevenperiod - {0x808eef1b, 0x0068}, // h - {0x80b21ab0, 0x00f5}, // otilde - {0x80b54bce, 0x3170}, // mieumpansioskorean - {0x80c36a57, 0x0480}, // Koppacyrillic - {0x80f8e4b8, 0x017f}, // slong - {0x80fb86d5, 0x00ff}, // ydieresis - {0x810ea19f, 0x02bd}, // afii64937 - {0x810f1d5a, 0x30c6}, // tekatakana - {0x812767fa, 0x0555}, // Oharmenian - {0x8140027d, 0x24d3}, // dcircle - {0x815134d6, 0x00cd}, // Iacute - {0x81589a47, 0x2220}, // angle - {0x816211ee, 0x05dc}, // lamedholamdageshhebrew - {0x81658581, 0x0207}, // einvertedbreve - {0x816871c9, 0x1ec2}, // Ecircumflexhookabove - {0x8169da43, 0x0483}, // titlocyrilliccmb - {0x8170d563, 0x256b}, // SF530000 - {0x81796466, 0xf6f2}, // ssuperior - {0x817f112a, 0x1e37}, // ldotbelow - {0x817f9471, 0x1e92}, // Zdotbelow - {0x81806da2, 0x328d}, // ideographwoodcircle - {0x8184073f, 0x053b}, // Iniarmenian - {0x818aac3d, 0x3165}, // ssangnieunkorean - {0x81b94a51, 0x3233}, // ideographicsocietyparen - {0x81e18c26, 0x30c3}, // tusmallkatakana - {0x81eec5b0, 0x320e}, // kiyeokaparenkorean - {0x8215ea5e, 0x02b2}, // jsuperior - {0x82173176, 0x05d9}, // afii57673 - {0x8218cc3e, 0x039c}, // Mu - {0x822cf82c, 0x3070}, // bahiragana - {0x8230e7a0, 0x32a7}, // ideographicleftcircle - {0x823da9d2, 0x0413}, // afii10020 - {0x825a2038, 0x3045}, // usmallhiragana - {0x8260fa87, 0x1ea5}, // acircumflexacute - {0x8272e0b5, 0x249b}, // twentyperiod - {0x827d6960, 0xff40}, // gravemonospace - {0x828072a0, 0x2666}, // diamond - {0x8281c05a, 0x00b5}, // mu1 - {0x8291bd7d, 0x248e}, // sevenperiod - {0x82ab3b91, 0x03a3}, // Sigma - {0x82b182a5, 0x057e}, // vewarmenian - {0x82b58e6a, 0x1e94}, // Zlinebelow - {0x82b5e1a0, 0x266b}, // eighthnotebeamed - {0x82b5fc2f, 0x05bc}, // afii57807 - {0x82c39f59, 0x1e62}, // Sdotbelow - {0x82c3da09, 0x0a1a}, // cagurmukhi - {0x82d03f46, 0x056e}, // caarmenian - {0x82d4758a, 0x25e6}, // whitebullet - {0x82db51c1, 0x05b6}, // segolnarrowhebrew - {0x82dffbf3, 0xfe9c}, // thehmedialarabic - {0x8322270c, 0x1e49}, // nlinebelow - {0x832d9a03, 0x263b}, // invsmileface - {0x83393d74, 0xfef7}, // lamalefhamzaaboveisolatedarabic - {0x83589346, 0x1eb0}, // Abrevegrave - {0x836fd101, 0x25c7}, // a51 - {0x83736e7a, 0x2308}, // ceilingleftBig - {0x837601e2, 0x0ae7}, // onegujarati - {0x8377c3f2, 0x026b}, // lmiddletilde - {0x837a2830, 0x2113}, // lsquare - {0x837c1552, 0x2172}, // threeroman - {0x8388f2be, 0x00c9}, // Eacute - {0x83a89a03, 0x045f}, // dzhecyrillic - {0x83aeaef2, 0x1e23}, // hdotaccent - {0x83c5c486, 0x05e7}, // afii57687 - {0x83cd4320, 0x0565}, // echarmenian - {0x83e3c3a4, 0x3075}, // huhiragana - {0x83f86a79, 0x339e}, // squarekm - {0x83fc4077, 0x0037}, // seven - {0x83fe9093, 0x0441}, // escyrillic - {0x840c8507, 0x0313}, // commaabovecmb - {0x8411d0c3, 0x1e3e}, // Macute - {0x84132896, 0x0140}, // ldot - {0x841d72ff, 0x02e4}, // glottalstopreversedsuperior - {0x841d9ceb, 0x0572}, // ghadarmenian - {0x8424a64d, 0x05b5}, // tserewidehebrew - {0x843c7aca, 0x323f}, // ideographicallianceparen - {0x8445bb28, 0x0905}, // adeva - {0x8459e5f4, 0x2248}, // approxequal - {0x84776c26, 0x329d}, // ideographicexcellentcircle - {0x847d9b8a, 0x1ec5}, // ecircumflextilde - {0x847ed2d4, 0x0540}, // Hoarmenian - {0x8487ed37, 0x0621}, // hamzaarabic - {0x848baa07, 0xfc5f}, // shaddakasratanarabic - {0x8494dfda, 0x05b1}, // hatafsegol24 - {0x8498dbae, 0xfe86}, // wawhamzaabovefinalarabic - {0x849b0297, 0x1e2e}, // Idieresisacute - {0x84a67fee, 0x323a}, // ideographiccallparen - {0x84b1d089, 0x0430}, // acyrillic - {0x84de35f4, 0x0210}, // Rdblgrave - {0x84e0b580, 0x04ef}, // umacroncyrillic - {0x8501599a, 0x30f6}, // kesmallkatakana - {0x85103d59, 0xfb39}, // yoddagesh - {0x851a3968, 0xf6da}, // registerserif - {0x853a4f53, 0x217b}, // twelveroman - {0x855c805d, 0xff1a}, // colonmonospace - {0x856013c8, 0x248a}, // threeperiod - {0x8567c154, 0x01bc}, // Tonefive - {0x856bfeb5, 0x0029}, // parenrightBigg - {0x85a6c8bc, 0x310a}, // tbopomofo - {0x85b41716, 0x201a}, // quotesinglbase - {0x85b6b018, 0x2228}, // logicalor - {0x85c83eb6, 0xff77}, // kikatakanahalfwidth - {0x85cde6eb, 0xf8e7}, // arrowhorizex - {0x85ce16f4, 0x05da}, // afii57674 - {0x85e92466, 0x2282}, // propersubset - {0x85ee23d7, 0x311b}, // obopomofo - {0x85f325ac, 0x064c}, // dammatanaltonearabic - {0x85f47ad1, 0x0660}, // zerohackarabic - {0x85f89b18, 0x3049}, // osmallhiragana - {0x86129c18, 0x2209}, // notelementof - {0x861e8048, 0xff54}, // tmonospace - {0x861ef200, 0x1e75}, // utildebelow - {0x864008ae, 0x05d3}, // daletqubutshebrew - {0x8654695b, 0x0020}, // spacehackarabic - {0x865c7659, 0x0312}, // commaturnedabovecmb - {0x8665f7ab, 0x201b}, // quotereversed - {0x8686768e, 0x093e}, // aavowelsigndeva - {0x8694e2ae, 0x3132}, // ssangkiyeokkorean - {0x8699e716, 0x09ef}, // ninebengali - {0x869fef4c, 0x064b}, // afii57451 - {0x86a662d1, 0x05e7}, // qofhebrew - {0x86a80595, 0x0535}, // Echarmenian - {0x86c2d4a4, 0x01ef}, // ezhcaron - {0x86d0b880, 0x01c7}, // LJ - {0x86d66230, 0x04ad}, // tedescendercyrillic - {0x86e222a0, 0x05d9}, // yod - {0x86eea6f9, 0x03a4}, // Tau - {0x870315b6, 0x30e1}, // mekatakana - {0x8713ac2f, 0xfb4b}, // vavholam - {0x87634c8c, 0x05bd}, // siluqhebrew - {0x877afbbb, 0xfb35}, // afii57723 - {0x877f7c7a, 0xfeb4}, // seenmedialarabic - {0x8787b92b, 0x02c0}, // glottalstopmod - {0x87a041c7, 0x0446}, // afii10088 - {0x87a4b30d, 0x263c}, // compass - {0x87b6c8ba, 0x00c3}, // Atilde - {0x87bb7ac5, 0x020b}, // iinvertedbreve - {0x87e03b4f, 0x0642}, // afii57442 - {0x87e97d46, 0x04dd}, // zhedieresiscyrillic - {0x87ef58ab, 0xfe30}, // twodotleadervertical - {0x87fc47e5, 0x24d2}, // ccircle - {0x88044bf5, 0x2167}, // Eightroman - {0x880a9911, 0x1e34}, // Klinebelow - {0x881905a5, 0x0e22}, // yoyakthai - {0x881a4ba0, 0x0931}, // rradeva - {0x88264250, 0x1e71}, // tcircumflexbelow - {0x8826a561, 0x03cd}, // upsilontonos - {0x883bae04, 0x248c}, // fiveperiod - {0x8841d986, 0x30b8}, // zikatakana - {0x8853f322, 0x339b}, // mumsquare - {0x885dcb80, 0x00a7}, // section - {0x886c5d13, 0x0636}, // dadarabic - {0x8876a700, 0x1e98}, // wring - {0x888833ba, 0x02e7}, // tonebarmidmod - {0x888e1142, 0x026d}, // lhookretroflex - {0x88a12621, 0x05d4}, // afii57668 - {0x88b6884b, 0x06f7}, // sevenpersian - {0x88c2fc70, 0x0a6a}, // fourgurmukhi - {0x88c96d26, 0xfb4a}, // tavdages - {0x88cc32a3, 0x1ef6}, // Yhookabove - {0x88da326f, 0x0546}, // Nowarmenian - {0x88e4df33, 0x1e1b}, // etildebelow - {0x88e6eee8, 0x3119}, // sbopomofo - {0x88ea0124, 0x0949}, // ocandravowelsigndeva - {0x88ea9631, 0xf7af}, // Macronsmall - {0x88f38eed, 0x21d0}, // arrowdblleft - {0x88f62270, 0x314f}, // akorean - {0x88fdc1bb, 0x308e}, // wasmallhiragana - {0x88fdcf2e, 0x039e}, // Xi - {0x89098ea4, 0x2211}, // summationdisplay - {0x893a8f13, 0x09b9}, // habengali - {0x89468742, 0x0e1f}, // fofanthai - {0x897340ea, 0x3207}, // ieungparenkorean - {0x897854cd, 0x060c}, // afii57388 - {0x897adc4f, 0x0128}, // Itilde - {0x89aa67b7, 0x2161}, // Tworoman - {0x89ace505, 0xff06}, // ampersandmonospace - {0x89d8daae, 0x25c9}, // fisheye - {0x89e05206, 0x0022}, // quotedbl - {0x89e2c74b, 0x062d}, // afii57421 - {0x89ed1e17, 0x3171}, // kapyeounmieumkorean - {0x89f4c981, 0x02dc}, // tilde - {0x89f7042b, 0xfe38}, // bracerightvertical - {0x89fc7dc4, 0x05bf}, // rafehebrew - {0x8a1958e1, 0x03d1}, // theta1 - {0x8a27f623, 0x030e}, // dblverticallineabovecmb - {0x8a36e0e0, 0x0a89}, // ugujarati - {0x8a64ee32, 0x23a2}, // bracketleftex - {0x8a743e71, 0x3279}, // thieuthacirclekorean - {0x8a7ff438, 0x0632}, // zainarabic - {0x8ab11ede, 0x0907}, // ideva - {0x8ab50af4, 0xfedb}, // kafinitialarabic - {0x8ac9c3df, 0x00cb}, // Edieresis - {0x8ad52e55, 0x05d3}, // dalethatafsegolhebrew - {0x8ae82e18, 0x05c2}, // sindothebrew - {0x8aebef01, 0x064f}, // afii57455 - {0x8af00e69, 0x3396}, // mlsquare - {0x8af0299d, 0x2465}, // sixcircle - {0x8af3a8ba, 0x1e55}, // pacute - {0x8afdb385, 0x05b2}, // hatafpatahnarrowhebrew - {0x8b04e879, 0x0573}, // cheharmenian - {0x8b2ea84b, 0x045f}, // afii10193 - {0x8b336b03, 0x33c3}, // bqsquare - {0x8b3d9ff3, 0x313a}, // rieulkiyeokkorean - {0x8b46ba2c, 0x1e10}, // Dcedilla - {0x8b5fbe71, 0x0209}, // idblgrave - {0x8b6e36e5, 0x0001}, // controlSTX - {0x8b91eefb, 0x0135}, // jcircumflex - {0x8ba07e30, 0x3236}, // ideographicfinancialparen - {0x8ba61ca6, 0x0170}, // Udblacute - {0x8bb0c7c5, 0x04a4}, // Enghecyrillic - {0x8bb9fe95, 0x1e35}, // klinebelow - {0x8bc6e552, 0x027a}, // rlonglegturned - {0x8bd60707, 0x33ce}, // squarekmcapital - {0x8bdd4dfa, 0x05a1}, // pazerhebrew - {0x8be0aeeb, 0x1e28}, // Hcedilla - {0x8bf3f9ec, 0x0aed}, // sevengujarati - {0x8bfc7ed2, 0x02e9}, // tonebarextralowmod - {0x8c09cf1f, 0x0251}, // ascript - {0x8c169f16, 0x0a4c}, // aumatragurmukhi - {0x8c1a91ec, 0x1ed2}, // Ocircumflexgrave - {0x8c21575a, 0x2175}, // sixroman - {0x8c31d770, 0x007d}, // bracerightBigg - {0x8c382c45, 0xf6c5}, // afii10064 - {0x8c3dc32f, 0x0632}, // afii57426 - {0x8c5fd3c7, 0x05dd}, // afii57677 - {0x8c6ceb51, 0xeb61}, // suppress - {0x8c7614fd, 0x0046}, // F - {0x8c789c98, 0x0255}, // ccurl - {0x8c7eba77, 0x3114}, // chbopomofo - {0x8c941f03, 0x0639}, // afii57433 - {0x8c9c3f66, 0x0e37}, // saraueethai - {0x8c9d6579, 0x2308}, // ceilingleftBigg - {0x8cb6cb59, 0xfb6c}, // vehinitialarabic - {0x8cbe2a76, 0x0951}, // udattadeva - {0x8cc838c1, 0x099f}, // ttabengali - {0x8ccab94e, 0x311d}, // ehbopomofo - {0x8cd2ceac, 0x322f}, // ideographicearthparen - {0x8cd87862, 0x2a01}, // circleplusdisplay - {0x8cdd7a5e, 0xfefb}, // lamalefisolatedarabic - {0x8cfeaaad, 0x04b4}, // Tetsecyrillic - {0x8d0e3bcc, 0x0162}, // Tcommaaccent - {0x8d15f0f9, 0x01d8}, // udieresisacute - {0x8d17055f, 0xff23}, // Cmonospace - {0x8d2183aa, 0x00ee}, // icircumflex - {0x8d24b8c2, 0x0457}, // afii10104 - {0x8d262f6a, 0x33ad}, // radsquare - {0x8d3bc051, 0x1eb1}, // abrevegrave - {0x8d430411, 0x0288}, // tretroflexhook - {0x8d4c7b99, 0x0473}, // afii10195 - {0x8d557bba, 0xfe98}, // tehmedialarabic - {0x8d5ae6d4, 0x0440}, // ercyrillic - {0x8d62c566, 0x21e0}, // arrowdashleft - {0x8d7f2614, 0x2164}, // Fiveroman - {0x8d983a6e, 0x22b5}, // a4 - {0x8db3e76c, 0x1e97}, // tdieresis - {0x8dbd6f57, 0xffe1}, // sterlingmonospace - {0x8dc41abc, 0x1e33}, // kdotbelow - {0x8de51633, 0x1ed7}, // ocircumflextilde - {0x8df7afeb, 0x0968}, // twodeva - {0x8e0d9fbd, 0x0337}, // solidusshortoverlaycmb - {0x8e2538f6, 0x0420}, // Ercyrillic - {0x8e325301, 0x0133}, // ij - {0x8e3386c6, 0x0439}, // iishortcyrillic - {0x8e360b54, 0x027d}, // rhook - {0x8e38f2c0, 0x005d}, // bracketrightbig - {0x8e40b292, 0x01fb}, // aringacute - {0x8e467ab5, 0x1ecc}, // Odotbelow - {0x8e474342, 0x1e2a}, // Hbrevebelow - {0x8e5ae93f, 0x0909}, // udeva - {0x8e5f575a, 0x0458}, // jecyrillic - {0x8e5f7ac5, 0x01d2}, // ocaron - {0x8e6f5aa1, 0x3074}, // pihiragana - {0x8e757f60, 0x308a}, // rihiragana - {0x8e7aa1b5, 0x207c}, // equalsuperior - {0x8e8e0711, 0x042f}, // afii10049 - {0x8e91af6c, 0x3000}, // ideographicspace - {0x8ec625f1, 0x2304}, // a43 - {0x8ec9ea4f, 0xfb40}, // nundagesh - {0x8eca9ee8, 0x045c}, // kjecyrillic - {0x8ed1765d, 0xff36}, // Vmonospace - {0x8ed539a2, 0x278a}, // onecircleinversesansserif - {0x8f084bdd, 0x3204}, // mieumparenkorean - {0x8f19bc84, 0x0e4a}, // maitrithai - {0x8f289d06, 0x0444}, // efcyrillic - {0x8f28eae1, 0x013f}, // Ldotaccent - {0x8f3d926c, 0xf7e2}, // Acircumflexsmall - {0x8f4b9c51, 0x0404}, // afii10053 - {0x8f505863, 0x04f2}, // Uhungarumlautcyrillic - {0x8f52df2f, 0x0256}, // dtail - {0x8f5e284f, 0xfed6}, // qaffinalarabic - {0x8f760fbe, 0x25e5}, // blackupperrighttriangle - {0x8f7f3f67, 0x0645}, // afii57445 - {0x8f89b56f, 0x05b8}, // qamatsqatanhebrew - {0x8f9b61ad, 0x22c0}, // logicalanddisplay - {0x8fa69b6c, 0x0331}, // macronbelowcmb - {0x8fbba331, 0x0205}, // edblgrave - {0x8fc968d8, 0x01b9}, // ezhreversed - {0x8fce94ba, 0x0395}, // Epsilon - {0x8fd18473, 0x2593}, // shadedark - {0x8fe2c390, 0x0e53}, // threethai - {0x8fe329b9, 0x266c}, // beamedsixteenthnotes - {0x8fe85541, 0x0637}, // afii57431 - {0x8ff897b6, 0x0042}, // B - {0x900e8281, 0x1e3b}, // llinebelow - {0x900fb5c0, 0x0144}, // nacute - {0x902443c2, 0xfe52}, // periodsmall - {0x9024a760, 0x029d}, // jcrossedtail - {0x90307534, 0x3059}, // suhiragana - {0x9059f738, 0x00b7}, // middot - {0x906746a4, 0xff75}, // okatakanahalfwidth - {0x907d968c, 0x0a9b}, // chagujarati - {0x90872973, 0x0538}, // Etarmenian - {0x9098fbd4, 0x0002}, // controlSOT - {0x90995fc1, 0x1e09}, // ccedillaacute - {0x90a162b6, 0x05b4}, // hiriqwidehebrew - {0x90b86ad8, 0x30dd}, // pokatakana - {0x90b9c076, 0xff0f}, // slashmonospace - {0x90c2be85, 0x0268}, // istroke - {0x90d8e15f, 0xf6e8}, // periodsuperior - {0x91032be8, 0x02c6}, // hatwide - {0x910a1b16, 0x03f1}, // rhosymbolgreek - {0x91306ea5, 0x2127}, // a48 - {0x9132f814, 0xff22}, // Bmonospace - {0x9134ebbc, 0x01cb}, // Nj - {0x913ff5ff, 0x3125}, // engbopomofo - {0x9141d43c, 0x2126}, // Ohm - {0x914548fb, 0xf7f9}, // Ugravesmall - {0x914ce494, 0x05e6}, // afii57686 - {0x9166eec8, 0x33ba}, // pwsquare - {0x916cdeb8, 0xfed2}, // fehfinalarabic - {0x917f2f3f, 0x0438}, // afii10074 - {0x9181b388, 0x01eb}, // oogonek - {0x9184e24f, 0x30ab}, // kakatakana - {0x919c9ad4, 0xf898}, // thanthakhatlowleftthai - {0x919f5679, 0x00ca}, // Ecircumflex - {0x91acc220, 0xff91}, // mukatakanahalfwidth - {0x91accd4b, 0x0937}, // ssadeva - {0x91c3e17e, 0x05f2}, // afii57718 - {0x91d99037, 0x1eb9}, // edotbelow - {0x91de3939, 0x064f}, // dammalowarabic - {0x91e65480, 0x0abf}, // ivowelsigngujarati - {0x91ea8b93, 0x2303}, // a42 - {0x91eaac20, 0x3214}, // siosaparenkorean - {0x920233a7, 0xf6de}, // threequartersemdash - {0x920dae79, 0x039f}, // Omicron - {0x9215b042, 0x3147}, // ieungkorean - {0x9220d7f0, 0xff69}, // usmallkatakanahalfwidth - {0x923767e3, 0x3133}, // kiyeoksioskorean - {0x9239e7fb, 0x062b}, // theharabic - {0x923bf3d0, 0x0330}, // tildebelowcmb - {0x926b691e, 0x0100}, // Amacron - {0x92aa52d3, 0x30fb}, // dotkatakana - {0x92e2ffd9, 0x21e8}, // arrowrightwhite - {0x92e50e35, 0xf88e}, // maitholowrightthai - {0x92f283dc, 0x25d8}, // bulletinverse - {0x92f96dbe, 0x1e56}, // Pdotaccent - {0x930724f6, 0x06ba}, // noonghunnaarabic - {0x930c1a0b, 0x001b}, // controlESC - {0x932512ee, 0x03ea}, // Gangiacoptic - {0x9330a2fc, 0x0336}, // strokelongoverlaycmb - {0x934b1595, 0x062d}, // haharabic - {0x93959445, 0x263a}, // smileface - {0x939a56c4, 0x03ad}, // epsilontonos - {0x939b5eb8, 0xfe92}, // behmedialarabic - {0x93bca3b6, 0x099e}, // nyabengali - {0x93e00dc4, 0x2193}, // arrowdown - {0x93eef318, 0x0263}, // gammalatinsmall - {0x9404d5fc, 0x33d5}, // squaremil - {0x941a6b5f, 0x0a23}, // nnagurmukhi - {0x941b20fa, 0xfe4b}, // overlinewavy - {0x942ad1c7, 0x09be}, // aavowelsignbengali - {0x9453959c, 0x24bd}, // Hcircle - {0x9464bc2e, 0x1e66}, // Scarondotaccent - {0x94724b66, 0x21bc}, // harpoonleftbarbup - {0x94803386, 0x09d7}, // aulengthmarkbengali - {0x948a9ce4, 0x05de}, // afii57678 - {0x949bc805, 0x01da}, // udieresiscaron - {0x94ae0441, 0x0410}, // Acyrillic - {0x94b7f6ea, 0x0463}, // yatcyrillic - {0x94c36e74, 0x3261}, // nieuncirclekorean - {0x94c9571f, 0x25ac}, // blackrectangle - {0x94ca16e5, 0xf893}, // maichattawaupperleftthai - {0x94d13d1c, 0xfe39}, // tortoiseshellbracketleftvertical - {0x94d44c33, 0x007b}, // braceleftbig - {0x94d74b96, 0x1e64}, // Sacutedotaccent - {0x94e6f584, 0x3058}, // zihiragana - {0x94ee5ae7, 0x2792}, // ninecircleinversesansserif - {0x94f9a508, 0x3265}, // pieupcirclekorean - {0x9518a20d, 0x30d9}, // bekatakana - {0x951a0238, 0xfdf2}, // lamlamhehisolatedarabic - {0x951ae869, 0x09dc}, // rrabengali - {0x952cce64, 0x04ee}, // Umacroncyrillic - {0x952ec009, 0x0988}, // iibengali - {0x95394a64, 0x05da}, // finalkafsheva - {0x953a0a51, 0x2211}, // summation - {0x954920d5, 0xf769}, // Ismall - {0x954a8776, 0x03d1}, // thetasymbolgreek - {0x95526ac8, 0x2500}, // SF100000 - {0x9559e176, 0x05b7}, // patah2a - {0x955dbbe7, 0x23aa}, // braceex - {0x957765bc, 0xfe8a}, // yehhamzaabovefinalarabic - {0x958830cb, 0x2669}, // quarternote - {0x9588e4f1, 0xff99}, // rukatakanahalfwidth - {0x959cf6c1, 0x203b}, // referencemark - {0x95af6475, 0x05e3}, // finalpehebrew - {0x95aff05f, 0x03ca}, // iotadieresis - {0x95b3bc07, 0xfb46}, // tsadidagesh - {0x95bed968, 0x0e15}, // totaothai - {0x95cabf3f, 0x21cf}, // arrowrightdblstroke - {0x95d7e2f4, 0x0032}, // two - {0x95ed768c, 0x05e0}, // nun - {0x960140f0, 0x2496}, // fifteenperiod - {0x961b2e15, 0x1e6f}, // tlinebelow - {0x96220dd7, 0x318a}, // yuyeokorean - {0x962b0c72, 0x3323}, // sentosquare - {0x9638605a, 0x0669}, // ninearabic - {0x967b01ac, 0x05b9}, // holamhebrew - {0x967d0326, 0x3134}, // nieunkorean - {0x968e4cb7, 0xf899}, // nikhahitleftthai - {0x96a5e022, 0x25d9}, // invcircle - {0x96b677d5, 0x0153}, // oe - {0x96c05d98, 0x01f2}, // Dz - {0x96c1ab16, 0x247f}, // twelveparen - {0x96d9cc68, 0x0427}, // Checyrillic - {0x96fd8ec6, 0x1e7a}, // Umacrondieresis - {0x9711eb31, 0x21aa}, // arrowhookleft - {0x9741ad45, 0x05bf}, // rafe - {0x975dc1dc, 0x32a5}, // ideographiccentrecircle - {0x9776a4ba, 0x0007}, // controlBEL - {0x977737b3, 0x0265}, // hturned - {0x9778a35b, 0x0562}, // benarmenian - {0x977e0dfa, 0x25d0}, // circlewithlefthalfblack - {0x97843a2e, 0x09f8}, // denominatorminusonenumeratorbengali - {0x978c8c89, 0x03ac}, // alphatonos - {0x97ae16ea, 0x23a1}, // bracketlefttp - {0x97b3e7db, 0x24c3}, // Ncircle - {0x97e45478, 0x05b6}, // segol2c - {0x97ea0cb5, 0x04d8}, // Schwacyrillic - {0x97ebb44e, 0x015f}, // scedilla - {0x97f03f9c, 0x0419}, // Iishortcyrillic - {0x97f6721e, 0x05bf}, // afii57841 - {0x980e76a2, 0x1e32}, // Kdotbelow - {0x98148d7b, 0xff14}, // fourmonospace - {0x981fc90b, 0x0a1b}, // chagurmukhi - {0x982585a7, 0x260e}, // telephoneblack - {0x982718e0, 0x003c}, // less - {0x982eb09a, 0x0e5b}, // khomutthai - {0x9853033e, 0x04b5}, // tetsecyrillic - {0x987e6d13, 0x0411}, // Becyrillic - {0x9896e370, 0x0402}, // afii10051 - {0x98b02dc0, 0x0a48}, // aimatragurmukhi - {0x98bf4a1b, 0xf6d0}, // Macron - {0x98c60f17, 0xf6d9}, // copyrightserif - {0x98d74b1c, 0x01c8}, // Lj - {0x98d9aba5, 0x03ae}, // etatonos - {0x98eba766, 0x018b}, // Dtopbar - {0x98f4783f, 0x24ac}, // qparen - {0x98f4b751, 0x0651}, // afii57457 - {0x98ffb065, 0x02c6}, // hatwider - {0x99104281, 0x02e5}, // tonebarextrahighmod - {0x99235205, 0x05dc}, // lamedhebrew - {0x994ebac3, 0x05c0}, // afii57842 - {0x99725844, 0x0320}, // minusbelowcmb - {0x9982855c, 0x0686}, // afii57507 - {0x99830dc7, 0x062c}, // afii57420 - {0x99863852, 0x03ed}, // shimacoptic - {0x99997c4f, 0x3314}, // kirosquare - {0x999c619c, 0x3078}, // hehiragana - {0x999f4db4, 0x05b4}, // afii57793 - {0x99cca883, 0xff04}, // dollarmonospace - {0x99e63f81, 0x0962}, // lvocalicvowelsigndeva - {0x9a069ea3, 0x2267}, // greateroverequal - {0x9a098276, 0xfea2}, // hahfinalarabic - {0x9a157ece, 0x246a}, // elevencircle - {0x9a1c929d, 0x043c}, // afii10078 - {0x9a310f17, 0xff51}, // qmonospace - {0x9a3391f5, 0x0190}, // Eopen - {0x9a464a33, 0x0174}, // Wcircumflex - {0x9a50ec2e, 0x05b6}, // segolquarterhebrew - {0x9a7aab21, 0x05c3}, // sofpasuqhebrew - {0x9ac6c137, 0x0e0f}, // topatakthai - {0x9ae2a69d, 0xf6c0}, // ll - {0x9aea680b, 0x3029}, // ninehangzhou - {0x9af6d63b, 0x054a}, // Peharmenian - {0x9b064cf1, 0xfedf}, // lammeemjeeminitialarabic - {0x9b09b61d, 0x0a10}, // aigurmukhi - {0x9b0db21d, 0x0402}, // Djecyrillic - {0x9b100042, 0x0e21}, // momathai - {0x9b29e68e, 0x0278}, // philatin - {0x9b3ff954, 0x0e56}, // sixthai - {0x9b5a3eb3, 0x0626}, // afii57414 - {0x9b712e01, 0x1eba}, // Ehookabove - {0x9b73811a, 0x2227}, // logicaland - {0x9b76648b, 0x041f}, // afii10033 - {0x9b7712b3, 0x1e5a}, // Rdotbelow - {0x9b8591a5, 0x30ca}, // nakatakana - {0x9b950b60, 0x095e}, // fadeva - {0x9ba02025, 0x01e9}, // kcaron - {0x9bca0720, 0x1e93}, // zdotbelow - {0x9bcccde6, 0x0e4e}, // yamakkanthai - {0x9bd59a36, 0x300e}, // whitecornerbracketleft - {0x9bdb98a4, 0x1e5e}, // Rlinebelow - {0x9bdfdedf, 0x05d3}, // daletsheva - {0x9be54046, 0x0e0a}, // chochangthai - {0x9bfe067d, 0x0405}, // Dzecyrillic - {0x9c14c866, 0x0484}, // palatalizationcyrilliccmb - {0x9c1ff986, 0x05f1}, // afii57717 - {0x9c30e64e, 0x0121}, // gdot - {0x9c3d076c, 0x002d}, // hyphen - {0x9c5df589, 0x03b2}, // beta - {0x9c5e488c, 0x05d3}, // dalethebrew - {0x9c743ddb, 0x3239}, // ideographicrepresentparen - {0x9cc9b890, 0x2a00}, // circledottext - {0x9cd2074a, 0x0a36}, // shagurmukhi - {0x9ce0dacf, 0xfebb}, // sadinitialarabic - {0x9ce3d2fe, 0x06d2}, // afii57519 - {0x9ce9cdfc, 0x0408}, // Jecyrillic - {0x9ce9f027, 0x0426}, // Tsecyrillic - {0x9cf54095, 0x20aa}, // newsheqelsign - {0x9d1b1141, 0x25d8}, // invbullet - {0x9d1ed2c0, 0x0120}, // Gdotaccent - {0x9d25f804, 0x0294}, // glottalstop - {0x9d3a5187, 0x03bb}, // lambda - {0x9d4507ca, 0x00a0}, // nonbreakingspace - {0x9d4ea24d, 0x045a}, // njecyrillic - {0x9d5ba323, 0x3145}, // sioskorean - {0x9d5eb9a4, 0x001f}, // controlUS - {0x9d662219, 0x332a}, // haitusquare - {0x9d760ad7, 0x3318}, // guramusquare - {0x9d770652, 0x1e2b}, // hbrevebelow - {0x9db9ebc8, 0x30ba}, // zukatakana - {0x9dee7277, 0x2015}, // afii00208 - {0x9df531bb, 0x059b}, // tevirhebrew - {0x9e021469, 0x22cf}, // curlyand - {0x9e062707, 0x02a2}, // glottalstopstrokereversed - {0x9e0bf218, 0x02b1}, // hhooksuperior - {0x9e0d1458, 0x02c4}, // arrowheadupmod - {0x9e1247f8, 0x0033}, // three - {0x9e248728, 0x3053}, // kohiragana - {0x9e2d5a68, 0x053f}, // Kenarmenian - {0x9e37413a, 0x22c2}, // intersectiondisplay - {0x9e4de0cc, 0x221a}, // radicalBigg - {0x9e5de325, 0x222e}, // contourintegral - {0x9e65e800, 0x248b}, // fourperiod - {0x9e98d52c, 0x2483}, // sixteenparen - {0x9ea14168, 0x05b7}, // patahquarterhebrew - {0x9ea23fe1, 0x00f1}, // ntilde - {0x9eac193b, 0x00ef}, // idieresis - {0x9eb5aea3, 0x3142}, // pieupkorean - {0x9ebea1a0, 0x3150}, // aekorean - {0x9ee7bbd1, 0x094b}, // ovowelsigndeva - {0x9eeac84b, 0xfee7}, // noonhehinitialarabic - {0x9eedaba9, 0x0113}, // emacron - {0x9ef0c911, 0xf765}, // Esmall - {0x9f023815, 0x20ac}, // euro - {0x9f30fc87, 0xfec2}, // tahfinalarabic - {0x9f37894c, 0x040e}, // afii10062 - {0x9f53036c, 0x0a19}, // ngagurmukhi - {0x9f65cf71, 0x1e25}, // hdotbelow - {0x9f69147e, 0x1e61}, // sdotaccent - {0x9f6f9105, 0x0433}, // gecyrillic - {0x9f739695, 0x04f9}, // yerudieresiscyrillic - {0x9f79f6eb, 0xfb33}, // daletdageshhebrew - {0x9f7f5e1f, 0xf897}, // thanthakhatlowrightthai - {0x9f8cff14, 0x003e}, // greater - {0x9f94b2e4, 0x04a1}, // kabashkircyrillic - {0x9fa5f7ad, 0x0e49}, // maithothai - {0x9fa872ec, 0x02dc}, // tildewidest - {0x9fc7ffac, 0x05b4}, // hiriqhebrew - {0x9fd406b1, 0xfed8}, // qafmedialarabic - {0x9fd7c50e, 0x05bb}, // afii57796 - {0x9fdfc7a1, 0x00b0}, // degree - {0x9ffeaad9, 0x01ed}, // oogonekmacron - {0xa0144bc6, 0xfc8d}, // noonnoonfinalarabic - {0xa0166e3d, 0x3159}, // waekorean - {0xa016fb2d, 0x016b}, // umacron - {0xa0286aa8, 0x1e04}, // Bdotbelow - {0xa03db58b, 0x02d2}, // ringhalfrightcentered - {0xa05ccf71, 0x05e1}, // samekhhebrew - {0xa069fd2d, 0x012b}, // imacron - {0xa08ca5a7, 0x2491}, // tenperiod - {0xa09c7d02, 0x05e8}, // reshhatafpatahhebrew - {0xa0a317f9, 0x0574}, // menarmenian - {0xa0adde45, 0xf884}, // maihanakatleftthai - {0xa0c2ffe3, 0x247a}, // sevenparen - {0xa0e40fac, 0x337b}, // heiseierasquare - {0xa0e487b8, 0x33cd}, // KKsquare - {0xa0ee672b, 0x3143}, // ssangpieupkorean - {0xa100bc11, 0x043e}, // ocyrillic - {0xa10462a8, 0x0394}, // Deltagreek - {0xa11f6f39, 0x0071}, // q - {0xa12507ea, 0x2177}, // eightroman - {0xa12d2230, 0x05b5}, // tsere2b - {0xa134a191, 0xff11}, // onemonospace - {0xa14f5367, 0x05b0}, // sheva15 - {0xa14fd78e, 0x2193}, // arrowbt - {0xa157c7c6, 0x0643}, // kafarabic - {0xa15811a3, 0x061f}, // questionarabic - {0xa1697005, 0x0015}, // controlNAK - {0xa16fa8a4, 0x22a3}, // tackleft - {0xa1703e0a, 0x3219}, // thieuthaparenkorean - {0xa1850262, 0x05c2}, // afii57803 - {0xa1a14a63, 0x1eb8}, // Edotbelow - {0xa1ed89db, 0x0202}, // Ainvertedbreve - {0xa20cadbf, 0x0062}, // b - {0xa20ea9da, 0x24aa}, // oparen - {0xa212ed2d, 0x0e38}, // sarauthai - {0xa23bb3ad, 0x222b}, // integraltext - {0xa2448aa1, 0x01e6}, // Gcaron - {0xa2543878, 0x326f}, // nieunacirclekorean - {0xa254ebdd, 0xfb3e}, // memdagesh - {0xa259bfe7, 0xff19}, // ninemonospace - {0xa262edc1, 0xfe49}, // overlinedashed - {0xa26bc10f, 0x061b}, // semicolonarabic - {0xa27876ee, 0xfe35}, // parenleftvertical - {0xa28a5f58, 0xfec8}, // zahmedialarabic - {0xa28ba8ac, 0x317d}, // siospieupkorean - {0xa2972ad9, 0x2305}, // projective - {0xa2be0dd9, 0x062b}, // afii57419 - {0xa2c2120e, 0x0e52}, // twothai - {0xa2d967e3, 0x2083}, // threeinferior - {0xa2e1fb7a, 0x221e}, // infinity - {0xa2f62d95, 0x306e}, // nohiragana - {0xa3004c6f, 0x092e}, // madeva - {0xa316ccc6, 0x2044}, // fraction - {0xa32a4538, 0xfb1f}, // afii57705 - {0xa334b2d1, 0x043d}, // afii10079 - {0xa34b5d2f, 0x0e57}, // seventhai - {0xa36dbdee, 0x30db}, // hokatakana - {0xa386d6fe, 0x3327}, // tonsquare - {0xa3903917, 0x3270}, // tikeutacirclekorean - {0xa39b2570, 0xfefc}, // lamaleffinalarabic - {0xa3b51a89, 0x0597}, // reviamugrashhebrew - {0xa3cc74fa, 0x3056}, // zahiragana - {0xa3d9a90d, 0x0499}, // zedescendercyrillic - {0xa3e95215, 0xfef9}, // lamalefhamzabelowisolatedarabic - {0xa3ec709c, 0x0569}, // toarmenian - {0xa3fbf1d9, 0x0497}, // zhedescendercyrillic - {0xa3fe88d1, 0x0104}, // Aogonek - {0xa40369ed, 0x32a9}, // ideographicmedicinecircle - {0xa4259ac9, 0xff76}, // kakatakanahalfwidth - {0xa43a91b7, 0x005b}, // bracketleftbig - {0xa43cdc2e, 0xfb44}, // pedageshhebrew - {0xa446d45f, 0x3224}, // fiveideographicparen - {0xa450f946, 0x0454}, // afii10101 - {0xa456f11e, 0x09e8}, // twobengali - {0xa457c062, 0x30ad}, // kikatakana - {0xa45b3183, 0x0aeb}, // fivegujarati - {0xa45b7f21, 0x010e}, // Dcaron - {0xa4627c0f, 0x0204}, // Edblgrave - {0xa478f921, 0x09e0}, // rrvocalicbengali - {0xa4863185, 0x30f4}, // vukatakana - {0xa4922e7c, 0x0341}, // acutetonecmb - {0xa4aa1092, 0x05b1}, // hatafsegol30 - {0xa4aa8935, 0xff58}, // xmonospace - {0xa4af8f73, 0x2282}, // subset - {0xa4decb10, 0x0a72}, // irigurmukhi - {0xa4ebd5d8, 0x05e7}, // qofhiriqhebrew - {0xa50a3a99, 0x0630}, // afii57424 - {0xa50cf621, 0xff7e}, // sekatakanahalfwidth - {0xa512e58d, 0xff83}, // tekatakanahalfwidth - {0xa517b724, 0xfee6}, // noonfinalarabic - {0xa52168e0, 0x2325}, // option - {0xa54253fb, 0x05e7}, // qof - {0xa545c2a6, 0xfb2a}, // afii57694 - {0xa553cf3e, 0x003b}, // semicolon - {0xa56dfce7, 0x0e03}, // khokhuatthai - {0xa58382dd, 0x0137}, // kcedilla - {0xa5b93826, 0x2555}, // SF220000 - {0xa5ecbdaa, 0x03b5}, // epsilon - {0xa6056425, 0x05b8}, // qamatswidehebrew - {0xa60745ee, 0x2250}, // approaches - {0xa6281f81, 0x0142}, // lslash - {0xa62afc92, 0x0534}, // Daarmenian - {0xa63a8cce, 0xf7f4}, // Ocircumflexsmall - {0xa6454b66, 0x2498}, // seventeenperiod - {0xa64723d6, 0x30af}, // kukatakana - {0xa6522894, 0x24da}, // kcircle - {0xa652cff2, 0x24a8}, // mparen - {0xa65ca284, 0x314d}, // phieuphkorean - {0xa65ea7b9, 0x00ab}, // guillemotleft - {0xa6644796, 0xfc94}, // yehnoonfinalarabic - {0xa66b3ab3, 0x00b8}, // cedilla - {0xa675e0d6, 0x0156}, // Rcommaaccent - {0xa683217b, 0x0ab7}, // ssagujarati - {0xa6a017fd, 0x0415}, // Iecyrillic - {0xa6ae34a8, 0x3028}, // eighthangzhou - {0xa6b19efc, 0x0591}, // etnahtafoukhhebrew - {0xa6b46028, 0xff72}, // ikatakanahalfwidth - {0xa6bd2b95, 0x1e6b}, // tdotaccent - {0xa6c10839, 0x0431}, // becyrillic - {0xa6e68e9f, 0x0966}, // zerodeva - {0xa6f16c03, 0x03c2}, // sigma1 - {0xa6f2df0d, 0x0a32}, // lagurmukhi - {0xa6f3cb6a, 0x21d3}, // arrowdblbt - {0xa716a470, 0x2464}, // fivecircle - {0xa71dfe13, 0x1ea2}, // Ahookabove - {0xa73026ce, 0x007a}, // z - {0xa73199c0, 0x05bb}, // qubutshebrew - {0xa731e944, 0x0411}, // afii10018 - {0xa7320cb3, 0x3139}, // rieulkorean - {0xa74014fc, 0x003f}, // question - {0xa745be27, 0x2308}, // ceilingleftbig - {0xa74cd67a, 0x025f}, // jdotlessstroke - {0xa756caf5, 0x04d2}, // Adieresiscyrillic - {0xa7769b7a, 0x22c1}, // logicalortext - {0xa7895d88, 0x252c}, // SF060000 - {0xa796d5bb, 0x0267}, // henghook - {0xa7bff3d5, 0x032c}, // caronbelowcmb - {0xa7dcd836, 0xfb68}, // ttehinitialarabic - {0xa7e01c26, 0x01a7}, // Tonetwo - {0xa7e7d702, 0x05b8}, // qamats1a - {0xa7edca33, 0x25b7}, // whiterightpointingtriangle - {0xa7fb6ee6, 0x226f}, // notgreater - {0xa7fe97d8, 0x3166}, // nieuntikeutkorean - {0xa815fa8a, 0x309e}, // voicediterationhiragana - {0xa819fe3e, 0x315e}, // wekorean - {0xa81ee743, 0x0542}, // Ghadarmenian - {0xa826b713, 0xfeb6}, // sheenfinalarabic - {0xa842618b, 0x025b}, // eopen - {0xa84fdde5, 0x0340}, // gravetonecmb - {0xa851c76f, 0x05a5}, // merkhahebrew - {0xa8547bdd, 0x0455}, // afii10102 - {0xa8665e8d, 0x05b1}, // afii57801 - {0xa877e561, 0x2642}, // male - {0xa87899cd, 0xf6e6}, // hyphensuperior - {0xa8982f3b, 0x09b2}, // labengali - {0xa8a24959, 0x00d0}, // Eth - {0xa8b6c7f5, 0x0a2e}, // magurmukhi - {0xa8b7f35e, 0x06c1}, // haaltonearabic - {0xa8bb13d5, 0x0a70}, // tippigurmukhi - {0xa8ccc65c, 0x3316}, // kiromeetorusquare - {0xa8db2b93, 0x017e}, // zcaron - {0xa93204a5, 0x03a6}, // Phi - {0xa9350b3f, 0x20a1}, // colonmonetary - {0xa93a2a4f, 0x1e47}, // ndotbelow - {0xa94e0303, 0x33ab}, // mpasquare - {0xa94eeaee, 0x01aa}, // eshreversedloop - {0xa95e2711, 0x1e21}, // gmacron - {0xa96cef91, 0x3169}, // rieulkiyeoksioskorean - {0xa981562d, 0x0668}, // eightarabic - {0xa98e771c, 0x0634}, // sheenarabic - {0xa9985803, 0x30dc}, // bokatakana - {0xa99c94c2, 0x01be}, // glottalinvertedstroke - {0xa9a0932f, 0x2077}, // sevensuperior - {0xa9af18f2, 0x30b4}, // gokatakana - {0xa9c0b182, 0x2264}, // lessequal - {0xa9dc390a, 0x05da}, // finalkafqamatshebrew - {0xa9e88297, 0x2053}, // a58 - {0xaa13efde, 0x007d}, // braceright - {0xaa245bb8, 0x0028}, // parenleftBig - {0xaa4e278b, 0x0967}, // onedeva - {0xaa51d75f, 0x2476}, // threeparen - {0xaa69d0f1, 0x256c}, // SF440000 - {0xaa863ce3, 0x0629}, // tehmarbutaarabic - {0xaa8c5eeb, 0x03e5}, // feicoptic - {0xaa96b9dc, 0x0665}, // fivearabic - {0xaaabcf5c, 0x04b9}, // cheverticalstrokecyrillic - {0xaab6b9a5, 0x0211}, // rdblgrave - {0xaabfed05, 0xff85}, // nakatakanahalfwidth - {0xaac3a76a, 0x0559}, // ringhalfleftarmenian - {0xaac3adf0, 0x3121}, // oubopomofo - {0xaacaffc4, 0x2162}, // Threeroman - {0xaad54f7c, 0x3002}, // ideographicperiod - {0xaaf6eb21, 0x01ce}, // acaron - {0xab0b499a, 0x099c}, // jabengali - {0xab126f69, 0x5344}, // twentyhangzhou - {0xab1f1bb7, 0x05df}, // afii57679 - {0xab24577f, 0x0667}, // sevenarabic - {0xab2b4200, 0x2105}, // careof - {0xab3b4b27, 0x24e2}, // scircle - {0xab52e61f, 0x05d3}, // dalethatafpatah - {0xab808d1e, 0x2087}, // seveninferior - {0xab8a6656, 0x01d0}, // icaron - {0xaba55a59, 0xfb32}, // gimeldageshhebrew - {0xabb7eb8f, 0x2081}, // oneinferior - {0xabd373e8, 0x055e}, // questionarmenian - {0xac05d874, 0x1e84}, // Wdieresis - {0xac259f58, 0x0448}, // afii10090 - {0xac2c323e, 0x0191}, // Fhook - {0xac32a034, 0x316f}, // mieumsioskorean - {0xac483cb3, 0x338c}, // mufsquare - {0xac4f1094, 0x059c}, // gereshaccenthebrew - {0xac50a082, 0x33a3}, // mmcubedsquare - {0xac5faca7, 0x230b}, // floorrightbig - {0xac67aca2, 0x045b}, // tshecyrillic - {0xacac7818, 0x219d}, // a59 - {0xacb92bab, 0x0691}, // rreharabic - {0xacd00f05, 0x21c6}, // arrowleftoverright - {0xacd11e18, 0x2010}, // hyphentwo - {0xace7d07a, 0x0921}, // ddadeva - {0xacfcbdb9, 0x3042}, // ahiragana - {0xad01f787, 0xff1d}, // equalmonospace - {0xad1b58f9, 0x0595}, // zaqefgadolhebrew - {0xad29738f, 0x05f4}, // gershayimhebrew - {0xad33f4b3, 0x04c1}, // Zhebrevecyrillic - {0xad37f8e0, 0x0a24}, // tagurmukhi - {0xad38bc31, 0x2194}, // arrowboth - {0xad45a65c, 0xf6cc}, // DieresisAcute - {0xad5fe438, 0x0924}, // tadeva - {0xad781e89, 0x200c}, // afii61664 - {0xad8ff38a, 0x0a21}, // ddagurmukhi - {0xadb1b19e, 0x0206}, // Einvertedbreve - {0xadb53f6b, 0xfbaf}, // yehbarreefinalarabic - {0xadbea3e4, 0x20aa}, // afii57636 - {0xadc3ff5e, 0x0649}, // afii57449 - {0xadf402a9, 0x0989}, // ubengali - {0xadf4d422, 0x0625}, // alefhamzabelowarabic - {0xae04e5ad, 0x0a15}, // kagurmukhi - {0xae06976c, 0xf6d5}, // cyrflex - {0xae1f7b0a, 0x2076}, // sixsuperior - {0xae23dd7b, 0x1eaf}, // abreveacute - {0xae30147f, 0x0908}, // iideva - {0xae346d0d, 0x05e8}, // reshsheva - {0xae56317c, 0x24ae}, // sparen - {0xae6f7e74, 0x031b}, // horncmb - {0xae7c975f, 0x249a}, // nineteenperiod - {0xae8f4e4c, 0x0406}, // afii10055 - {0xaeac4f55, 0xf7e9}, // Eacutesmall - {0xaeb06274, 0x0423}, // Ucyrillic - {0xaec173e8, 0x03b8}, // theta - {0xaee16fb6, 0xfe4f}, // underscorewavy - {0xaef4b475, 0x1edf}, // ohornhookabove - {0xaef8393d, 0x0664}, // fourarabic - {0xaf01f370, 0x278e}, // fivecircleinversesansserif - {0xaf0ebb84, 0xf6d6}, // dblgrave - {0xaf2073fd, 0x2103}, // centigrade - {0xaf3552ce, 0x3072}, // hihiragana - {0xaf36c6b1, 0x30cd}, // nekatakana - {0xaf499180, 0x2309}, // ceilingrightBig - {0xaf4df0df, 0xfc0e}, // tehmeemisolatedarabic - {0xaf5710c9, 0x00c0}, // Agrave - {0xaf5b123d, 0x032d}, // circumflexbelowcmb - {0xaf5ce08f, 0x00e0}, // agrave - {0xaf788850, 0x00fc}, // udieresis - {0xaf7abcb1, 0x05b9}, // holam - {0xaf8a8524, 0x0455}, // dzecyrillic - {0xafa14924, 0x33d3}, // lxsquare - {0xafaa365c, 0x30be}, // zokatakana - {0xafb28009, 0x03e2}, // Sheicoptic - {0xafb8e89a, 0x0a68}, // twogurmukhi - {0xafbbfcac, 0xff71}, // akatakanahalfwidth - {0xafbd0738, 0x305d}, // sohiragana - {0xafc9b657, 0x0e17}, // thothahanthai - {0xaff892ca, 0x05d3}, // dalettserehebrew - {0xb000150a, 0xfe96}, // tehfinalarabic - {0xb01f8020, 0x0666}, // sixarabic - {0xb026a3ef, 0x30b3}, // kokatakana - {0xb0309f24, 0xfee3}, // meeminitialarabic - {0xb032be97, 0x047b}, // omegaroundcyrillic - {0xb033a837, 0x0079}, // y - {0xb03640f2, 0x2252}, // approxequalorimage - {0xb0522c01, 0x278f}, // sixcircleinversesansserif - {0xb0791aaf, 0x09f3}, // rupeesignbengali - {0xb0a20aff, 0x22db}, // greaterequalorless - {0xb0c33454, 0x028a}, // upsilonlatin - {0xb0efaba6, 0x0a97}, // gagujarati - {0xb107bdf6, 0x304b}, // kahiragana - {0xb1240d86, 0x0474}, // afii10148 - {0xb145d406, 0x327b}, // hieuhacirclekorean - {0xb169c9ac, 0x1eed}, // uhornhookabove - {0xb1722e49, 0x3006}, // ideographicclose - {0xb199f9f3, 0x314a}, // chieuchkorean - {0xb1a83745, 0x246e}, // fifteencircle - {0xb1a9eaa4, 0x1eb7}, // abrevedotbelow - {0xb1b08c26, 0x2020}, // dagger - {0xb1b2e578, 0xff13}, // threemonospace - {0xb1c3eac2, 0x1e8c}, // Xdieresis - {0xb1e18633, 0x0e2d}, // oangthai - {0xb1eda93c, 0x09e2}, // lvocalicvowelsignbengali - {0xb1fa6226, 0x0a9a}, // cagujarati - {0xb225a8bc, 0x0947}, // evowelsigndeva - {0xb243894e, 0x21d1}, // arrowdblup - {0xb25639c1, 0x2534}, // SF070000 - {0xb2566e08, 0x064d}, // afii57453 - {0xb256786e, 0x03f2}, // sigmalunatesymbolgreek - {0xb25b34dc, 0x0e1a}, // bobaimaithai - {0xb26943db, 0x0420}, // afii10034 - {0xb27e91f4, 0x01bb}, // twostroke - {0xb290d64a, 0xfe88}, // alefhamzabelowfinalarabic - {0xb2bbd0d4, 0xfeb0}, // zainfinalarabic - {0xb2cc02c2, 0x1e38}, // Ldotbelowmacron - {0xb2d79f3e, 0x00f9}, // ugrave - {0xb2d7f27b, 0x0652}, // afii57458 - {0xb2d95c63, 0x2518}, // SF040000 - {0xb2f3aff0, 0x0946}, // eshortvowelsigndeva - {0xb311c284, 0x05e7}, // qoftsere - {0xb3178333, 0x00da}, // Uacute - {0xb321fe9c, 0x21e3}, // arrowdashdown - {0xb327a481, 0x2290}, // a61 - {0xb32daf91, 0xf6c6}, // afii10192 - {0xb32e268f, 0xf6fe}, // Tildesmall - {0xb3329e90, 0x313e}, // rieulthieuthkorean - {0xb33c41bc, 0x018c}, // dtopbar - {0xb340e2fe, 0x04a5}, // enghecyrillic - {0xb341da2f, 0x1e36}, // Ldotbelow - {0xb345c512, 0xfea4}, // hahmedialarabic - {0xb369c9bd, 0x2423}, // blank - {0xb36f3f4e, 0x054d}, // Seharmenian - {0xb3880287, 0x05d6}, // zayinhebrew - {0xb38b59bc, 0x0ac0}, // iivowelsigngujarati - {0xb3a3592e, 0x21e5}, // arrowtabright - {0xb3dbcf55, 0x323d}, // ideographicenterpriseparen - {0xb3e6b497, 0x03c9}, // omega - {0xb3ed41be, 0x328f}, // ideographearthcircle - {0xb40169ac, 0x05b0}, // sheva22 - {0xb405e3e3, 0x0439}, // afii10075 - {0xb40aff3d, 0xf730}, // zerooldstyle - {0xb41baecc, 0x2487}, // twentyparen - {0xb427632e, 0x05b3}, // hatafqamats1b - {0xb4344c30, 0x090f}, // edeva - {0xb43bb55a, 0x3263}, // rieulcirclekorean - {0xb448d464, 0x0391}, // Alpha - {0xb45a5763, 0x201b}, // quoteleftreversed - {0xb45ef9b7, 0x03c0}, // pi - {0xb47a6410, 0x230a}, // floorleftBigg - {0xb497903a, 0x01dd}, // eturned - {0xb4a55071, 0x1e7d}, // vtilde - {0xb4a6b289, 0x2235}, // because - {0xb4a7f99d, 0x0954}, // acutedeva - {0xb4a9d27d, 0x05d2}, // afii57666 - {0xb4c0dc86, 0x0e48}, // maiekthai - {0xb4c2484c, 0x05dc}, // lamed - {0xb4c667bc, 0xff61}, // periodhalfwidth - {0xb4c72b2a, 0x0215}, // udblgrave - {0xb4e21f31, 0x2198}, // arrowdownright - {0xb4fef2ed, 0x05d3}, // dalettsere - {0xb500deca, 0x1e41}, // mdotaccent - {0xb510d684, 0x1e80}, // Wgrave - {0xb526b685, 0x22bf}, // righttriangle - {0xb52e7c1d, 0x091e}, // nyadeva - {0xb53ca7e2, 0x326c}, // phieuphcirclekorean - {0xb5866d85, 0x005c}, // backslashbig - {0xb58e59d7, 0x24ad}, // rparen - {0xb5af274f, 0x064a}, // afii57450 - {0xb5b94593, 0x010d}, // ccaron - {0xb5c458a3, 0x05b8}, // qamatsqatanwidehebrew - {0xb5f24e31, 0xff5a}, // zmonospace - {0xb600bed1, 0x3024}, // fourhangzhou - {0xb6052cdb, 0x010b}, // cdotaccent - {0xb61c54b4, 0x24e4}, // ucircle - {0xb64312f2, 0x00a2}, // cent - {0xb6443d26, 0x0622}, // afii57410 - {0xb647ed9e, 0x01d7}, // Udieresisacute - {0xb652184e, 0x0e4b}, // maichattawathai - {0xb6588f1c, 0x247c}, // nineparen - {0xb66bf9b9, 0x33dc}, // svsquare - {0xb673fbb5, 0x038e}, // Upsilontonos - {0xb67e35c8, 0x0121}, // gdotaccent - {0xb6951f83, 0x2210}, // coproductdisplay - {0xb6bb2a6b, 0x0116}, // Edot - {0xb6d45c54, 0xff7a}, // kokatakanahalfwidth - {0xb6f322b3, 0x05e5}, // afii57685 - {0xb6f9554e, 0x3205}, // pieupparenkorean - {0xb6f9c67c, 0x0464}, // Eiotifiedcyrillic - {0xb6fea9e7, 0xff3f}, // underscoremonospace - {0xb70f3f60, 0xff4e}, // nmonospace - {0xb711b601, 0x039d}, // Nu - {0xb7124c93, 0xf770}, // Psmall - {0xb719922a, 0x067e}, // afii57506 - {0xb71d84e2, 0x3167}, // nieunsioskorean - {0xb726c42e, 0xfb49}, // shindageshhebrew - {0xb72e5846, 0x1edb}, // ohornacute - {0xb73606f5, 0x0463}, // afii10194 - {0xb7400632, 0x33aa}, // kpasquare - {0xb747ebc8, 0x2310}, // revlogicalnot - {0xb755a24e, 0x310e}, // kbopomofo - {0xb7934eea, 0x01c5}, // Dzcaron - {0xb7affc1f, 0x0418}, // afii10026 - {0xb7b78fdd, 0x2463}, // fourcircle - {0xb7bd89d3, 0x0491}, // gheupturncyrillic - {0xb7d20c6c, 0x215c}, // threeeighths - {0xb7e9bb2b, 0x30fe}, // voicediterationkatakana - {0xb80991a9, 0x04d6}, // Iebrevecyrillic - {0xb81d8e8c, 0xfb31}, // betdagesh - {0xb855cda8, 0x3397}, // dlsquare - {0xb85a6427, 0x0650}, // kasraarabic - {0xb8632720, 0x0e07}, // ngonguthai - {0xb879d78f, 0xfe32}, // endashvertical - {0xb894f4d6, 0x01a0}, // Ohorn - {0xb8972176, 0x04bb}, // shhacyrillic - {0xb89948ac, 0x0a93}, // ogujarati - {0xb8be7e03, 0x2039}, // guilsinglleft - {0xb8fa96e6, 0x0110}, // Dslash - {0xb8ff412c, 0xfef8}, // lamalefhamzaabovefinalarabic - {0xb902d285, 0x053a}, // Zhearmenian - {0xb90dcf8c, 0xff6a}, // esmallkatakanahalfwidth - {0xb910864a, 0x2032}, // minute - {0xb921c241, 0xfeca}, // ainfinalarabic - {0xb92ccc5d, 0x2469}, // tencircle - {0xb9305b2b, 0x3174}, // pieupsioskiyeokkorean - {0xb96268cb, 0x00de}, // Thorn - {0xb9808b18, 0x09c1}, // uvowelsignbengali - {0xb9927e88, 0x3382}, // muasquare - {0xb99f8f9e, 0xfeeb}, // hehinitialarabic - {0xb9b2e314, 0x0498}, // Zedescendercyrillic - {0xb9b4563d, 0x24b3}, // xparen - {0xb9c5eece, 0x05bc}, // dageshhebrew - {0xb9d8b5d9, 0xfba4}, // hehhamzaaboveisolatedarabic - {0xb9dbedd2, 0x317b}, // siosnieunkorean - {0xb9e5ea71, 0x314c}, // thieuthkorean - {0xb9e8b13e, 0x25a0}, // filledbox - {0xb9ebf396, 0xf764}, // Dsmall - {0xb9f42560, 0x0964}, // danda - {0xb9f5b462, 0x0990}, // aibengali - {0xba1bcecd, 0x0176}, // Ycircumflex - {0xba1f80d6, 0x21e1}, // arrowdashup - {0xba21ad27, 0xfb3a}, // finalkafdagesh - {0xba3aaf1e, 0x27e9}, // angbracketrightBig - {0xba4eb5f9, 0x0055}, // U - {0xba544632, 0x05db}, // afii57675 - {0xba5871eb, 0x033e}, // tildeverticalcmb - {0xba60a3b8, 0x0902}, // anusvaradeva - {0xba7e1049, 0x01d9}, // Udieresiscaron - {0xba8d69d2, 0x232a}, // angleright - {0xbaa24d97, 0x05e0}, // afii57680 - {0xbaa7aa4c, 0xfedc}, // kafmedialarabic - {0xbab8d5ec, 0xf771}, // Qsmall - {0xbabbf0c0, 0x05e8}, // reshhiriqhebrew - {0xbac7de75, 0x1ed3}, // ocircumflexgrave - {0xbad44ddc, 0x004f}, // O - {0xbad7d685, 0x04b8}, // Cheverticalstrokecyrillic - {0xbad97612, 0x03af}, // iotatonos - {0xbadf80e2, 0x06f5}, // fivepersian - {0xbae37657, 0x0621}, // hamzalowkasratanarabic - {0xbafeb301, 0x0422}, // Tecyrillic - {0xbb28e2ea, 0x1eb2}, // Abrevehookabove - {0xbb30f37e, 0x0218}, // Scommaaccent - {0xbb6353b2, 0x0332}, // lowlinecmb - {0xbb66e953, 0x22c8}, // a49 - {0xbb72d76e, 0x0139}, // Lacute - {0xbb89235d, 0xf6e0}, // centsuperior - {0xbb906e01, 0x3266}, // sioscirclekorean - {0xbb970588, 0x266f}, // musicsharpsign - {0xbba252f7, 0x0106}, // Cacute - {0xbba2c6f4, 0x27e9}, // angbracketrightbigg - {0xbbae7b40, 0x3172}, // pieupkiyeokkorean - {0xbbb9d0f4, 0x0934}, // llladeva - {0xbbd8677b, 0x330d}, // karoriisquare - {0xbbdbcb55, 0x0a6f}, // ninegurmukhi - {0xbbdc86be, 0xfb2b}, // shinsindot - {0xbc041d93, 0x05da}, // finalkafqamats - {0xbc0d2781, 0x0a1f}, // ttagurmukhi - {0xbc1b1166, 0x2558}, // SF500000 - {0xbc280da2, 0x1e79}, // utildeacute - {0xbc3510eb, 0x317f}, // pansioskorean - {0xbc45cf9a, 0x02a4}, // dezh - {0xbc75336c, 0x21a9}, // arrowhookright - {0xbc78e14f, 0x24b0}, // uparen - {0xbcd2c61b, 0x064c}, // dammatanarabic - {0xbcf16b16, 0x0621}, // hamzadammatanarabic - {0xbd0f6f71, 0x004c}, // L - {0xbd1a9441, 0x3235}, // ideographicspecialparen - {0xbd1abdb6, 0x0184}, // Tonesix - {0xbd2d2e5f, 0x054e}, // Vewarmenian - {0xbd30ce0c, 0x2641}, // earth - {0xbd4d0860, 0x320a}, // khieukhparenkorean - {0xbd54bd2d, 0x3208}, // cieucparenkorean - {0xbd569183, 0x0182}, // Btopbar - {0xbd5dbcc1, 0x0151}, // odblacute - {0xbd5ee257, 0x01b7}, // Ezh - {0xbd85b57b, 0x21a8}, // arrowupdownbase - {0xbd8f8d24, 0x064b}, // fathatanarabic - {0xbd906fab, 0x041f}, // Pecyrillic - {0xbd98b80f, 0x25c8}, // whitediamondcontainingblacksmalldiamond - {0xbdc1280a, 0x24be}, // Icircle - {0xbdd372da, 0x318b}, // yuyekorean - {0xbde8281d, 0x3276}, // cieucacirclekorean - {0xbe1bc796, 0xfb7c}, // tchehmeeminitialarabic - {0xbe3e45cf, 0xfb58}, // pehinitialarabic - {0xbe663ca6, 0x2470}, // seventeencircle - {0xbe7a58ae, 0x3203}, // rieulparenkorean - {0xbea937fd, 0x25bc}, // blackdownpointingtriangle - {0xbec6916e, 0x011c}, // Gcircumflex - {0xbedd6640, 0x00d9}, // Ugrave - {0xbee1ad99, 0xed79}, // vextenddouble - {0xbf12496a, 0x0985}, // abengali - {0xbf156070, 0x04e2}, // Imacroncyrillic - {0xbf26dc61, 0x041d}, // Encyrillic - {0xbf2dca30, 0x3082}, // mohiragana - {0xbf3cff90, 0x0425}, // afii10039 - {0xbf5cef43, 0x01ee}, // Ezhcaron - {0xbf673175, 0x01fd}, // aeacute - {0xbf87a284, 0x00bf}, // questiondown - {0xbf897387, 0x2273}, // greaterorequivalent - {0xbf8f3598, 0x25a6}, // squareorthogonalcrosshatchfill - {0xbf934ed3, 0x04e0}, // Dzeabkhasiancyrillic - {0xbf97194e, 0x010a}, // Cdot - {0xbf9bc7bd, 0xfb59}, // pehmedialarabic - {0xbf9c1926, 0x0627}, // alefarabic - {0xbfc69ab7, 0xff18}, // eightmonospace - {0xbfd3ede4, 0x0396}, // Zeta - {0xbfe44580, 0x05d3}, // dalethiriq - {0xbffa52a3, 0x33c7}, // cosquare - {0xc006a810, 0x062a}, // teharabic - {0xc008508a, 0xff1c}, // lessmonospace - {0xc00a3b07, 0x24bc}, // Gcircle - {0xc0126352, 0x0661}, // onearabic - {0xc03e102c, 0x3012}, // postalmark - {0xc059a094, 0x0626}, // yehhamzaabovearabic - {0xc0668ba8, 0x202e}, // afii61575 - {0xc07e7e42, 0x24a6}, // kparen - {0xc084bd84, 0x1e29}, // hcedilla - {0xc092fb91, 0x1e95}, // zlinebelow - {0xc09823db, 0x016f}, // uring - {0xc09889a1, 0x1e11}, // dcedilla - {0xc09e394d, 0x2211}, // summationtext - {0xc0a2bc69, 0x2564}, // SF470000 - {0xc0a93f4f, 0x0e2c}, // lochulathai - {0xc0bd9f90, 0x094a}, // oshortvowelsigndeva - {0xc0c043bd, 0x3008}, // anglebracketleft - {0xc0c1496c, 0x029e}, // kturned - {0xc0cbe66a, 0x33b7}, // mvsquare - {0xc0d444a4, 0x3220}, // oneideographicparen - {0xc0dcb90f, 0x062e}, // khaharabic - {0xc0efe98c, 0x2191}, // arrowup - {0xc0f7b81d, 0xf888}, // saraueeleftthai - {0xc0fb3832, 0x25ab}, // H18551 - {0xc131664b, 0x30e4}, // yakatakana - {0xc1425417, 0x317a}, // sioskiyeokkorean - {0xc1641f79, 0xfe4d}, // lowlinedashed - {0xc1835ca2, 0x02d3}, // ringhalfleftcentered - {0xc191ae65, 0x0470}, // Psicyrillic - {0xc1aa3399, 0x2a06}, // unionsqtext - {0xc1c1cd87, 0xff2e}, // Nmonospace - {0xc1d325d6, 0x05d8}, // tet - {0xc1e02cdd, 0x0594}, // zaqefqatanhebrew - {0xc1e3fd2d, 0x05d5}, // vav - {0xc1e4c743, 0x3057}, // sihiragana - {0xc1e7aebd, 0xf779}, // Ysmall - {0xc1ec1451, 0x03c3}, // sigma - {0xc1f9ede7, 0x05a3}, // munahhebrew - {0xc2089a04, 0x05b7}, // patah1d - {0xc21675c5, 0x0317}, // acutebelowcmb - {0xc21e92b6, 0x2265}, // greaterequal - {0xc2352e98, 0x0554}, // Keharmenian - {0xc25217c2, 0xfeff}, // zerowidthjoiner - {0xc25a58a0, 0x0a28}, // nagurmukhi - {0xc25a7d39, 0x2663}, // club - {0xc2658d7c, 0x3395}, // mulsquare - {0xc26d6fce, 0x20a9}, // won - {0xc283f2c3, 0x03bc}, // mugreek - {0xc29c269a, 0x326d}, // hieuhcirclekorean - {0xc2c391b3, 0x25b2}, // triagup - {0xc2d0d165, 0x0137}, // kcommaaccent - {0xc2db7e0f, 0x04a0}, // Kabashkircyrillic - {0xc327f9ff, 0xf8eb}, // parenlefttp - {0xc32ea721, 0x061f}, // afii57407 - {0xc347a5d5, 0x22c1}, // logicalordisplay - {0xc36634d0, 0x09f9}, // sixteencurrencydenominatorbengali - {0xc3722d19, 0x23ad}, // bracerightbt - {0xc3751bae, 0x25ab}, // whitesmallsquare - {0xc375a046, 0x05b0}, // shevahebrew - {0xc391e9a8, 0xfe50}, // commasmall - {0xc3a63833, 0x0621}, // hamzasukunarabic - {0xc3c94bba, 0x306a}, // nahiragana - {0xc3d9dd70, 0xfe43}, // whitecornerbracketleftvertical - {0xc3df4586, 0x0903}, // visargadeva - {0xc3eb9abd, 0x02c6}, // circumflex - {0xc3edb597, 0x24bb}, // Fcircle - {0xc3f1c1ff, 0x00e3}, // atilde - {0xc3f76044, 0xff7c}, // sikatakanahalfwidth - {0xc3f8f5bb, 0x04e3}, // imacroncyrillic - {0xc3fbb2ce, 0x025e}, // eopenreversedclosed - {0xc4004762, 0x328a}, // ideographmooncircle - {0xc4289b41, 0x25a5}, // squareverticalfill - {0xc43e9d0c, 0x1e26}, // Hdieresis - {0xc4494fb1, 0x098b}, // rvocalicbengali - {0xc459127a, 0x2174}, // fiveroman - {0xc460226d, 0xfb34}, // hedagesh - {0xc4607843, 0x25ca}, // lozenge - {0xc4991f6f, 0x03d0}, // betasymbolgreek - {0xc49bedba, 0x1e22}, // Hdotaccent - {0xc4bd396f, 0xff98}, // rikatakanahalfwidth - {0xc4cf0400, 0x0ac3}, // rvocalicvowelsigngujarati - {0xc4d48fb7, 0x0a06}, // aagurmukhi - {0xc510ccfb, 0x0327}, // cedillacmb - {0xc51e03d1, 0x0e2a}, // sosuathai - {0xc5233a99, 0xff41}, // amonospace - {0xc52d9608, 0x0409}, // afii10058 - {0xc541abe3, 0x0409}, // Ljecyrillic - {0xc560e83e, 0x1e4c}, // Otildeacute - {0xc575fbd8, 0x3303}, // aarusquare - {0xc577ce75, 0xff5d}, // bracerightmonospace - {0xc579feb1, 0x03bf}, // omicron - {0xc5904240, 0x1ee9}, // uhornacute - {0xc594a84a, 0x0a85}, // agujarati - {0xc5a57fbd, 0x0178}, // Ydieresis - {0xc5b52809, 0x25ac}, // filledrect - {0xc5c558c0, 0x2593}, // dkshade - {0xc5df0b88, 0x0aae}, // magujarati - {0xc5e2935b, 0x30bf}, // takatakana - {0xc616ce34, 0x1e83}, // wacute - {0xc618c356, 0x005f}, // underscore - {0xc6231f67, 0x3117}, // zbopomofo - {0xc62d494f, 0x042b}, // afii10045 - {0xc65b9029, 0x0012}, // controlDC2 - {0xc65e4473, 0x0300}, // gravecomb - {0xc6649ea6, 0x263b}, // blacksmilingface - {0xc6730a47, 0x3230}, // ideographicsunparen - {0xc6a18663, 0x2173}, // fourroman - {0xc6a33bcf, 0xf8f9}, // bracketrighttp - {0xc6bb9cde, 0x03c1}, // rho - {0xc6c2ca67, 0x0537}, // Eharmenian - {0xc6db1db1, 0x0a94}, // augujarati - {0xc6ddc5a6, 0x0334}, // tildeoverlaycmb - {0xc6e9fa39, 0x064a}, // yeharabic - {0xc6fbfdac, 0x025a}, // schwahook - {0xc6fedf58, 0xf731}, // oneoldstyle - {0xc703d8e7, 0x33b8}, // kvsquare - {0xc7199c26, 0xf763}, // Csmall - {0xc71e49b3, 0xf8fa}, // bracketrightex - {0xc74688aa, 0x24dc}, // mcircle - {0xc74a8cc7, 0x05b5}, // tserequarterhebrew - {0xc74f4c99, 0x0298}, // bilabialclick - {0xc7515b37, 0x0132}, // IJ - {0xc755c80f, 0xff67}, // asmallkatakanahalfwidth - {0xc75bc6a7, 0x01e8}, // Kcaron - {0xc7618f62, 0x05b3}, // hatafqamats28 - {0xc76816e4, 0x0566}, // zaarmenian - {0xc76c439e, 0x0115}, // ebreve - {0xc76ec8b2, 0x0e1c}, // phophungthai - {0xc77c2828, 0x2206}, // Delta - {0xc7855795, 0xf894}, // maichattawalowrightthai - {0xc786ef31, 0x095b}, // zadeva - {0xc78887c7, 0x1e08}, // Ccedillaacute - {0xc78fe323, 0x0698}, // afii57508 - {0xc798936b, 0xfc73}, // tehnoonfinalarabic - {0xc7b3573a, 0x1e2f}, // idieresisacute - {0xc7daee30, 0x09b7}, // ssabengali - {0xc7e20869, 0x0aee}, // eightgujarati - {0xc7ed01af, 0x33a5}, // mcubedsquare - {0xc7f07bcf, 0x248f}, // eightperiod - {0xc7f0b4c8, 0x0406}, // Icyrillic - {0xc7fb5fe5, 0x05b2}, // afii57800 - {0xc808d8ed, 0xf8f5}, // integralex - {0xc812d1b7, 0x041b}, // afii10029 - {0xc82c0a32, 0x026f}, // mturned - {0xc834804d, 0x2475}, // twoparen - {0xc8488aa4, 0x05b0}, // shevawidehebrew - {0xc84db89c, 0x2013}, // endash - {0xc85fce80, 0x0901}, // candrabindudeva - {0xc86d3a57, 0xff31}, // Qmonospace - {0xc875e6fd, 0x040c}, // afii10061 - {0xc88f7d57, 0x05b3}, // hatafqamatsnarrowhebrew - {0xc89d4f1f, 0x0006}, // controlACK - {0xc8ae6fb2, 0x0e26}, // luthai - {0xc8b50d48, 0x21d4}, // dblarrowleft - {0xc8c2c42c, 0x0162}, // Tcedilla - {0xc8c687a4, 0xfb4b}, // vavholamhebrew - {0xc8cf912e, 0xfe59}, // parenleftsmall - {0xc8fcce82, 0x0424}, // Efcyrillic - {0xc8fdfe4b, 0x0914}, // audeva - {0xc9033cb3, 0x05e7}, // qofhatafpatahhebrew - {0xc905dac2, 0xf7e0}, // Agravesmall - {0xc9315b90, 0x0338}, // soliduslongoverlaycmb - {0xc93304ec, 0x2176}, // sevenroman - {0xc9366418, 0x1e7e}, // Vdotbelow - {0xc948d9f2, 0x01fe}, // Oslashacute - {0xc948dd49, 0x0417}, // Zecyrillic - {0xc94ac55a, 0xfb4e}, // perafehebrew - {0xc94ceb7c, 0x1eca}, // Idotbelow - {0xc956ff7e, 0x1e7b}, // umacrondieresis - {0xc997284d, 0x03d3}, // Upsilonacutehooksymbolgreek - {0xc997d626, 0xfe3d}, // dblanglebracketleftvertical - {0xc9d02325, 0x2283}, // propersuperset - {0xc9d7e9b6, 0x064c}, // afii57452 - {0xc9d96803, 0x3278}, // khieukhacirclekorean - {0xc9e8cf5f, 0xfebf}, // dadinitialarabic - {0xc9ea8b89, 0x305b}, // sehiragana - {0xc9eb1227, 0x321c}, // cieucuparenkorean - {0xca07e9ca, 0x02dd}, // hungarumlaut - {0xca0b3331, 0x1e5f}, // rlinebelow - {0xca0f9f38, 0xf887}, // saraueleftthai - {0xca2dd9fa, 0x2590}, // rtblock - {0xca5ed753, 0x0269}, // iotalatin - {0xca65e972, 0x0646}, // noonarabic - {0xcab40374, 0x1e1f}, // fdotaccent - {0xcabe62a6, 0x0e16}, // thothungthai - {0xcac3bcb6, 0x33a8}, // moverssquaredsquare - {0xcac4b1a9, 0x32a8}, // ideographicrightcircle - {0xcad1f345, 0x01bd}, // tonefive - {0xcae44cee, 0x0013}, // controlDC3 - {0xcaf66d1c, 0x33b4}, // pvsquare - {0xcb1a38a0, 0x226b}, // muchgreater - {0xcb1b6c03, 0x0a5e}, // fagurmukhi - {0xcb1e3324, 0x042d}, // afii10047 - {0xcb267db3, 0x3221}, // twoideographicparen - {0xcb281438, 0x33ae}, // radoverssquare - {0xcb2edf2d, 0x220f}, // product - {0xcb4fc444, 0x03f0}, // kappasymbolgreek - {0xcb56efb7, 0x015c}, // Scircumflex - {0xcb5b537a, 0x0412}, // afii10019 - {0xcb669b9c, 0x1ee2}, // Ohorndotbelow - {0xcb72660a, 0xff1e}, // greatermonospace - {0xcb75245d, 0x1e48}, // Nlinebelow - {0xcb88e590, 0x013c}, // lcedilla - {0xcb8bc7f1, 0x002b}, // plus - {0xcbada403, 0x0429}, // Shchacyrillic - {0xcc11d7b0, 0x000c}, // controlFF - {0xcc261604, 0x04a2}, // Endescendercyrillic - {0xcc2b60a5, 0x05e7}, // qofhiriq - {0xcc3139de, 0x33d1}, // squareln - {0xcc334bff, 0xf766}, // Fsmall - {0xcc3accb9, 0x05d8}, // tethebrew - {0xcc3b7b5c, 0x0649}, // alefmaksuraarabic - {0xcc447b1d, 0x0296}, // glottalstopinverted - {0xcc8c13e9, 0x25c0}, // blackleftpointingtriangle - {0xcc993e5c, 0x025c}, // eopenreversed - {0xcca8fd16, 0x09e3}, // llvocalicvowelsignbengali - {0xccaa74e1, 0xfb7d}, // tchehmedialarabic - {0xccac0ec6, 0x300b}, // dblanglebracketright - {0xccc389ea, 0xfb30}, // alefdageshhebrew - {0xccc85a27, 0x0a81}, // candrabindugujarati - {0xcd07b41d, 0x05bc}, // dagesh - {0xcd30953c, 0x203c}, // exclamdbl - {0xcd37d58c, 0x24e3}, // tcircle - {0xcd415c99, 0x0e55}, // fivethai - {0xcd499038, 0x33a2}, // kmsquaredsquare - {0xcd54eec2, 0x06f4}, // fourpersian - {0xcd5fb77d, 0x0185}, // tonesix - {0xcd64e087, 0x266b}, // musicalnotedbl - {0xcd75d5eb, 0x2551}, // SF240000 - {0xcd7ce3d0, 0x24a7}, // lparen - {0xcd85d846, 0x1eec}, // Uhornhookabove - {0xcd9d27ad, 0x24c7}, // Rcircle - {0xcd9f5a2c, 0x0028}, // parenleft - {0xcda0c667, 0x2018}, // quoteleft - {0xcdab3631, 0xf7ff}, // Ydieresissmall - {0xcdae6ea2, 0xff59}, // ymonospace - {0xcdbb64f4, 0x2105}, // afii61248 - {0xcdd2cfab, 0x24b4}, // yparen - {0xcdd44c7f, 0x33a4}, // cmcubedsquare - {0xcde56fe0, 0x05b6}, // segol - {0xcdea4ff0, 0x03d4}, // Upsilondieresishooksymbolgreek - {0xcdf0bcd8, 0x0e1e}, // phophanthai - {0xcdfd40ec, 0x0180}, // bstroke - {0xce074882, 0x0668}, // afii57400 - {0xce4d2d1e, 0x2563}, // SF230000 - {0xce63250d, 0x005d}, // bracketrightBigg - {0xce6d06c6, 0x0aab}, // phagujarati - {0xce6f0d59, 0x3272}, // mieumacirclekorean - {0xce79a056, 0x3339}, // herutusquare - {0xce8dac39, 0x25a8}, // squareupperrighttolowerleftfill - {0xce942ad9, 0x09a6}, // dabengali - {0xcea39f20, 0x02d5}, // downtackmod - {0xced82ba6, 0xed19}, // bracehtipupleft - {0xcedf2a68, 0x0157}, // rcedilla - {0xcee9759d, 0x043a}, // afii10076 - {0xcef01870, 0x0171}, // udblacute - {0xcef10e83, 0x046a}, // Yusbigcyrillic - {0xcef67881, 0x200c}, // zerowidthnonjoiner - {0xcf235874, 0x030c}, // caroncmb - {0xcf4c6b71, 0x02d4}, // uptackmod - {0xcf6550b0, 0xfb4a}, // tavdageshhebrew - {0xcf6a5e7c, 0x323e}, // ideographicresourceparen - {0xcf738908, 0x011d}, // gcircumflex - {0xcf848334, 0x0453}, // afii10100 - {0xcf8cbf6b, 0x0195}, // hv - {0xcf9b96b5, 0x03bd}, // nu - {0xcfb1da5d, 0xff89}, // nokatakanahalfwidth - {0xcfc386a6, 0x00db}, // Ucircumflex - {0xcfc400d6, 0x06d2}, // yehbarreearabic - {0xcfd8a703, 0xfe61}, // asterisksmall - {0xcfe519cb, 0x309b}, // voicedmarkkana - {0xcfe64e44, 0x0668}, // eighthackarabic - {0xcff88b7d, 0x05b8}, // qamatsqatannarrowhebrew - {0xd009507e, 0x05d3}, // daletqamatshebrew - {0xd0096386, 0x25b3}, // whiteuppointingtriangle - {0xd0227bd1, 0x0199}, // khook - {0xd02a9cfe, 0x0105}, // aogonek - {0xd031b297, 0x24e9}, // zcircle - {0xd03ef2b0, 0x316b}, // rieulpieupsioskorean - {0xd0417b9a, 0x0494}, // Ghemiddlehookcyrillic - {0xd044dddd, 0x0a9d}, // jhagujarati - {0xd04ad0f0, 0x263c}, // sun - {0xd04cc01e, 0x0561}, // aybarmenian - {0xd0511b87, 0x0e4c}, // thanthakhatthai - {0xd056aca3, 0xff9a}, // rekatakanahalfwidth - {0xd06b6bb7, 0x096a}, // fourdeva - {0xd07a803b, 0x09aa}, // pabengali - {0xd07f3aad, 0xf768}, // Hsmall - {0xd0847e20, 0x05c4}, // upperdothebrew - {0xd087e60f, 0x0158}, // Rcaron - {0xd0897bb6, 0x0579}, // chaarmenian - {0xd0c5df61, 0x05b4}, // hiriq14 - {0xd0ce4edc, 0x09e9}, // threebengali - {0xd0d6e6c0, 0xff6c}, // yasmallkatakanahalfwidth - {0xd0e3648a, 0xfd3e}, // parenleftaltonearabic - {0xd133ff70, 0x01a1}, // ohorn - {0xd1373ca2, 0x0648}, // wawarabic - {0xd13d9bf5, 0xfe37}, // braceleftvertical - {0xd13faec5, 0x05e1}, // samekh - {0xd14fc185, 0x045b}, // afii10108 - {0xd17987dd, 0x0543}, // Cheharmenian - {0xd180d934, 0x0621}, // hamzalowkasraarabic - {0xd18447d8, 0x0663}, // threearabic - {0xd18961af, 0xf7fa}, // Uacutesmall - {0xd18966b1, 0x0a82}, // anusvaragujarati - {0xd18d83de, 0x0aa3}, // nnagujarati - {0xd190d310, 0x0a35}, // vagurmukhi - {0xd191827c, 0x0e39}, // sarauuthai - {0xd1acdf44, 0xfb94}, // gafinitialarabic - {0xd1d7231f, 0x04bc}, // Cheabkhasiancyrillic - {0xd1d9da71, 0x30ea}, // rikatakana - {0xd2337241, 0x05b6}, // segol1f - {0xd24297bf, 0xf889}, // maitaikhuleftthai - {0xd247ef8b, 0x3243}, // ideographicreachparen - {0xd254c368, 0x0443}, // ucyrillic - {0xd2658bcb, 0x05b9}, // holamquarterhebrew - {0xd26b0e16, 0x2321}, // integralbt - {0xd26ef570, 0x310f}, // hbopomofo - {0xd293868c, 0x019b}, // lambdastroke - {0xd297cb79, 0x30b7}, // sikatakana - {0xd2b4c516, 0x30da}, // pekatakana - {0xd2c0e1bc, 0x0150}, // Odblacute - {0xd2cbfc99, 0x05b7}, // patahhebrew - {0xd2e2a716, 0x03ec}, // Shimacoptic - {0xd2eaddf5, 0x0633}, // seenarabic - {0xd2f253f5, 0xfe40}, // anglebracketrightvertical - {0xd2f3cdf3, 0x1e0e}, // Dlinebelow - {0xd304784a, 0x05d3}, // dalet - {0xd308b167, 0x1e5b}, // rdotbelow - {0xd310b973, 0x25a1}, // a50 - {0xd310fcc1, 0x04e9}, // obarredcyrillic - {0xd3145153, 0xfeec}, // hehmedialarabic - {0xd326ec6d, 0x2237}, // proportion - {0xd3342503, 0x30bd}, // sokatakana - {0xd33cb244, 0x02cd}, // macronlowmod - {0xd35ba6fb, 0x04be}, // Chedescenderabkhasiancyrillic - {0xd3730282, 0xff64}, // ideographiccommaleft - {0xd3777d75, 0x05d3}, // daletsegolhebrew - {0xd3797e0f, 0x24db}, // lcircle - {0xd37b4bcb, 0x041c}, // afii10030 - {0xd3a5ba29, 0x062e}, // afii57422 - {0xd3c22da1, 0x01b5}, // Zstroke - {0xd3c6a66e, 0x05e4}, // pe - {0xd3cfef4c, 0x0427}, // afii10041 - {0xd3e84c23, 0x201c}, // quotedblleft - {0xd421361f, 0x067e}, // peharabic - {0xd4273f62, 0x30fd}, // iterationkatakana - {0xd44f2d4c, 0xff9b}, // rokatakanahalfwidth - {0xd45c6c89, 0x3079}, // behiragana - {0xd467b0a3, 0x0131}, // dotlessi - {0xd46989dc, 0x05e7}, // qofholam - {0xd48c064b, 0x0599}, // pashtahebrew - {0xd48dad4d, 0x01e2}, // AEmacron - {0xd4b2bb68, 0x0145}, // Ncedilla - {0xd4ce7b9e, 0x0621}, // hamzadammaarabic - {0xd4d3eb56, 0x255e}, // SF360000 - {0xd4e86e58, 0x1ef7}, // yhookabove - {0xd4e92fa8, 0x0623}, // alefhamzaabovearabic - {0xd514a0e0, 0x318c}, // yuikorean - {0xd5189135, 0x1e73}, // udieresisbelow - {0xd52f1d8f, 0x24cb}, // Vcircle - {0xd54b71bd, 0x0a6e}, // eightgurmukhi - {0xd574af4c, 0x318e}, // araeaekorean - {0xd57a206a, 0x00f2}, // ograve - {0xd58ee561, 0x04f3}, // uhungarumlautcyrillic - {0xd5b6f4bf, 0x3163}, // ikorean - {0xd5b7a706, 0x1e13}, // dcircumflexbelow - {0xd5da03ab, 0x0123}, // gcommaaccent - {0xd5da183e, 0xf76e}, // Nsmall - {0xd5dc1f0e, 0x24a5}, // jparen - {0xd5e6a2b4, 0x200f}, // afii300 - {0xd6067104, 0x05bd}, // siluqlefthebrew - {0xd6180af1, 0x0023}, // numbersign - {0xd6191adc, 0x02ce}, // gravelowmod - {0xd6480a61, 0x0e46}, // maiyamokthai - {0xd65815d1, 0x04f5}, // chedieresiscyrillic - {0xd6674587, 0xfea8}, // khahmedialarabic - {0xd66f3b98, 0x1ebd}, // etilde - {0xd67d357f, 0x0e23}, // roruathai - {0xd67dc19d, 0x1e05}, // bdotbelow - {0xd682be7e, 0xfe54}, // semicolonsmall - {0xd689f58d, 0x0024}, // dollar - {0xd68be98a, 0xff8f}, // makatakanahalfwidth - {0xd6a99b0e, 0x05aa}, // yerahbenyomolefthebrew - {0xd6c4c66e, 0x3262}, // tikeutcirclekorean - {0xd6c7e5a6, 0x03b0}, // upsilondieresistonos - {0xd6df6252, 0xfef4}, // yehmedialarabic - {0xd6e234de, 0x044d}, // afii10095 - {0xd7151c8a, 0x040b}, // afii10060 - {0xd71970f6, 0x05d3}, // daletsegol - {0xd71af0cf, 0x00af}, // overscore - {0xd72c6112, 0x0036}, // six - {0xd7363d15, 0x05d3}, // daletholamhebrew - {0xd73b3901, 0x02da}, // ring - {0xd7425de1, 0x0a1d}, // jhagurmukhi - {0xd771b953, 0x3107}, // mbopomofo - {0xd7a40cc3, 0x315c}, // ukorean - {0xd7b7f8a3, 0x3094}, // vuhiragana - {0xd7b8c7af, 0x05b8}, // qamatsquarterhebrew - {0xd7bc737d, 0x230b}, // floorrightBig - {0xd7bf0d2a, 0x308b}, // ruhiragana - {0xd7cebade, 0x01b1}, // Upsilonafrican - {0xd7d268b5, 0x314e}, // hieuhkorean - {0xd7ece605, 0x2553}, // SF520000 - {0xd813ab1a, 0x3176}, // pieupcieuckorean - {0xd816387d, 0x2178}, // nineroman - {0xd8171429, 0x013e}, // lcaron - {0xd817c39d, 0x0664}, // fourhackarabic - {0xd824acfb, 0x05de}, // memhebrew - {0xd82c0976, 0x05e8}, // reshsegolhebrew - {0xd849e14d, 0x3052}, // gehiragana - {0xd84afb0a, 0x00d1}, // Ntilde - {0xd85534fc, 0x02ca}, // secondtonechinese - {0xd8708805, 0x01ba}, // ezhtail - {0xd890928b, 0x0053}, // S - {0xd893adf8, 0x0580}, // reharmenian - {0xd8964f73, 0x043d}, // encyrillic - {0xd89879e8, 0x2116}, // afii61352 - {0xd8a1ab6d, 0x03ab}, // Upsilondieresis - {0xd8b1d2bf, 0x0177}, // ycircumflex - {0xd8faed0d, 0x30ef}, // wakatakana - {0xd9038cdb, 0x32a4}, // ideographichighcircle - {0xd90a7039, 0x06af}, // afii57509 - {0xd91584cd, 0xfe31}, // emdashvertical - {0xd92072b9, 0x0493}, // ghestrokecyrillic - {0xd92d9608, 0x0acd}, // viramagujarati - {0xd932c15c, 0x30ac}, // gakatakana - {0xd93c2940, 0x33cf}, // ktsquare - {0xd94d846e, 0x321a}, // phieuphaparenkorean - {0xd94faf13, 0x0188}, // chook - {0xd95c2f59, 0x04bd}, // cheabkhasiancyrillic - {0xd9697a13, 0x328b}, // ideographfirecircle - {0xd98cc91f, 0x0307}, // dotaccentcmb - {0xd98dcef9, 0xf8ff}, // apple - {0xd991004f, 0x0e4f}, // fongmanthai - {0xd99e3976, 0x249f}, // dparen - {0xd9ba695c, 0xff70}, // katahiraprolongmarkhalfwidth - {0xd9d63664, 0x0189}, // Dafrican - {0xd9e83df4, 0x096b}, // fivedeva - {0xd9eba56d, 0x03b3}, // gamma - {0xda15411c, 0x0304}, // macroncmb - {0xda2037e1, 0x1e01}, // aringbelow - {0xda3670ae, 0x3347}, // mansyonsquare - {0xda38804a, 0xf738}, // eightoldstyle - {0xda39b9df, 0x013d}, // Lcaron - {0xda48ff7e, 0x00bb}, // guillemotright - {0xda4e1891, 0x228b}, // supersetnotequal - {0xda55d0f3, 0x0a69}, // threegurmukhi - {0xda620e6e, 0xfca2}, // tehhahinitialarabic - {0xda734cc8, 0x232b}, // deleteleft - {0xda85eaa3, 0x2070}, // zerosuperior - {0xda94576a, 0x0999}, // ngabengali - {0xda94a677, 0x0634}, // afii57428 - {0xda99b3d7, 0x30d1}, // pakatakana - {0xda9d5f69, 0xf6c8}, // afii10832 - {0xdab46527, 0x21e9}, // arrowdownwhite - {0xdac4a95a, 0x002f}, // slash - {0xdac8670b, 0x011e}, // Gbreve - {0xdace8a4c, 0xed17}, // bracehtipdownleft - {0xdad5813e, 0x24bf}, // Jcircle - {0xdaf9ae21, 0x03e7}, // kheicoptic - {0xdb00acb2, 0x04dc}, // Zhedieresiscyrillic - {0xdb07430c, 0x1eac}, // Acircumflexdotbelow - {0xdb15243d, 0xfb38}, // tetdagesh - {0xdb180684, 0x059d}, // gereshmuqdamhebrew - {0xdb19f222, 0x1e30}, // Kacute - {0xdb215045, 0xf76f}, // Osmall - {0xdb36c0cb, 0x00c1}, // Aacute - {0xdb46a061, 0x044f}, // afii10097 - {0xdb4843d8, 0x0140}, // ldotaccent - {0xdb491e12, 0x3201}, // nieunparenkorean - {0xdb4ecb82, 0x06a4}, // afii57505 - {0xdb5fdfb2, 0x09cd}, // viramabengali - {0xdb7c2cdb, 0xf88f}, // maitholowleftthai - {0xdb8ff30c, 0xf6f5}, // Caronsmall - {0xdb9c2f74, 0x3063}, // tusmallhiragana - {0xdb9dda85, 0xfb3b}, // kafdageshhebrew - {0xdba170e8, 0x0998}, // ghabengali - {0xdbae2c8c, 0x2277}, // greaterorless - {0xdbc3c473, 0x001a}, // controlSUB - {0xdbc6ef9a, 0x05b2}, // hatafpatah23 - {0xdbc71338, 0xff01}, // exclammonospace - {0xdbcb0069, 0x338a}, // pfsquare - {0xdbf12380, 0x2460}, // onecircle - {0xdc0071a3, 0xfb46}, // tsadidageshhebrew - {0xdc05ec50, 0x30f5}, // kasmallkatakana - {0xdc0ac9c6, 0x0028}, // parenleftBigg - {0xdc0ad3ae, 0x012d}, // ibreve - {0xdc0c240d, 0xff9e}, // voicedmarkkanahalfwidth - {0xdc0c9e85, 0xff9f}, // semivoicedmarkkanahalfwidth - {0xdc3d7ac8, 0x04a7}, // pemiddlehookcyrillic - {0xdc41d3b3, 0x05ab}, // olehebrew - {0xdc54447c, 0x307c}, // bohiragana - {0xdc6ca9b3, 0x0584}, // keharmenian - {0xdc7650d9, 0xf73f}, // questionsmall - {0xdc7756d1, 0x0077}, // w - {0xdc7d1de8, 0xfba9}, // hehmedialaltonearabic - {0xdc7f6ca5, 0x0624}, // wawhamzaabovearabic - {0xdcc5c006, 0x055a}, // apostrophearmenian - {0xdce03f6b, 0x261e}, // pointingindexrightwhite - {0xdcefaeeb, 0x228a}, // subsetnotequal - {0xdd07775c, 0x3223}, // fourideographicparen - {0xdd07a474, 0x00b3}, // threesuperior - {0xdd21d4c1, 0x039b}, // Lambda - {0xdd2fee63, 0x0aad}, // bhagujarati - {0xdd4e62a4, 0x0a96}, // khagujarati - {0xdd55f861, 0x2560}, // SF420000 - {0xdd64bab7, 0x3080}, // muhiragana - {0xdd68d3ef, 0x00a5}, // yen - {0xdd8a8538, 0x0a26}, // dagurmukhi - {0xdd9a009b, 0x2016}, // dblverticalbar - {0xdda2fef7, 0x33db}, // srsquare - {0xdda8f1e0, 0x33d4}, // mbsquare - {0xddd89deb, 0xff4d}, // mmonospace - {0xdde406ed, 0x23a8}, // braceleftmid - {0xddfdd08a, 0x30a7}, // esmallkatakana - {0xddfea657, 0x0049}, // I - {0xddffcb32, 0x1e60}, // Sdotaccent - {0xde111430, 0x2271}, // notgreaternorequal - {0xde159412, 0x2605}, // blackstar - {0xde3de1bb, 0xfede}, // lamfinalarabic - {0xde4643cf, 0x0ac5}, // ecandravowelsigngujarati - {0xde5450d1, 0xff88}, // nekatakanahalfwidth - {0xde6c8dd1, 0x2223}, // divides - {0xde91c7ac, 0xfb35}, // vavdagesh - {0xdea63325, 0x0e0c}, // chochoethai - {0xdea93241, 0x0385}, // dieresistonos - {0xdeab4b8b, 0x05ad}, // dehihebrew - {0xdebc4010, 0xfcd5}, // noonmeeminitialarabic - {0xdebf0df4, 0x05f0}, // afii57716 - {0xdecde878, 0x1e52}, // Omacronacute - {0xdee80462, 0xffe5}, // yenmonospace - {0xdee969b3, 0x3001}, // ideographiccomma - {0xdef14eee, 0x020e}, // Oinvertedbreve - {0xdef351c2, 0x020c}, // Odblgrave - {0xdef92b6a, 0x3349}, // mirisquare - {0xdf08e8b4, 0xff15}, // fivemonospace - {0xdf09c757, 0x0186}, // Oopen - {0xdf1ee74b, 0xff81}, // tikatakanahalfwidth - {0xdf243dad, 0x044c}, // softsigncyrillic - {0xdf46fba9, 0x01a4}, // Phook - {0xdf5e1052, 0x221a}, // radicalbig - {0xdf80589a, 0x3217}, // chieuchaparenkorean - {0xdf8c6402, 0x0e45}, // lakkhangyaothai - {0xdf8fbdeb, 0x05e7}, // qofsheva - {0xdf9eaf7a, 0x33bc}, // muwsquare - {0xdfad5d93, 0x22c0}, // logicalandtext - {0xdfaf476d, 0x0167}, // tbar - {0xdfb9632c, 0x3144}, // pieupsioskorean - {0xdfe8c3dc, 0xf7fc}, // Udieresissmall - {0xdff819d0, 0xfe8c}, // yehhamzaabovemedialarabic - {0xdffe3761, 0x1e14}, // Emacrongrave - {0xe0061dae, 0x05d3}, // daletpatah - {0xe0130535, 0x316c}, // rieulpansioskorean - {0xe019189f, 0x0994}, // aubengali - {0xe0197d92, 0x0a4b}, // oomatragurmukhi - {0xe02aebf6, 0xf6e3}, // dollarinferior - {0xe0343a59, 0x0323}, // dotbelowcomb - {0xe03a2368, 0x019f}, // Ocenteredtilde - {0xe0489c79, 0x017f}, // longs - {0xe0513bea, 0xf6ff}, // Zcaronsmall - {0xe0560cdf, 0x1e19}, // ecircumflexbelow - {0xe065671a, 0x1e0a}, // Ddotaccent - {0xe07dfee5, 0x04f4}, // Chedieresiscyrillic - {0xe0800244, 0xfb69}, // ttehmedialarabic - {0xe0831234, 0x007b}, // braceleftBig - {0xe0987417, 0x24dd}, // ncircle - {0xe0ab68f9, 0xf6dc}, // onefitted - {0xe0ac4869, 0x3225}, // sixideographicparen - {0xe0c42e1f, 0x3357}, // wattosquare - {0xe0cf3aca, 0x1e1d}, // ecedillabreve - {0xe0d114bf, 0x04b6}, // Chedescendercyrillic - {0xe0dbd3b5, 0x2494}, // thirteenperiod - {0xe0ec0106, 0x05a6}, // merkhakefulahebrew - {0xe0ec7a9f, 0x01a6}, // yr - {0xe0f957bb, 0x0644}, // afii57444 - {0xe10a53c6, 0x0aa8}, // nagujarati - {0xe13f2d93, 0x3026}, // sixhangzhou - {0xe173c1f2, 0x1e12}, // Dcircumflexbelow - {0xe180ca73, 0x1e43}, // mdotbelow - {0xe1b37094, 0x0629}, // afii57417 - {0xe1bbda55, 0x040e}, // Ushortcyrillic - {0xe1bf1035, 0x0536}, // Zaarmenian - {0xe20234a2, 0x012c}, // Ibreve - {0xe20c937f, 0x041a}, // Kacyrillic - {0xe20deadd, 0x047c}, // Omegatitlocyrillic - {0xe222a727, 0x02dc}, // tildewide - {0xe2234dec, 0xff52}, // rmonospace - {0xe2256c16, 0x05d3}, // daletqamats - {0xe22682ea, 0x3260}, // kiyeokcirclekorean - {0xe22a6510, 0x1e8e}, // Ydotaccent - {0xe23968a4, 0x04b3}, // hadescendercyrillic - {0xe25773d9, 0x04d3}, // adieresiscyrillic - {0xe259edda, 0x0628}, // afii57416 - {0xe25f57e9, 0xfe9a}, // thehfinalarabic - {0xe26168f6, 0x1e82}, // Wacute - {0xe28a564c, 0x044f}, // iacyrillic - {0xe28eea2e, 0x1e51}, // omacrongrave - {0xe2924f7e, 0x0a67}, // onegurmukhi - {0xe2948e05, 0xf6f6}, // Circumflexsmall - {0xe2a7b092, 0x3213}, // pieupaparenkorean - {0xe2b99909, 0x0e14}, // dodekthai - {0xe2cfeeb5, 0x0301}, // acutecomb - {0xe2eccaa5, 0x0059}, // Y - {0xe2ef1bbf, 0x2197}, // arrowupright - {0xe2fc74df, 0x0533}, // Gimarmenian - {0xe2ff3ec5, 0xfb8d}, // rrehfinalarabic - {0xe2ffc4d4, 0x2661}, // heartsuitwhite - {0xe3356dd7, 0x1e54}, // Pacute - {0xe35f1369, 0xfe5c}, // bracerightsmall - {0xe3708e14, 0xfed3}, // fehinitialarabic - {0xe37c75f9, 0x03c7}, // chi - {0xe38423f1, 0x01ab}, // tpalatalhook - {0xe387ebf8, 0xff94}, // yakatakanahalfwidth - {0xe39adf52, 0x05b7}, // patahnarrowhebrew - {0xe39bb5ba, 0x0258}, // ereversed - {0xe3a00fb0, 0x0aa2}, // ddhagujarati - {0xe3a0394c, 0x05b3}, // afii57802 - {0xe3bf40b5, 0x21c5}, // arrowupleftofdown - {0xe3c68591, 0x005d}, // bracketrightBig - {0xe3cbb73f, 0x0459}, // afii10106 - {0xe3cddac1, 0x0621}, // hamzalowarabic - {0xe3d5ad06, 0x1ec0}, // Ecircumflexgrave - {0xe3dd99f7, 0x0596}, // tipehahebrew - {0xe3fae787, 0x0587}, // echyiwnarmenian - {0xe3fe00d6, 0x2170}, // oneroman - {0xe401701f, 0x3016}, // whitelenticularbracketleft - {0xe41d9109, 0x3089}, // rahiragana - {0xe424f4cb, 0x0969}, // threedeva - {0xe42a588e, 0x0e27}, // wowaenthai - {0xe42a6647, 0x0a71}, // addakgurmukhi - {0xe433c6bf, 0x042c}, // afii10046 - {0xe44aea0b, 0x0219}, // scommaaccent - {0xe44ed7aa, 0x2481}, // fourteenparen - {0xe468e60e, 0x33bd}, // mwsquare - {0xe47b4b2e, 0xfecb}, // aininitialarabic - {0xe4896ee4, 0x09c0}, // iivowelsignbengali - {0xe4924345, 0xff63}, // cornerbracketrighthalfwidth - {0xe49ba568, 0x090c}, // lvocalicdeva - {0xe4a8920f, 0x0014}, // controlDC4 - {0xe4c6b94a, 0x0550}, // Reharmenian - {0xe4c91eec, 0x1ea7}, // acircumflexgrave - {0xe4ce70c5, 0xfedf}, // lammeemkhahinitialarabic - {0xe4d0a5c5, 0x2171}, // tworoman - {0xe4de0824, 0x090b}, // rvocalicdeva - {0xe4e78bbf, 0x0e33}, // saraamthai - {0xe4e90251, 0xfb41}, // samekhdagesh - {0xe4f1acea, 0x24d7}, // hcircle - {0xe5034999, 0xff55}, // umonospace - {0xe504c22f, 0x01a9}, // Esh - {0xe506e1eb, 0x2493}, // twelveperiod - {0xe5107e85, 0xff92}, // mekatakanahalfwidth - {0xe5116fc8, 0x2472}, // nineteencircle - {0xe514f37f, 0x03be}, // xi - {0xe51bd3a3, 0x0163}, // tcedilla - {0xe5287de7, 0x3173}, // pieuptikeutkorean - {0xe5322bbf, 0x25b2}, // blackuppointingtriangle - {0xe5431590, 0x2296}, // minuscircle - {0xe54a2cdd, 0x201e}, // quotedblbase - {0xe5694805, 0x3161}, // eukorean - {0xe56f3e08, 0x1e9b}, // slongdotaccent - {0xe5779de7, 0x0666}, // afii57398 - {0xe578bf9d, 0x066d}, // asteriskaltonearabic - {0xe5850206, 0x2226}, // notparallel - {0xe59889e5, 0x014b}, // eng - {0xe59f1c1d, 0x2664}, // spadesuitwhite - {0xe59f1f71, 0x2203}, // thereexists - {0xe5dca65a, 0x04aa}, // Esdescendercyrillic - {0xe5e0ac19, 0x0a74}, // ekonkargurmukhi - {0xe5eb1828, 0x25e6}, // openbullet - {0xe5f403ac, 0x0981}, // candrabindubengali - {0xe5f51e2d, 0x0156}, // Rcedilla - {0xe61a323e, 0x21d2}, // arrowdblright - {0xe61dad29, 0x017b}, // Zdotaccent - {0xe62fb889, 0x2524}, // SF090000 - {0xe65602bc, 0x05d3}, // daletqubuts - {0xe6699f03, 0x025d}, // eopenreversedhook - {0xe6743f55, 0x011a}, // Ecaron - {0xe6861695, 0x018a}, // Dhook - {0xe68d35b4, 0x0436}, // afii10072 - {0xe68e2cfd, 0x306b}, // nihiragana - {0xe6910141, 0x06f1}, // onepersian - {0xe6936418, 0xfb2f}, // alefqamatshebrew - {0xe6a0587d, 0x3222}, // threeideographicparen - {0xe6a445c8, 0xfcd2}, // noonjeeminitialarabic - {0xe6b00dbd, 0x060c}, // commaarabic - {0xe6bd7d55, 0x04f0}, // Udieresiscyrillic - {0xe6beeaab, 0x2667}, // clubsuitwhite - {0xe6d26878, 0x0663}, // threehackarabic - {0xe6eee43a, 0x031a}, // leftangleabovecmb - {0xe70bdf5d, 0x1e85}, // wdieresis - {0xe72762a6, 0x3127}, // ibopomofo - {0xe74e8d5b, 0x02d0}, // colontriangularmod - {0xe75de72d, 0x0a4d}, // halantgurmukhi - {0xe79030f9, 0xf6cf}, // Hungarumlaut - {0xe796e6c1, 0x032f}, // breveinvertedbelowcmb - {0xe7a9201c, 0x24e5}, // vcircle - {0xe7abb869, 0x05b0}, // sheva115 - {0xe7f3b395, 0x24d8}, // icircle - {0xe80a2426, 0x3116}, // rbopomofo - {0xe80eec90, 0x0942}, // uuvowelsigndeva - {0xe832e25c, 0x03ef}, // deicoptic - {0xe836846a, 0x20a1}, // colonsign - {0xe8445eb9, 0x05e5}, // finaltsadihebrew - {0xe84e29b1, 0xfef5}, // lamalefmaddaaboveisolatedarabic - {0xe853fc35, 0x3177}, // pieupthieuthkorean - {0xe871a9d4, 0x03e3}, // sheicoptic - {0xe872f83d, 0x02a0}, // qhook - {0xe87409fd, 0xfe8b}, // yehhamzaaboveinitialarabic - {0xe885d69b, 0x1e58}, // Rdotaccent - {0xe893423b, 0x202c}, // afii61573 - {0xe894f25c, 0x03a1}, // Rho - {0xe89d944f, 0x043a}, // kacyrillic - {0xe8aff9ae, 0x24b7}, // Bcircle - {0xe8d4db79, 0x2320}, // integraltp - {0xe8d6bd29, 0x0621}, // afii57409 - {0xe8ec3154, 0x2490}, // nineperiod - {0xe8ef5782, 0x3092}, // wohiragana - {0xe8f0c584, 0x05d1}, // afii57665 - {0xe8f5ca9b, 0x05b1}, // hatafsegolnarrowhebrew - {0xe8f7e9bf, 0x320f}, // nieunaparenkorean - {0xe903bc23, 0xfb36}, // zayindageshhebrew - {0xe90424fe, 0x2479}, // sixparen - {0xe927829f, 0x0953}, // gravedeva - {0xe92a9522, 0x0060}, // grave - {0xe93b2c93, 0x09c8}, // aivowelsignbengali - {0xe9544ae6, 0x2308}, // ceilingleftbigg - {0xe9598c36, 0x018e}, // Ereversed - {0xe96c43a5, 0x00d4}, // Ocircumflex - {0xe977a63b, 0x0591}, // etnahtalefthebrew - {0xe9860674, 0x2467}, // eightcircle - {0xe994ec07, 0x1e88}, // Wdotbelow - {0xe9955c1b, 0x2109}, // fahrenheit - {0xe997ce80, 0x03d6}, // pisymbolgreek - {0xe9b8fb39, 0x256a}, // SF540000 - {0xe9c5c9e3, 0x0928}, // nadeva - {0xe9dc1b2b, 0x3162}, // yikorean - {0xe9f5bb0b, 0x1e40}, // Mdotaccent - {0xe9fd5bd7, 0x02d1}, // colontriangularhalfmod - {0xe9fe0986, 0xfe91}, // behinitialarabic - {0xea0e9b0d, 0x3077}, // puhiragana - {0xea11b5f2, 0x05d7}, // hethebrew - {0xea281c50, 0xfb3b}, // kafdagesh - {0xea281f0f, 0xfb43}, // pefinaldageshhebrew - {0xea4521ba, 0x1e99}, // yring - {0xea469ad4, 0x0641}, // feharabic - {0xea4bf6ca, 0x25b5}, // whiteuppointingsmalltriangle - {0xea505c24, 0x006b}, // k - {0xea723c32, 0x05b7}, // patahwidehebrew - {0xea828d24, 0x0ac4}, // rrvocalicvowelsigngujarati - {0xea8df8fe, 0xff09}, // parenrightmonospace - {0xeaaa8586, 0x05b6}, // segolhebrew - {0xeabb8dad, 0xfeb3}, // seeninitialarabic - {0xeabdd2cd, 0xff02}, // quotedblmonospace - {0xeacd0b4a, 0xfb1f}, // doubleyodpatah - {0xeade9ba5, 0x2113}, // afii61289 - {0xeb0445d5, 0x043f}, // afii10081 - {0xeb095515, 0x0452}, // afii10099 - {0xeb4a0523, 0x056a}, // zhearmenian - {0xeb4fdea3, 0xfc08}, // behmeemisolatedarabic - {0xeb576d94, 0x21de}, // pageup - {0xeb6b92be, 0x2191}, // arrowtp - {0xeb701704, 0x2014}, // emdash - {0xeb71d801, 0x30f3}, // nkatakana - {0xebeccb02, 0x00dd}, // Yacute - {0xec20a331, 0x096c}, // sixdeva - {0xec450aad, 0x3211}, // rieulaparenkorean - {0xec4fc0c5, 0x0173}, // uogonek - {0xec78ec45, 0x05a4}, // mahapakhhebrew - {0xec820a21, 0x05b4}, // hiriqquarterhebrew - {0xec8ae366, 0x0987}, // ibengali - {0xec967081, 0x040a}, // Njecyrillic - {0xecad584f, 0x01a8}, // tonetwo - {0xecc21039, 0x0a98}, // ghagujarati - {0xecce5cae, 0x056b}, // iniarmenian - {0xecd385c5, 0x03a8}, // Psi - {0xecda4c6b, 0x0622}, // alefmaddaabovearabic - {0xecddb27b, 0x23d0}, // vextendsingle - {0xecddb519, 0x05db}, // kaf - {0xecef01e0, 0x1e59}, // rdotaccent - {0xed102125, 0x24c0}, // Kcircle - {0xed1afc7c, 0x05b2}, // hatafpatah2f - {0xed2b4a43, 0x00aa}, // ordfeminine - {0xed4bb321, 0x313f}, // rieulphieuphkorean - {0xed65d1e6, 0x05e7}, // qofqubutshebrew - {0xed65e3bb, 0x057a}, // peharmenian - {0xed729d82, 0x049e}, // Kastrokecyrillic - {0xed796a9e, 0x0407}, // afii10056 - {0xed8b66db, 0x040b}, // Tshecyrillic - {0xed9bf511, 0x063a}, // afii57434 - {0xedfaec74, 0xfe69}, // dollarsmall - {0xee22e47f, 0x00bd}, // onehalf - {0xee3352d3, 0x05b0}, // afii57799 - {0xee339d2e, 0x2025}, // twodotenleader - {0xee421e32, 0x0660}, // zeroarabic - {0xee6c8858, 0x3168}, // nieunpansioskorean - {0xee7a31f8, 0x220b}, // suchthat - {0xee8d09d6, 0xff12}, // twomonospace - {0xee900f0f, 0x0462}, // afii10146 - {0xee9f1e99, 0x02b7}, // wsuperior - {0xeeb00f1b, 0x0063}, // c - {0xeeb5ef47, 0x24c2}, // Mcircle - {0xeeda5b48, 0x00a6}, // brokenbar - {0xeeeef128, 0x062f}, // afii57423 - {0xeeef7f7c, 0x01b6}, // zstroke - {0xef03e03f, 0x32a3}, // ideographiccorrectcircle - {0xef22f61a, 0x06f0}, // zeropersian - {0xef24cf3c, 0x00a8}, // dieresis - {0xef2800a0, 0x00cc}, // Igrave - {0xef33d78e, 0x25a1}, // H22073 - {0xef3a179c, 0x020a}, // Iinvertedbreve - {0xef636ee0, 0x05da}, // finalkaf - {0xef7afe15, 0x007d}, // bracerightbigg - {0xefa03eab, 0x00c6}, // AE - {0xefc57067, 0x0260}, // ghook - {0xefd65ddd, 0x2033}, // second - {0xefd69119, 0x044e}, // iucyrillic - {0xefd88572, 0x1ecb}, // idotbelow - {0xefe0e3fd, 0xfb01}, // fi - {0xeff59b38, 0x0397}, // Eta - {0xeff843d0, 0x25a3}, // squarewhitewithsmallblack - {0xf00181f3, 0x305c}, // zehiragana - {0xf00455e8, 0x1e86}, // Wdotaccent - {0xf0045976, 0x3178}, // kapyeounpieupkorean - {0xf0213847, 0x3383}, // masquare - {0xf0248bca, 0x0640}, // tatweelarabic - {0xf029041c, 0x3017}, // whitelenticularbracketright - {0xf0412bb8, 0x04d0}, // Abrevecyrillic - {0xf04a093b, 0xff66}, // wokatakanahalfwidth - {0xf04c3677, 0xfe62}, // plussmall - {0xf04d9cf4, 0x308c}, // rehiragana - {0xf064a013, 0x047e}, // Otcyrillic - {0xf0673e49, 0x096f}, // ninedeva - {0xf0757f39, 0x030a}, // ringcmb - {0xf08334d5, 0x05d3}, // dalethatafpatahhebrew - {0xf08a28a9, 0xfe4e}, // lowlinecenterline - {0xf09092b0, 0x3185}, // ssanghieuhkorean - {0xf091911a, 0x223d}, // reversedtilde - {0xf098620b, 0x066a}, // percentarabic - {0xf0a5507a, 0x03d5}, // phisymbolgreek - {0xf0ac995b, 0x337c}, // syouwaerasquare - {0xf0b806fd, 0xfb7c}, // tchehinitialarabic - {0xf0c10455, 0x0645}, // meemarabic - {0xf0d79471, 0x0201}, // adblgrave - {0xf0e2f076, 0x04cb}, // Chekhakassiancyrillic - {0xf0ec6a42, 0x0302}, // circumflexcmb - {0xf0f2a82b, 0x1e8a}, // Xdotaccent - {0xf0fcc511, 0x3398}, // klsquare - {0xf1116d2e, 0xfe41}, // cornerbracketleftvertical - {0xf1200f87, 0x05e6}, // tsadi - {0xf13a2d0d, 0x0119}, // eogonek - {0xf1410096, 0x1e1a}, // Etildebelow - {0xf144c7a3, 0x249d}, // bparen - {0xf15ab600, 0x05bb}, // qubuts18 - {0xf16238a6, 0x04de}, // Zedieresiscyrillic - {0xf1aad12e, 0x0638}, // afii57432 - {0xf1b08e52, 0x20ab}, // dong - {0xf1b0be56, 0x20a2}, // cruzeiro - {0xf1b5f5d1, 0x05b5}, // tserehebrew - {0xf1dd7830, 0x033d}, // xabovecmb - {0xf1ddaa7d, 0x0995}, // kabengali - {0xf1e94d64, 0x064e}, // fathaarabic - {0xf1eb4f66, 0x0116}, // Edotaccent - {0xf1f2ec50, 0x05e7}, // qofhatafsegol - {0xf1f78ce7, 0x226a}, // muchless - {0xf2118c6c, 0x0635}, // sadarabic - {0xf232181a, 0x2640}, // venus - {0xf237f0f1, 0xff29}, // Imonospace - {0xf23a5b68, 0x0130}, // Idot - {0xf24a3a6b, 0x05b8}, // qamats1c - {0xf2558e7a, 0x230a}, // floorleftbig - {0xf2620ee8, 0x1e07}, // blinebelow - {0xf26e5910, 0x045e}, // ushortcyrillic - {0xf2b4963c, 0x09b0}, // rabengali - {0xf2b826ec, 0x0449}, // shchacyrillic - {0xf2c1d44e, 0x05be}, // maqafhebrew - {0xf2c69081, 0x016e}, // Uring - {0xf2dd8deb, 0x248d}, // sixperiod - {0xf2e23a0c, 0xfb57}, // pehfinalarabic - {0xf2e7f536, 0x0329}, // verticallinebelowcmb - {0xf2efdad2, 0x05e8}, // reshqamats - {0xf2f52e6c, 0x00ce}, // Icircumflex - {0xf2f6e905, 0x24cd}, // Xcircle - {0xf3086f4b, 0x2030}, // perthousand - {0xf311fe21, 0xfece}, // ghainfinalarabic - {0xf315dbae, 0xfe3c}, // blacklenticularbracketrightvertical - {0xf31fc2c2, 0xf76d}, // Msmall - {0xf336d994, 0xfef3}, // yehinitialarabic - {0xf3527249, 0xfb67}, // ttehfinalarabic - {0xf365ee1e, 0xf6f8}, // Hungarumlautsmall - {0xf3935843, 0xff26}, // Fmonospace - {0xf399cd14, 0x0074}, // t - {0xf3ab1b0a, 0x05d3}, // dalethatafsegol - {0xf3c08521, 0x0431}, // afii10066 - {0xf3ce4ef0, 0x014a}, // Eng - {0xf3cfe996, 0x05b8}, // qamatsde - {0xf3ef0654, 0x2160}, // Oneroman - {0xf41c3e87, 0x3182}, // yesieungsioskorean - {0xf4266df0, 0x2253}, // imageorapproximatelyequal - {0xf4584280, 0x05ea}, // tav - {0xf4637345, 0x207a}, // plussuperior - {0xf467a09a, 0x3066}, // tehiragana - {0xf4728f62, 0x06f9}, // ninepersian - {0xf47778a3, 0x0958}, // qadeva - {0xf47c7f06, 0x05a5}, // merkhalefthebrew - {0xf4970a5b, 0x222b}, // integraldisplay - {0xf498c20b, 0xfb2c}, // shindageshshindothebrew - {0xf4a0d900, 0xf7e6}, // AEsmall - {0xf4a2e6c9, 0xff8e}, // hokatakanahalfwidth - {0xf4c721dd, 0x0415}, // afii10022 - {0xf4d1afd1, 0x015b}, // sacute - {0xf4d731e8, 0x0e2b}, // hohipthai - {0xf4d7dcfe, 0x05b0}, // sheva - {0xf4ea5918, 0x0423}, // afii10037 - {0xf4f5b85f, 0x05bd}, // afii57839 - {0xf4fec4c5, 0x2026}, // ellipsis - {0xf4fecbee, 0x3152}, // yaekorean - {0xf521dc0d, 0xf777}, // Wsmall - {0xf526b2bc, 0x09f5}, // twonumeratorbengali - {0xf53d898f, 0x0122}, // Gcedilla - {0xf54df907, 0x02e8}, // tonebarlowmod - {0xf573def2, 0x25ba}, // blackrightpointingpointer - {0xf573f1ec, 0x24a4}, // iparen - {0xf59704d9, 0xff4f}, // omonospace - {0xf59943f5, 0x01d4}, // ucaron - {0xf59f95da, 0x0399}, // Iota - {0xf5a6729d, 0x247e}, // elevenparen - {0xf5ab4f6d, 0x0458}, // afii10105 - {0xf5c2a87b, 0x0a14}, // augurmukhi - {0xf5c40812, 0x2019}, // quoteright - {0xf5cad972, 0x1ea6}, // Acircumflexgrave - {0xf5e83826, 0x0986}, // aabengali - {0xf5f606a8, 0x316e}, // mieumpieupkorean - {0xf5f79af6, 0x23a3}, // bracketleftbt - {0xf5fe99ee, 0x2017}, // underscoredbl - {0xf61328eb, 0x2580}, // upblock - {0xf61a2336, 0x0157}, // rcommaaccent - {0xf6228c58, 0x20a3}, // franc - {0xf6271ec7, 0x0429}, // afii10043 - {0xf630815e, 0x0577}, // shaarmenian - {0xf643d64b, 0xf774}, // Tsmall - {0xf64f0a5d, 0x30f9}, // vekatakana - {0xf64f6666, 0xff44}, // dmonospace - {0xf6545660, 0x3333}, // huiitosquare - {0xf655e1cb, 0x316a}, // rieultikeutkorean - {0xf66aa028, 0x215d}, // fiveeighths - {0xf67e1ed1, 0x01a3}, // oi - {0xf6886180, 0x3216}, // cieucaparenkorean - {0xf68c8679, 0x3043}, // ismallhiragana - {0xf68fb68d, 0x215b}, // oneeighth - {0xf6909b76, 0x24a1}, // fparen - {0xf69fb673, 0xf7e4}, // Adieresissmall - {0xf6b386e5, 0x1e3c}, // Lcircumflexbelow - {0xf6c0ec85, 0x1e5c}, // Rdotbelowmacron - {0xf6ea45f8, 0xf6fa}, // OEsmall - {0xf6f2a8b6, 0x0289}, // ubar - {0xf7114d7b, 0x2502}, // SF110000 - {0xf7440454, 0x045e}, // afii10110 - {0xf757213f, 0x01d6}, // udieresismacron - {0xf779fd74, 0x1ea0}, // Adotbelow - {0xf7887f64, 0x24ba}, // Ecircle - {0xf7994ed0, 0x0a6d}, // sevengurmukhi - {0xf7c65164, 0x266d}, // musicflatsign - {0xf7d4f2e3, 0x1e1e}, // Fdotaccent - {0xf7ddf3cd, 0x0a17}, // gagurmukhi - {0xf7de3a36, 0x3086}, // yuhiragana - {0xf7edf1a3, 0x0403}, // Gjecyrillic - {0xf7fe7207, 0x279e}, // arrowrightheavy - {0xf7fec616, 0x1ec4}, // Ecircumflextilde - {0xf81e4626, 0x0a02}, // bindigurmukhi - {0xf8245f14, 0x30e6}, // yukatakana - {0xf82ad190, 0x05e4}, // pehebrew - {0xf8376f18, 0x0410}, // afii10017 - {0xf885c738, 0x30d3}, // bikatakana - {0xf8868f94, 0xff8c}, // hukatakanahalfwidth - {0xf8892150, 0x04a8}, // Haabkhasiancyrillic - {0xf89a4fca, 0x05d3}, // daletholam - {0xf89be814, 0x0abc}, // nuktagujarati - {0xf8e483f7, 0x1eb5}, // abrevetilde - {0xf8ef289b, 0x21df}, // pagedown - {0xf90377b2, 0x3151}, // yakorean - {0xf90f516b, 0x0a5b}, // zagurmukhi - {0xf9190810, 0x0203}, // ainvertedbreve - {0xf929be43, 0x0ab6}, // shagujarati - {0xf93a01ea, 0xfe6a}, // percentsmall - {0xf952cde5, 0x1eae}, // Abreveacute - {0xf95ad1c7, 0x0065}, // e - {0xf95b34b0, 0x0660}, // afii57392 - {0xf976011b, 0x3399}, // fmsquare - {0xf99ebcf4, 0x25c1}, // whiteleftpointingtriangle - {0xf9bdabb3, 0x00e2}, // acircumflex - {0xf9d67642, 0x00c8}, // Egrave - {0xf9e5170b, 0x1eb6}, // Abrevedotbelow - {0xf9e8161d, 0x3206}, // siosparenkorean - {0xf9eeaebc, 0x002c}, // comma - {0xf9f4a348, 0x2279}, // notgreaternorless - {0xf9f6f2fe, 0xfe84}, // alefhamzaabovefinalarabic - {0xf9f909db, 0x09f1}, // ralowerdiagonalbengali - {0xfa1f37f7, 0x207d}, // parenleftsuperior - {0xfa3ebdeb, 0xfb8b}, // jehfinalarabic - {0xfa46e08a, 0x010a}, // Cdotaccent - {0xfa6e953f, 0x0e13}, // nonenthai - {0xfa7aad8b, 0x0e34}, // saraithai - {0xfa85b29d, 0x0ae6}, // zerogujarati - {0xfa8f771c, 0xfe82}, // alefmaddaabovefinalarabic - {0xfa932832, 0x1ec9}, // ihookabove - {0xfa9cd43f, 0x2488}, // oneperiod - {0xfa9f7510, 0x1e6a}, // Tdotaccent - {0xfaa7f693, 0xff1b}, // semicolonmonospace - {0xfab3dba6, 0x3138}, // ssangtikeutkorean - {0xfac03db8, 0x015e}, // Scedilla - {0xfac092ef, 0x24de}, // ocircle - {0xfad44b21, 0x278d}, // fourcircleinversesansserif - {0xfadde282, 0x0539}, // Toarmenian - {0xfaf8abd4, 0x05bb}, // qubuts25 - {0xfb0a35fb, 0xfb2b}, // afii57695 - {0xfb0e1bad, 0x2567}, // SF450000 - {0xfb1373b2, 0x30b9}, // sukatakana - {0xfb161300, 0x049f}, // kastrokecyrillic - {0xfb206015, 0x30b1}, // kekatakana - {0xfb2465d5, 0x0468}, // Yuslittleiotifiedcyrillic - {0xfb3e0b48, 0x01fc}, // AEacute - {0xfb4678bc, 0xfe90}, // behfinalarabic - {0xfb5bf4b4, 0x02cf}, // acutelowmod - {0xfb5cfdc8, 0x095c}, // dddhadeva - {0xfb6edad4, 0xf6c9}, // Acute - {0xfb764dd2, 0x21d3}, // arrowdbldown - {0xfb7c1fd7, 0x0485}, // dasiapneumatacyrilliccmb - {0xfbcf44c4, 0x018d}, // deltaturned - {0xfbd1b93f, 0x33c4}, // squarecc - {0xfbd50511, 0x04e8}, // Obarredcyrillic - {0xfbf1fcde, 0x03e9}, // horicoptic - {0xfc161b2f, 0x2499}, // eighteenperiod - {0xfc18556b, 0x02bd}, // commareversedmod - {0xfc1a2c97, 0x046c}, // Yusbigiotifiedcyrillic - {0xfc2caf5c, 0x2285}, // notsuperset - {0xfc3393bc, 0x0124}, // Hcircumflex - {0xfc3a32c2, 0x0a8d}, // ecandragujarati - {0xfc75d31c, 0x1ec6}, // Ecircumflexdotbelow - {0xfc7e1ef8, 0x0952}, // anudattadeva - {0xfc7ea01a, 0x04e6}, // Odieresiscyrillic - {0xfc8020b6, 0xfb39}, // yoddageshhebrew - {0xfc828b2d, 0x1ee4}, // Udotbelow - {0xfc9cf271, 0x020d}, // odblgrave - {0xfcd52169, 0xf7ed}, // Iacutesmall - {0xfce47bc6, 0x05b7}, // patah - {0xfce8ddc1, 0x1e0f}, // dlinebelow - {0xfce9ddb5, 0x05aa}, // yerahbenyomohebrew - {0xfcf6e2a9, 0x21ea}, // capslock - {0xfd00e31a, 0x0303}, // tildecomb - {0xfd0eac29, 0x0261}, // gscript - {0xfd1397ce, 0x0412}, // Vecyrillic - {0xfd166ead, 0x05e0}, // nunhebrew - {0xfd2c8feb, 0x1ea4}, // Acircumflexacute - {0xfd5ace9a, 0x057b}, // jheharmenian - {0xfd6ac237, 0x221d}, // proportional - {0xfd77296d, 0x04af}, // ustraightcyrillic - {0xfd891a4c, 0x0948}, // aivowelsigndeva - {0xfd8944f5, 0x0309}, // hookabovecomb - {0xfd89977d, 0x0e50}, // zerothai - {0xfd93a170, 0xf8ec}, // parenleftex - {0xfd99bb06, 0xfb3c}, // lameddagesh - {0xfdb6c57c, 0x2215}, // divisionslash - {0xfdbbbec8, 0x090d}, // ecandradeva - {0xfdc83f1f, 0x028d}, // wturned - {0xfdd37935, 0x0422}, // afii10036 - {0xfdec640d, 0x0640}, // kashidaautoarabic - {0xfdf32442, 0x3390}, // Hzsquare - {0xfdf4c83e, 0x026e}, // lezh - {0xfe3d55df, 0x064f}, // dammaarabic - {0xfe407199, 0x2276}, // lessorgreater - {0xfe7515f3, 0x03a9}, // Omegagreek - {0xfe779a6a, 0x045a}, // afii10107 - {0xfea7088a, 0x0628}, // beharabic - {0xfeb66fd9, 0xfec7}, // zahinitialarabic - {0xfeb7f263, 0x0556}, // Feharmenian - {0xfec7bc3b, 0x0651}, // shaddaarabic - {0xfee2004d, 0x01fe}, // Ostrokeacute - {0xfee5f25e, 0x2126}, // Omega - {0xfee9d86c, 0x2295}, // pluscircle - {0xfef651f8, 0x0688}, // afii57512 - {0xff5dadf4, 0x0193}, // Ghook - {0xff7d5e86, 0x05e7}, // qoftserehebrew - {0xff81c116, 0x21cd}, // arrowleftdblstroke - {0xff8c00d8, 0x3386}, // MBsquare - {0xff8f2931, 0x30ae}, // gikatakana - {0xff90fc92, 0x0923}, // nnadeva - {0xff94689d, 0x04c0}, // palochkacyrillic - {0xffce1162, 0xf734}, // fouroldstyle - {0xffe38169, 0x043f}, // pecyrillic - {0xfffadc30, 0x2568}, // SF460000 -}; - - -/** Returns the Unicode point for a given PostScript character name. - * @param psname PostScript name of the character to look up - * @return codepoint of the character */ -Int32 Unicode::psNameToCodepoint (const string &psname) { - UInt32 hash = XXH32(&psname[0], psname.length(), 0); - int left=0; - int right=sizeof(hash2unicode)/sizeof(Hash2Unicode)-1; - while (left <= right) { - int mid = left+(right-left)/2; - if (hash == hash2unicode[mid].hash) - return hash2unicode[mid].codepoint; - if (hash < hash2unicode[mid].hash) - right = mid-1; - else - left = mid+1; - } - return 0; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.h deleted file mode 100644 index 738f38a6e3a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/Unicode.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* -** Unicode.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_UNICODE_H -#define DVISVGM_UNICODE_H - -#include -#include "types.h" - -struct Unicode -{ - static bool isValidCodepoint (UInt32 code); - static UInt32 charToCodepoint (UInt32 c); - static std::string utf8 (Int32 c); - static Int32 psNameToCodepoint (const std::string &psname); -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFActions.h deleted file mode 100644 index 886771e75a7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFActions.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* -** VFActions.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_VFACTIONS_H -#define DVISVGM_VFACTIONS_H - -#include -#include -#include "types.h" - - -struct VFActions -{ - virtual ~VFActions () {} - virtual void preamble (std::string comment, UInt32 checksum, double dsize) {} - virtual void postamble () {} - virtual void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize) {} - virtual void defineVFChar (UInt32 c, std::vector *dvi) {} -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.cpp deleted file mode 100644 index f17a82c02f7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************************* -** VFReader.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include "Font.h" -#include "VFActions.h" -#include "VFReader.h" -#include "macros.h" - -using namespace std; - - -/** Converts a TFM fix point value to double (PS point units). */ -static inline double fix2double (FixWord fix) { - const double pt2bp = 72/72.27; - return double(fix)/(1 << 20)*pt2bp; -} - - -VFReader::VFReader (istream &is) - : StreamReader(is), _actions(0), _designSize(0) { -} - - -VFReader::~VFReader () { -} - - -VFActions* VFReader::replaceActions (VFActions *a) { - VFActions *ret = _actions; - _actions = a; - return ret; -} - - -/** Reads a single VF command from the current position of the input stream and calls the - * corresponding cmdFOO method. The execution can be influenced by a function of type ApproveOpcode. - * It takes an opcode and returns true if the command is supposed to be executed. - * @param[in] approve function to approve invocation of the action assigned to command - * @return opcode of the executed command */ -int VFReader::executeCommand (ApproveAction approve) { - int opcode = readByte(); - if (!isStreamValid() || opcode < 0) // at end of file? - throw VFException("invalid VF file"); - - bool approved = !approve || approve(opcode); - VFActions *actions = _actions; - if (!approved) - replaceActions(0); // disable actions - - if (opcode <= 241) // short character definition? - cmdShortChar(opcode); - else if (opcode >= 243 && opcode <= 246) // font definition? - cmdFontDef(opcode-243+1); - else { - switch (opcode) { - case 242: cmdLongChar(); break; // long character definition - case 247: cmdPre(); break; // preamble - case 248: cmdPost(); break; // postamble - default : { // invalid opcode - replaceActions(actions); // reenable actions - ostringstream oss; - oss << "undefined VF command (opcode " << opcode << ')'; - throw VFException(oss.str()); - } - } - } - replaceActions(actions); // reenable actions - return opcode; -} - - -bool VFReader::executeAll () { - clearStream(); // reset all status bits - if (!isStreamValid()) - return false; - seek(0); // move file pointer to first byte of the input stream - while (!eof() && executeCommand() != 248); // stop reading after post (248) - return true; -} - - -/// Returns true if op indicates the preamble or a font definition -static bool is_pre_or_fontdef (int op) {return op > 242;} -static bool is_chardef (int op) {return op < 243;} - - -bool VFReader::executePreambleAndFontDefs () { - clearStream(); - if (!isStreamValid()) - return false; - seek(0); // move file pointer to first byte of the input stream - while (!eof() && executeCommand(is_pre_or_fontdef) > 242); // stop reading after last font definition - return true; -} - - -bool VFReader::executeCharDefs () { - clearStream(); - if (!isStreamValid()) - return false; - seek(0); - while (!eof() && executeCommand(is_chardef) < 243); // stop reading after last char definition - return true; -} - -////////////////////////////////////////////////////////////////////////////// - -/** Reads and executes DVI preamble command. */ -void VFReader::cmdPre () { - UInt32 i = readUnsigned(1); // identification number (should be 2) - UInt32 k = readUnsigned(1); // length of following comment - string cmt = readString(k); // comment - UInt32 cs = readUnsigned(4); // check sum to be compared with TFM cecksum - UInt32 ds = readUnsigned(4); // design size (same as TFM design size) (fix_word) - _designSize = fix2double(ds); - if (i != 202) - throw VFException("invalid identification value in preamble"); - if (_actions) - _actions->preamble(cmt, cs, ds); -} - - -void VFReader::cmdPost () { - while ((readUnsigned(1)) == 248); // skip fill bytes - if (_actions) - _actions->postamble(); -} - - -void VFReader::cmdLongChar () { - UInt32 pl = readUnsigned(4); // packet length (length of DVI subroutine) - if (!_actions) - seek(8+pl, ios::cur); // skip remaining char definition bytes - else { - UInt32 cc = readUnsigned(4); // character code - readUnsigned(4); // character width from corresponding TFM file - vector *dvi = new vector(pl); // DVI subroutine - readBytes(pl, *dvi); - _actions->defineVFChar(cc, dvi); // call template method for user actions - } -} - - -/** Reads and executes short_char_x command. - * @param[in] pl packet length (length of DVI subroutine) */ -void VFReader::cmdShortChar (int pl) { - if (!_actions) - seek(4+pl, ios::cur); // skip char definition bytes - else { - UInt32 cc = readUnsigned(1); // character code - readUnsigned(3); // character width from corresponding TFM file - vector *dvi = new vector(pl); // DVI subroutine - readBytes(pl, *dvi); - _actions->defineVFChar(cc, dvi); // call template method for user actions - } -} - - -void VFReader::cmdFontDef (int len) { - UInt32 fontnum = readUnsigned(len); // font number - UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) - UInt32 ssize = readUnsigned(4); // scaled size of font relative to design size (fix_word) - UInt32 dsize = readUnsigned(4); // design size of font (same as TFM design size) (fix_word) - UInt32 pathlen = readUnsigned(1); // length of font path - UInt32 namelen = readUnsigned(1); // length of font name - string fontpath = readString(pathlen); - string fontname = readString(namelen); - if (_actions) { - double ss = fix2double(ssize); - double ds = fix2double(dsize); - _actions->defineVFFont(fontnum, fontpath, fontname, checksum, ds, ss*_designSize); - } -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.h deleted file mode 100644 index 00467f5746a..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VFReader.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* -** VFReader.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_VFREADER_H -#define DVISVGM_VFREADER_H - -#include "MessageException.h" -#include "StreamReader.h" -#include "types.h" - - -struct VFException : public MessageException -{ - VFException (const std::string &msg) : MessageException(msg) {} -}; - - -struct VFActions; - - -class VFReader : public StreamReader -{ - typedef bool (*ApproveAction)(int); - public: - VFReader (std::istream &is); - virtual ~VFReader (); - VFActions* replaceActions (VFActions *a); - bool executeAll (); - bool executePreambleAndFontDefs (); - bool executeCharDefs (); - - protected: - int executeCommand (ApproveAction approve=0); - - // the following methods represent the VF commands - // they are called by executeCommand and should not be used directly - void cmdPre (); - void cmdPost (); - void cmdShortChar (int pl); - void cmdLongChar (); - void cmdFontDef (int len); - - private: - VFActions *_actions; ///< actions to execute when reading a VF command - double _designSize; ///< design size of currently read VF -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorIterator.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorIterator.h deleted file mode 100644 index dc27327a60c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorIterator.h +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* -** VectorIterator.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef VECTORITERATOR_H -#define VECTORITERATOR_H - -#include -#include "MessageException.h" - - -struct IteratorException : public MessageException -{ - IteratorException (const std::string &msg) : MessageException(msg) {} -}; - - -template -class VectorIterator -{ - public: - VectorIterator (std::vector &vec) : _vector(vec), _pos(0) {} - - VectorIterator operator ++ () { - _pos++; - return *this; - } - - VectorIterator operator ++ (int) { - VectorIterator it = *this; - _pos++; - return it; - } - - VectorIterator operator -- () { - _pos--; - return *this; - } - - VectorIterator operator -- (int) { - VectorIterator it = *this; - _pos--; - return it; - } - - VectorIterator operator += (int n) { - _pos += n; - return *this; - } - - VectorIterator operator -= (int n) { - _pos -= n; - return *this; - } - - VectorIterator operator + (int n) { - return VectorIterator(_vector, _pos+n); - } - - VectorIterator operator - (int n) { - return VectorIterator(_vector, _pos-n); - } - - T& operator * () { - if (valid()) - return _vector[_pos]; - throw IteratorException("invalid access"); - } - - T* operator -> () { - if (valid()) - return &_vector[_pos]; - throw IteratorException("invalid access"); - } - - 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 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();} - void invalidate () {_pos = _vector.size();} - - protected: - VectorIterator (std::vector &vec, size_t pos) : _vector(vec), _pos(pos) {} - - private: - std::vector &_vector; - size_t _pos; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorStream.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorStream.h deleted file mode 100644 index f3043943669..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/VectorStream.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* -** VectorStream.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_VECTORSTREAM_H -#define DVISVGM_VECTORSTREAM_H - -#include -#include - - -template -struct VectorStreamBuffer : public std::streambuf -{ - VectorStreamBuffer (std::vector &source) { - setg((char*)&source[0], (char*)&source[0], (char*)&source[0]+source.size()); - } -}; - - -template -class VectorInputStream : public std::istream -{ - public: - VectorInputStream (std::vector &source) : std::istream(&_buf), _buf(source) {} - private: - VectorStreamBuffer _buf; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.cpp deleted file mode 100644 index 6b73f7cd436..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* -** XMLDocument.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include "macros.h" -#include "XMLDocument.h" - -using namespace std; - -XMLDocument::XMLDocument (XMLElementNode *root) - : _rootElement(root) -{ -} - - -XMLDocument::~XMLDocument () { - clear(); -} - - -void XMLDocument::clear () { - delete _rootElement; - _rootElement = 0; - FORALL(_nodes, list::iterator, i) - delete *i; - _nodes.clear(); -} - - -void XMLDocument::append (XMLNode *node) { - if (!node) - return; - XMLElementNode *newRoot = dynamic_cast(node); - if (newRoot) { // there can only be one root element node in the document - delete _rootElement; // so if there is already one... - _rootElement = newRoot; // ...we replace it - } - else - _nodes.push_back(node); -} - - -void XMLDocument::setRootNode (XMLElementNode *root) { - delete _rootElement; - _rootElement = root; -} - - -ostream& XMLDocument::write (ostream &os) const { - if (_rootElement) { // no root element => no output - os << "\n"; - FORALL(_nodes, list::const_iterator, i) - (*i)->write(os); - _rootElement->write(os); - } - return os; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.h deleted file mode 100644 index e3b2727dfd9..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLDocument.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* -** XMLDocument.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_XMLDOCUMENT_H -#define DVISVGM_XMLDOCUMENT_H - -#include "XMLNode.h" - -class XMLDocument -{ - public: - XMLDocument (XMLElementNode *root=0); - ~XMLDocument (); - void clear (); - void append (XMLNode *node); - void setRootNode (XMLElementNode *root); - const XMLElementNode* getRootElement () const {return _rootElement;} - std::ostream& write (std::ostream &os) const; - - private: - std::list _nodes; - XMLElementNode *_rootElement; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.cpp deleted file mode 100644 index 4fd3b997391..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/************************************************************************* -** XMLNode.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include "macros.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -XMLElementNode::XMLElementNode (const string &n) : _name(n) { -} - - -XMLElementNode::XMLElementNode (const XMLElementNode &node) - : _name(node._name), _attributes(node._attributes) -{ - FORALL(node._children, ChildList::const_iterator, it) - _children.push_back((*it)->clone()); -} - - -XMLElementNode::~XMLElementNode () { - while (!_children.empty()) { - delete _children.back(); - _children.pop_back(); - } -} - - -void XMLElementNode::clear () { - _attributes.clear(); - while (!_children.empty()) { - delete _children.back(); - _children.pop_back(); - } -} - - -void XMLElementNode::addAttribute (const string &name, const string &value) { - _attributes[name] = value; -} - - -void XMLElementNode::addAttribute (const string &name, double value) { - _attributes[name] = XMLString(value); -} - - -void XMLElementNode::append (XMLNode *child) { - if (!child) - return; - XMLTextNode *textNode1 = dynamic_cast(child); - if (!textNode1 || _children.empty()) - _children.push_back(child); - else { - if (XMLTextNode *textNode2 = dynamic_cast(_children.back())) - textNode2->append(textNode1); // merge two consecutive text nodes - else - _children.push_back(child); - } -} - - -void XMLElementNode::append (const string &str) { - if (_children.empty() || !dynamic_cast(_children.back())) - _children.push_back(new XMLTextNode(str)); - else - static_cast(_children.back())->append(str); -} - - -void XMLElementNode::prepend (XMLNode *child) { - if (!child) - return; - XMLTextNode *textNode1 = dynamic_cast(child); - if (!textNode1 || _children.empty()) - _children.push_front(child); - else { - if (XMLTextNode *textNode2 = dynamic_cast(_children.front())) - textNode2->prepend(textNode1); // merge two consecutive text nodes - else - _children.push_front(child); - } -} - - -/** Inserts a new child node before a given child node already present. The latter - * will be the following sibling of the node to be inserted. If there's no such - * node present, nothing is inserted. - * @param[in] child node to be inserted - * @param[in] sibling following sibling of 'child' - * @return true on success */ -bool XMLElementNode::insertBefore (XMLNode *child, XMLNode *sibling) { - ChildList::iterator it = _children.begin(); - while (it != _children.end() && *it != sibling) - ++it; - if (it == _children.end()) - return false; - _children.insert(it, child); - return true; -} - - -/** Inserts a new child node after a given child node already present. The latter - * will be the preceding sibling of the node to be inserted. If there's no such - * node present, nothing is inserted. - * @param[in] child node to be inserted - * @param[in] sibling preceding sibling of 'child' - * @return true on success */ -bool XMLElementNode::insertAfter (XMLNode *child, XMLNode *sibling) { - ChildList::iterator it = _children.begin(); - while (it != _children.end() && *it != sibling) - ++it; - if (it == _children.end()) - return false; - _children.insert(++it, child); - return true; -} - - -/** Gets all descendant elements with a given name and given attribute. - * @param[in] name name of elements to find - * @param[in] attrName name of attribute to find - * @param[out] descendants all elements found - * @return true if at least one element was found */ -bool XMLElementNode::getDescendants (const char *name, const char *attrName, vector &descendants) const { - FORALL(_children, ChildList::const_iterator, it) { - if (XMLElementNode *elem = dynamic_cast(*it)) { - if ((!name || elem->getName() == name) && (!attrName || elem->hasAttribute(attrName))) - descendants.push_back(elem); - elem->getDescendants(name, attrName, descendants); - } - } - return !descendants.empty(); -} - - -/** Returns the first descendant element that matches the given properties in depth first order. - * @param[in] name element name; if 0, all elements are taken into account - * @param[in] attrName if not 0, only elements with an attribute of this name are considered - * @param[in] attrValue if not 0, only elements with attribute attrName="attrValue" are considered - * @return pointer to the found element or 0 */ -XMLElementNode* XMLElementNode::getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const { - FORALL(_children, ChildList::const_iterator, it) { - if (XMLElementNode *elem = dynamic_cast(*it)) { - if (!name || elem->getName() == name) { - const char *value; - if (!attrName || (((value = elem->getAttributeValue(attrName)) != 0) && (!attrValue || string(value) == attrValue))) - return elem; - } - if (XMLElementNode *descendant = elem->getFirstDescendant(name, attrName, attrValue)) - return descendant; - } - } - return 0; -} - - -ostream& XMLElementNode::write (ostream &os) const { - os << '<' << _name; - FORALL(_attributes, AttribMap::const_iterator, i) - os << ' ' << i->first << "='" << i->second << '\''; - if (_children.empty()) - os << "/>\n"; - else { - os << '>'; - if (dynamic_cast(_children.front())) - os << '\n'; - FORALL(_children, ChildList::const_iterator, i) - (*i)->write(os); - os << "\n"; - } - return os; -} - - -/** Returns true if this element has an attribute of given name. */ -bool XMLElementNode::hasAttribute (const string &name) const { - return _attributes.find(name) != _attributes.end(); -} - - -/** Returns the value of an attribute. - * @param[in] name name of attribute - * @return attribute value or 0 if attribute doesn't exist */ -const char* XMLElementNode::getAttributeValue(const std::string& name) const { - AttribMap::const_iterator it = _attributes.find(name); - if (it != _attributes.end()) - return it->second.c_str(); - return 0; -} - - -////////////////////// - -void XMLTextNode::append (XMLNode *node) { - if (XMLTextNode *tn = dynamic_cast(node)) - append(tn); - else - delete node; -} - - -void XMLTextNode::append (XMLTextNode *node) { - if (node) - _text += node->_text; - delete node; -} - - -void XMLTextNode::append (const string &str) { - _text += str; -} - - -void XMLTextNode::prepend (XMLNode *node) { - if (XMLTextNode *tn = dynamic_cast(node)) - _text = tn->_text + _text; - else - delete node; -} - - -////////////////////// - - -ostream& XMLCDataNode::write (ostream &os) const { - if (!_data.empty()) - os << "\n"; - return os; -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.h deleted file mode 100644 index 71bd5a8ada9..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLNode.h +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* -** XMLNode.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_XMLNODE_H -#define DVISVGM_XMLNODE_H - -#include -#include -#include -#include - -#include "SpecialActions.h" - - -struct XMLNode -{ - virtual ~XMLNode () {} - virtual XMLNode* clone () const =0; - virtual void clear () =0; - virtual std::ostream& write (std::ostream &os) const =0; -}; - - -class XMLElementNode : public XMLNode -{ - typedef std::map AttribMap; - typedef std::list ChildList; - public: - XMLElementNode (const std::string &name); - XMLElementNode (const XMLElementNode &node); - ~XMLElementNode (); - XMLElementNode* clone () const {return new XMLElementNode(*this);} - void clear (); - void addAttribute (const std::string &name, const std::string &value); - void addAttribute (const std::string &name, double value); - void append (XMLNode *child); - void append (const std::string &str); - void prepend (XMLNode *child); - void remove (XMLNode *child) {_children.remove(child);} - bool insertAfter (XMLNode *child, XMLNode *sibling); - bool insertBefore (XMLNode *child, XMLNode *sibling); - bool hasAttribute (const std::string &name) const; - const char* getAttributeValue (const std::string &name) const; - bool getDescendants (const char *name, const char *attrName, std::vector &descendants) const; - XMLElementNode* getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const; - std::ostream& write (std::ostream &os) const; - bool empty () const {return _children.empty();} - const std::list& children () const {return _children;} - const std::string& getName () const {return _name;} - - private: - std::string _name; // element name (...) - AttribMap _attributes; - ChildList _children; // child nodes -}; - - -class XMLTextNode : public XMLNode -{ - public: - XMLTextNode (const std::string &str) : _text(str) {} - XMLTextNode* clone () const {return new XMLTextNode(*this);} - void clear () {_text.clear();} - void append (XMLNode *node); - void append (XMLTextNode *node); - void append (const std::string &str); - void prepend (XMLNode *child); - std::ostream& write (std::ostream &os) const {return os << _text;} - const std::string& getText () const {return _text;} - - private: - std::string _text; -}; - - -class XMLCommentNode : public XMLNode -{ - public: - XMLCommentNode (const std::string &str) : _text(str) {} - XMLCommentNode* clone () const {return new XMLCommentNode(*this);} - void clear () {_text.clear();} - std::ostream& write (std::ostream &os) const {return os << "\n";} - - private: - std::string _text; -}; - - -class XMLCDataNode : public XMLNode -{ - public: - XMLCDataNode (const std::string &d) : _data(d) {} - XMLCDataNode* clone () const {return new XMLCDataNode(*this);} - void clear () {_data.clear();} - std::ostream& write (std::ostream &os) const; - - private: - std::string _data; -}; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.cpp deleted file mode 100644 index 97aa91ee4ab..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* -** XMLString.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "macros.h" -#include "types.h" -#include "Unicode.h" -#include "XMLString.h" - -using namespace std; - -int XMLString::DECIMAL_PLACES = 0; - - -static string translate (UInt32 c) { - switch (c) { - case '<' : return "<"; - case '&' : return "&"; - case '"' : return """; - case '\'': return "'"; - } - return Unicode::utf8(c); -} - - -XMLString::XMLString (const string &str, bool plain) { - if (plain) - assign(str); - else { - FORALL(str, string::const_iterator, i) - *this += translate(*i); - } -} - - -XMLString::XMLString (const char *str, bool plain) { - if (str) { - if (plain) - assign(str); - else { - while (*str) - *this += translate(*str++); - } - } -} - - -XMLString::XMLString (int n, bool cast) { - if (cast) { - stringstream ss; - ss << n; - ss >> *this; - } - else - *this += translate(n); -} - - -/** Rounds a floating point value to a given number of decimal places. - * @param[in] x number to round - * @param[in] n number of decimal places (must be between 1 and 6) - * @return rounded value */ -static inline double round (double x, int n) { - const long pow10[] = {10L, 100L, 1000L, 10000L, 100000L, 1000000L}; - const double eps = 1e-7; - n--; - if (x >= 0) - return floor(x*pow10[n]+0.5+eps)/pow10[n]; - return ceil(x*pow10[n]-0.5-eps)/pow10[n]; -} - - -XMLString::XMLString (double x) { - stringstream ss; - if (fabs(x) < 1e-8) - x = 0; - if (DECIMAL_PLACES > 0) - x = round(x, DECIMAL_PLACES); - // don't use fixed and setprecision() manipulators here to avoid - // banker's rounding applied in some STL implementations - ss << x; - ss >> *this; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.h deleted file mode 100644 index f160c4427a4..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/XMLString.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* -** XMLString.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_XMLSTRING_H -#define DVISVGM_XMLSTRING_H - -#include - - -class XMLString : public std::string -{ - public: - XMLString () : std::string() {} - XMLString (const char *str, bool plain=false); - XMLString (const std::string &str, bool plain=false); - XMLString (int n, bool cast=true); - XMLString (double x); - - static int DECIMAL_PLACES; ///< number of decimal places applied to floating point values (0-6) -}; - - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/dvisvgm.cpp deleted file mode 100644 index 03e40623982..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/dvisvgm.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/************************************************************************* -** dvisvgm.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "gzstream.h" -#include "CommandLine.h" -#include "DVIToSVG.h" -#include "DVIToSVGActions.h" -#include "EPSToSVG.h" -#include "FileFinder.h" -#include "FilePath.h" -#include "FileSystem.h" -#include "Font.h" -#include "FontCache.h" -#include "FontEngine.h" -#include "FontMap.h" -#include "Ghostscript.h" -#include "HtmlSpecialHandler.h" -#include "InputReader.h" -#include "Message.h" -#include "PageSize.h" -#include "PSInterpreter.h" -#include "PsSpecialHandler.h" -#include "SignalHandler.h" -#include "SpecialManager.h" -#include "SVGOutput.h" -#include "System.h" - -#ifdef __MSVC__ -#include -#else -extern "C" { -#include -} -#endif - -using namespace std; - - -//////////////////////////////////////////////////////////////////////////////// - -static void show_help (const CommandLine &cmd) { - cout << PACKAGE_STRING "\n\n"; - cmd.help(cmd.help_arg()); - cout << "\nCopyright (C) 2005-2015 Martin Gieseking \n\n"; -} - - -static string remove_path (string fname) { - fname = FileSystem::adaptPathSeperators(fname); - size_t slashpos = fname.rfind('/'); - if (slashpos == string::npos) - return fname; - return fname.substr(slashpos+1); -} - - -static string ensure_suffix (string fname, bool eps) { - size_t dotpos = remove_path(fname).rfind('.'); - if (dotpos == string::npos) - fname += (eps ? ".eps" : ".dvi"); - return fname; -} - - -static string get_transformation_string (const CommandLine &args) { - ostringstream oss; - if (args.rotate_given()) - oss << 'R' << args.rotate_arg() << ",w/2,h/2"; - if (args.translate_given()) - oss << 'T' << args.translate_arg(); - if (args.scale_given()) - oss << 'S' << args.scale_arg(); - if (args.transform_given()) - oss << args.transform_arg(); - return oss.str(); -} - - -static void set_libgs (CommandLine &args) { -#if !defined(DISABLE_GS) && !defined(HAVE_LIBGS) - if (args.libgs_given()) - Ghostscript::LIBGS_NAME = args.libgs_arg(); - else if (getenv("LIBGS")) - Ghostscript::LIBGS_NAME = getenv("LIBGS"); -#endif -} - - -static bool set_cache_dir (const CommandLine &args) { - if (args.cache_given() && !args.cache_arg().empty()) { - if (args.cache_arg() == "none") - PhysicalFont::CACHE_PATH = 0; - else if (FileSystem::exists(args.cache_arg().c_str())) - PhysicalFont::CACHE_PATH = args.cache_arg().c_str(); - else - Message::wstream(true) << "cache directory '" << args.cache_arg() << "' does not exist (caching disabled)\n"; - } - else if (const char *userdir = FileSystem::userdir()) { - static string cachepath = userdir + string("/.dvisvgm/cache"); - if (!FileSystem::exists(cachepath.c_str())) - FileSystem::mkdir(cachepath.c_str()); - PhysicalFont::CACHE_PATH = cachepath.c_str(); - } - if (args.cache_given() && args.cache_arg().empty()) { - cout << "cache directory: " << (PhysicalFont::CACHE_PATH ? PhysicalFont::CACHE_PATH : "(none)") << '\n'; - FontCache::fontinfo(PhysicalFont::CACHE_PATH, cout, true); - return false; - } - return true; -} - - -static bool check_bbox (const string &bboxstr) { - const char *formats[] = {"none", "min", "dvi", 0}; - for (const char **p=formats; *p; ++p) - if (bboxstr == *p) - return true; - if (isalpha(bboxstr[0])) { - try { - PageSize size(bboxstr); - return true; - } - catch (const PageSizeException &e) { - Message::estream(true) << "invalid bounding box format '" << bboxstr << "'\n"; - return false; - } - } - try { - BoundingBox bbox; - bbox.set(bboxstr); - return true; - } - catch (const MessageException &e) { - Message::estream(true) << e.what() << '\n'; - return false; - } -} - - -static void print_version (bool extended) { - ostringstream oss; - oss << PACKAGE_STRING; - if (extended) { - if (strlen(TARGET_SYSTEM) > 0) - oss << " (" TARGET_SYSTEM ")"; - int len = oss.str().length(); - oss << "\n" << string(len, '-') << "\n" - "clipper: " << CLIPPER_VERSION "\n" - "freetype: " << FontEngine::version() << "\n"; - - Ghostscript gs; - string gsver = gs.revision(true); - if (!gsver.empty()) - oss << "Ghostscript: " << gsver + "\n"; - oss << -#ifdef MIKTEX - "MiKTeX: " << FileFinder::version() << "\n" -#else - "kpathsea: " << FileFinder::version() << "\n" -#endif - "potrace: " << (strchr(potrace_version(), ' ') ? strchr(potrace_version(), ' ')+1 : "unknown") << "\n" - "zlib: " << zlibVersion(); - } - cout << oss.str() << endl; -} - - -static void init_fontmap (const CommandLine &args) { - const char *mapseq = args.fontmap_given() ? args.fontmap_arg().c_str() : 0; - bool additional = mapseq && strchr("+-=", *mapseq); - if (!mapseq || additional) { - const char *mapfiles[] = {"ps2pk.map", "dvipdfm.map", "psfonts.map", 0}; - bool found = false; - for (const char **p=mapfiles; *p && !found; p++) - found = FontMap::instance().read(*p); - if (!found) - Message::wstream(true) << "none of the default map files could be found"; - } - if (mapseq) - FontMap::instance().read(mapseq); -} - - -int main (int argc, char *argv[]) { - CommandLine args; - args.parse(argc, argv); - if (args.error()) - return 1; - - if (argc == 1 || args.help_given()) { - show_help(args); - return 0; - } - - Message::COLORIZE = args.color_given(); - - try { - FileFinder::init(argv[0], "dvisvgm", !args.no_mktexmf_given()); - } - catch (MessageException &e) { - Message::estream(true) << e.what() << '\n'; - return 0; - } - - set_libgs(args); - if (args.version_given()) { - print_version(args.version_arg()); - return 0; - } - if (args.list_specials_given()) { - DVIToSVG::setProcessSpecials(); - SpecialManager::instance().writeHandlerInfo(cout); - return 0; - } - - if (!set_cache_dir(args)) - return 0; - - if (argc > 1 && args.numFiles() < 1) { - Message::estream(true) << "no input file given\n"; - return 1; - } - - if (args.stdout_given() && args.zip_given()) { - Message::estream(true) << "writing SVGZ files to stdout is not supported\n"; - return 1; - } - - if (!check_bbox(args.bbox_arg())) - return 1; - - if (args.progress_given()) { - DVIReader::COMPUTE_PROGRESS = args.progress_given(); - SpecialActions::PROGRESSBAR_DELAY = args.progress_arg(); - } - SVGTree::CREATE_STYLE = !args.no_styles_given(); - SVGTree::USE_FONTS = !args.no_fonts_given(); - SVGTree::CREATE_USE_ELEMENTS = args.no_fonts_arg() < 1; - SVGTree::ZOOM_FACTOR = args.zoom_arg(); - SVGTree::RELATIVE_PATH_CMDS = args.relative_given(); - SVGTree::MERGE_CHARS = !args.no_merge_given(); - DVIToSVG::TRACE_MODE = args.trace_all_given() ? (args.trace_all_arg() ? 'a' : 'm') : 0; - Message::LEVEL = args.verbosity_arg(); - PhysicalFont::EXACT_BBOX = args.exact_given(); - PhysicalFont::KEEP_TEMP_FILES = args.keep_given(); - PhysicalFont::METAFONT_MAG = max(1.0, args.mag_arg()); - XMLString::DECIMAL_PLACES = max(0, min(6, args.precision_arg())); - if (!HtmlSpecialHandler::setLinkMarker(args.linkmark_arg())) - Message::wstream(true) << "invalid argument '"+args.linkmark_arg()+"' supplied for option --linkmark\n"; - double start_time = System::time(); - bool eps_given=false; -#ifndef DISABLE_GS - eps_given = args.eps_given(); - PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = args.clipjoin_given(); - PsSpecialHandler::SHADING_SEGMENT_OVERLAP = args.grad_overlap_given(); - PsSpecialHandler::SHADING_SEGMENT_SIZE = max(1, args.grad_segments_arg()); - PsSpecialHandler::SHADING_SIMPLIFY_DELTA = args.grad_simplify_arg(); -#endif - string inputfile = ensure_suffix(args.file(0), eps_given); - ifstream ifs(inputfile.c_str(), ios::binary|ios::in); - if (!ifs) { - Message::estream(true) << "can't open file '" << inputfile << "' for reading\n"; - return 0; - } - try { - SVGOutput out(args.stdout_given() ? 0 : inputfile.c_str(), args.output_arg(), args.zip_given() ? args.zip_arg() : 0); - SignalHandler::instance().start(); -#ifndef DISABLE_GS - if (args.eps_given()) { - EPSToSVG eps2svg(inputfile, out); - eps2svg.convert(); - Message::mstream().indent(0); - Message::mstream(false, Message::MC_PAGE_NUMBER) - << "file converted in " << (System::time()-start_time) << " seconds\n"; - } - else -#endif - { - init_fontmap(args); - DVIToSVG dvi2svg(ifs, out); - const char *ignore_specials = args.no_specials_given() ? (args.no_specials_arg().empty() ? "*" : args.no_specials_arg().c_str()) : 0; - dvi2svg.setProcessSpecials(ignore_specials, true); - dvi2svg.setPageTransformation(get_transformation_string(args)); - dvi2svg.setPageSize(args.bbox_arg()); - - pair pageinfo; - dvi2svg.convert(args.page_arg(), &pageinfo); - Message::mstream().indent(0); - Message::mstream(false, Message::MC_PAGE_NUMBER) << "\n" << pageinfo.first << " of " << pageinfo.second << " page"; - if (pageinfo.second > 1) - Message::mstream(false, Message::MC_PAGE_NUMBER) << 's'; - Message::mstream(false, Message::MC_PAGE_NUMBER) << " converted in " << (System::time()-start_time) << " seconds\n"; - } - } - catch (DVIException &e) { - Message::estream() << "\nDVI error: " << e.what() << '\n'; - } - catch (PSException &e) { - Message::estream() << "\nPostScript error: " << e.what() << '\n'; - } - catch (SignalException &e) { - Message::wstream().clearline(); - Message::wstream(true) << "execution interrupted by user\n"; - } - catch (MessageException &e) { - Message::estream(true) << e.what() << '\n'; - } - FileFinder::finish(); - return 0; -} - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.cpp deleted file mode 100644 index 2893c299891..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// ============================================================================ -// gzstream, C++ iostream classes wrapping the zlib compression library. -// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// ============================================================================ -// -// File : gzstream.C -// Revision : $Revision: 1.3 $ -// Revision_date : $Date: 2006/01/05 16:22:35 $ -// Author(s) : Deepak Bandyopadhyay, Lutz Kettner -// -// Standard streambuf implementation following Nicolai Josuttis, "The -// Standard C++ Library". -// ============================================================================ - -#include "gzstream.h" -#include -#include // for memcpy - -#ifdef GZSTREAM_NAMESPACE -namespace GZSTREAM_NAMESPACE { -#endif - -const int gzstreambuf::bufferSize = 47+256; // size of data buff - -// ---------------------------------------------------------------------------- -// Internal classes to implement gzstream. See header file for user classes. -// ---------------------------------------------------------------------------- - -// -------------------------------------- -// class gzstreambuf: -// -------------------------------------- - -gzstreambuf* gzstreambuf::open(const char* name, int compression_level, int open_mode) { - if ( is_open()) - return (gzstreambuf*)0; - mode = open_mode; - // no append nor read/write mode - if ((mode & std::ios::ate) || (mode & std::ios::app) - || ((mode & std::ios::in) && (mode & std::ios::out))) - return (gzstreambuf*)0; - if (compression_level < 1) - compression_level = 1; - else if (compression_level > 9) - compression_level = 9; - char fmode[10]; - char* fmodeptr = fmode; - if ( mode & std::ios::in) - *fmodeptr++ = 'r'; - else if ( mode & std::ios::out) - *fmodeptr++ = 'w'; - *fmodeptr++ = 'b'; - *fmodeptr++ = '0'+compression_level; - *fmodeptr = '\0'; - file = gzopen( name, fmode); - if (file == 0) - return (gzstreambuf*)0; - opened = 1; - return this; -} - -gzstreambuf * gzstreambuf::close() { - if ( is_open()) { - sync(); - opened = 0; - if ( gzclose( file) == Z_OK) - return this; - } - return (gzstreambuf*)0; -} - -int gzstreambuf::underflow() { // used for input buffer only - if ( gptr() && ( gptr() < egptr())) - return * reinterpret_cast( gptr()); - - if ( ! (mode & std::ios::in) || ! opened) - return EOF; - // Josuttis' implementation of inbuf - int n_putback = gptr() - eback(); - if ( n_putback > 4) - n_putback = 4; - memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback); - - int num = gzread( file, buffer+4, bufferSize-4); - if (num <= 0) // ERROR or EOF - return EOF; - - // reset buffer pointers - setg( buffer + (4 - n_putback), // beginning of putback area - buffer + 4, // read position - buffer + 4 + num); // end of buffer - - // return next character - return * reinterpret_cast( gptr()); -} - -int gzstreambuf::flush_buffer() { - // Separate the writing of the buffer from overflow() and - // sync() operation. - int w = pptr() - pbase(); - if ( gzwrite( file, pbase(), w) != w) - return EOF; - pbump( -w); - return w; -} - -int gzstreambuf::overflow( int c) { // used for output buffer only - if ( ! ( mode & std::ios::out) || ! opened) - return EOF; - if (c != EOF) { - *pptr() = c; - pbump(1); - } - if ( flush_buffer() == EOF) - return EOF; - return c; -} - -int gzstreambuf::sync() { - // Changed to use flush_buffer() instead of overflow( EOF) - // which caused improper behavior with std::endl and flush(), - // bug reported by Vincent Ricard. - if ( pptr() && pptr() > pbase()) { - if ( flush_buffer() == EOF) - return -1; - } - return 0; -} - -// -------------------------------------- -// class gzstreambase: -// -------------------------------------- - -gzstreambase::gzstreambase( const char* name, int compression_level, int mode) { - init( &buf); - open( name, compression_level, mode); -} - -gzstreambase::~gzstreambase() { - buf.close(); -} - -void gzstreambase::open( const char* name, int compression_level, int open_mode) { - if ( ! buf.open( name, compression_level, open_mode)) - clear( rdstate() | std::ios::badbit); -} - -void gzstreambase::close() { - if ( buf.is_open()) - if ( ! buf.close()) - clear( rdstate() | std::ios::badbit); -} - -#ifdef GZSTREAM_NAMESPACE -} // namespace GZSTREAM_NAMESPACE -#endif - -// ============================================================================ -// EOF // diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.h deleted file mode 100644 index 60f38c4fac7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/gzstream.h +++ /dev/null @@ -1,121 +0,0 @@ -// ============================================================================ -// gzstream, C++ iostream classes wrapping the zlib compression library. -// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// ============================================================================ -// -// File : gzstream.h -// Revision : $Revision: 1.3 $ -// Revision_date : $Date: 2006/01/05 16:22:35 $ -// Author(s) : Deepak Bandyopadhyay, Lutz Kettner -// -// Standard streambuf implementation following Nicolai Josuttis, "The -// Standard C++ Library". -// ============================================================================ - -#ifndef GZSTREAM_H -#define GZSTREAM_H 1 - -// standard C++ with new header file names and std:: namespace -#include -#include -#include - -#ifdef GZSTREAM_NAMESPACE -namespace GZSTREAM_NAMESPACE { -#endif - -// ---------------------------------------------------------------------------- -// Internal classes to implement gzstream. See below for user classes. -// ---------------------------------------------------------------------------- - -class gzstreambuf : public std::streambuf { -private: - static const int bufferSize; // size of data buff - // totals 512 bytes under g++ for igzstream at the end. - - gzFile file; // file handle for compressed file - char buffer[47+256]; // data buffer - char opened; // open/close state of stream - int mode; // I/O mode - - int flush_buffer(); -public: - gzstreambuf() : opened(0) { - setp( buffer, buffer + (bufferSize-1)); - setg( buffer + 4, // beginning of putback area - buffer + 4, // read position - buffer + 4); // end position - // ASSERT: both input & output capabilities will not be used together - } - int is_open() { return opened; } - gzstreambuf* open(const char* name, int compression_level, int open_mode); - gzstreambuf* close(); - ~gzstreambuf() { close(); } - - virtual int overflow( int c = EOF); - virtual int underflow(); - virtual int sync(); -}; - -class gzstreambase : virtual public std::ios { -protected: - gzstreambuf buf; -public: - gzstreambase() { init(&buf); } - gzstreambase( const char* name, int compression_level, int open_mode); - ~gzstreambase(); - void open( const char* name, int compression_level, int open_mode); - void close(); - gzstreambuf* rdbuf() { return &buf; } -}; - -// ---------------------------------------------------------------------------- -// User classes. Use igzstream and ogzstream analogously to ifstream and -// ofstream respectively. They read and write files based on the gz* -// function interface of the zlib. Files are compatible with gzip compression. -// ---------------------------------------------------------------------------- - -class igzstream : public gzstreambase, public std::istream { -public: - igzstream() : std::istream( &buf) {} - igzstream( const char* name, int compression_level, int open_mode = std::ios::in) - : gzstreambase(name, compression_level, open_mode), std::istream( &buf) {} - gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } - void open( const char* name, int compression_level, int open_mode = std::ios::in) { - gzstreambase::open( name, compression_level, open_mode); - } -}; - -class ogzstream : public gzstreambase, public std::ostream { -public: - ogzstream() : std::ostream( &buf) {} - ogzstream( const char* name, int compression_level, int mode = std::ios::out) - : gzstreambase(name, compression_level, mode), std::ostream( &buf) {} - gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } - void open( const char* name, int compression_level, int open_mode = std::ios::out) { - gzstreambase::open(name, compression_level, open_mode); - } -}; - -#ifdef GZSTREAM_NAMESPACE -} // namespace GZSTREAM_NAMESPACE -#endif - -#endif // GZSTREAM_H -// ============================================================================ -// EOF // - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/iapi.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/iapi.h deleted file mode 100644 index 8e29d938d03..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/iapi.h +++ /dev/null @@ -1,300 +0,0 @@ -/* Copyright (C) 2001-2006 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, modified - or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com/ - or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, - San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - -/* $Id: iapi.h 9043 2008-08-28 22:48:19Z giles $ */ - -/* - * Public API for Ghostscript interpreter - * for use both as DLL and for static linking. - * - * Should work for Windows, OS/2, Linux, Mac. - * - * DLL exported functions should be as similar as possible to imain.c - * You will need to include "ierrors.h". - * - * Current problems: - * 1. Ghostscript does not support multiple instances. - * 2. Global variables in gs_main_instance_default() - * and gsapi_instance_counter - */ - -/* Exported functions may need different prefix - * GSDLLEXPORT marks functions as exported - * GSDLLAPI is the calling convention used on functions exported - * by Ghostscript - * GSDLLCALL is used on callback functions called by Ghostscript - * When you include this header file in the caller, you may - * need to change the definitions by defining these - * before including this header file. - * Make sure you get the calling convention correct, otherwise your - * program will crash either during callbacks or soon after returning - * due to stack corruption. - */ - -#ifndef iapi_INCLUDED -# define iapi_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WINDOWS_) || defined(__WINDOWS__) -# ifndef _Windows -# define _Windows -# endif -#endif - -#ifdef _Windows -# ifndef GSDLLEXPORT -# define GSDLLEXPORT __declspec(dllexport) -# endif -# ifndef GSDLLAPI -# define GSDLLAPI __stdcall -# endif -# ifndef GSDLLCALL -# define GSDLLCALL __stdcall -# endif -#endif /* _Windows */ - -#if defined(OS2) && defined(__IBMC__) -# ifndef GSDLLAPI -# define GSDLLAPI _System -# endif -# ifndef GSDLLCALL -# define GSDLLCALL _System -# endif -#endif /* OS2 && __IBMC */ - -#ifdef __MACOS__ -# pragma export on -#endif - -#ifndef GSDLLEXPORT -# define GSDLLEXPORT -#endif -#ifndef GSDLLAPI -# define GSDLLAPI -#endif -#ifndef GSDLLCALL -# define GSDLLCALL -#endif - -#if defined(__IBMC__) -# define GSDLLAPIPTR * GSDLLAPI -# define GSDLLCALLPTR * GSDLLCALL -#else -# define GSDLLAPIPTR GSDLLAPI * -# define GSDLLCALLPTR GSDLLCALL * -#endif - -#ifndef display_callback_DEFINED -# define display_callback_DEFINED -typedef struct display_callback_s display_callback; -#endif - -typedef struct gsapi_revision_s { - const char *product; - const char *copyright; - long revision; - long revisiondate; -} gsapi_revision_t; - - -/* Get version numbers and strings. - * This is safe to call at any time. - * You should call this first to make sure that the correct version - * of the Ghostscript is being used. - * pr is a pointer to a revision structure. - * len is the size of this structure in bytes. - * Returns 0 if OK, or if len too small (additional parameters - * have been added to the structure) it will return the required - * size of the structure. - */ -GSDLLEXPORT int GSDLLAPI -gsapi_revision(gsapi_revision_t *pr, int len); - -/* - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * Ghostscript supports only one instance. - * The current implementation uses a global static instance - * counter to make sure that only a single instance is used. - * If you try to create two instances, the second attempt - * will return < 0 and set pinstance to NULL. - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ -/* Create a new instance of Ghostscript. - * This instance is passed to most other API functions. - * The caller_handle will be provided to callback functions. - */ - -GSDLLEXPORT int GSDLLAPI -gsapi_new_instance(void **pinstance, void *caller_handle); - -/* - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * Ghostscript supports only one instance. - * The current implementation uses a global static instance - * counter to make sure that only a single instance is used. - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ -/* Destroy an instance of Ghostscript - * Before you call this, Ghostscript must have finished. - * If Ghostscript has been initialised, you must call gsapi_exit() - * before gsapi_delete_instance. - */ -GSDLLEXPORT void GSDLLAPI -gsapi_delete_instance(void *instance); - -/* Set the callback functions for stdio - * The stdin callback function should return the number of - * characters read, 0 for EOF, or -1 for error. - * The stdout and stderr callback functions should return - * the number of characters written. - * If a callback address is NULL, the real stdio will be used. - */ -GSDLLEXPORT int GSDLLAPI -gsapi_set_stdio(void *instance, - int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len), - int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len), - int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len)); - -/* Set the callback function for polling. - * This is used for handling window events or cooperative - * multitasking. This function will only be called if - * Ghostscript was compiled with CHECK_INTERRUPTS - * as described in gpcheck.h. - * The polling function should return 0 if all is well, - * and negative if it wants ghostscript to abort. - * The polling function must be fast. - */ -GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance, - int (GSDLLCALLPTR poll_fn)(void *caller_handle)); - -/* Set the display device callback structure. - * If the display device is used, this must be called - * after gsapi_new_instance() and before gsapi_init_with_args(). - * See gdevdisp.h for more details. - */ -GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback( - void *instance, display_callback *callback); - - -/* Initialise the interpreter. - * This calls gs_main_init_with_args() in imainarg.c - * 1. If quit or EOF occur during gsapi_init_with_args(), - * the return value will be e_Quit. This is not an error. - * You must call gsapi_exit() and must not call any other - * gsapi_XXX functions. - * 2. If usage info should be displayed, the return value will be e_Info - * which is not an error. Do not call gsapi_exit(). - * 3. Under normal conditions this returns 0. You would then - * call one or more gsapi_run_*() functions and then finish - * with gsapi_exit(). - */ -GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance, - int argc, char **argv); - -/* - * The gsapi_run_* functions are like gs_main_run_* except - * that the error_object is omitted. - * If these functions return <= -100, either quit or a fatal - * error has occured. You then call gsapi_exit() next. - * The only exception is gsapi_run_string_continue() - * which will return e_NeedInput if all is well. - */ - -GSDLLEXPORT int GSDLLAPI -gsapi_run_string_begin(void *instance, - int user_errors, int *pexit_code); - -GSDLLEXPORT int GSDLLAPI -gsapi_run_string_continue(void *instance, - const char *str, unsigned int length, int user_errors, int *pexit_code); - -GSDLLEXPORT int GSDLLAPI -gsapi_run_string_end(void *instance, - int user_errors, int *pexit_code); - -GSDLLEXPORT int GSDLLAPI -gsapi_run_string_with_length(void *instance, - const char *str, unsigned int length, int user_errors, int *pexit_code); - -GSDLLEXPORT int GSDLLAPI -gsapi_run_string(void *instance, - const char *str, int user_errors, int *pexit_code); - -GSDLLEXPORT int GSDLLAPI -gsapi_run_file(void *instance, - const char *file_name, int user_errors, int *pexit_code); - - -/* Exit the interpreter. - * This must be called on shutdown if gsapi_init_with_args() - * has been called, and just before gsapi_delete_instance(). - */ -GSDLLEXPORT int GSDLLAPI -gsapi_exit(void *instance); - -/* Visual Tracer */ -/* This function is only for debug purpose clients */ -struct vd_trace_interface_s; -GSDLLEXPORT void GSDLLAPI -gsapi_set_visual_tracer(struct vd_trace_interface_s *I); - - -/* function prototypes */ -typedef int (GSDLLAPIPTR PFN_gsapi_revision)( - gsapi_revision_t *pr, int len); -typedef int (GSDLLAPIPTR PFN_gsapi_new_instance)( - void **pinstance, void *caller_handle); -typedef void (GSDLLAPIPTR PFN_gsapi_delete_instance)( - void *instance); -typedef int (GSDLLAPIPTR PFN_gsapi_set_stdio)(void *instance, - int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len), - int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len), - int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len)); -typedef int (GSDLLAPIPTR PFN_gsapi_set_poll)(void *instance, - int(GSDLLCALLPTR poll_fn)(void *caller_handle)); -typedef int (GSDLLAPIPTR PFN_gsapi_set_display_callback)( - void *instance, display_callback *callback); -typedef int (GSDLLAPIPTR PFN_gsapi_init_with_args)( - void *instance, int argc, char **argv); -typedef int (GSDLLAPIPTR PFN_gsapi_run_string_begin)( - void *instance, int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_run_string_continue)( - void *instance, const char *str, unsigned int length, - int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_run_string_end)( - void *instance, int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)( - void *instance, const char *str, unsigned int length, - int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_run_string)( - void *instance, const char *str, - int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance, - const char *file_name, int user_errors, int *pexit_code); -typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance); -typedef void (GSDLLAPIPTR PFN_gsapi_set_visual_tracer) - (struct vd_trace_interface_s *I); - - -#ifdef __MACOS__ -#pragma export off -#endif - -#ifdef __cplusplus -} /* extern 'C' protection */ -#endif - -#endif /* iapi_INCLUDED */ diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ierrors.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ierrors.h deleted file mode 100644 index 3184341177e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/ierrors.h +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright (C) 2001-2006 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, modified - or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com/ - or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, - San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - -/* $Id: ierrors.h 8022 2007-06-05 22:23:38Z giles $ */ -/* Definition of error codes */ - -#ifndef ierrors_INCLUDED -# define ierrors_INCLUDED - -/* - * DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY. - * THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER. - * USE gserrors.h IN THE LIBRARY. - */ - -/* - * A procedure that may return an error always returns - * a non-negative value (zero, unless otherwise noted) for success, - * or negative for failure. - * We use ints rather than an enum to avoid a lot of casting. - */ - -/* Define the error name table */ -extern const char *const gs_error_names[]; - - /* ------ PostScript Level 1 errors ------ */ - -#define e_unknownerror (-1) /* unknown error */ -#define e_dictfull (-2) -#define e_dictstackoverflow (-3) -#define e_dictstackunderflow (-4) -#define e_execstackoverflow (-5) -#define e_interrupt (-6) -#define e_invalidaccess (-7) -#define e_invalidexit (-8) -#define e_invalidfileaccess (-9) -#define e_invalidfont (-10) -#define e_invalidrestore (-11) -#define e_ioerror (-12) -#define e_limitcheck (-13) -#define e_nocurrentpoint (-14) -#define e_rangecheck (-15) -#define e_stackoverflow (-16) -#define e_stackunderflow (-17) -#define e_syntaxerror (-18) -#define e_timeout (-19) -#define e_typecheck (-20) -#define e_undefined (-21) -#define e_undefinedfilename (-22) -#define e_undefinedresult (-23) -#define e_unmatchedmark (-24) -#define e_VMerror (-25) /* must be the last Level 1 error */ - -#define LEVEL1_ERROR_NAMES\ - "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\ - "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\ - "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\ - "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\ - "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\ - "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror" - - /* ------ Additional Level 2 errors (also in DPS) ------ */ - -#define e_configurationerror (-26) -#define e_undefinedresource (-27) -#define e_unregistered (-28) - -#define LEVEL2_ERROR_NAMES\ - "configurationerror", "undefinedresource", "unregistered" - - /* ------ Additional DPS errors ------ */ - -#define e_invalidcontext (-29) -/* invalidid is for the NeXT DPS extension. */ -#define e_invalidid (-30) - -#define DPS_ERROR_NAMES\ - "invalidcontext", "invalidid" - -#define ERROR_NAMES\ - LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_ERROR_NAMES - - /* ------ Pseudo-errors used internally ------ */ - -/* - * Internal code for a fatal error. - * gs_interpret also returns this for a .quit with a positive exit code. - */ -#define e_Fatal (-100) - -/* - * Internal code for the .quit operator. - * The real quit code is an integer on the operand stack. - * gs_interpret returns this only for a .quit with a zero exit code. - */ -#define e_Quit (-101) - -/* - * Internal code for a normal exit from the interpreter. - * Do not use outside of interp.c. - */ -#define e_InterpreterExit (-102) - -/* - * Internal code that indicates that a procedure has been stored in the - * remap_proc of the graphics state, and should be called before retrying - * the current token. This is used for color remapping involving a call - * back into the interpreter -- inelegant, but effective. - */ -#define e_RemapColor (-103) - -/* - * Internal code to indicate we have underflowed the top block - * of the e-stack. - */ -#define e_ExecStackUnderflow (-104) - -/* - * Internal code for the vmreclaim operator with a positive operand. - * We need to handle this as an error because otherwise the interpreter - * won't reload enough of its state when the operator returns. - */ -#define e_VMreclaim (-105) - -/* - * Internal code for requesting more input from run_string. - */ -#define e_NeedInput (-106) - -/* - * Internal code for a normal exit when usage info is displayed. - * This allows Window versions of Ghostscript to pause until - * the message can be read. - */ -#define e_Info (-110) - -/* - * Define which error codes require re-executing the current object. - */ -#define ERROR_IS_INTERRUPT(ecode)\ - ((ecode) == e_interrupt || (ecode) == e_timeout) - -#endif /* ierrors_INCLUDED */ diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/macros.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/macros.h deleted file mode 100644 index 50deb9417c1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/macros.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* -** macros.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_MACROS_H -#define DVISVGM_MACROS_H - -#define FORALL(container, itertype, itervar) \ - for (itertype itervar=(container).begin(); itervar != (container).end(); ++itervar) - -#define IMPLEMENT_ARITHMETIC_OPERATOR(class, op) \ - inline class operator op (class a, const class &b) { \ - return a op##= b; \ - } - -#define IMPLEMENT_ARITHMETIC_OPERATOR2(class, scalar, op) \ - inline class operator op (class a, scalar b) { \ - return a op##= b; \ - } - -#define IMPLEMENT_OUTPUT_OPERATOR(class) \ - inline std::ostream& operator << (std::ostream &os, class obj) { \ - return obj.write(os); \ - } - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.dtd deleted file mode 100644 index c5321e3444b..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.dtd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.xml deleted file mode 100644 index a05d4489ef3..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/options.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - dvisvgm - [options] dvifile - -E [options] epsfile - This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG. - - -
- - - -
-
- - - - - - - - - - - - - - -
-
- - - - - -
-
- - - - - - - - -
-
- - - - - - -
-
-
- diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/psdefs.cpp deleted file mode 100644 index a9a818a3fe7..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/psdefs.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* -** psdefs.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#include "PSInterpreter.h" - -const char *PSInterpreter::PSDEFS = -"3 dict dup begin/Install{matrix setmatrix}def/HWResolution[72 72]def/PageSize[" -"10000 10000]def end setpagedevice/@dodraw true store/@patcnt 0 store/@SD syste" -"mdict def/@UD userdict def true setglobal @SD/:save @SD/save get put @SD/:rest" -"ore @SD/restore get put @SD/:gsave @SD/gsave get put @SD/:grestore @SD/grestor" -"e get put @SD/:grestoreall @SD/grestoreall get put @SD/:newpath @SD/newpath ge" -"t put @SD/:stroke @SD/stroke get put @SD/:fill @SD/fill get put @SD/:eofill @S" -"D/eofill get put @SD/:clip @SD/clip get put @SD/:eoclip @SD/eoclip get put @SD" -"/:charpath @SD/charpath get put @SD/:show @SD/show get put @SD/.setopacityalph" -"a known not{@SD/.setopacityalpha{pop}put}if @SD/prseq{-1 1{-1 roll =only( )pri" -"nt}for(\\n)print}put @SD/prcmd{( )exch(\\ndvi.)3{print}repeat prseq}put @SD/cv" -"xall{{cvx}forall}put @SD/defpr{[exch[/copy @SD]cvxall 5 -1 roll dup 6 1 roll[/" -"get/exec]cvxall 6 -1 roll dup 7 1 roll 4 -1 roll dup 5 1 roll dup length strin" -"g cvs/prcmd cvx]cvx def}put @SD/querypos{{currentpoint}stopped{$error/newerror" -" false put}{2(querypos)prcmd}ifelse}put @SD/applyscalevals{1 0 transform 0 0 t" -"ransform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 0 1 transform 0 0" -" transform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 1 0 transform d" -"up mul exch dup dup mul 3 -1 roll add sqrt div 3(applyscalevals)prcmd}put @SD/" -"prpath{{2(moveto)prcmd}{2(lineto)prcmd}{6(curveto)prcmd}{0(closepath)prcmd}pat" -"hforall}put @SD/charpath{/@dodraw false store :charpath/@dodraw true store}put" -" @SD/show{@dodraw{dup :gsave currentpoint :newpath moveto true charpath eofill" -" :grestore/@dodraw false store :show/@dodraw true store}if}put @SD/newpath{:ne" -"wpath 0 1(newpath)prcmd}put @SD/stroke{@dodraw{1 1(newpath)prcmd prpath 0(stro" -"ke)prcmd :newpath}{:stroke}ifelse}put @SD/fill{@dodraw{1 1(newpath)prcmd prpat" -"h 0(fill)prcmd :newpath}{:fill}ifelse}put @SD/eofill{@dodraw{1 1(newpath)prcmd" -" prpath 0(eofill)prcmd :newpath}{:eofill}ifelse}put @SD/clip{:clip 0 1(newpath" -")prcmd prpath 0(clip)prcmd}put @SD/eoclip{:eoclip 1 1(newpath)prcmd prpath 0(e" -"oclip)prcmd}put @SD/shfill{begin currentdict/ShadingType known currentdict/Col" -"orSpace known and currentdict/DataSource known and currentdict/Function known " -"not and ShadingType 4 ge and DataSource type/arraytype eq and{<>begin currentdict ColorSpace known{ShadingType ColorSpace load" -" bgknown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse S" -"hadingType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorS" -"pace load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if en" -"d}if end}put/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlineto neg" -" 0 rlineto closepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0 lt x" -"or{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto ex" -"ch 0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:newpat" -"h dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse cli" -"p :newpath}put @SD/rectfill{gsave :newpath dup type/arraytype eq{aload length " -"4 idiv{@rectcc}repeat}{@rectcc}ifelse fill grestore}put @SD/rectstroke{gsave :" -"newpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ifelse s" -"troke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/clippath " -"0 defpr/sysexec{@SD exch get exec}def/adddot{dup length 1 add string dup 0 46 " -"put dup 3 -1 roll 1 exch putinterval}def/setlinewidth{dup/setlinewidth sysexec" -" applyscalevals 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defp" -"r/setmiterlimit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec applyscal" -"evals exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}def/setgst" -"ate{currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd cu" -"rrentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd curr" -"entrgbcolor 3(setrgbcolor)prcmd 6 array currentmatrix aload pop 6(setmatrix)pr" -"cmd currentdash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setd" -"ash)prcmd pop}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveI" -"D 1(save)prcmd}def/restore{:restore setgstate @UD/@saveID known{@UD begin @sav" -"eID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore setgsta" -"te 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(grestoreall)prcmd}" -"def/rotate{dup type/arraytype ne{dup 1(rotate)prcmd}if/rotate sysexec}def/scal" -"e{dup type/arraytype ne{2 copy 2(scale)prcmd}if/scale sysexec}def/translate{du" -"p type/arraytype ne{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatri" -"x{dup/setmatrix sysexec aload pop 6(setmatrix)prcmd}def/initmatrix{matrix setm" -"atrix}def/concat{matrix currentmatrix matrix concatmatrix setmatrix}def/makepa" -"ttern{gsave<>begin dup/XUID[1000000 @patcnt]put mx/makepattern " -"sysexec dup dup begin PatternType @patcnt BBox aload pop XStep YStep PaintType" -" mx aload pop 15(makepattern)prcmd :newpath matrix setmatrix PaintProc 0 1(mak" -"epattern)prcmd end/@patcnt @patcnt 1 add store end grestore}def/setpattern{beg" -"in PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentco" -"lorspace aload length -1 roll pop]setcolorspace/setcolor sysexec XUID aload po" -"p exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd}{/setpattern sy" -"sexec}ifelse end}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysex" -"ec}ifelse}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbc" -"olor 3 defpr/.setopacityalpha{dup/.setopacityalpha sysexec 1(setopacityalpha)p" -"rcmd}def "; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/types.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/src/types.h deleted file mode 100644 index 54a028fe085..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/src/types.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* -** types.h ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2015 Martin Gieseking ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** 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 . ** -*************************************************************************/ - -#ifndef DVISVGM_TYPES_H -#define DVISVGM_TYPES_H - -namespace internal { - template - class ERROR_inttype_not_available - { - ERROR_inttype_not_available(); - }; - - template - struct select - { - typedef A T; - }; - - template - struct select - { - typedef B T; - }; -} - - -// Retrieves a signed integer type with sizeof(T) == BYTES -template -struct int_t -{ - typedef typename internal::select >::T>::T>::T>::T>::T T; -}; - - -// Retrieves an unsigned integer type with sizeof(T) == BYTES -template -struct int_t -{ - typedef typename internal::select >::T>::T>::T>::T>::T T; -}; - - -// Machine independent definition of sized integer types -typedef int_t<1, true>::T Int8; -typedef int_t<2, true>::T Int16; -typedef int_t<4, true>::T Int32; -typedef int_t<8, true>::T Int64; -typedef int_t<1, false>::T UInt8; -typedef int_t<2, false>::T UInt16; -typedef int_t<4, false>::T UInt32; -typedef int_t<8, false>::T UInt64; - -typedef Int32 FixWord; -typedef UInt32 ScaledInt; - -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/Makefile.am deleted file mode 100644 index df0a4c53238..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -noinst_LIBRARIES = libxxhash.a -libxxhash_a_SOURCES = xxhash.c xxhash.h -AM_CXXFLAGS = -Wall - -xxhash.c: xxhash.h - -@CODE_COVERAGE_RULES@ - -CLEANFILES = *.gcda *.gcno - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.c b/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.c deleted file mode 100644 index e6fb8f149a5..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.c +++ /dev/null @@ -1,915 +0,0 @@ -/* -xxHash - Fast Hash algorithm -Copyright (C) 2012-2015, Yann Collet - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -You can contact the author at : -- xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - - -/************************************** -* Tuning parameters -**************************************/ -/* Unaligned memory access is automatically enabled for "common" CPU, such as x86. - * For others CPU, the compiler will be more cautious, and insert extra code to ensure aligned access is respected. - * If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance. - * You can also enable this parameter if you know your input data will always be aligned (boundaries of 4, for U32). - */ -#if defined(__ARM_FEATURE_UNALIGNED) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -# define XXH_USE_UNALIGNED_ACCESS 1 -#endif - -/* XXH_ACCEPT_NULL_INPUT_POINTER : - * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. - * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. - * By default, this option is disabled. To enable it, uncomment below define : - */ -/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ - -/* XXH_FORCE_NATIVE_FORMAT : - * By default, xxHash library provides endian-independant Hash values, based on little-endian convention. - * Results are therefore identical for little-endian and big-endian CPU. - * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. - * Should endian-independance be of no importance for your application, you may set the #define below to 1. - * It will improve speed for Big-endian CPU. - * This option has no impact on Little_Endian CPU. - */ -#define XXH_FORCE_NATIVE_FORMAT 0 - - -/************************************** -* Compiler Specific Options -***************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# define FORCE_INLINE static __forceinline -#else -# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ -# define FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define FORCE_INLINE static inline -# endif -# else -# define FORCE_INLINE static -# endif /* __STDC_VERSION__ */ -#endif - - -/************************************** -* Includes & Memory related functions -***************************************/ -#include "xxhash.h" -/* Modify the local functions below should you wish to use some other memory routines */ -/* for malloc(), free() */ -#include -static void* XXH_malloc(size_t s) { return malloc(s); } -static void XXH_free (void* p) { free(p); } -/* for memcpy() */ -#include -static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } - - -/************************************** -* Basic Types -***************************************/ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; -#else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef unsigned int U32; - typedef signed int S32; - typedef unsigned long long U64; -#endif - -static U32 XXH_read32(const void* memPtr) -{ - U32 val32; - memcpy(&val32, memPtr, 4); - return val32; -} - -static U64 XXH_read64(const void* memPtr) -{ - U64 val64; - memcpy(&val64, memPtr, 8); - return val64; -} - - - -/****************************************** -* Compiler-specific Functions and Macros -******************************************/ -#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ -#if defined(_MSC_VER) -# define XXH_rotl32(x,r) _rotl(x,r) -# define XXH_rotl64(x,r) _rotl64(x,r) -#else -# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) -# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap32 _byteswap_ulong -# define XXH_swap64 _byteswap_uint64 -#elif GCC_VERSION >= 403 -# define XXH_swap32 __builtin_bswap32 -# define XXH_swap64 __builtin_bswap64 -#else -static U32 XXH_swap32 (U32 x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} -static U64 XXH_swap64 (U64 x) -{ - return ((x << 56) & 0xff00000000000000ULL) | - ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | - ((x << 8) & 0x000000ff00000000ULL) | - ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | - ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif - - -/*************************************** -* Architecture Macros -***************************************/ -typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; -#ifndef XXH_CPU_LITTLE_ENDIAN /* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example using a compiler switch */ -static const int one = 1; -# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one)) -#endif - - -/***************************** -* Memory reads -*****************************/ -typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; - -FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); - else - return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr); -} - -FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE32_align(ptr, endian, XXH_unaligned); -} - -FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); - else - return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr); -} - -FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE64_align(ptr, endian, XXH_unaligned); -} - - -/*************************************** -* Macros -***************************************/ -#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */ - - -/*************************************** -* Constants -***************************************/ -#define PRIME32_1 2654435761U -#define PRIME32_2 2246822519U -#define PRIME32_3 3266489917U -#define PRIME32_4 668265263U -#define PRIME32_5 374761393U - -#define PRIME64_1 11400714785074694791ULL -#define PRIME64_2 14029467366897019727ULL -#define PRIME64_3 1609587929392839161ULL -#define PRIME64_4 9650029242287828579ULL -#define PRIME64_5 2870177450012600261ULL - - -/***************************** -* Simple Hash Functions -*****************************/ -FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U32 h32; -#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) - { - len=0; - bEnd=p=(const BYTE*)(size_t)16; - } -#endif - - if (len>=16) - { - const BYTE* const limit = bEnd - 16; - U32 v1 = seed + PRIME32_1 + PRIME32_2; - U32 v2 = seed + PRIME32_2; - U32 v3 = seed + 0; - U32 v4 = seed - PRIME32_1; - - do - { - v1 += XXH_get32bits(p) * PRIME32_2; - v1 = XXH_rotl32(v1, 13); - v1 *= PRIME32_1; - p+=4; - v2 += XXH_get32bits(p) * PRIME32_2; - v2 = XXH_rotl32(v2, 13); - v2 *= PRIME32_1; - p+=4; - v3 += XXH_get32bits(p) * PRIME32_2; - v3 = XXH_rotl32(v3, 13); - v3 *= PRIME32_1; - p+=4; - v4 += XXH_get32bits(p) * PRIME32_2; - v4 = XXH_rotl32(v4, 13); - v4 *= PRIME32_1; - p+=4; - } - while (p<=limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } - else - { - h32 = seed + PRIME32_5; - } - - h32 += (U32) len; - - while (p+4<=bEnd) - { - h32 += XXH_get32bits(p) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -unsigned XXH32 (const void* input, size_t len, unsigned seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_state_t state; - XXH32_reset(&state, seed); - XXH32_update(&state, input, len); - return XXH32_digest(&state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - -# if !defined(XXH_USE_UNALIGNED_ACCESS) - if ((((size_t)input) & 3) == 0) /* Input is 4-bytes aligned, leverage the speed benefit */ - { - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } -# endif - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - -FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U64 h64; -#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) - { - len=0; - bEnd=p=(const BYTE*)(size_t)32; - } -#endif - - if (len>=32) - { - const BYTE* const limit = bEnd - 32; - U64 v1 = seed + PRIME64_1 + PRIME64_2; - U64 v2 = seed + PRIME64_2; - U64 v3 = seed + 0; - U64 v4 = seed - PRIME64_1; - - do - { - v1 += XXH_get64bits(p) * PRIME64_2; - p+=8; - v1 = XXH_rotl64(v1, 31); - v1 *= PRIME64_1; - v2 += XXH_get64bits(p) * PRIME64_2; - p+=8; - v2 = XXH_rotl64(v2, 31); - v2 *= PRIME64_1; - v3 += XXH_get64bits(p) * PRIME64_2; - p+=8; - v3 = XXH_rotl64(v3, 31); - v3 *= PRIME64_1; - v4 += XXH_get64bits(p) * PRIME64_2; - p+=8; - v4 = XXH_rotl64(v4, 31); - v4 *= PRIME64_1; - } - while (p<=limit); - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - - v1 *= PRIME64_2; - v1 = XXH_rotl64(v1, 31); - v1 *= PRIME64_1; - h64 ^= v1; - h64 = h64 * PRIME64_1 + PRIME64_4; - - v2 *= PRIME64_2; - v2 = XXH_rotl64(v2, 31); - v2 *= PRIME64_1; - h64 ^= v2; - h64 = h64 * PRIME64_1 + PRIME64_4; - - v3 *= PRIME64_2; - v3 = XXH_rotl64(v3, 31); - v3 *= PRIME64_1; - h64 ^= v3; - h64 = h64 * PRIME64_1 + PRIME64_4; - - v4 *= PRIME64_2; - v4 = XXH_rotl64(v4, 31); - v4 *= PRIME64_1; - h64 ^= v4; - h64 = h64 * PRIME64_1 + PRIME64_4; - } - else - { - h64 = seed + PRIME64_5; - } - - h64 += (U64) len; - - while (p+8<=bEnd) - { - U64 k1 = XXH_get64bits(p); - k1 *= PRIME64_2; - k1 = XXH_rotl64(k1,31); - k1 *= PRIME64_1; - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) - { - h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_state_t state; - XXH64_reset(&state, seed); - XXH64_update(&state, input, len); - return XXH64_digest(&state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - -# if !defined(XXH_USE_UNALIGNED_ACCESS) - if ((((size_t)input) & 7)==0) /* Input is aligned, let's leverage the speed advantage */ - { - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } -# endif - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - -/**************************************************** -* Advanced Hash Functions -****************************************************/ - -/*** Allocation ***/ -typedef struct -{ - U64 total_len; - U32 seed; - U32 v1; - U32 v2; - U32 v3; - U32 v4; - U32 mem32[4]; /* defined as U32 for alignment */ - U32 memsize; -} XXH_istate32_t; - -typedef struct -{ - U64 total_len; - U64 seed; - U64 v1; - U64 v2; - U64 v3; - U64 v4; - U64 mem64[4]; /* defined as U64 for alignment */ - U32 memsize; -} XXH_istate64_t; - - -XXH32_state_t* XXH32_createState(void) -{ - XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); /* A compilation error here means XXH32_state_t is not large enough */ - return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); -} -XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH64_state_t* XXH64_createState(void) -{ - XXH_STATIC_ASSERT(sizeof(XXH64_state_t) >= sizeof(XXH_istate64_t)); /* A compilation error here means XXH64_state_t is not large enough */ - return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); -} -XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - - -/*** Hash feed ***/ - -XXH_errorcode XXH32_reset(XXH32_state_t* state_in, U32 seed) -{ - XXH_istate32_t* state = (XXH_istate32_t*) state_in; - state->seed = seed; - state->v1 = seed + PRIME32_1 + PRIME32_2; - state->v2 = seed + PRIME32_2; - state->v3 = seed + 0; - state->v4 = seed - PRIME32_1; - state->total_len = 0; - state->memsize = 0; - return XXH_OK; -} - -XXH_errorcode XXH64_reset(XXH64_state_t* state_in, unsigned long long seed) -{ - XXH_istate64_t* state = (XXH_istate64_t*) state_in; - state->seed = seed; - state->v1 = seed + PRIME64_1 + PRIME64_2; - state->v2 = seed + PRIME64_2; - state->v3 = seed + 0; - state->v4 = seed - PRIME64_1; - state->total_len = 0; - state->memsize = 0; - return XXH_OK; -} - - -FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const void* input, size_t len, XXH_endianess endian) -{ - XXH_istate32_t* state = (XXH_istate32_t *) state_in; - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len += len; - - if (state->memsize + len < 16) /* fill in tmp buffer */ - { - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len); - state->memsize += (U32)len; - return XXH_OK; - } - - if (state->memsize) /* some data left from previous update */ - { - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize); - { - const U32* p32 = state->mem32; - state->v1 += XXH_readLE32(p32, endian) * PRIME32_2; - state->v1 = XXH_rotl32(state->v1, 13); - state->v1 *= PRIME32_1; - p32++; - state->v2 += XXH_readLE32(p32, endian) * PRIME32_2; - state->v2 = XXH_rotl32(state->v2, 13); - state->v2 *= PRIME32_1; - p32++; - state->v3 += XXH_readLE32(p32, endian) * PRIME32_2; - state->v3 = XXH_rotl32(state->v3, 13); - state->v3 *= PRIME32_1; - p32++; - state->v4 += XXH_readLE32(p32, endian) * PRIME32_2; - state->v4 = XXH_rotl32(state->v4, 13); - state->v4 *= PRIME32_1; - p32++; - } - p += 16-state->memsize; - state->memsize = 0; - } - - if (p <= bEnd-16) - { - const BYTE* const limit = bEnd - 16; - U32 v1 = state->v1; - U32 v2 = state->v2; - U32 v3 = state->v3; - U32 v4 = state->v4; - - do - { - v1 += XXH_readLE32(p, endian) * PRIME32_2; - v1 = XXH_rotl32(v1, 13); - v1 *= PRIME32_1; - p+=4; - v2 += XXH_readLE32(p, endian) * PRIME32_2; - v2 = XXH_rotl32(v2, 13); - v2 *= PRIME32_1; - p+=4; - v3 += XXH_readLE32(p, endian) * PRIME32_2; - v3 = XXH_rotl32(v3, 13); - v3 *= PRIME32_1; - p+=4; - v4 += XXH_readLE32(p, endian) * PRIME32_2; - v4 = XXH_rotl32(v4, 13); - v4 *= PRIME32_1; - p+=4; - } - while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) - { - XXH_memcpy(state->mem32, p, bEnd-p); - state->memsize = (int)(bEnd-p); - } - - return XXH_OK; -} - -XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH32_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endianess endian) -{ - const XXH_istate32_t* state = (const XXH_istate32_t*) state_in; - const BYTE * p = (const BYTE*)state->mem32; - const BYTE* bEnd = (const BYTE*)(state->mem32) + state->memsize; - U32 h32; - - if (state->total_len >= 16) - { - h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); - } - else - { - h32 = state->seed + PRIME32_5; - } - - h32 += (U32) state->total_len; - - while (p+4<=bEnd) - { - h32 += XXH_readLE32(p, endian) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -U32 XXH32_digest (const XXH32_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_digest_endian(state_in, XXH_littleEndian); - else - return XXH32_digest_endian(state_in, XXH_bigEndian); -} - - -FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const void* input, size_t len, XXH_endianess endian) -{ - XXH_istate64_t * state = (XXH_istate64_t *) state_in; - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len += len; - - if (state->memsize + len < 32) /* fill in tmp buffer */ - { - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len); - state->memsize += (U32)len; - return XXH_OK; - } - - if (state->memsize) /* some data left from previous update */ - { - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize); - { - const U64* p64 = state->mem64; - state->v1 += XXH_readLE64(p64, endian) * PRIME64_2; - state->v1 = XXH_rotl64(state->v1, 31); - state->v1 *= PRIME64_1; - p64++; - state->v2 += XXH_readLE64(p64, endian) * PRIME64_2; - state->v2 = XXH_rotl64(state->v2, 31); - state->v2 *= PRIME64_1; - p64++; - state->v3 += XXH_readLE64(p64, endian) * PRIME64_2; - state->v3 = XXH_rotl64(state->v3, 31); - state->v3 *= PRIME64_1; - p64++; - state->v4 += XXH_readLE64(p64, endian) * PRIME64_2; - state->v4 = XXH_rotl64(state->v4, 31); - state->v4 *= PRIME64_1; - p64++; - } - p += 32-state->memsize; - state->memsize = 0; - } - - if (p+32 <= bEnd) - { - const BYTE* const limit = bEnd - 32; - U64 v1 = state->v1; - U64 v2 = state->v2; - U64 v3 = state->v3; - U64 v4 = state->v4; - - do - { - v1 += XXH_readLE64(p, endian) * PRIME64_2; - v1 = XXH_rotl64(v1, 31); - v1 *= PRIME64_1; - p+=8; - v2 += XXH_readLE64(p, endian) * PRIME64_2; - v2 = XXH_rotl64(v2, 31); - v2 *= PRIME64_1; - p+=8; - v3 += XXH_readLE64(p, endian) * PRIME64_2; - v3 = XXH_rotl64(v3, 31); - v3 *= PRIME64_1; - p+=8; - v4 += XXH_readLE64(p, endian) * PRIME64_2; - v4 = XXH_rotl64(v4, 31); - v4 *= PRIME64_1; - p+=8; - } - while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) - { - XXH_memcpy(state->mem64, p, bEnd-p); - state->memsize = (int)(bEnd-p); - } - - return XXH_OK; -} - -XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH64_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endianess endian) -{ - const XXH_istate64_t * state = (const XXH_istate64_t *) state_in; - const BYTE * p = (const BYTE*)state->mem64; - const BYTE* bEnd = (const BYTE*)state->mem64 + state->memsize; - U64 h64; - - if (state->total_len >= 32) - { - U64 v1 = state->v1; - U64 v2 = state->v2; - U64 v3 = state->v3; - U64 v4 = state->v4; - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - - v1 *= PRIME64_2; - v1 = XXH_rotl64(v1, 31); - v1 *= PRIME64_1; - h64 ^= v1; - h64 = h64*PRIME64_1 + PRIME64_4; - - v2 *= PRIME64_2; - v2 = XXH_rotl64(v2, 31); - v2 *= PRIME64_1; - h64 ^= v2; - h64 = h64*PRIME64_1 + PRIME64_4; - - v3 *= PRIME64_2; - v3 = XXH_rotl64(v3, 31); - v3 *= PRIME64_1; - h64 ^= v3; - h64 = h64*PRIME64_1 + PRIME64_4; - - v4 *= PRIME64_2; - v4 = XXH_rotl64(v4, 31); - v4 *= PRIME64_1; - h64 ^= v4; - h64 = h64*PRIME64_1 + PRIME64_4; - } - else - { - h64 = state->seed + PRIME64_5; - } - - h64 += (U64) state->total_len; - - while (p+8<=bEnd) - { - U64 k1 = XXH_readLE64(p, endian); - k1 *= PRIME64_2; - k1 = XXH_rotl64(k1,31); - k1 *= PRIME64_1; - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) - { - h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -unsigned long long XXH64_digest (const XXH64_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_digest_endian(state_in, XXH_littleEndian); - else - return XXH64_digest_endian(state_in, XXH_bigEndian); -} - - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.h b/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.h deleted file mode 100644 index c60aa61571c..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.11/xxHash/xxhash.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - xxHash - Extremely Fast Hash algorithm - Header File - Copyright (C) 2012-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - -/* Notice extracted from xxHash homepage : - -xxHash is an extremely fast Hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MumurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -A 64-bits version, named XXH64, is available since r35. -It offers much better speed, but for 64-bits applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#pragma once - -#if defined (__cplusplus) -extern "C" { -#endif - - -/***************************** -* Definitions -*****************************/ -#include /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; - - -/***************************** -* Namespace Emulation -*****************************/ -/* Motivations : - -If you need to include xxHash into your library, -but wish to avoid xxHash symbols to be present on your library interface -in an effort to avoid potential name collision if another library also includes xxHash, - -you can use XXH_NAMESPACE, which will automatically prefix any symbol from xxHash -with the value of XXH_NAMESPACE (so avoid to keep it NULL, and avoid numeric values). - -Note that no change is required within the calling program : -it can still call xxHash functions using their regular name. -They will be automatically translated by this header. -*/ -#ifdef XXH_NAMESPACE -# define XXH_CAT(A,B) A##B -# define XXH_NAME2(A,B) XXH_CAT(A,B) -# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) -# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) -# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) -# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) -# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) -# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) -# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) -# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) -# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) -# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) -# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) -# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) -#endif - - -/***************************** -* Simple Hash Functions -*****************************/ - -unsigned int XXH32 (const void* input, size_t length, unsigned seed); -unsigned long long XXH64 (const void* input, size_t length, unsigned long long seed); - -/* -XXH32() : - Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". - The memory between input & input+length must be valid (allocated and read-accessible). - "seed" can be used to alter the result predictably. - This function successfully passes all SMHasher tests. - Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s -XXH64() : - Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". - Faster on 64-bits systems. Slower on 32-bits systems. -*/ - - - -/***************************** -* Advanced Hash Functions -*****************************/ -typedef struct { long long ll[ 6]; } XXH32_state_t; -typedef struct { long long ll[11]; } XXH64_state_t; - -/* -These structures allow static allocation of XXH states. -States must then be initialized using XXHnn_reset() before first use. - -If you prefer dynamic allocation, please refer to functions below. -*/ - -XXH32_state_t* XXH32_createState(void); -XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); - -XXH64_state_t* XXH64_createState(void); -XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); - -/* -These functions create and release memory for XXH state. -States must then be initialized using XXHnn_reset() before first use. -*/ - - -XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned seed); -XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -unsigned int XXH32_digest (const XXH32_state_t* statePtr); - -XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); -XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -unsigned long long XXH64_digest (const XXH64_state_t* statePtr); - -/* -These functions calculate the xxHash of an input provided in multiple smaller packets, -as opposed to an input provided as a single block. - -XXH state space must first be allocated, using either static or dynamic method provided above. - -Start a new hash by initializing state with a seed, using XXHnn_reset(). - -Then, feed the hash state by calling XXHnn_update() as many times as necessary. -Obviously, input must be valid, meaning allocated and read accessible. -The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. - -Finally, you can produce a hash anytime, by using XXHnn_digest(). -This function returns the final nn-bits hash. -You can nonetheless continue feeding the hash state with more input, -and therefore get some new hashes, by calling again XXHnn_digest(). - -When you are done, don't forget to free XXH state space, using typically XXHnn_freeState(). -*/ - - -#if defined (__cplusplus) -} -#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog new file mode 100644 index 00000000000..b51282d02f4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog @@ -0,0 +1,113 @@ +2015-12-03 Akira Kakuto + + * Import release 1.12. + +2015-04-12 Peter Breitenlohner + + * Import release 1.9.2. + +2015-03-01 Peter Breitenlohner + + * Import release 1.9.1. + * patch-01-mingw32, patch-09-funccall, patch-10-pow-int-int + (removed): Included upstream. + +2015-01-15 Peter Breitenlohner + + * patch-10-pow-int-int (new): Build fix for ppc-darwin gcc-4.2, + from Mojca Miklavec . + +2015-01-11 Karl Berry + + * patch-09-funccall (new): LLVM/Clang build (or bug) fix. + problem found by Richard Koch . + +2015-01-07 Peter Breitenlohner + + * Import release 1.9. + * patch-01-mingw32 (new): Oldish MinGW32 may not define this. + +2014-09-15 Peter Breitenlohner + + * Import release 1.8.1. + +2014-07-31 Peter Breitenlohner + + * Import release 1.8. + * patch-01-cygwin (removed): Included upstream. + +2014-06-25 Peter Breitenlohner + + * patch-01-cygwin (new): Cygwin soname for gs library. + +2014-06-20 Peter Breitenlohner + + * Import release 1.7. + +2014-04-29 Peter Breitenlohner + + * Import release 1.6. + +2014-04-13 Peter Breitenlohner + + * Import release 1.5.3. + +2014-01-13 Peter Breitenlohner + + * Import release 1.5.2. + +2013-10-30 Peter Breitenlohner + + * Import release 1.5.1. + +2013-09-17 Akira Kakuto + + * patch-01-MSVC (removed): Instead compile with -DNOMINMAX. + +2013-09-16 Akira Kakuto + + * patch-01-MSVC (new): Build fix for Visual Studio 2010. + +2013-09-10 Peter Breitenlohner + + * Import release 1.5. + * patch-01-cpp, patch-02-config_h: Removed. + +2013-08-08 Peter Breitenlohner + + * Import release 1.4. + * patch-01-cpp, patch-02-config_h: Adapted. + +2013-06-28 Peter Breitenlohner + + * patch-02-config_h (new): Include always first. + +2013-06-16 Peter Breitenlohner + + * patch-01-cpp: New version for kpathsea adapted to C++. + +2013-05-17 Peter Breitenlohner + + * Import release 1.3. + * patch-01-cpp: Adapted. + +2013-04-11 Peter Breitenlohner + + * Import release 1.2.1. + * patch-1-cpp (removed): Renamed ... + * patch-01-cpp (new): ... and adapted. + +2013-04-02 Karl Berry + + * patch-1-cpp (new): Force __cplusplus to be 1, + for sake of g++ 4.7.x and including c-memstr.h and Solaris. + Patch from Apostolos, tlbuild 1 Apr 2013 00:34:43. + +2013-03-02 Peter Breitenlohner + + * Import release 1.2. + +2013-01-29 Peter Breitenlohner + + * Import release 1.1. + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes new file mode 100644 index 00000000000..c19886df7a7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes @@ -0,0 +1,21 @@ +Changes applied to the dvisvgm-1.12 tree as obtained from: + http://dvisvgm.bplaced.net/Downloads + +Removed: + Makefile.in + aclocal.m4 + compile + config.guess + config.sub + configure + depcomp + install-sh + missing + test-driver + tests/ + */Makefile.in + +Converted Dos/Win line ends to native: + clipper/clipper.cpp + clipper/clipper.hpp + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/AUTHORS b/Build/source/texk/dvisvgm/dvisvgm-src/AUTHORS new file mode 100644 index 00000000000..d9b6468421e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/AUTHORS @@ -0,0 +1,7 @@ +Martin Gieseking + author of dvisvgm + +Deepak Bandyopadhyay, Lutz Kettner + authors of gzstream library + dvisvgm uses a slightly modified version + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/COPYING b/Build/source/texk/dvisvgm/dvisvgm-src/COPYING new file mode 100644 index 00000000000..94a9ed024d3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog new file mode 100644 index 00000000000..ce8772109de --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/ChangeLog @@ -0,0 +1,4630 @@ +2015-11-18 Martin Gieseking + + * NEWS: + updated NEWS + + * .travis.yml, configure.ac, src/Doxyfile: + set version to 1.12 + +2015-11-16 Martin Gieseking + + * src/FontEngine.cpp: + treat character code as character index if no font mapping is set + + * src/FontManager.cpp: + removed redundant #include + +2015-11-12 Martin Gieseking + + * README, README.md: + updated links to Google Test framework + +2015-11-09 Martin Gieseking + + * doc/dvisvgm.txt.in, src/Color.cpp, src/Color.h, src/CommandLine.cpp, + src/CommandLine.h, src/DVIToSVGActions.cpp, + src/DvisvgmSpecialHandler.cpp, src/EmSpecialHandler.cpp, + src/HtmlSpecialHandler.cpp, src/PSPattern.cpp, src/PsSpecialHandler.cpp, + src/SVGTree.cpp, src/TpicSpecialHandler.cpp, src/dvisvgm.cpp, + src/options.xml, tests/ColorTest.cpp: + added option --colornames to replace RGB color values with SVG color + names + + * tests/Makefile.am, tests/ShadingPatch.cpp, tests/ShadingPatchTest.cpp: + renamed ShadingPatchTest + + * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, + src/HtmlSpecialHandler.cpp, tests/ColorTest.cpp: + renamed Color::setName() to Color::setPSName() + +2015-10-27 Martin Gieseking + + * src/Process.cpp, src/Process.h: + fixed invalid access to freed string memory + +2015-10-06 Martin Gieseking + + * doc/dvisvgm.txt.in: + minor improvements of the manual page + +2015-09-21 Martin Gieseking + + * NEWS, README, README.md: + updated NEWS and README files + +2015-09-18 Martin Gieseking + + * .travis.yml, configure.ac, src/Doxyfile: + set version to 1.11 + +2015-09-14 Martin Gieseking + + * src/Font.cpp, src/Unicode.cpp, src/Unicode.h, tests/UnicodeTest.cpp: + renamed Unicode::psName2Codepoint to Unicode::psNameToCodepoint + + * src/Font.cpp, src/ToUnicodeMap.cpp, src/Unicode.cpp, src/Unicode.h, + tests/UnicodeTest.cpp: + improved handling of invalid Unicode points + +2015-09-10 Martin Gieseking + + * src/HtmlSpecialHandler.cpp: + quote XML metacharacters in xlink:title attributes + + * src/Font.cpp: + prevent creating 0x00 codepoints if PS character name is unknown + +2015-09-09 Martin Gieseking + + * src/SVGTree.cpp: + force creating a new text element after appending a different node to + the page + +2015-08-13 Martin Gieseking + + * README, README.md: + minor updates to README and README.md + +2015-07-29 Martin Gieseking + + * tests/CommandLineTest.cpp, tests/MessageExceptionTest.cpp: + use ASSERT_STREQ in tests + + * tests/UnicodeTest.cpp: + improved UnicodeTest + + * tests/GhostscriptTest.cpp, tests/Makefile.am: + added GhostscriptTest + +2015-07-22 Martin Gieseking + + * README, README.md, doc/dvisvgm.txt.in: + updated links to project website again (relocated to + dvisvgm.bplaced.net) + +2015-07-20 Martin Gieseking + + * README, README.md, doc/dvisvgm.txt.in: + updated info about new project website + +2015-07-14 Martin Gieseking + + * NEWS: + updated NEWS + + * .travis.yml, configure.ac, src/Doxyfile: + set version to 1.10 + +2015-07-12 Martin Gieseking + + * README.md, doc/dvisvgm.txt.in, src/BasicDVIReader.cpp, + src/BasicDVIReader.h, src/DVIReader.cpp, src/DVIReader.h, src/Font.h, + src/FontManager.cpp, src/FontManager.h: + added support for new XDV format 6 + +2015-07-11 Martin Gieseking + + * README, README.md: + updated README + +2015-07-03 Martin Gieseking + + * src/MiKTeXCom.cpp: + added some comments to MiKTeXCom.cpp + + * src/dvisvgm.cpp: + check for option --help before initializing the FileFinder + +2015-07-02 Martin Gieseking + + * src/Font.cpp, src/Makefile.am, src/Unicode.cpp, src/Unicode.h, + tests/Makefile.am, tests/create-makefile: + added mapping from character names to unicode for PostScript fonts + + * Makefile.am, configure.ac, xxHash/LICENSE, xxHash/Makefile.am, + xxHash/xxhash.c, xxHash/xxhash.h: + added xxHash library (https://github.com/Cyan4973/xxHash) + + * tests/BezierTest.cpp: + removed #include "debug.h" from test + +2015-04-07 Martin Gieseking + + * src/SVGTree.cpp: + apply --precision settings to font-size attributes too + + * NEWS, README.md: + updated NEWS and README.md + + * .travis.yml, configure.ac, src/Doxyfile: + set version to 1.9.2 + +2015-04-04 Martin Gieseking + + * tests/SVGOutputTest.cpp: + remove output files created by SVGOutputTest::getPageStream() + +2015-04-02 Martin Gieseking + + * README.md: + minor additions to README.md + +2015-03-26 Martin Gieseking + + * src/GFReader.cpp, src/GFReader.h, tests/GFReaderTest.cpp: + improved GFReaderTest + + * src/GlyphTracerMessages.h: + always skip tracer message if no glyphs have been traced + +2015-03-25 Martin Gieseking + + * src/DVIToSVG.cpp: + avoid retracing of fonts if option --no-fonts is given + + * src/GFGlyphTracer.cpp, src/GFTracer.h, tests/GFGlyphTracerTest.cpp, + tests/Makefile.am: + ensure GFGlyphTracer::executeChar() returns the correct status; added + GFGlyphtracerTest + +2015-03-22 Martin Gieseking + + * tests/SVGOutputTest.cpp: + improved SVGOutputTest + + * tests/StreamWriterTest.cpp: + fixed StreamWriterTest + +2015-03-19 Martin Gieseking + + * tests/Makefile.am, tests/ShadingPatch.cpp: + added ShadingPatchTest + +2015-03-18 Martin Gieseking + + * src/TensorProductPatch.h, tests/TensorProductPatchTest.cpp: + improved TensorProductPatchTest + + * src/Bezier.cpp, src/Bezier.h, src/TensorProductPatch.cpp, + src/TriangularPatch.cpp, src/TriangularPatch.h, + tests/TriangularPatchTest.cpp: + renamed method pointAt() of class Bezier and TriangularPatch to + valueAt() + + * src/ShadingPatch.h, src/TensorProductPatch.cpp, + src/TensorProductPatch.h, src/TriangularPatch.cpp, src/TriangularPatch.h, + tests/Makefile.am, tests/TriangularPatchTest.cpp: + added test for class TriangularPatch + +2015-03-17 Martin Gieseking + + * autogen.sh: + updated autogen.sh + +2015-03-15 Martin Gieseking + + * tests/Makefile.am, tests/VectorIteratorTest.cpp: + added VectorIteratorTest + + * Makefile.am, clipper/Makefile.am, configure.ac, m4/ax_code_coverage.m4, + src/Makefile.am, tests/Makefile.am, tests/create-makefile: + extended build system to generate coverage reports + + * src/XMLNode.cpp, src/XMLNode.h, tests/Makefile.am, + tests/XMLNodeTest.cpp: + fixed a few issues in class XMLElementNode; added XMLNodeTest + +2015-03-13 Martin Gieseking + + * tests/XMLStringTest.cpp: + fixed test class name of XMLString + +2015-03-09 Martin Gieseking + + * tests/GraphicPathTest.cpp: + extended tests of class GraphicPath + + * tests/CRC32Test.cpp: + added test for 'compute' methods of class CRC32 + +2015-03-08 Martin Gieseking + + * tests/StreamReaderTest.cpp: + exteded StreamReader tests + +2015-03-07 Martin Gieseking + + * .gitignore: + added .gitignore + + * src/XMLString.cpp, tests/Makefile.am, tests/XMLStringTest.cpp: + fixed conversion from C and C++ strings to XMLString; added + XMLStringTest + +2015-03-06 Martin Gieseking + + * src/BoundingBox.cpp, src/BoundingBox.h, tests/BoundingBoxTest.cpp: + improved BoundingBox tests + + * src/Bitmap.cpp, src/Bitmap.h, tests/BitmapTest.cpp, + tests/GFReaderTest.cpp, tests/Makefile.am: + small refactorings of class Bitmap; added tests for class Bitmap + +2015-03-01 Martin Gieseking + + * README.md: + added license badge to README.md + + * .travis.yml: + Travis conf: added configuration data for Coverity Scan + +2015-02-28 Martin Gieseking + + * NEWS, README.md: + updated NEWS and README.md + +2015-02-27 Martin Gieseking + + * src/Calculator.cpp: + replaced while(1) with for(;;) for consistency + +2015-02-26 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.9.1 + +2015-02-25 Martin Gieseking + + * src/Ghostscript.cpp: + disable lookup of GS library in Windows registry for old gcc versions + +2015-02-20 Martin Gieseking + + * doc/Makefile.am, doc/db2html.xsl, doc/dvisvgm.css: + create html manpage with a separate stylesheet matching the new website + theme + + * doc/Makefile.am, doc/conf-dblatex-man.xsl, doc/conf-dblatex-pdf.xsl, + doc/dvisvgm.sty, doc/dvisvgm.xpr, doc/tweak-dblatex-pdf.xsl: + improved the layout of the pdf manpage + + * doc/dvisvgm.txt.in: + minor additions and formatting changes of the manpage + + * doc/dvisvgm.txt.in, src/SVGOutput.cpp, src/SVGOutput.h, + tests/Makefile.am, tests/SVGOutputTest.cpp, tests/create-makefile: + added width specifiers and exression evaluation to --output patterns + +2015-02-19 Martin Gieseking + + * .travis.yml: + Travis conf: build gtest libraries since Ubuntu doesn't provide the + binaries + + * .travis.yml: + Travis conf: added missing call of 'configure' + + * .travis.yml: + added dependency 'libgtest-dev' to Travis configuration; ensure call of + 'make check' + + * .travis.yml: + added dependency 'python-lxml' to Travis configuration + + * .travis.yml: + added configuration file for Travis CI + +2015-02-18 Martin Gieseking + + * src/TpicSpecialHandler.cpp: + use constant M_PI rather than computing PI locally + +2015-02-17 Martin Gieseking + + * README, README.md: + updated README and README.md + +2015-01-21 Martin Gieseking + + * src/TensorProductPatch.cpp, src/TriangularPatch.cpp: + renamed static helper function clip() to snap() + +2015-01-15 Martin Gieseking + + * src/Color.cpp: + resolved ambiguous call of pow (patch by Peter Breitenlohner) + +2015-01-12 Martin Gieseking + + * src/VectorIterator.h: + removed redundant method VectorIterator::distanceToLast() + +2014-12-30 Martin Gieseking + + * Makefile.am, README, README.md, configure.ac, doc/Makefile.am, + doc/dvisvgm.txt.in, src/BasicDVIReader.cpp, src/BasicDVIReader.h, + src/Bezier.cpp, src/Bezier.h, src/BgColorSpecialHandler.cpp, + src/BgColorSpecialHandler.h, src/Bitmap.cpp, src/Bitmap.h, + src/BoundingBox.cpp, src/BoundingBox.h, src/CMap.cpp, src/CMap.h, + src/CMapManager.cpp, src/CMapManager.h, src/CMapReader.cpp, + src/CMapReader.h, src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, + src/Calculator.h, src/CharMapID.cpp, src/CharMapID.h, src/Character.h, + src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, + src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/DependencyGraph.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EPSFile.cpp, src/EPSFile.h, src/EPSToSVG.cpp, src/EPSToSVG.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/EncFile.cpp, + src/EncFile.h, src/FileFinder.cpp, src/FileFinder.h, src/FilePath.cpp, + src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, + src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, + src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, + src/FontMetrics.cpp, src/FontMetrics.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, + src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, + src/InputReader.cpp, src/InputReader.h, src/JFM.cpp, src/JFM.h, + src/Length.cpp, src/Length.h, src/Makefile.am, src/Makefile.old, + src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, + src/Message.cpp, src/Message.h, src/MessageException.h, + src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/MiKTeXCom.cpp, + src/MiKTeXCom.h, src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, + src/NumericRanges.h, src/PSFilter.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PSPattern.cpp, src/PSPattern.h, + src/PSPreviewFilter.cpp, src/PSPreviewFilter.h, src/PageRanges.cpp, + src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/PathClipper.cpp, src/PathClipper.h, src/PdfSpecialHandler.cpp, + src/PdfSpecialHandler.h, src/PreScanDVIReader.cpp, + src/PreScanDVIReader.h, src/Process.cpp, src/Process.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/RangeMap.cpp, + src/RangeMap.h, src/SVGOutputBase.h, src/SVGTree.cpp, src/SVGTree.h, + src/SWFWriter.cpp, src/SWFWriter.h, src/ShadingPatch.cpp, + src/ShadingPatch.h, src/SignalHandler.cpp, src/SignalHandler.h, + src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, + src/SpecialManager.h, src/StreamReader.cpp, src/StreamReader.h, + src/StreamWriter.cpp, src/StreamWriter.h, src/Subfont.cpp, src/Subfont.h, + src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, + src/TensorProductPatch.cpp, src/TensorProductPatch.h, src/Terminal.cpp, + src/Terminal.h, src/ToUnicodeMap.cpp, src/ToUnicodeMap.h, + src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, + src/TriangularPatch.cpp, src/TriangularPatch.h, src/Unicode.cpp, + src/Unicode.h, src/VFActions.h, src/VFReader.cpp, src/VFReader.h, + src/VectorIterator.h, src/VectorStream.h, src/XMLDocument.cpp, + src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, + src/XMLString.h, src/dvisvgm.cpp, src/gfprint.mak, src/macros.h, + src/options.dtd, src/options.xml, src/psdefs.cpp, src/psdefs.ps, + src/types.h, tests/BoundingBoxTest.cpp, tests/CMapReaderTest.cpp, + tests/CMapTest.cpp, tests/CRC32Test.cpp, tests/CalculatorTest.cpp, + tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, + tests/CommandLineTest.cpp, tests/DependencyGraphTest.cpp, + tests/DirectoryTest.cpp, tests/DvisvgmSpecialTest.cpp, + tests/FileFinderTest.cpp, tests/FilePathTest.cpp, + tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, + tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, + tests/LengthTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, + tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, + tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, + tests/PageSizeTest.cpp, tests/PairTest.cpp, tests/RangeMapTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, + tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, + tests/SubfontTest.cpp, tests/TensorProductPatchTest.cpp, + tests/ToUnicodeMapTest.cpp, tests/TypesTest.cpp, + tests/VectorStreamTest.cpp, tests/check-conv, tests/create-makefile, + tests/normalize.xsl: + updated year in copyright statements to 2015 + +2014-12-28 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.9 + + * src/dvisvgm.cpp: + clear line before printing the message about user interruption to avoid + trailing text fragments + + * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/EPSToSVG.cpp, + src/EPSToSVG.h, src/SpecialActions.h, src/SpecialManager.cpp, + src/dvisvgm.cpp: + show PS instruction counter when processing EPS files with option + --progress + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/ShadingPatch.h, + src/TensorProductPatch.cpp, src/TensorProductPatch.h, + src/TriangularPatch.cpp, src/TriangularPatch.h, src/dvisvgm.cpp, + src/options.xml: + added command-line options --grad-overlap, --grad-segments, and + --grad-simplify + +2014-12-20 Martin Gieseking + + * src/DVIReader.cpp: + check validity of DVI file before trying to collect the BOPs + +2014-12-18 Martin Gieseking + + * src/Color.cpp, src/Color.h, src/Makefile.am, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/VectorIterator.h, src/psdefs.cpp, + src/psdefs.ps: + extended PS operator 'shfill' to support triangular patch meshes + + * src/Makefile.am, src/PsSpecialHandler.cpp, src/ShadingPatch.cpp, + src/ShadingPatch.h, src/TensorProductPatch.cpp, src/TensorProductPatch.h: + extracted common interface class ShadingPatch from TensorProductPatch + + * src/Makefile.am, src/TriangularPatch.cpp, src/TriangularPatch.h: + added class to compute triangular shading patches + +2014-12-16 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + added processing of the optional 'BBox' entry in a PS shading dictionary + +2014-12-03 Martin Gieseking + + * src/Color.cpp, tests/ColorSpecialTest.cpp, tests/ColorTest.cpp: + fixed CMYK to RGB approximation + + * src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, + src/options.xml: + disable option --clipjoin if PS support is disabled + +2014-11-27 Martin Gieseking + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.cpp, src/psdefs.ps, + tests/PSInterpreterTest.cpp: + added evaluation of PS operator "shfill" (Coons and tensor product + patches only) + +2014-11-24 Martin Gieseking + + * README.md: + added list of features and a download button to README.md + +2014-11-20 Martin Gieseking + + * src/MiKTeXCom.cpp: + added missing includes to make MinGW-w64 happy + +2014-11-09 Martin Gieseking + + * clipper/clipper.cpp, clipper/clipper.hpp: + updated clipper library to version 6.2.1 + +2014-11-08 Martin Gieseking + + * src/Bezier.cpp, src/Bezier.h, src/BoundingBox.h, src/GraphicPath.h, + src/Makefile.am, src/TensorProductPatch.cpp, src/TensorProductPatch.h, + tests/Makefile.am, tests/TensorProductPatchTest.cpp: + added code to compute tensor-product patches required for gradient fills + +2014-11-06 Martin Gieseking + + * src/Matrix.cpp: + use constant M_PI rather than defining PI locally + +2014-10-23 Martin Gieseking + + * src/Color.cpp, src/Color.h, tests/ColorTest.cpp: + added deltaE and L*a*b* color space methods to class Color + + * src/Color.cpp, src/Color.h: + replaced vectors with valarrays in class Color + + * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, + src/DVIReader.cpp, src/HtmlSpecialHandler.cpp, src/PsSpecialHandler.cpp, + tests/ColorTest.cpp: + renamed RGB setters/getters of class Color + + * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, + src/PsSpecialHandler.cpp, tests/ColorTest.cpp: + replaced float by double in class Color + +2014-10-17 Martin Gieseking + + * src/GraphicPath.h, src/PathClipper.cpp, src/PathClipper.h, + src/XMLNode.h: + fixed a couple of doxygen comments; removed redundant + PathClipperException + + * clipper/clipper.cpp, clipper/clipper.hpp: + updated clipper library to version 6.2.0 + +2014-10-08 Martin Gieseking + + * src/Ghostscript.cpp: + try to lookup the location of the GS DLL in the Windows registry + + * src/CommandLine.cpp: + updated CommandLine.cpp with description of option --no-merge + +2014-10-01 Martin Gieseking + + * doc/dvisvgm.txt.in, src/options.xml: + added info about option --no-merge to the manpage + +2014-09-24 Khaled Hosny + + * src/Makefile.am: + Add an opt2cpp Python script + +A very ugly script that should work as a + drop in replacement for the +opt2cpp XSLT. + +2014-09-15 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + ensure that colors set by a color special are always considered by the + PS handler + +2014-09-10 Martin Gieseking + + * src/BasicDVIReader.cpp, src/DVIReader.cpp, src/FontCache.cpp, + src/GFReader.cpp, src/dvisvgm.cpp: + replaced namespace 'ios_base' with 'ios' + +2014-08-29 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.8.1 + + * src/FontEngine.cpp, tests/PageRagesTest.cpp: + removed unused static functions + + * src/PsSpecialHandler.cpp: + added missing whitespace boundaries in PS code + +2014-08-20 Khaled Hosny + + * src/CommandLine.cpp, src/CommandLine.h, src/SVGTree.cpp, src/SVGTree.h, + src/dvisvgm.cpp, src/options.xml: + Add an option not to merge adjacent chars + +With this option on, each DVI + character is put in its own tag. +Makes post processing the SVG + file a bit simpler. + +2014-08-18 Martin Gieseking + + * src/DVIToSVG.cpp, src/DependencyGraph.h, src/Makefile.am, + src/SVGTree.cpp, src/SVGTree.h, src/XMLNode.cpp, src/XMLNode.h, + tests/DependencyGraphTest.cpp, tests/Makefile.am: + remove redundant clipPath elements from generated SVG files + +2014-08-16 Martin Gieseking + + * src/PSPattern.cpp, src/XMLNode.cpp, src/XMLNode.h: + renamed XMLElementNode::findDescendants() and made it constant + +2014-08-11 Martin Gieseking + + * tests/Makefile.am, tests/create-makefile: + link tests against FreeType library + +2014-08-10 Khaled Hosny + + * configure.ac, src/Makefile.am: + Don't override CPPFLAGS and LDFLAGS in configure + +For the same reasons + as the previous commit + + * configure.ac, src/Makefile.am: + Don't override CXXFLAGS in configure script + +Breaks standard things + like: + + make CXXFLAGS="-g -O0 -pg" + + * configure.ac, src/Makefile.am: + EXTRA_LIBS is not used anymore + +2014-08-07 Martin Gieseking + + * src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h: + removed unused emit() methods from XML classes + +2014-08-06 Martin Gieseking + + * README.md: + minor fixes to README.md + +2014-07-31 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/psdefs.cpp, src/psdefs.ps: + prevent side-effects caused by bop/eop operators present in PS specials + +2014-07-29 Martin Gieseking + + * NEWS: + updated NEWS + +2014-07-28 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.8 + + * src/GraphicPath.h, src/PSInterpreter.cpp, src/PSInterpreter.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/psdefs.cpp, + src/psdefs.ps, tests/PSInterpreterTest.cpp: + added evaluation of PS operator 'clippath' (copies clipping path into + graphics path) + +2014-07-26 Martin Gieseking + + * src/Font.cpp, src/GFGlyphTracer.cpp, src/GraphicPath.h, + src/PsSpecialHandler.cpp: + renamed GraphicPath::newpath() to GraphicPath::clear() + +2014-07-24 Martin Gieseking + + * src/InputReader.cpp, src/PSInterpreter.cpp: + ensure that InputReader::compare() checks whole and not just partial + words + +2014-07-22 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/dvisvgm.cpp, + src/options.xml: + added option --clippath to compute the intersection of clipping paths + + * README, README.md, src/Bezier.cpp, src/Bezier.h, src/GraphicPath.h, + src/Makefile.am, src/PathClipper.cpp, src/PathClipper.h, src/dvisvgm.cpp: + added class PathClipper to compute intersections of closed curved + graphics paths + + * src/GraphicPath.h: + added field to store the winding rule to class GraphicPath + + * Makefile.am, clipper/License.txt, clipper/Makefile.am, + clipper/clipper.cpp, clipper/clipper.hpp, configure.ac, src/Makefile.am: + added slightly modified sources of clipper library (computes boolops on + polygons) + + * src/DVIToSVG.h, src/dvisvgm.cpp: + prevent throwing a DVIException when option -l is present + +2014-07-20 Khaled Hosny + + * src/FontEngine.cpp: + free existing FT_Face before creating a new one + +2014-07-18 Martin Gieseking + + * src/TpicSpecialHandler.cpp: + TPIC handler: use class GraphicPath to create SVG path commands + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/GraphicPath.h, src/PsSpecialHandler.cpp, src/SVGTree.cpp, + src/SVGTree.h, src/dvisvgm.cpp, src/options.xml, + tests/GraphicPathTest.cpp: + added option to create relative rather than absolute path commands + +2014-07-07 Martin Gieseking + + * src/DVIToSVGActions.h, src/Doxyfile, src/HtmlSpecialHandler.h, + src/RangeMap.cpp, src/SpecialManager.cpp, src/ToUnicodeMap.cpp: + fixed a couple of broken doxygen comments + +2014-06-25 Martin Gieseking + + * src/Ghostscript.cpp: + get proper name of Ghostscript library when building for Cygwin + +2014-06-23 Martin Gieseking + + * README.md: + added markdown version of README + +2014-06-20 Martin Gieseking + + * src/psdefs.cpp, src/psdefs.ps: + suppress output of PS operator ':show' to prevent the creation of + additional graphic elements + +2014-06-17 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.7 + + * src/InputReader.cpp: + added missing include + + * doc/dvisvgm.txt.in, src/DVIToSVGActions.cpp, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + tests/DvisvgmSpecialTest.cpp, tests/Makefile.am: + added/improved dvisvgm::raw* specials + + * src/SpecialManager.cpp, src/SpecialManager.h: + removed redundant method SpecialManager::leavePSHeaderSection() + +2014-06-12 Martin Gieseking + + * src/XMLNode.cpp, src/XMLNode.h: + added clear() to XMLNode classes; added XMLTextNode::getText() + +2014-06-11 Martin Gieseking + + * src/DVIToSVG.cpp, src/SpecialHandler.h, src/SpecialManager.cpp, + src/SpecialManager.h: + added listener to allow SpecialHandlers being notified when + pre-processing has finished + + * src/InputReader.cpp, src/InputReader.h: + added InputReader::getLine() + +2014-06-10 Martin Gieseking + + * src/SpecialActions.h, tests/ColorSpecialTest.cpp: + renamed class SpecialEmptyActions to EmptySpecialActions + +2014-06-09 Martin Gieseking + + * src/DVIToSVG.h, src/SpecialManager.h: + removed redundant definition of assignment operators + + * src/DVIReader.cpp, src/Ghostscript.cpp: + removed unused variable; call Ghostscript::exit() with explicitely given + object + +2014-06-05 Martin Gieseking + + * src/BasicDVIReader.cpp, src/BasicDVIReader.h, src/Bitmap.h, + src/BoundingBox.h, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, + src/CMapReader.h, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, + src/CmdLineParserBase.h, src/Color.cpp, src/ColorSpecialHandler.cpp, + src/ColorSpecialHandler.h, src/CommandLine.cpp, src/CommandLine.h, + src/DLLoader.h, src/DVIReader.cpp, src/DVIToSVG.h, src/DVIToSVGActions.h, + src/Directory.h, src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, + src/EmSpecialHandler.h, src/EncFile.h, src/FileFinder.h, + src/FileSystem.cpp, src/Font.cpp, src/Font.h, src/FontCache.h, + src/FontEncoding.cpp, src/FontEngine.cpp, src/FontEngine.h, + src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, + src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, + src/GraphicPath.h, src/HtmlSpecialHandler.h, src/InputBuffer.cpp, + src/InputBuffer.h, src/JFM.h, src/Length.cpp, src/Length.h, + src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/NoPsSpecialHandler.h, src/NumericRanges.h, src/PSInterpreter.h, + src/PSPattern.h, src/PSPreviewFilter.h, src/PageRanges.h, src/PageSize.h, + src/Pair.h, src/PdfSpecialHandler.cpp, src/PdfSpecialHandler.h, + src/Process.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/SVGTree.h, src/SWFWriter.cpp, src/SignalHandler.h, + src/SpecialActions.h, src/SpecialManager.h, src/StreamWriter.h, + src/Subfont.cpp, src/Subfont.h, src/TFM.h, src/ToUnicodeMap.h, + src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, src/VFReader.cpp, + src/VectorStream.h, src/XMLDocument.h, src/XMLNode.h, src/XMLString.cpp, + src/XMLString.h, src/dvisvgm.cpp, src/types.h: + replaced leading spaces by tabs; removed trailing whitespace + + * doc/dvisvgm.txt.in, src/BasicDVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/EPSToSVG.cpp, src/EPSToSVG.h, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/PreScanDVIReader.cpp, + src/PreScanDVIReader.h, src/SpecialActions.h: + process hyperref anchors and links across pages + + * src/BasicDVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h: + allow to replace the DVI reader assigned to an instance of + DVIToSVGActions + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/SpecialManager.cpp, src/SpecialManager.h, src/dvisvgm.cpp: + made class SpecialManager a singleton + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, + src/PreScanDVIReader.cpp, src/PreScanDVIReader.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/StreamReader.cpp, + src/StreamReader.h: + pre-process DVI file to collect required data not present in the page + ranges to be converted + + * src/BasicDVIReader.h, src/DVIReader.cpp, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/dvisvgm.cpp: + moved call of executePreamble() and executePostamble() from DVIToSVG to + DVIReader + + * src/BasicDVIReader.cpp, src/BasicDVIReader.h, src/DVIReader.cpp, + src/DVIReader.h, src/Makefile.am: + moved basic funtionality of DVIReader to base class BasicDVIReader + +2014-06-03 Martin Gieseking + + * src/PsSpecialHandler.cpp: + fixed incorrect extent values shown when applying a preview bbox + (bp->pt) + + * rpm/Makefile.am: + removed outdated project folder 'rpm' + + * src/DVIReader.cpp, src/DVIReader.h: + removed redundant variable DVIReader::_prevBop + +2014-06-01 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h: + removed redundant code from DVIReader::evalCommand() + + * src/EPSFile.cpp, src/GFReader.cpp: + replaced relative variant of seekg() by absolute one where possible + +2014-05-31 Martin Gieseking + + * src/DVIReader.cpp, src/StreamReader.h, src/VFReader.cpp: + renamed some methods of class StreamReader + + * src/DVIReader.cpp, src/StreamReader.cpp, src/StreamReader.h, + src/VFReader.cpp: + removed StreamReader::in() + + * src/DVIReader.cpp, src/VFReader.cpp: + few code adjustments + +2014-05-29 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h: + simplified DVIReader::executePage; removed DVIReader::executePages + + * src/DVIReader.cpp, src/DVIReader.h, src/dvisvgm.cpp: + simplified computation of progress ratio + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h: + removed DVIReader::_totalPages; use number of BOP offsets instead + + * src/DVIReader.cpp, src/DVIReader.h, src/StreamReader.h: + collect all DVI BOP offsets to reach them quickly + +2014-05-22 Martin Gieseking + + * src/Makefile.am: + Makefiles: put source files on separate lines + + * src/Makefile.am, src/RangeMap.h, src/ToUnicodeMap.cpp, + src/ToUnicodeMap.h, tests/Makefile.am, tests/ToUnicodeMapTest.cpp: + added class ToUnicodeMap to handle mappings from character indexes to + unicode points + + * src/DVIToSVG.cpp, src/Makefile.am, src/NumericRanges.h, + src/PageRanges.cpp, src/PageRanges.h, tests/PageRagesTest.cpp: + extracted functionality of class PageRanges to separate class + NumericRanges + + * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/Font.h, + src/FontEngine.cpp, src/FontEngine.h, src/Makefile.am: + replaced class CharMap with more generic class RangeMap + + * src/RangeMap.cpp: + fixed right joins of touching ranges in a RangeMap + + * src/CMap.cpp, src/CMap.h, src/Makefile.am, src/RangeMap.cpp, + src/RangeMap.h, tests/Makefile.am, tests/RangeMapTest.cpp: + extracted class RangeMap previously implemented as part of SegmentedCMap + + * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/FontEngine.cpp, + src/FontEngine.h: + removed redundant method CharMap::invert() + +2014-04-30 Martin Gieseking + + * src/CharMapID.cpp, src/CharMapID.h, src/DVIReader.cpp, src/Font.cpp, + src/Font.h, src/FontEngine.cpp, src/FontEngine.h: + try to add unicode mappings missing in a font's cmap table + +2014-04-29 Martin Gieseking + + * src/SVGTree.cpp: + don't add unnecessary element 'missing-glyph' to SVG files + +2014-04-24 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/options.xml: + renamed argument of option --linkmark from 'type' to 'style' + +2014-04-22 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.6 + +2014-04-21 Martin Gieseking + + * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/EPSToSVG.cpp: + removed date and machine triplet from generated SVG files + +2014-04-18 Martin Gieseking + + * doc/dvisvgm.txt.in, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h: + added optional selection of line/box colors to option --linkmark + +2014-04-17 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/options.xml: + changed default argument of option --linkmark to 'box' + + * src/DVIReader.h, src/DVIToSVGActions.h, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/SpecialActions.h: + only split hyperlink boxes on line breaks + + * src/CommandLine.h, src/DVIToSVG.cpp, src/EPSToSVG.cpp: + don't link GS messages unnecessarily if HAVE_LIBGS is defined + +2014-04-16 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/SVGTree.cpp, src/SVGTree.h, src/dvisvgm.cpp, src/options.xml: + added command-line option --zoom + + * src/Ghostscript.cpp, src/dvisvgm.cpp: + moved lookup of MiKTeX's GS DLL to get_libgs() + + * doc/dvisvgm.txt.in, src/Ghostscript.cpp: + if libgs is loaded during runtime, look for libgs.so.X instead of + libgs.so + + * src/DLLoader.cpp: + prevent calling dlopen() if the length of the string argument is 0 + +2014-04-11 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.5.3 + + * src/CMap.cpp, src/CmdLineParserBase.cpp, src/ColorSpecialHandler.cpp, + src/DVIReader.cpp, src/DVIToSVGActions.cpp, src/Doxyfile, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EPSFile.cpp, src/EmSpecialHandler.cpp, src/FileFinder.cpp, + src/FileSystem.cpp, src/Font.cpp, src/FontCache.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontMap.cpp, src/GraphicPath.h, + src/PSInterpreter.cpp, src/PageRanges.cpp, src/PsSpecialHandler.cpp, + src/SVGTree.cpp, src/SVGTree.h, src/SpecialManager.cpp, src/Subfont.cpp, + src/TFM.cpp, src/TpicSpecialHandler.cpp, src/XMLDocument.cpp, + src/XMLNode.cpp, src/dvisvgm.cpp: + fixed issues in the doxygen documentation + +2014-04-09 Martin Gieseking + + * src/BoundingBox.h, src/DVIActions.cpp, src/DVIActions.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/DvisvgmSpecialHandler.cpp, src/EPSToSVG.cpp, + src/EmSpecialHandler.cpp, src/Font.h, src/FontManager.cpp, + src/GFGlyphTracer.cpp, src/GFReader.cpp, src/GFTracer.cpp, + src/GFTracer.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, + src/Makefile.am, src/PSPattern.cpp, src/PSPreviewFilter.cpp, + src/PSPreviewFilter.h, src/PageSize.cpp, src/PageSize.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/TFM.cpp, src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, + src/VFReader.cpp: + switched internal computations from TeX points (pt) to PS points (bp) + + * src/DVIToSVGActions.cpp: + equalize implementations of moveToX and moveToY + +2014-02-05 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h: + ensure updating the SVG cursor position when executing DVI command + set_rule + +2014-01-13 Martin Gieseking + + * src/Ghostscript.cpp: + check if library given by --libgs is actually a GS library + +2014-01-10 Martin Gieseking + + * NEWS: + updated NEWS + +2014-01-03 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.5.2 + + * src/FileFinder.cpp: + return 'unknown' if MiKTeX version can't be retrieved + + * src/Directory.cpp: + initialize Directory member variables (Win only) + + * src/FileFinder.cpp: + catch exceptions thrown by MiKTeXCom object + +2014-01-02 Martin Gieseking + + * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, + src/CMapReader.cpp, src/CMapReader.h, src/CRC32.cpp, src/CRC32.h, + src/Calculator.cpp, src/Calculator.h, src/CharMap.cpp, src/CharMap.h, + src/CharMapID.cpp, src/CharMapID.h, src/Character.h, + src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, + src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EPSFile.cpp, src/EPSFile.h, src/EPSToSVG.cpp, src/EPSToSVG.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/EncFile.cpp, + src/EncFile.h, src/FileFinder.cpp, src/FileFinder.h, src/FilePath.cpp, + src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, + src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, + src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, + src/FontMetrics.cpp, src/FontMetrics.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, + src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, + src/InputReader.cpp, src/InputReader.h, src/JFM.cpp, src/JFM.h, + src/Length.cpp, src/Length.h, src/Makefile.am, src/Makefile.old, + src/MapLine.cpp, src/MapLine.h, src/Matrix.cpp, src/Matrix.h, + src/Message.cpp, src/Message.h, src/MessageException.h, + src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/MiKTeXCom.cpp, + src/MiKTeXCom.h, src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, + src/PSFilter.h, src/PSInterpreter.cpp, src/PSInterpreter.h, + src/PSPattern.cpp, src/PSPattern.h, src/PSPreviewFilter.cpp, + src/PSPreviewFilter.h, src/PageRanges.cpp, src/PageRanges.h, + src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/PdfSpecialHandler.cpp, + src/PdfSpecialHandler.h, src/Process.cpp, src/Process.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGOutputBase.h, + src/SVGTree.cpp, src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, + src/SignalHandler.cpp, src/SignalHandler.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, + src/StreamWriter.h, src/Subfont.cpp, src/Subfont.h, src/System.cpp, + src/System.h, src/TFM.cpp, src/TFM.h, src/Terminal.cpp, src/Terminal.h, + src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, src/VFActions.h, + src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, + src/options.dtd, src/options.xml, src/psdefs.cpp, src/psdefs.ps, + src/types.h, tests/BoundingBoxTest.cpp, tests/CMapReaderTest.cpp, + tests/CMapTest.cpp, tests/CRC32Test.cpp, tests/CalculatorTest.cpp, + tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, + tests/CommandLineTest.cpp, tests/DirectoryTest.cpp, + tests/FileFinderTest.cpp, tests/FilePathTest.cpp, + tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, + tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, + tests/LengthTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, + tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, + tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, + tests/PageSizeTest.cpp, tests/PairTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, + tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, + tests/SubfontTest.cpp, tests/TypesTest.cpp, tests/VectorStreamTest.cpp, + tests/check-conv, tests/create-makefile, tests/normalize.xsl: + updated year in copyright statements to 2014 + +2013-12-29 Martin Gieseking + + * src/FontCache.cpp: + catch potential StreamReaderException + + * src/Directory.cpp, src/Directory.h, src/FontMap.cpp, + tests/DirectoryTest.cpp: + changed directory entry types from char to enums + + * src/Font.cpp: + check if units per EM are not 0 to prevent divisions by zero + +2013-12-18 Martin Gieseking + + * src/DVIReader.cpp, src/Directory.cpp, src/GFReader.cpp: + added missing initializations of member variables + + * src/FontCache.cpp, src/SpecialManager.cpp: + restore stream format flags + + * src/DvisvgmSpecialHandler.cpp, src/FontCache.cpp: + ensure null pointer checks before dereferencing + + * src/DVIReader.cpp: + check if denominator of DVI unit is non-zero + + * src/Matrix.cpp: + ensure return value of istream::get() is assigned to int vars + + * src/FontCache.cpp: + avoid accessing strings constructed from temporaries + + * src/BoundingBox.cpp: + explicitely initialize BoundingBox fields + +2013-11-16 Martin Gieseking + + * src/DVIReader.cpp, src/SVGTree.cpp, src/SVGTree.h: + don't let global font colors interfere with color specials + +2013-10-29 Martin Gieseking + + * NEWS: + updated NEWS + +2013-10-28 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.5.1 + + * src/DVIReader.cpp: + temporarily reactivated processing of font definitions located in the + postamble + + * src/FileSystem.cpp, src/MetafontWrapper.cpp: + added explicit casts from ifstream to bool + + * src/Bitmap.cpp, src/Color.cpp, src/JFM.cpp, src/Matrix.cpp: + added missing #includes of header file + +2013-10-27 Martin Gieseking + + * src/DVIToSVG.cpp: + suppress output of logical page number if it equals physical page number + +2013-10-16 Martin Gieseking + + * src/PSPreviewFilter.cpp, src/PsSpecialHandler.cpp: + ensure proper evaluation of tightpage data if multiple pages are + processed + +2013-10-12 Martin Gieseking + + * src/Color.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + added 'const' to read-only methods + + * src/InputBuffer.h: + don't check unsigned variables for negative values + +2013-09-21 Martin Gieseking + + * src/DVIToSVG.cpp: + changed warning message that appears if PS support has been disabled + permanently + + * src/DVIToSVG.cpp, src/Ghostscript.h, src/dvisvgm.cpp: + added missing guards and functions to prevent compilation errors if + DISABLE_GS is set + + * src/FontCache.cpp, src/FontCache.h: + renamed FontCache::VERSION to FontCache::FORMAT_VERSION + +2013-09-01 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.5 + + * src/DLLoader.h, src/Directory.h: + moved #define NOMINMAX to Windows config.h + + * src/BgColorSpecialHandler.cpp, src/Bitmap.cpp, src/BoundingBox.cpp, + src/CMap.cpp, src/CMapManager.cpp, src/CMapReader.cpp, src/CRC32.cpp, + src/Calculator.cpp, src/CharMap.cpp, src/CmdLineParserBase.cpp, + src/Color.cpp, src/ColorSpecialHandler.cpp, src/CommandLine.cpp, + src/CommandLine.h, src/DLLoader.cpp, src/DVIActions.cpp, + src/DVIReader.cpp, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, + src/Directory.cpp, src/DvisvgmSpecialHandler.cpp, src/EPSFile.cpp, + src/EPSToSVG.cpp, src/EmSpecialHandler.cpp, src/EncFile.cpp, + src/FileFinder.cpp, src/FilePath.cpp, src/FileSystem.cpp, src/Font.cpp, + src/FontCache.cpp, src/FontEncoding.cpp, src/FontEngine.cpp, + src/FontManager.cpp, src/FontMap.cpp, src/FontMetrics.cpp, + src/GFGlyphTracer.cpp, src/GFReader.cpp, src/GFTracer.cpp, + src/Ghostscript.cpp, src/Ghostscript.h, src/HtmlSpecialHandler.cpp, + src/InputBuffer.cpp, src/InputReader.cpp, src/JFM.cpp, src/Length.cpp, + src/MapLine.cpp, src/Matrix.cpp, src/Message.cpp, + src/MetafontWrapper.cpp, src/MiKTeXCom.cpp, src/NoPsSpecialHandler.cpp, + src/PSInterpreter.cpp, src/PSPattern.cpp, src/PSPreviewFilter.cpp, + src/PageRanges.cpp, src/PageSize.cpp, src/PdfSpecialHandler.cpp, + src/Process.cpp, src/PsSpecialHandler.cpp, src/SVGTree.cpp, + src/SignalHandler.cpp, src/SpecialManager.cpp, src/StreamReader.cpp, + src/StreamWriter.cpp, src/Subfont.cpp, src/System.cpp, src/TFM.cpp, + src/Terminal.cpp, src/TpicSpecialHandler.cpp, src/VFReader.cpp, + src/XMLDocument.cpp, src/XMLNode.cpp, src/XMLString.cpp, src/dvisvgm.cpp: + include config.h at the top of every translation unit + +2013-08-30 Martin Gieseking + + * doc/dvisvgm.txt.in: + updated manpage + + * src/Font.cpp, src/Font.h, src/XMLString.cpp: + replaced entity references by corresponding UTF-8 characters; use + correct unicode points rather than DVI charcodes + + * src/DVIReader.cpp, src/DVIReader.h, src/Font.cpp, src/Font.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontManager.h, src/FontStyle.h, src/SVGTree.cpp, src/dvisvgm.cpp: + added support for XDV (DVI format 5) files + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontMetrics.h, src/JFM.h, + src/SVGTree.cpp, src/SVGTree.h, src/TFM.h, src/dvisvgm.cpp: + added support for DVI format 3 (pTeX, vertical mode) + + * src/FontMetrics.h, src/JFM.cpp, src/JFM.h, src/TFM.h: + added retrieval of vertical mode flag to class FontMetrics + +2013-08-29 Martin Gieseking + + * src/CharMap.cpp, src/CharMap.h, src/Font.cpp, src/Font.h, + src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontManager.cpp, src/Makefile.am: + replaced local std::map tables used in Font classes with new class + CharMap + +2013-08-22 Martin Gieseking + + * src/XMLString.cpp: + replace very small floating point numbers by 0 + +2013-08-20 Martin Gieseking + + * src/FileFinder.cpp: + suppress error messages from makeFOO tools + +2013-08-13 Martin Gieseking + + * src/Font.cpp, src/Font.h, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h: + moved assignment of base font map to Font class + + * src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, + src/EncFile.h, src/Font.cpp, src/Font.h, src/FontEncoding.cpp, + src/FontEncoding.h, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h: + derive EncodingPair from FontEncoding + +2013-08-11 Martin Gieseking + + * src/dvisvgm.cpp: + fix number of dashes printed by -V1 + + * configure.ac, src/FileFinder.cpp: + check if the kpathsea library is C++-safe (patch by Peter Breitenlohner) + +2013-08-08 Martin Gieseking + + * src/Matrix.cpp, src/Matrix.h: + renamed Matrix skewing methods + +2013-08-04 Martin Gieseking + + * src/Ghostscript.h, src/PSPreviewFilter.cpp, src/PsSpecialHandler.cpp: + added missing variable initializations + + * src/Font.cpp, src/Font.h, src/FontEngine.cpp, src/FontManager.cpp, + src/FontMap.cpp, src/FontMap.h, src/FontStyle.h, src/Makefile.am: + store pointers to font map and encoding in Font objects to speed up + looking them up + +2013-08-03 Martin Gieseking + + * src/CMapManager.cpp, src/CMapManager.h, src/FontManager.cpp: + avoid const_cast in CMapManager + +2013-08-02 Martin Gieseking + + * src/CMap.h, src/CMapManager.cpp: + properly handle 'unicode' encoding entries set in font map + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp: + disable font processing while scanning PS header specials + +2013-08-01 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.4 + + * NEWS: + updated NEWS + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.h, src/EPSToSVG.h, + src/Matrix.cpp, src/Matrix.h, src/PsSpecialHandler.cpp, + src/SpecialActions.h, src/dvisvgm.cpp: + apply page transformations to width, height, and depth of preview bbox + + * src/DVIToSVG.cpp: + removed redundant #include statements + + * src/DVIToSVG.cpp, src/Makefile.am, src/SVGTree.cpp, + src/XMLDocTypeNode.h: + removed DOCTYPE declaration from generated files as suggested by the SVG + specification + + * src/XMLDocument.cpp, src/XMLString.cpp: + changed encoding of SVG files from ISO-8859-1 to UTF-8 + +2013-07-31 Martin Gieseking + + * src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, src/CMapReader.cpp, + src/CharMapID.cpp, src/CharMapID.h, src/Font.cpp, src/Font.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontMap.cpp, src/FontMap.h, src/Makefile.am: + try to decode characters of non-CID fonts that have a CMap assigned in + the fontmap + + * src/CMap.cpp, src/CMap.h, src/CMapReader.cpp, src/CMapReader.h, + tests/CMapReaderTest.cpp, tests/CMapTest.cpp, tests/Makefile.am: + added evaluation of base font (bf) sections in CMap files + + * src/Font.cpp, src/Font.h, src/FontMetric.cpp, src/FontMetric.h, + src/FontMetrics.cpp, src/FontMetrics.h, src/Makefile.am, src/TFM.h: + renamed class FontMetric to FontMetrics + + * src/FileFinder.cpp, src/Font.cpp, src/Font.h, src/FontManager.cpp: + added support for OTF fonts + + * src/CMap.cpp, src/CMap.h, src/Character.h, src/EncFile.h, src/Font.cpp, + src/Font.h, src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, + src/Makefile.am, tests/CMapTest.cpp: + added Character class to handle character names, codes, and indexes + consistently + + * src/CMap.cpp, src/CMap.h, src/CMapManager.h, src/EncFile.cpp, + src/EncFile.h, src/FileFinder.cpp, src/Font.cpp, src/Font.h, + src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontManager.cpp, src/Makefile.am, + tests/CMapTest.cpp: + derive .enc encoding vectors and CMaps from common base class + FontEncoding + + * src/CMap.cpp, src/CMap.h, src/CMapManager.cpp, src/CMapManager.h, + src/CMapReader.cpp, src/CMapReader.h, src/FontManager.cpp, + src/Makefile.am, tests/CMapTest.cpp, tests/Makefile.am: + added classes to handle CMap files + +2013-07-27 Martin Gieseking + + * doc/dvisvgm.txt.in, src/DVIActions.h, src/DVIReader.cpp, + src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/EPSToSVG.cpp, src/Makefile.am, src/PSFilter.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PSPreviewFilter.cpp, src/PSPreviewFilter.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h: + added evaluation of bounding box information created by preview package + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp: + added funtion to execute PS code snippets and retrieve their results + + * src/BgColorSpecialHandler.h, src/DVIToSVG.cpp, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h: + ensure that PS header code is evaluated before the page/body code; also + execute bop-hook and eop-hook + + * src/JFM.cpp: + fixed retrieval of char indexes if a JFM contains entries of chartype 0 + only + +2013-07-23 Martin Gieseking + + * src/FontMap.cpp: + check for EOF prior to try to parse another mapline + + * src/psdefs.cpp, src/psdefs.ps: + PS handler: call newpath before executing charpath in operator show + + * src/EPSToSVG.cpp: + print warning message if height or width of EPS bbox is 0 + +2013-07-18 Martin Gieseking + + * src/psdefs.cpp, src/psdefs.ps: + replaced PS operator prval with =only in psdefs + +2013-07-17 Martin Gieseking + + * src/psdefs.cpp, src/psdefs.ps: + properly store PS operator applyscalevals in systemdict + + * src/DVIToSVG.cpp: + ensure catching PSExceptions while processing PS header specials to + prevent segfaults + +2013-07-14 Martin Gieseking + + * src/FileFinder.cpp, src/FileFinder.h: + FileFinder: added lookup of cmap files + + * src/Process.cpp, src/Process.h: + extended Process::run() to grab the output written to stdout + +2013-07-08 Martin Gieseking + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp: + command-line parser: changed type of argument mode from char to enum + +2013-06-17 Martin Gieseking + + * src/FileFinder.cpp: + removed redundant 'using namespace std' + +2013-06-03 Martin Gieseking + + * doc/dvisvgm.txt.in, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/dvisvgm.cpp: + extend option --linkmark to highlight linked areas by a given background + color + +2013-06-01 Martin Gieseking + + * src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, + src/ColorSpecialHandler.h, src/SpecialActions.h, + tests/ColorSpecialTest.cpp, tests/ColorTest.cpp, tests/Makefile.am: + use Color class in ColorSpecialHandler rather than local code; added + ColorTest + +2013-05-22 Martin Gieseking + + * src/dvisvgm.cpp: + added a missing (underlining) hyphen to the output of -V1 + +2013-05-13 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.3 + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/HtmlSpecialHandler.cpp, src/dvisvgm.cpp, src/options.xml: + added option --linkmark to select the highlighing variant for hyperlinks + + * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/HtmlSpecialHandler.cpp, + src/HtmlSpecialHandler.h, src/Makefile.am, src/SpecialManager.cpp: + added support of hyperref specials + + * src/FileFinder.cpp, src/MiKTeXCom.cpp, src/MiKTeXCom.h, src/dvisvgm.cpp: + try to load the Ghostscript library that comes with MiKTeX + + * src/Font.cpp, src/FontMetric.cpp, src/FontMetric.h, src/JFM.cpp, + src/JFM.h, src/Makefile.am, src/StreamReader.h, src/TFM.cpp, src/TFM.h: + added support for Japanese font metric (JFM) files + + * src/Font.cpp, src/Font.h, src/FontManager.h, src/FontMetric.cpp, + src/FontMetric.h, src/Makefile.am, src/TFM.cpp, src/TFM.h: + handle invalid TFM files properly + +2013-05-02 Martin Gieseking + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, + src/NoPsSpecialHandler.cpp, src/NoPsSpecialHandler.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: + added page number parameter to DVIEndPageListener::dviEndPage() + + * src/EmSpecialHandler.h, src/NoPsSpecialHandler.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.h: + moved DVI listener methods to dedicated listener interface classes + + * src/HtmlSpecialHandler.h: + dropped old HtmlSpecialHandler.h that should had been removed long time + ago + + * src/InputReader.cpp, src/InputReader.h: + added optional parameter 'quotechar' to InputReader::parseAttributes() + + * src/DVIToSVGActions.h, src/EPSToSVG.h, src/SpecialActions.h: + provide the context push/pop methods of class SVGTree to special + handlers + + * src/SVGTree.cpp, src/SVGTree.h: + added methods to push and pop 'context elements' to a page that wrap + parts of the page contents + + * AUTHORS, Makefile.am, README, configure.ac, potracelib/Makefile.am, + potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: + removed bundled potrace library + +2013-05-01 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/Terminal.cpp, src/Terminal.h: + disable cursor when showing the progress indicator (Windows only) + +2013-04-26 Martin Gieseking + + * src/DVIToSVG.cpp: + don't link NoPsSpecialHandler if HAVE_LIBGS + +2013-04-25 Martin Gieseking + + * src/FontEncoding.cpp: + fixed bracketing bug that prevented lookup of fontmap files + +2013-04-24 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.2.2 + + * src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, + src/Calculator.h, src/Matrix.cpp, src/Matrix.h, src/MessageException.h, + src/PageSize.cpp, src/PageSize.h, src/StreamReader.cpp, + src/StreamReader.h, src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, + src/XMLDocument.cpp, src/XMLDocument.h: + added missing underscores to private member variables + +2013-04-23 Martin Gieseking + + * src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.h, + src/CmdLineParserBase.h, src/DVIToSVGActions.cpp, src/Message.cpp, + src/VFReader.cpp: + added missing member initializations to some classes + + * src/DVIToSVG.cpp, src/EPSToSVG.cpp, src/dvisvgm.cpp: + avoid output of empty parentheses if TARGET_SYSTEM is not set + +2013-04-20 Martin Gieseking + + * src/DVIToSVG.cpp, src/Makefile.am, src/NoPsSpecialHandler.cpp, + src/NoPsSpecialHandler.h, src/SpecialManager.cpp: + print a warning message if PS specials are found but ignored + +2013-04-15 Martin Gieseking + + * src/FileFinder.cpp, src/dvisvgm.cpp: + catch MessageException if MiKTeX version can't be obtained + +2013-04-09 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.2.1 + + * tests/Makefile.am, tests/create-makefile: + updated tests/Makefile.am to honor system potracelib if present + +2013-04-08 Martin Gieseking + + * src/PageRanges.h: + dropped unused variable PageRanges::_max + + * src/CmdLineParserBase.h, src/InputReader.h: + changed 'struct InputReader' to 'class InputReader' + + * doc/dvisvgm.txt.in, src/Color.cpp, src/Color.h, src/DVIToSVGActions.cpp: + allow the background color special to insert white rectancles + +2013-04-04 Martin Gieseking + + * src/XMLNode.cpp, src/XMLNode.h: + unhide derived method XMLDeclarationNode::append + +2013-03-10 Martin Gieseking + + * Makefile.am, configure.ac: + don't build bundled potracelib if system library is used (patch by + Alexis Ballier) + +2013-03-03 Martin Gieseking + + * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: + updated bundled potrace library to version 1.11 + +2013-03-02 Martin Gieseking + + * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/decompose.h, potracelib/lists.h, potracelib/progress.h, + potracelib/trace.c, potracelib/trace.h, src/EPSFile.cpp, + src/EPSToSVG.cpp, src/EPSToSVG.h, src/PSPattern.cpp, src/PSPattern.h, + src/SVGOutputBase.h: + converted DOS line endings + +2013-02-28 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.2 + + * src/psdefs.cpp, src/psdefs.ps: + improved processing of PS operator "show" + + * tests/MapLineTest.cpp: + prevent MapLineTest from failing if file UGBK.sfd is not available + + * src/Makefile.am, src/PSInterpreter.cpp, src/psdefs.cpp, src/psdefs.ps, + src/psdefs.psc: + make psdefs a separate compilation unit + + * src/Makefile.am, src/PSInterpreter.cpp, src/PSInterpreter.h, + src/PSPattern.cpp, src/PSPattern.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc, + tests/PSInterpreterTest.cpp: + PS handler: added support of tiling patterns + +2013-02-21 Martin Gieseking + + * src/XMLNode.cpp, src/XMLNode.h: + added methods to lookup attribute values and selected descendant XML + nodes + +2013-02-19 Martin Gieseking + + * src/FilePath.cpp: + adapt path separators on Windows systems to get the correct output path + + * src/PSInterpreter.cpp, src/PSInterpreter.h: + added PSInterpreter::limit() to limit the number of bytes to be + processed + +2013-02-11 Martin Gieseking + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, + src/CommandLine.h: + applied a few refactorings to the command-line parser + +2013-02-07 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, + src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, src/options.xml: + added optional parameter to option --help to specify output format + +2013-02-06 Martin Gieseking + + * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/CommandLine.cpp, + src/CommandLine.h, src/EmSpecialHandler.cpp, src/GraphicPath.h, + src/Matrix.cpp, src/PsSpecialHandler.cpp, src/TpicSpecialHandler.cpp, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/options.xml: + added option --precision to set the number of decimal places applied to + attribute values + +2013-01-30 Martin Gieseking + + * src/CommandLine.cpp: + fixed alignment of --help text + +2013-01-21 Martin Gieseking + + * NEWS, README: + updated NEWS and README + + * configure.ac, src/Doxyfile: + set version to 1.1 + + * src/CommandLine.cpp, src/Font.cpp, src/Font.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, + src/MapLine.cpp, src/MapLine.h, tests/MapLineTest.cpp: + implemented evaluation of font style options given in a mapline + + * src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, src/MapLine.h: + replaced FontMap entries by pointers; initialize entries with MapLine + objects + + * src/DVIReader.cpp, src/DVIToSVG.cpp, src/FileFinder.cpp, src/Font.cpp, + src/Font.h, src/FontEncoding.cpp, src/FontEngine.cpp, src/FontEngine.h, + src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, src/Makefile.am, + src/MapLine.cpp, src/MapLine.h, src/Subfont.cpp, src/Subfont.h, + tests/FontMapTest.cpp, tests/Makefile.am, tests/MapLineTest.cpp, + tests/SubfontTest.cpp, tests/create-makefile, tests/sample.sfd: + added support for subfont definitions and multi-font (.ttc) files + +2013-01-20 Martin Gieseking + + * src/FontEngine.cpp, src/FontEngine.h: + removed unneeded code related to font sizes from class FontEngine + +2013-01-16 Martin Gieseking + + * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/FontMap.cpp, src/FontMap.h, + src/Makefile.am, src/PdfSpecialHandler.cpp, src/PdfSpecialHandler.h: + added PdfSpecialHandler to evaluate pdf:mapline and pdf:mapfile specials + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/FontMap.cpp, src/FontMap.h, src/dvisvgm.cpp, src/options.xml: + renamed option --map-file to --fontmap; allow multiple mapfiles and + modes + +2013-01-10 Martin Gieseking + + * src/Font.cpp, src/FontEncoding.cpp: + fixed a string exception that occurred when an encoding file or an entry + in the encoding table is unavailable + +2013-01-06 Martin Gieseking + + * src/FileFinder.cpp, src/FileFinder.h, src/FontEncoding.cpp, + src/FontEncoding.h: + removed font encoding methods from FileFinder + +2013-01-02 Martin Gieseking + + * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, + src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, + src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, + src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, + src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, + src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, + src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, + src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, + src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/MiKTeXCom.cpp, src/MiKTeXCom.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PageRanges.cpp, src/PageRanges.h, + src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/Process.cpp, + src/Process.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/SVGTree.cpp, src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, + src/SignalHandler.cpp, src/SignalHandler.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, + src/StreamWriter.h, src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, + src/Terminal.cpp, src/Terminal.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, + src/options.dtd, src/options.xml, src/psdefs.ps, src/psdefs.psc, + src/types.h, tests/BoundingBoxTest.cpp, tests/CRC32Test.cpp, + tests/CalculatorTest.cpp, tests/ColorSpecialTest.cpp, + tests/CommandLineTest.cpp, tests/DirectoryTest.cpp, + tests/FileFinderTest.cpp, tests/FilePathTest.cpp, + tests/FileSystemTest.cpp, tests/FontManagerTest.cpp, + tests/FontMapTest.cpp, tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, + tests/LengthTest.cpp, tests/Makefile.am, tests/MatrixTest.cpp, + tests/MessageExceptionTest.cpp, tests/PSInterpreterTest.cpp, + tests/PageRagesTest.cpp, tests/PageSizeTest.cpp, tests/PairTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, + tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, + tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/create-makefile: + updated year in copyright statements to 2013 + +2012-12-23 Martin Gieseking + + * src/FileFinder.cpp, src/Message.cpp, src/dvisvgm.cpp: + reduced scope of some variables + + * src/CmdLineParserBase.h, src/Directory.cpp, src/GFReader.cpp, + src/PsSpecialHandler.cpp: + initialize uninitialized member variables + + * src/FileFinder.cpp, src/MiKTeXCom.cpp, src/Process.cpp: + avoid creating copies of exception objects + + * src/FontCache.cpp, src/PsSpecialHandler.cpp, src/TpicSpecialHandler.cpp: + check emptiness of containers with empty() instead of size() + +2012-12-12 Martin Gieseking + + * src/SpecialManager.cpp: + clear all corresponding containers when calling + SpecialHandler::unregisterHandlers() + + * src/FontCache.cpp: + replaced 'char' with 'glyph' in font cache listing + +2012-12-03 Martin Gieseking + + * src/Ghostscript.cpp: + added explicit cast to avoid signed/unsigned comparison warning + +2012-12-02 Martin Gieseking + + * doc/dvisvgm.txt.in, src/Ghostscript.cpp: + use gsdll64.dll for 64-bit builds; added info about gsdll64.dll to + manpage + + * src/FileFinder.cpp, src/FontEngine.cpp, src/Makefile.am, + src/MiKTeXCom.cpp, src/MiKTeXCom.h: + moved MiKTeX COM code to separate class + + * src/MiKTeX209-session_i.c: + add additiona files required to build dvisvgm with MinGW + + * src/macros.h: + removed SHOW() from macros.h + + * tests/FileSystemTest.cpp, tests/GFReaderTest.cpp: + ensure that tests work properly on Windows + + * src/FilePath.cpp, tests/FilePathTest.cpp: + strip drive letter if it's not set (Windows only) + +2012-11-23 Martin Gieseking + + * src/PSInterpreter.cpp, src/psdefs.ps, src/psdefs.psc: + print operand stack in case of a PS error + + * src/Ghostscript.cpp, src/Ghostscript.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/dvisvgm.cpp: + print an error message if the execution of PS code fails + +2012-11-22 Martin Gieseking + + * src/Message.cpp: + handle wrapping of messages containing newlines correctly + +2012-11-21 Martin Gieseking + + * src/DLLoader.cpp, src/DLLoader.h, src/Ghostscript.cpp: + renamed DLLoader::loadFunction() to DLLoader::loadSymbol() + +2012-11-19 Martin Gieseking + + * src/Font.cpp, src/Font.h, src/FontManager.cpp: + print warning if font checksums don't match + + * src/FontEngine.cpp, src/FontEngine.h: + renamed FontEngine::fname to FontEngine::_fontname + +2012-11-16 Martin Gieseking + + * src/Directory.h: + undefine macro max() to avoid compilation problems on Windows + +2012-11-15 Martin Gieseking + + * src/FileFinder.cpp, src/FontManager.cpp, src/FontMap.cpp, src/FontMap.h, + tests/FontMapTest.cpp: + adapted code to use new MapLine class; introduced support of map line + modes + + * src/Makefile.am, src/MapLine.cpp, src/MapLine.h, tests/Makefile.am, + tests/MapLineTest.cpp: + added new class MapLine to parse and evaluate a single line of a map + file + + * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp: + moved initialization of FontMap from FileFinder to dvisvgm.cpp + + * src/FileFinder.cpp, src/FileFinder.h, src/FontMap.cpp, src/FontMap.h, + tests/FontMapTest.cpp: + made class FontMap a singleton + +2012-11-14 Martin Gieseking + + * src/DVIToSVG.cpp: + prevent compilation error when using a C++11 compiler (patch by Peter + Breitenlohner) + + * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp, + tests/FileFinderTest.cpp, tests/FontManagerTest.cpp: + initialize second parameter of kpse_set_program_name() correctly + + * src/FileFinder.cpp: + initialize Ghostscript when compiled for TeX Live Win32 (patch by Peter + Breitenlohner) + +2012-11-11 Martin Gieseking + + * src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, + src/InputReader.h, src/PsSpecialHandler.cpp, + tests/StreamInputBufferTest.cpp: + some refactorings of class InputReader; added InputReader::find() + +2012-10-24 Martin Gieseking + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/dvisvgm.cpp: + don't show warning about disabled PS support in list of special handlers + +2012-09-27 Martin Gieseking + + * doc/Makefile.am: + remove manpage when calling 'make distclean' + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.0.12 + +2012-09-20 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + removed Ghostscript info from ps entry in list of special handlers + + * src/DVIToSVG.cpp: + show warning if processing of PS specials is disabled + +2012-06-06 Martin Gieseking + + * src/gfprint.mak: + fixed bugs in gfprint, and added gfprint.mak for easier builds + +2012-04-17 Martin Gieseking + + * doc/Makefile.am: + keep manpage when calling 'make clean' or 'make distclean' + +2012-04-04 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/SVGTree.cpp, src/SVGTree.h, + tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, + tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: + scale point units in the SVG files to big points (bp) + +2012-04-02 Martin Gieseking + + * src/Matrix.cpp, src/Matrix.h, tests/MatrixTest.cpp: + added Matrix::invert() and det() + +2012-03-29 Martin Gieseking + + * src/Matrix.cpp, src/Matrix.h, tests/MatrixTest.cpp: + added start index parameter to Matrix::set(vector<>) + +2012-03-21 Martin Gieseking + + * src/psdefs.ps, src/psdefs.psc: + evaluate PS operators rectclip, rectfill, and rectstroke + +2012-03-09 Martin Gieseking + + * NEWS: + updated NEWS + + * src/dvisvgm.cpp: + added Ghostscript to library list printed by --version=yes + + * src/Ghostscript.cpp, src/Ghostscript.h: + added optional parameter to Ghostscript::revision() to retrieve the + revision number only + +2012-03-08 Martin Gieseking + + * configure.ac, src/Doxyfile: + set version to 1.0.11 + +2012-03-07 Martin Gieseking + + * src/DVIToSVGActions.cpp: + correct location of a rule's bounding box (lp bug #948713) + +2012-02-24 Martin Gieseking + + * doc/dvisvgm.txt.in: + fixed a couple of mistakes and formatting flaws in the manpage + +2012-02-17 Martin Gieseking + + * README: + updated information about bug reporting + +2012-01-26 Martin Gieseking + + * src/CmdLineParserBase.h, src/DVIActions.h, src/DVIReader.h, + src/DVIToSVGActions.h, src/FontEngine.h, src/FontManager.h, + src/MetafontWrapper.h, src/SVGTree.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.h, src/TFM.h, src/VFReader.h: + adapt forward declarations of classes and structs to their corresponding + definition (SF bug #3480013) + +2012-01-09 Martin Gieseking + + * src/TpicSpecialHandler.cpp: + added some more comments to methods of class TpicSpecialHandler + + * src/InputReader.cpp, tests/StreamInputBufferTest.cpp: + fixed parsing of negative floating point numbers starting with '-0.' (SF + bug #3471097) + +2012-01-06 Martin Gieseking + + * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/CRC32.cpp, src/CRC32.h, src/Calculator.cpp, src/Calculator.h, + src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Color.cpp, + src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, + src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, + src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, + src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, + src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, + src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, + src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageRanges.cpp, + src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/Process.cpp, src/Process.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/SVGTree.cpp, src/SVGTree.h, + src/SWFWriter.cpp, src/SWFWriter.h, src/SignalHandler.cpp, + src/SignalHandler.h, src/SpecialActions.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/StreamReader.cpp, + src/StreamReader.h, src/StreamWriter.cpp, src/StreamWriter.h, + src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, src/Terminal.cpp, + src/Terminal.h, src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h, + src/VFActions.h, src/VFReader.cpp, src/VFReader.h, src/VectorStream.h, + src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, + src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, + src/dvisvgm.cpp, src/macros.h, src/options.dtd, src/options.xml, + src/psdefs.ps, src/psdefs.psc, src/types.h, tests/BoundingBoxTest.cpp, + tests/CRC32Test.cpp, tests/CalculatorTest.cpp, + tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, + tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, + tests/FilePathTest.cpp, tests/FileSystemTest.cpp, + tests/FontManagerTest.cpp, tests/FontMapTest.cpp, tests/GFReaderTest.cpp, + tests/GraphicPathTest.cpp, tests/LengthTest.cpp, tests/Makefile.am, + tests/MatrixTest.cpp, tests/MessageExceptionTest.cpp, + tests/PSInterpreterTest.cpp, tests/PageRagesTest.cpp, + tests/PageSizeTest.cpp, tests/PairTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, + tests/StreamReaderTest.cpp, tests/StreamWriterTest.cpp, + tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/check-conv, + tests/create-makefile: + updated year in copyright statements + +2011-12-18 Martin Gieseking + + * NEWS: + updated NEWS + + * configure.ac, src/Doxyfile: + set version to 1.0.10 + + * tests/Makefile.am, tests/create-makefile: + link tests with -lpthread (required by gtest on Ubuntu) + +2011-12-17 Martin Gieseking + + * doc/dvisvgm.txt.in: + added documentation on environment variable DVISVGM_COLORS to manpage + + * src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/GlyphTracerMessages.h, + src/Message.cpp, src/Message.h, src/MetafontWrapper.cpp, + src/Terminal.cpp, src/Terminal.h, src/dvisvgm.cpp: + allow users to customize the message colors + +2011-11-22 Martin Gieseking + + * src/GraphicPath.h: + added some more comments to the methods of GraphicPath + +2011-11-18 Martin Gieseking + + * configure.ac: + move linker flag -lfreetype from LDFLAGS to LIBS to avoid linking + problems + +2011-10-28 Martin Gieseking + + * src/SVGTree.cpp: + avoid possible collisions of glyph IDs + + * src/FontMap.cpp: + removed unused variable eval_prefix in helper function read_entry() + +2011-10-13 Martin Gieseking + + * NEWS: + updated NEWS + +2011-10-10 Martin Gieseking + + * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontManager.h: + extended class FontManager to handle external fonts + + * src/ExternalFont.cpp, src/ExternalFont.h, src/Makefile.am: + added class ExternalFont + +2011-10-09 Martin Gieseking + + * configure.ac, src/FontDB.cpp, src/FontDB.h, src/Makefile.am: + added class FontDB + + * src/DirectoryTree.cpp, src/DirectoryTree.h, src/Makefile.am, + tests/DirectoryTreeTest.cpp, tests/Makefile.am: + added class DirectoryTree + + * src/Directory.h: + dropped method Directory::getEntry() + + * src/FilePath.cpp: + added some missing comments to methods of class FilePath + +2011-10-07 Martin Gieseking + + * src/Process.cpp: + exclude definition of split_paramstr() from Windows builds as it's not + used there + + * src/Process.cpp: + added missing include to Process.cpp + +2011-10-03 Martin Gieseking + + * doc/Makefile.am: + add metadata/pdfmarks to pdf version of manpage + +2011-09-30 Martin Gieseking + + * src/InputReader.cpp, src/InputReader.h, tests/StreamInputBufferTest.cpp: + added InputReader::getUntil() to simplify parsing of an input stream + + * src/CommandLine.cpp, src/CommandLine.h, src/dvisvgm.cpp, + src/options.xml: + added command-line option --query + +2011-09-06 Martin Gieseking + + * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: + updated bundled potrace library to version 1.10 + +2011-06-04 Martin Gieseking + + * src/FileFinder.cpp, src/MetafontWrapper.cpp: + fixed segfault occured in TeX Live Win32 caused by mf.exe being + unavailable (SF bug #3308473) + + * configure.ac, src/Doxyfile: + set version to 1.0.9dev + +2011-05-31 Martin Gieseking + + * src/PsSpecialHandler.cpp: + explicitly cast double to int in call of ClippingStack::dup()/pop() + + * NEWS, configure.ac, src/Doxyfile: + set version to 1.0.8; updated NEWS + +2011-05-27 Martin Gieseking + + * tests/check-conv, tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: + updated conversion tests + +2011-05-23 Martin Gieseking + + * src/Font.cpp, src/Makefile.am, src/MetafontWrapper.cpp, + src/MetafontWrapper.h, src/Process.cpp, src/Process.h, + src/SignalHandler.cpp: + replaced call of system() with Process::run() and kill child process if + necessary + +2011-05-22 Martin Gieseking + + * src/MetafontWrapper.cpp: + dropped '--halt-on-error' in Metafont call to process buggy mf files + completely + + * src/FileFinder.cpp: + MiKTeX: maketfm and makemf have been renamed to miktex-maketfm and + miktex-makemf + +2011-05-19 Martin Gieseking + + * src/DLLoader.h: + added #undef NOMINMAX before (re)defining it + +2011-05-12 Martin Gieseking + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc, + tests/PSInterpreterTest.cpp: + PS handler: implemented evaluation of save, restore, and grestoreall + +2011-05-07 Martin Gieseking + + * src/PsSpecialHandler.cpp: + fixed potential segfault caused by invisible zero-length paths + + * src/PsSpecialHandler.cpp: + add definitions in literal PS headers to dictionary TeXDict + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVGActions.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialActions.h: + fixed interaction between PS and DVI drawing position + + * configure.ac, src/Doxyfile: + set version to 1.0.8dev + +2011-05-06 Martin Gieseking + + * fedora/dvisvgm-gs.patch, fedora/dvisvgm-potrace.patch, + fedora/dvisvgm.spec: + removed directories 'fedora' and 'homepage' + + * NEWS, README, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.7; updated NEWS and README + +2011-05-05 Martin Gieseking + + * doc/dvisvgm.txt.in: + added info about dvips rounding issues to manpage + + * src/DVIToSVGActions.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/psdefs.ps, src/psdefs.psc: + PS handler: added missing unit conversions (pt vs. bp) + + * src/PsSpecialHandler.h: + corrected scaling formula applied to PS line properties + + * src/PSInterpreter.cpp, src/PsSpecialHandler.cpp: + separate PS snippets by newline characters to leave preceding comments + +2011-05-04 Martin Gieseking + + * src/Length.h: + undefine macro IN + + * src/Ghostscript.cpp, src/Ghostscript.h, src/PSInterpreter.cpp, + src/PSInterpreter.h: + avoid 'this' pointer in initialazation list of + PSInterpreter::PSInterpreter() + + * src/PsSpecialHandler.cpp: + don't call Ghostscript::revision() in initialization of static variable + +2011-05-03 Martin Gieseking + + * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: + tpic special 'ip' must not draw the outline of the polygon but only fill + its interior + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/macros.h, src/psdefs.ps, src/psdefs.psc, + tests/PSInterpreterTest.cpp: + improved handling of pure PostScript specials + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, + src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, + src/SpecialManager.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h: + replaced methods for DVI position alterations with translation semantics + +2011-05-02 Martin Gieseking + + * src/psdefs.ps, src/psdefs.psc: + PS handler: recognize save/restore operators + +2011-04-30 Martin Gieseking + + * src/psdefs.ps, src/psdefs.psc: + catch PS error /nocurrentpoint in operator 'setpos' properly + + * src/SpecialManager.cpp: + register special prefix ps:: properly + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.7dev + +2011-04-16 Martin Gieseking + + * NEWS, README, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.6; updated NEWS and README + +2011-04-14 Martin Gieseking + + * src/DVIReader.cpp, src/Font.cpp, src/GFReader.cpp, src/Makefile.am, + src/MetafontWrapper.cpp, src/PSInterpreter.cpp, src/SignalHandler.cpp, + src/SignalHandler.h, src/TFM.cpp, src/dvisvgm.cpp: + added class SignalHandler for CTRL-C signals + + * src/DVIToSVGActions.cpp, src/MessageException.h, src/dvisvgm.cpp, + tests/Makefile.am, tests/MessageExceptionTest.cpp: + derived MessageException from std::exception and replaced getMessage() + with what() + +2011-04-13 Martin Gieseking + + * src/XMLNode.cpp, src/XMLNode.h: + prepended member variables of the XMLNode classes with underscore + +2011-04-09 Martin Gieseking + + * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp, + tests/FileFinderTest.cpp: + dropped class FileFinder::Impl and simplified FileFinder interface + +2011-03-15 Martin Gieseking + + * src/DVIReader.cpp: + throw DVI exception if set_char/put_char is executed without preceding + font selection + +2011-03-12 Martin Gieseking + + * pull-wiki: + updated rsync parameters in 'pull-wiki' + +2011-03-04 Martin Gieseking + + * src/CRC32.cpp, src/StreamWriter.cpp: + added missing 'const' to type casts (Peter Breitenlohner) + + * potracelib/potracelib.c, potracelib/potracelib.h: + changed return type of potrace_version() to 'const char *' in order to + avoid compiler warning + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.6dev + +2011-02-28 Martin Gieseking + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.5, updated NEWS + + * src/Ghostscript.cpp: + fixed formatting of GS version number + + * doc/dvisvgm.txt.in, src/FontCache.cpp, src/FontCache.h, src/dvisvgm.cpp: + added code to remove outdated and corrupted cache files + +2011-02-21 Martin Gieseking + + * tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, + tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: + updated conversion test files + + * src/SVGTree.cpp: + added missing unit in height/width attribute of svg root element + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/GraphicPath.h, src/SVGTree.cpp, src/SVGTree.h, src/dvisvgm.cpp, + src/options.xml, tests/CommandLineTest.cpp: + added option to replace use elements with paths + +2011-02-16 Martin Gieseking + + * src/InputBuffer.h: + reference to scanned string in StringInputBuffer is constant now + +2011-02-10 Martin Gieseking + + * src/FontCache.cpp, src/FontCache.h: + added CRC32 checks to cache files + + * src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, + src/StreamWriter.h, tests/Makefile.am, tests/StreamReaderTest.cpp, + tests/StreamWriterTest.cpp: + added CRC32 computation methods to StreamReader and StreamWriter + + * src/CRC32.cpp, src/CRC32.h, src/Makefile.am, tests/CRC32Test.cpp, + tests/Makefile.am: + added class CRC32 and corresponding tests + + * src/FileSystem.cpp, src/FileSystem.h, src/dvisvgm.cpp, + tests/FileSystemTest.cpp: + merged FileSystem::move() into FileSystem::copy() + +2011-01-31 Martin Gieseking + + * src/CmdLineParserBase.cpp: + print character instead of ascii value in message of command-line parser + +2011-01-30 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/FileFinder.cpp, src/FileFinder.h, src/FontEngine.cpp, + src/FontEngine.h, src/dvisvgm.cpp, src/options.xml: + added optional argument to --version + +2011-01-28 Martin Gieseking + + * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: + updated bundled potrace library to version 1.9 + +2011-01-17 Martin Gieseking + + * doc/dvisvgm.txt.in, src/dvisvgm.cpp: + moved cache files to subfolder ($HOME/.dvisvgm/cache) + +2011-01-04 Martin Gieseking + + * tests/Makefile.am, tests/PSInterpreterTest.cpp: + added basic tests for class PSInterpreter + + * Makefile.am, README, configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/Calculator.cpp, src/Calculator.h, src/CmdLineParserBase.cpp, + src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, + src/FileFinder.h, src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, + src/FileSystem.h, src/Font.cpp, src/Font.h, src/FontCache.cpp, + src/FontCache.h, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontManager.h, src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.h, + src/GlyphTracerMessages.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, + src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, + src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageRanges.cpp, + src/PageRanges.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, + src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/StreamReader.cpp, src/StreamReader.h, src/StreamWriter.cpp, + src/StreamWriter.h, src/System.cpp, src/System.h, src/TFM.cpp, src/TFM.h, + src/Terminal.cpp, src/Terminal.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, + src/options.dtd, src/options.xml, src/psdefs.ps, src/psdefs.psc, + src/types.h, tests/BoundingBoxTest.cpp, tests/CalculatorTest.cpp, + tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, + tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, + tests/FilePathTest.cpp, tests/FontManagerTest.cpp, tests/FontMapTest.cpp, + tests/GFReaderTest.cpp, tests/GraphicPathTest.cpp, tests/LengthTest.cpp, + tests/Makefile.am, tests/MatrixTest.cpp, tests/PageRagesTest.cpp, + tests/PageSizeTest.cpp, tests/PairTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamInputBufferTest.cpp, + tests/TypesTest.cpp, tests/VectorStreamTest.cpp, tests/check-conv, + tests/create-makefile: + updated year in copyright info + +2010-12-18 Martin Gieseking + + * doc/dvisvgm.txt.in: + minor update to the manpage + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.4; updated NEWS + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: + PS handler: added missing scaling of linewidths and dash distances + + * src/PsSpecialHandler.cpp: + fixed scaling issue in PS positioning + +2010-12-16 Martin Gieseking + + * src/FileFinder.cpp: + updated to MiKTeX 2.8 SDK + +2010-08-18 Martin Gieseking + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.4dev + + * src/FontEngine.cpp: + fixed FreeType version check (patch by Paul Vojta) + +2010-08-11 Martin Gieseking + + * tests/Makefile.am, tests/PairTest.cpp: + added PairTest + +2010-08-05 Martin Gieseking + + * NEWS, doc/dvisvgm.txt.in: + updated manpage and NEWS + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.3 + +2010-08-04 Martin Gieseking + + * src/BoundingBox.cpp, src/BoundingBox.h, src/Matrix.cpp, src/Matrix.h, + src/PsSpecialHandler.cpp: + revamped PsSpecialHandler::psfile() to fix a transformation issue (SF + bug #3037372) + +2010-07-28 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp: + added check of DVI format version + +2010-07-26 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + restore transformation matrix after execution of psfile + +2010-07-13 Martin Gieseking + + * src/Directory.cpp, src/Directory.h, src/GFReader.cpp, src/GFReader.h: + added leading underscore to variables of GFReader + + * src/GraphicPath.h, src/PsSpecialHandler.h: + fixed missing initialization of GraphicPath iterator + + * src/Terminal.cpp: + replaced \e with \x1B + + * src/InputBuffer.h: + added missing namespace prefix + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.3dev + +2010-06-22 Martin Gieseking + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.2 + + * src/gzstream.cpp, src/gzstream.h: + fixed class variable issue introduced by previous AIX patch + +2010-06-18 Martin Gieseking + + * src/Bitmap.cpp, tests/DirectoryTest.cpp, tests/GFReaderTest.cpp, + tests/Makefile.am, tests/cmr10.600gf, tests/create-makefile: + added GFReaderTest; updated DirectoryTest + +2010-06-17 Martin Gieseking + + * src/types.h, tests/Makefile.am, tests/TypesTest.cpp: + added TypesTest + + * src/Message.cpp, src/Message.h: + renamed MessageStream::putchar() to MessageStream::putChar() to avoid + name clashes + + * src/Bitmap.cpp, src/Calculator.cpp, src/CmdLineParserBase.cpp, + src/Color.cpp, src/ColorSpecialHandler.cpp, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVGActions.cpp, src/DvisvgmSpecialHandler.cpp, + src/EmSpecialHandler.cpp, src/FontCache.cpp, src/FontEncoding.cpp, + src/GFGlyphTracer.cpp, src/Pair.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/TFM.cpp, src/TFM.h: + fixed some type conversion warnings + +2010-06-16 Martin Gieseking + + * potracelib/curve.c, potracelib/curve.h, potracelib/decompose.c: + renamed internal potrace functions path_new() and path_free() to prevent + linker conflicts on OS X + + * configure.ac, src/CmdLineParserBase.h, src/FileFinder.h, + src/FontCache.cpp, src/FontCache.h, src/FontEncoding.cpp, + src/FontEngine.cpp, src/GFGlyphTracer.h, src/MetafontWrapper.cpp, + src/gzstream.cpp: + applied latest TL patches from Peter Breitenlohner and Karl Berry + +2010-06-14 Martin Gieseking + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.2dev + +2010-06-11 Martin Gieseking + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.1 + + * src/Message.cpp: + suppress ANSI color code by default + +2010-06-09 Martin Gieseking + + * src/psdefs.ps, src/psdefs.psc: + fixed recursion issue in PS operator charpath + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0.1dev + +2010-06-08 Martin Gieseking + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h: + fixed PS destructor issue (SF bug #3013392) + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0 + + * doc/Makefile.am, doc/dvisvgm.txt.in: + documented option --help and --version in manpage + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/DVIActions.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/Makefile.am, src/Message.cpp, src/Message.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/SpecialActions.h, src/System.cpp, src/System.h, src/dvisvgm.cpp, + src/options.xml: + added percentage-based progress indicator + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h: + added method to compute length of DVI command + + * src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: + evaluate Ghostscript operator .setopacityalpha + + * src/Font.cpp: + print error message if Metafont failed + + * configure.ac, doc/Makefile.am, doc/dvisvgm.txt.in, src/CommandLine.cpp, + src/CommandLine.h, src/DVIActions.h, src/DVIToSVG.cpp, src/GFTracer.cpp, + src/GlyphTracerMessages.h, src/Makefile.am, src/Message.cpp, + src/Message.h, src/MetafontWrapper.cpp, src/Terminal.cpp, src/Terminal.h, + src/dvisvgm.cpp, src/options.xml: + improved output of messages including optional colorization + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, + src/PageRanges.cpp, src/PageRanges.h, src/StreamCounter.h, + src/dvisvgm.cpp, src/options.xml, tests/BoundingBoxTest.cpp, + tests/CommandLineTest.cpp, tests/Makefile.am, tests/PageRagesTest.cpp, + tests/StreamCounterTest.cpp: + added conversion of multiple pages + + * src/InputBuffer.h, tests/ColorSpecialTest.cpp, + tests/StreamInputBufferTest.cpp: + added InputBuffer::invalidate() + + * src/FilePath.cpp, src/FilePath.h, src/FileSystem.cpp, src/FileSystem.h, + src/Makefile.am, tests/FilePathTest.cpp, tests/Makefile.am: + added class FilePath + + * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/DvisvgmSpecialHandler.cpp, + src/EmSpecialHandler.cpp, src/PsSpecialHandler.cpp, src/SpecialActions.h, + src/SpecialManager.cpp, src/TpicSpecialHandler.cpp: + added special for creating local bounding boxes + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 1.0dev + + * configure.ac, doc/Makefile.am, src/Makefile.am: + cleaned up configuration scripts + +2010-05-09 Martin Gieseking + + * configure.ac: + fixed whitespace issue in CPPFLAGS and LDFLAGS + +2010-05-04 Martin Gieseking + + * tests/FileFinderTest.cpp, tests/FontManagerTest.cpp, tests/check-conv: + fixed segfaults in tests + + * configure.ac: + fixed kpathsea check; use pkg-config to check freetype availability + +2010-04-22 Martin Gieseking + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.9.1 + + * tests/check-conv, tests/frktest-wf-cmp.svg, tests/sample-wf-cmp.svg: + adapted conversion tests to new output format + + * src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h: + print page count and page number of DVI page being processed + + * src/SVGTree.cpp: + fixed broken validity when using SVG fonts + + * src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/SVGTree.cpp, src/SVGTree.h, src/XMLNode.cpp, src/XMLNode.h: + ignore unused fonts in CSS styles list + + * src/CommandLine.cpp, src/options.xml: + output of option --help: replaced '(default: FOO)' by '[FOO]' + +2010-04-20 Martin Gieseking + + * src/FontEncoding.cpp: + fixed memory bug in FontEncoding::encoding() + +2010-04-11 Martin Gieseking + + * src/DVIToSVGActions.cpp: + replaced wrong font pointer that could lead to segfaults + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.9.1dev + +2010-03-25 Martin Gieseking + + * fedora/dvisvgm.spec: + updated spec file + +2010-03-24 Martin Gieseking + + * transfer-cs: + added extension .patch to exported changesets + + * tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, + tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg: + updated conversion tests + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.9 + + * src/FontCache.cpp, src/GFGlyphTracer.cpp, src/GFReader.cpp: + variable _fontname is now correctly set in class FontCache + + * src/CmdLineParserBase.cpp, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, + src/FontEngine.cpp, src/GlyphTracerMessages.h, src/Message.cpp, + src/Message.h, src/MetafontWrapper.cpp, src/dvisvgm.cpp: + added class MessageStream, updated message output + + * src/FontCache.cpp, src/Makefile.am, src/StreamWriter.cpp, + src/StreamWriter.h, src/TFM.cpp: + replaced local stream IO functions by StreamReader/StreamWriter methods + + * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, + src/CommandLine.cpp, src/CommandLine.h, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, + src/GlyphTracerMessages.h, src/Makefile.am, src/dvisvgm.cpp, + src/options.xml: + added command-line option --exact + + * src/Font.cpp, src/Font.h, src/dvisvgm.cpp: + moved some methods from PhysicalFontImpl to PysicalFont + +2010-03-18 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/Font.cpp, src/Font.h, src/dvisvgm.cpp, src/options.xml: + added command-line option --keep + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/Font.cpp, src/Font.h, + src/dvisvgm.cpp, src/options.xml, tests/CommandLineTest.cpp: + reactivated option --trace-all, and added optional argument 'retrace' to + it + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h: + added evaluation of boolean and char arguments to the command-line + parser + + * src/DVIToSVG.cpp, src/Font.cpp, src/Font.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/SVGTree.cpp, src/SVGTree.h: + added class GFGlyphTracer::Callback providing an interface used to print + status information about the tracer + + * src/DVIToSVG.cpp, src/SVGTree.cpp: + moved creation of SVG 'use' elements from class DVIToSVG to class + SVGTree + +2010-03-17 Martin Gieseking + + * src/BoundingBox.cpp, src/Calculator.cpp, src/Matrix.cpp, + src/PSInterpreter.cpp, src/PSInterpreter.h: + fixed a couple of comments + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/Font.cpp, + src/Font.h, src/FontEmitter.h, src/GFGlyphTracer.h, src/Makefile.am, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, + src/SVGTree.h, src/dvisvgm.cpp, tests/Makefile.am, tests/check-conv, + tests/create-makefile: + removed emitter classes; incorporated their functionality into SVGTree + and PhysicalFontImpl + + * src/FontCache.cpp, src/FontCache.h: + added method FontCache::write(const char *dir) that updates the cache + file of the current font + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/FontManager.cpp, src/FontManager.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, + src/SVGTree.h, src/VFReader.h, tests/FontManagerTest.cpp: + made FontManager a singleton + + * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, + src/Makefile.am, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, + src/SVGTree.h: + removed class CharmapTranslator + + * src/GFReader.cpp, src/GFReader.h: + replaced GFReader messages by exceptions + +2010-02-26 Martin Gieseking + + * src/Font.cpp, src/FontCache.cpp, src/FontCache.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h: + refactorings of GF tracer class; removed transferGlyph() + +2010-02-21 Martin Gieseking + + * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/Font.cpp, + src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEngine.cpp, + src/FontEngine.h, src/Glyph.cpp, src/Glyph.h, src/Makefile.am, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h: + removed class Glyph and incorporated its functionality into Font class + +2010-02-05 Martin Gieseking + + * src/DVIToSVG.cpp: + added evaluation of literal PS headers to PSHeaderActions + +2010-02-04 Martin Gieseking + + * src/psdefs.ps, src/psdefs.psc: + removed PS error handler nocurrentpoint + +2010-02-02 Martin Gieseking + + * fedora/dvisvgm.spec: + updated homepage and spec file + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + version updated to 0.8.8 + +2010-02-01 Martin Gieseking + + * tests/check-conv: + skip conversion checks by default + +2010-01-31 Martin Gieseking + + * tests/normalize.xsl: + some improvements to normalize.xsl + + * tests/Makefile.am, tests/check-conv, tests/create-makefile, + tests/frktest-nf-cmp.svg, tests/frktest-wf-cmp.svg, tests/frktest.dvi, + tests/normalize.xsl, tests/sample-nf-cmp.svg, tests/sample-wf-cmp.svg, + tests/sample.dvi: + added tests to check conversion results + +2010-01-29 Martin Gieseking + + * src/GraphicPath.h: + fixed scaling bug in computation of glyph paths when using -n + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, + src/CommandLine.h: + removed CmdLineParserBase::numOptions() + +2010-01-24 Martin Gieseking + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/FontCache.h, src/dvisvgm.cpp, src/options.dtd, src/options.xml: + added command-line option --libgs + +2010-01-18 Martin Gieseking + + * src/CommandLine.cpp, src/options.dtd, src/options.xml: + added DTD for options.xml + +2010-01-17 Martin Gieseking + + * src/Ghostscript.cpp: + fixed typo in variable name + + * NEWS: + updated NEWS + + * doc/dvisvgm.txt.in, src/FileFinder.cpp, src/Ghostscript.cpp, + src/Ghostscript.h, src/dvisvgm.cpp: + environment variable LIBGS can now be used to set the name of the GS + shared library + + * Makefile.am, README, configure.ac, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, + src/CharmapTranslator.h, src/CmdLineParserBase.cpp, + src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/CommandLine.cpp, src/CommandLine.h, src/DLLoader.cpp, src/DLLoader.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/FileFinder.cpp, + src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, + src/Font.h, src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, + src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontManager.cpp, src/FontManager.h, + src/FontMap.cpp, src/FontMap.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, src/Glyph.cpp, + src/Glyph.h, src/GraphicPath.h, src/HtmlSpecialHandler.h, + src/InputBuffer.cpp, src/InputBuffer.h, src/InputReader.cpp, + src/InputReader.h, src/Length.cpp, src/Length.h, src/Makefile.am, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageSize.cpp, + src/PageSize.h, src/Pair.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, + src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, + src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/macros.h, + src/options.xml, src/psdefs.ps, src/psdefs.psc, src/types.h, + tests/BoundingBoxTest.cpp, tests/CalculatorTest.cpp, + tests/ColorSpecialTest.cpp, tests/CommandLineTest.cpp, + tests/DirectoryTest.cpp, tests/FileFinderTest.cpp, + tests/FontManagerTest.cpp, tests/FontMapTest.cpp, + tests/GraphicPathTest.cpp, tests/LengthTest.cpp, tests/Makefile.am, + tests/MatrixTest.cpp, tests/PageSizeTest.cpp, + tests/SplittedCharInputBufferTest.cpp, tests/StreamCounterTest.cpp, + tests/StreamInputBufferTest.cpp, tests/VectorStreamTest.cpp, + tests/create-makefile: + updated boilerplates + + * doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, + src/DVIToSVG.cpp, tests/BoundingBoxTest.cpp, tests/Makefile.am: + added support for enlarging the minimal bbox by a given amount. + + * configure.ac: + updated type of kpathsea_version_string (patch by lomov_vl) + +2009-12-16 Martin Gieseking + + * src/InputReader.cpp: + fixed bug in InputReader::parseUInt() + +2009-12-15 Martin Gieseking + + * configure.ac, src/dvisvgm.cpp: + appied get_time patch sent by Peter Breitenlohner + +2009-12-02 Martin Gieseking + + * src/BoundingBox.h, src/Calculator.h, src/CharmapTranslator.h, + src/DVIReader.h, src/DVIToSVG.h, src/DVIToSVGActions.h, src/Font.h, + src/FontEngine.h, src/FontManager.h, src/FontMap.h, src/GFGlyphTracer.h, + src/GFReader.h, src/MessageException.h, src/MetafontWrapper.h, + src/PageSize.h, src/SVGTree.cpp, src/SVGTree.h, src/StreamReader.h, + src/VFActions.h, src/VFReader.h, src/XMLDocTypeNode.h, src/XMLDocument.h, + src/XMLNode.h, src/XMLString.h: + removed using statements from header files + +2009-11-25 Martin Gieseking + + * src/FontCache.cpp, src/FontCache.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, + src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFTracer.cpp, + src/Glyph.cpp, src/Glyph.h, src/GraphicPath.h, src/Makefile.am, + src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp, + tests/GraphicPathTest.cpp: + removed FEGlyphCommands and replaced separate glyph class implementation + by class GraphicPath + +2009-11-23 Martin Gieseking + + * src/DVIToSVG.cpp: + avoid scaling by 1 in use elements + +2009-11-18 Martin Gieseking + + * src/DLLoader.cpp, src/DLLoader.h: + fixed line endings + + * src/Ghostscript.cpp, src/Ghostscript.h: + replaced #if HAVE_LIBGS by #if defined(HAVE_LIBGS) + + * src/DVIToSVG.cpp, src/Ghostscript.cpp, src/Ghostscript.h: + replaced #if !DISABLE_GS by #if !defined(DISABLE_GS) (Peter + Breitenlohner) + +2009-11-17 Martin Gieseking + + * NEWS: + updated NEWS + + * src/dvisvgm.cpp: + don't use email adress PACKAGE_BUGREPORT for copyright notice + + * src/CmdLineParserBase.h, src/GraphicPath.h, src/InputReader.h, + src/Makefile.am, src/PSInterpreter.h, src/SpecialManager.h: + added missing virtual destructors to avoid warnings + + * src/InputReader.cpp: + added missing initialization value (Peter Breitenlohner) + + * src/Color.cpp, src/ColorSpecialHandler.cpp, src/FontManager.cpp, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/TpicSpecialHandler.cpp: + added explicit casts to avoid compiler warnings (Peter Breitenlohner) + + * potracelib/potracelib.c, potracelib/potracelib.h: + replaced outdated string constant type char* by const char* in + potrace_version() + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.8.8dev + +2009-11-10 Martin Gieseking + + * fedora/dvisvgm.spec: + updated spec file + +2009-11-09 Martin Gieseking + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.8.7 + + * NEWS, src/Color.cpp, src/Color.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/SVGTree.cpp: + PS handler: colors set by color specials are now considered properly + + * src/DVIToSVG.cpp, src/dvisvgm.cpp: + added total number of pages to message text + +2009-11-06 Martin Gieseking + + * NEWS, src/PsSpecialHandler.cpp: + fixed path scaling issue in PS handler + + * NEWS, doc/dvisvgm.txt.in: + updated NEWS and manpage + + * src/GraphicPath.h, src/PsSpecialHandler.cpp: + PS handler: replace zero-length paths by dots + +2009-10-29 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/Font.cpp, src/Font.h: + fixed positioning of italic characters + +2009-10-18 Martin Gieseking + + * src/Font.cpp, src/TFM.cpp, src/TFM.h: + added italic correction values to character widths + +2009-10-16 Martin Gieseking + + * configure.ac, src/Doxyfile: + increased version to 0.8.7dev + + * tests/Makefile.am, tests/create-makefile: + added script to create tests/Makefile.am + +2009-10-13 Martin Gieseking + + * README, tests/CalculatorTest.cpp, tests/CalculatorTest.h, + tests/ColorSpecialTest.cpp, tests/ColorSpecialTest.h, + tests/CommandLineTest.cpp, tests/CommandLineTest.h, + tests/DirectoryTest.cpp, tests/DirectoryTest.h, tests/FileFinderTest.cpp, + tests/FileFinderTest.h, tests/FontManagerTest.cpp, + tests/FontManagerTest.h, tests/FontMapTest.cpp, tests/FontMapTest.h, + tests/GraphicPathTest.cpp, tests/GraphicPathTest.h, tests/LengthTest.cpp, + tests/LengthTest.h, tests/Makefile.am, tests/MatrixTest.cpp, + tests/MatrixTest.h, tests/PageSizeTest.cpp, tests/PageSizeTest.h, + tests/SplittedCharInputBufferTest.cpp, + tests/SplittedCharInputBufferTest.h, tests/StreamCounterTest.cpp, + tests/StreamCounterTest.h, tests/StreamInputBufferTest.cpp, + tests/StreamInputBufferTest.h, tests/VectorStreamTest.cpp, + tests/VectorStreamTest.h: + replaced cxxtest by googletest + + * doc/Makefile.am: + added missing dvi suffix in Makefile target dvi-pdf + + * fedora/dvisvgm.spec: + updated spec file + + * doc/Makefile.am, doc/dvisvgm.txt.in: + removed outdated post-processing of manpage + +2009-10-12 Martin Gieseking + + * src/FontInfo.cpp, src/FontInfo.h, src/FontTracer.h, src/PSObject.cpp, + src/PSObject.h, src/PSState.cpp, src/PSState.h, src/global.cpp, + src/global.h: + removed unused source files + + * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, + src/CharmapTranslator.h, src/CmdLineParserBase.cpp, + src/CmdLineParserBase.h, src/Color.cpp, src/Color.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DLLoader.cpp, + src/DLLoader.h, src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Directory.cpp, src/Directory.h, + src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, + src/EmSpecialHandler.h, src/FileFinder.cpp, src/FileFinder.h, + src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, + src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, + src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, + src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, src/FontMap.h, + src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/Ghostscript.cpp, + src/Ghostscript.h, src/GraphicPath.h, src/InputBuffer.cpp, + src/InputBuffer.h, src/InputReader.cpp, src/InputReader.h, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PageSize.cpp, + src/PageSize.h, src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, + src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, + src/SpecialManager.h, src/StreamCounter.h, src/StreamReader.cpp, + src/StreamReader.h, src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/macros.h, src/types.h: + code cleanup + +2009-10-11 Martin Gieseking + + * NEWS: + NEWS updated + + * src/DVIToSVG.cpp, src/DvisvgmSpecialHandler.cpp, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SVGTree.cpp, + src/SVGTree.h: + suppress empty style and transformation elements + + * transfer-cs: + improved transfer-cs + +2009-10-10 Martin Gieseking + + * src/PsSpecialHandler.cpp: + scale clipping paths by 72.27/72 + +2009-10-09 Martin Gieseking + + * src/Makefile.am: + fixed Makefile + + * src/Length.cpp, src/Length.h, tests/LengthTest.h: + fixed unit conversion bug + + * doc/dvisvgm.txt.in: + fixed formatting of manual page + + * transfer-cs: + added script to transfer changesets to dvisvgm-pub + + * autogen.sh, prepare: + prepare script replaced by autogen.sh + + * src/Bitmap.h: + fixed bit shift overflow in Bitmap class occured on 64-bit systems + +2009-10-08 Martin Gieseking + + * src/dvisvgm.cpp: + fixed uncaught PageSizeException + + * src/MetafontWrapper.cpp: + fixed file permissions + + * NEWS, src/GraphicPath.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h: + PS clipping path sequences and intersections are now handled correctly + + * NEWS, doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/CommandLine.cpp, + src/CommandLine.h, src/DVIToSVG.cpp, src/DVIToSVG.h, src/dvisvgm.cpp, + src/options.xml, tests/CommandLineTest.h, tests/Makefile.am: + cmdline parameter --bbox can now be used to set the absolute bounding + box + +2009-10-07 Martin Gieseking + + * src/BoundingBox.cpp, src/BoundingBox.h, src/Length.cpp, src/Length.h, + src/Makefile.am, tests/LengthTest.h: + class Length provides length unit calculations + + * NEWS, doc/dvisvgm.txt.in, src/BoundingBox.cpp, src/BoundingBox.h, + src/DvisvgmSpecialHandler.cpp: + added the special variant 'dvisvgm:bbox abs' and 'dvisvgm:bbox fix' + +2009-10-06 Martin Gieseking + + * NEWS, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + set version to 0.8.6 + + * src/BoundingBox.cpp, src/BoundingBox.h, src/GraphicPath.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/psdefs.ps, src/psdefs.psc: + fixed some PS bounding box and positioning issues introduced by previous + changesets + +2009-10-05 Martin Gieseking + + * NEWS, src/PsSpecialHandler.cpp: + fixed another positioning bug reported by John Bowman + + * src/PsSpecialHandler.cpp: + convert PS path coordinated to TeX point units + +2009-10-04 Martin Gieseking + + * src/GraphicPath.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + corrected positioning bug introduced with previous PS positioning fix + +2009-10-02 Martin Gieseking + + * doc/Makefile.am, doc/dvisvgm.txt.in: + generate pdf manpage directly with groff; adapted manpage source to work + with latest asciidoc + +2009-10-01 Martin Gieseking + + * doc/Makefile.am, doc/dvisvgm.txt.in: + replaced backticks in manpage by apostrophes; updated date on homepage + +2009-09-30 Martin Gieseking + + * Makefile.am, configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + increased version number to 0.8.5 + + * LGPL-2.1.txt, NEWS, README: + updated README and NEWS, and added file with LGPL license text + + * doc/dvisvgm.txt.in: + added dvisvgm:raw example to man page + +2009-09-17 Martin Gieseking + + * doc/dvisvgm.txt.in: + minor changes of the documentation + + * fedora/dvisvgm.spec: + updated spec file and fixed typo on website + + * src/PsSpecialHandler.h: + increased the default linewidth to 0.5 + + * NEWS: + added cretdit to John Bowman for sending a patch for the already fixed + clipping bug + +2009-09-11 Martin Gieseking + + * src/FileSystem.cpp, src/MetafontWrapper.cpp: + Windows: Metafont is now called via CreateProcess() + + * NEWS, doc/dvisvgm.txt.in, src/CommandLine.cpp, src/CommandLine.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/SpecialManager.cpp, + src/SpecialManager.h, src/dvisvgm.cpp, src/options.xml: + added option --progress for enabling a progress indicator (feature #22) + + * NEWS, src/CmdLineParserBase.cpp, src/FontCache.cpp, + src/SVGFontTraceEmitter.cpp: + fixed memory bug in tracer module (issue #21) + +2009-09-10 Martin Gieseking + + * src/FileSystem.cpp, src/FontCache.cpp: + fixed Windows-related bug in FileSystem::collect + + * NEWS, doc/dvisvgm.txt.in, src/FileSystem.cpp, src/FileSystem.h, + src/FontCache.cpp, src/FontCache.h, src/dvisvgm.cpp: + option --cache prints additional information about the cached fonts + (feature #7) + + * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DVIToSVG.cpp, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h: + refactored prefixes methods of the SpecialHandlers (ticket #20) + +2009-09-06 Martin Gieseking + + * NEWS, README: + updated NEWS and README + +2009-09-04 Martin Gieseking + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/CommandLine.cpp, + src/InputBuffer.h, src/InputReader.h, src/psdefs.psc, + tests/CommandLineTest.h: + improved the command line parser to make it more POSIX-compliant + (feature #17) + + * src/dvisvgm.cpp: + fixed evaluation of option --help + + * src/BoundingBox.cpp, src/BoundingBox.h, src/PsSpecialHandler.cpp: + linewidths are now considered properly in computation of bounding box + (issue #13) + + * configure.ac, fedora/dvisvgm.spec, src/Doxyfile: + increased version number to 0.8.4 + +2009-09-01 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/psdefs.ps, src/psdefs.psc: + fixed flattened clipping path bug (issue #11) + +2009-08-31 Martin Gieseking + + * src/Makefile.am: + added error checks; disallow numeric optional arguments w/o default + value + +2009-08-28 Martin Gieseking + + * NEWS, src/PSInterpreter.cpp, src/PsSpecialHandler.cpp, src/dvisvgm.cpp, + src/psdefs.ps, src/psdefs.psc: + added evaluation of PS 'show' operator in order to evaluate PSTricks + Type 3 fonts properly + +2009-08-27 Martin Gieseking + + * NEWS, configure.ac, doc/dvisvgm.txt.in, src/CmdLineParserBase.cpp, + src/CommandLine.cpp, src/Doxyfile, src/dvisvgm.cpp, src/getopt.c, + src/getopt.h, src/getopt1.c, src/options.xml: + replaced option --cache=? by --cache; increased version number to 0.8.3 + +2009-08-26 Martin Gieseking + + * NEWS, configure.ac, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/PsSpecialHandler.cpp, + src/SpecialManager.cpp, src/SpecialManager.h: + PS prologue files referenced in first page are now always loaded + + * configure.ac, fedora/dvisvgm.spec, src/Ghostscript.cpp, + src/Ghostscript.h, src/Makefile.am: + improved Ghostscript and potrace linking checks to simplify usage of + external devel files + + * fedora/dvisvgm-0.8.1-potrace.patch, fedora/dvisvgm-gs.patch, + fedora/dvisvgm-potrace.patch, fedora/dvisvgm.spec: + updated Fedora files + +2009-08-24 Martin Gieseking + + * src/CommandLine.cpp, src/CommandLine.h: + speed up printing help by using puts() instead of C++ streams + +2009-08-21 Martin Gieseking + + * NEWS, configure.ac, src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, + src/Doxyfile: + increased version number to 0.8.2 + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/Makefile.am, + src/dvisvgm.cpp, src/options.xml, tests/CommandLineTest.h, + tests/Makefile.am: + improved CmdLineParserBase and replaced gengetopt-based parser + + * src/FontMap.cpp: + fixed memory bug in FontMap + +2009-08-20 Martin Gieseking + + * COPYING: + added copy of file COPYING + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h: + finished cmdline parser + + * src/CmdLineParserBase.cpp, src/CmdLineParserBase.h, src/options.xml: + added files for replacement of gengetopt (not active yet) + + * src/InputReader.cpp, src/InputReader.h: + added method parseUInt() + +2009-08-17 Martin Gieseking + + * COPYING, LICENSE, Makefile.am, README, doc/dvisvgm.txt.in, + src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, + src/CharmapTranslator.h, src/Color.cpp, src/Color.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DLLoader.cpp, + src/DLLoader.h, src/DVIActions.cpp, src/DVIActions.h, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Directory.cpp, + src/Directory.h, src/DvisvgmSpecialHandler.cpp, + src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, + src/EmSpecialHandler.h, src/FileFinder.cpp, src/FileFinder.h, + src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, + src/FontCache.cpp, src/FontCache.h, src/FontEmitter.h, + src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, + src/FontInfo.h, src/FontManager.cpp, src/FontManager.h, src/FontMap.cpp, + src/FontMap.h, src/FontTracer.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/Ghostscript.cpp, src/Ghostscript.h, + src/GraphicPath.h, src/HtmlSpecialHandler.h, src/InputBuffer.cpp, + src/InputBuffer.h, src/InputReader.cpp, src/InputReader.h, + src/Matrix.cpp, src/Matrix.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSInterpreter.cpp, src/PSInterpreter.h, src/PSObject.cpp, + src/PSObject.h, src/PSState.cpp, src/PSState.h, src/PageSize.cpp, + src/PageSize.h, src/Pair.h, src/PsSpecialHandler.cpp, + src/PsSpecialHandler.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/SVGTree.cpp, + src/SVGTree.h, src/SWFWriter.cpp, src/SWFWriter.h, src/SpecialActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, + src/TFM.cpp, src/TFM.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/global.cpp, + src/global.h, src/inttypes.h, src/macros.h, src/psdefs.ps, + src/psdefs.psc, src/types.h, tests/CalculatorTest.h, + tests/ColorSpecialTest.h, tests/DirectoryTest.h, tests/FileFinderTest.h, + tests/FontManagerTest.h, tests/FontMapTest.h, tests/GraphicPathTest.h, + tests/MatrixTest.h, tests/PageSizeTest.h, + tests/SplittedCharInputBufferTest.h, tests/StreamCounterTest.h, + tests/StreamInputBufferTest.h, tests/VectorStreamTest.h: + changed license to GPL version 3 or later + + * tests/Makefile.am: + added include path to fix broken distcheck + +2009-08-10 Martin Gieseking + + * tests/Makefile.am: + added generated file test-all.cpp to CLEANFILES + + * Makefile.am, configure.ac, src/Makefile.am, src/tests/CalculatorTest.h, + src/tests/ColorSpecialTest.h, src/tests/DirectoryTest.h, + src/tests/FileFinderTest.h, src/tests/FontManagerTest.h, + src/tests/FontMapTest.h, src/tests/GraphicPathTest.h, + src/tests/MatrixTest.h, src/tests/PageSizeTest.h, + src/tests/SplittedCharInputBufferTest.h, src/tests/StreamCounterTest.h, + src/tests/StreamInputBufferTest.h, src/tests/VectorStreamTest.h, + src/tests/dvipdfm_test.map, src/tests/dvips_test.map, + tests/CalculatorTest.h, tests/ColorSpecialTest.h, tests/DirectoryTest.h, + tests/FileFinderTest.h, tests/FontManagerTest.h, tests/FontMapTest.h, + tests/GraphicPathTest.h, tests/Makefile.am, tests/MatrixTest.h, + tests/PageSizeTest.h, tests/SplittedCharInputBufferTest.h, + tests/StreamCounterTest.h, tests/StreamInputBufferTest.h, + tests/VectorStreamTest.h, tests/dvipdfm_test.map, tests/dvips_test.map: + moved tests from src/tests to ./tests + + * fedora/dvisvgm-0.8.1-potrace.patch, fedora/dvisvgm.spec, + rpm/dvisvgm.spec: + added spec file and patch for Fedora builds + +2009-08-02 Martin Gieseking + + * LICENSE, Makefile.am, rpm/dvisvgm.spec, rpm/dvisvgm.spec.in, + src/Ghostscript.cpp: + modified package to be compatible with prerequisites of Fedora + +2009-07-30 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/Ghostscript.cpp, src/Ghostscript.h, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h: + added Ghostscript revision info to output of dvisvgm -l + + * configure.ac, src/DVIToSVG.cpp: + added target triplet to version string in SVG output + +2009-07-29 Martin Gieseking + + * src/psdefs.psc: + added vim tag to psdefs.psc + +2009-07-28 Martin Gieseking + + * src/psdefs.psc: + cleaned up VC++ build files; added batch file to generate cmdline.c; + added generated file psdefs.psc for convenience + + * NEWS, src/FileSystem.cpp, src/FontEngine.cpp, src/FontManager.cpp, + src/Ghostscript.cpp, src/PageSize.cpp, src/dvisvgm.cpp: + fixed bug related to unsigned/size_t mismatch on x64 systems + + * NEWS, configure.ac, src/Doxyfile: + updated version number to 0.8.1 + + * src/PsSpecialHandler.cpp: + added evaluation of more psfile parameters; fixed psfile bounding box + bug + +2009-07-27 Martin Gieseking + + * src/DVIReader.h, src/InputBuffer.cpp, src/InputBuffer.h, + src/InputReader.cpp, src/InputReader.h, src/Matrix.cpp, src/Matrix.h, + src/PSInterpreter.h: + replaced size_t parameters by unsigned + + * NEWS, README: + fixed typos; updated homepage/manpage + + * src/DLLoader.cpp, src/InputReader.cpp, src/PSInterpreter.cpp: + changes to make VC happy; fixed potential memory bug + +2009-07-23 Martin Gieseking + + * src/PSInterpreter.cpp: + some clean-ups + +2009-07-22 Martin Gieseking + + * src/TpicSpecialHandler.cpp: + fixed reintroduced bug in TPIC handler + + * NEWS, README, doc/dvisvgm.txt.in, src/BoundingBox.cpp, + src/BoundingBox.h, src/GraphicPath.h, src/PSInterpreter.cpp, + src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, src/psdefs.ps: + fixed clipping bug; updated homepage, README, NEWS + +2009-07-20 Martin Gieseking + + * src/PsSpecialHandler.cpp, src/SVGTree.cpp: + fixed bbox bug; added missing file + + * src/DvisvgmSpecialHandler.cpp, src/InputBuffer.cpp, src/InputReader.cpp, + src/InputReader.h, src/PsSpecialHandler.cpp, src/PsSpecialHandler.h, + src/psdefs.ps, src/tests/StreamInputBufferTest.h: + implemented psfile special; fixed some bugs + +2009-06-01 Martin Gieseking + + * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/DvisvgmSpecialHandler.cpp, src/DvisvgmSpecialHandler.h, + src/EmSpecialHandler.cpp, src/EmSpecialHandler.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h: + transplanted changes to SpecialHandlers from branch 'pages' + + * src/GFTracer.cpp: + transplanted changes to GFTracer from branch 'pages' + + * src/VFReader.cpp: + transplanted changes to VFReader from branch 'pages' + + * src/FileSystem.cpp, src/FileSystem.h: + transplanted changes to FileSystem from branch 'pages' + + * src/DVIReader.cpp, src/DVIReader.h: + transplanted changes to DVIReader from branch 'pages' + + * src/Bitmap.cpp, src/Bitmap.h: + transplanted changes to Bitmap from branch 'pages' + + * src/InputBuffer.cpp, src/InputBuffer.h, src/Makefile.am: + transplanted changes to InputBuffer from branch 'pages' + +2009-04-24 Martin Gieseking + + * src/FontCache.h: + increased version of font cache files to ensure their recreation due to + the previously fixed shorthand path command bug + + * NEWS, configure.ac, src/Doxyfile: + increased version number to 0.7.3 + + * src/TpicSpecialHandler.cpp: + fixed TPIC handler bug that could caused unwanted color fills of + ellipses due to a missing call of reset() + +2009-04-02 Martin Gieseking + + * configure.ac, doc/dvisvgm.txt.in, src/MetafontWrapper.cpp, + src/dvisvgm.cpp: + prepared release 0.7.2 (removed inclusions of debug.h, adapted homepage + and manpage) + +2009-03-25 Martin Gieseking + + * src/Doxyfile: + added doxygen files + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/FontGlyph.cpp, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp: + replaced Metafont magnification variable and its setters by a public + class variable + +2009-03-24 Martin Gieseking + + * src/FontGlyph.cpp: + fixed memory bug in Glyph::optimizeCommands() + + * src/FontGlyph.cpp: + fixed potential bug in Glyph::optimizeCommands() + + * NEWS, src/FontCache.cpp, src/FontGlyph.cpp, src/FontGlyph.h, + src/GFGlyphTracer.cpp, src/Pair.h, src/SVGFontEmitter.cpp: + use of shorthand path commands has been implemented + +2009-03-20 Martin Gieseking + + * src/FontCache.cpp: + cache files are being compressed now to reduce the file size + +2009-03-19 Martin Gieseking + + * src/FontCache.cpp, src/SVGFontTraceEmitter.cpp: + don't read existing cache file if --trace-all is given (trace complete + font and then write cache file instead) + + * NEWS, doc/dvisvgm.txt.in, src/FontEmitter.h, src/GFGlyphTracer.cpp, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp, + src/options.ggo: + added option --trace-all that forces tracing of all glyphs of all + currently used bitmap fonts + +2009-03-18 Martin Gieseking + + * src/DVIToSVG.cpp, src/TFM.cpp, src/TFM.h: + added firstChar()/lastChar() to TFM class, removed unnecessary mag + member variable and its setter + + * src/FontCache.cpp: + fixed bug in read/write functions of FontCache + +2009-03-17 Martin Gieseking + + * src/FontCache.cpp: + reduced size of cache file format by using variable integer sizes + + * doc/dvisvgm.txt.in, src/dvisvgm.cpp: + added option variant --cache=? to display the default cache directory + + * doc/dvisvgm.txt.in, src/DVIToSVG.cpp, src/FileSystem.cpp, + src/FileSystem.h, src/FontCache.cpp, src/FontCache.h, src/FontGlyph.h, + src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/Makefile.am, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/dvisvgm.cpp: + completed font caching support + +2009-03-16 Martin Gieseking + + * NEWS, configure.ac, doc/dvisvgm.txt.in, src/DVIToSVG.cpp, + src/FileSystem.cpp, src/FileSystem.h, src/FontCache.cpp, src/FontCache.h, + src/FontGlyph.cpp, src/FontGlyph.h, src/GFGlyphTracer.cpp, + src/GFGlyphTracer.h, src/GFTracer.cpp, src/options.ggo: + first additions to support font caching; not working yet + +2009-03-11 Martin Gieseking + + * src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/FontEmitter.h, src/SVGFontEmitter.cpp, + src/SVGFontEmitter.h, src/SVGFontTraceEmitter.cpp, + src/SVGFontTraceEmitter.h: + improved font embedding algorithm in case of --no-fonts (identical + glyphs in different sizes are now referenced rather than duplicated) + +2009-03-10 Martin Gieseking + + * NEWS, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/Font.h, + src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp: + all glyph sizes are now computed correctly in conjuction with option + --no-fonts + +2009-03-09 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp: + fixed transformation bug (transformations are now applied properly to + the page) + + * src/types.h: + minor changes to homepage and .hgignore + + * src/BgColorSpecialHandler.cpp, src/SpecialManager.cpp, + src/TpicSpecialHandler.cpp: + adapted Code to make VC happy + +2009-03-08 Martin Gieseking + + * src/BgColorSpecialHandler.cpp, src/BgColorSpecialHandler.h: + added missing background color handler + + * NEWS, README, src/Color.cpp, src/Color.h, src/ColorSpecialHandler.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/DvisvgmSpecialHandler.cpp, src/EmSpecialHandler.cpp, src/Makefile.am, + src/TpicSpecialHandler.cpp: + added bgcolor support, updated homepage, fixed color handler bug + +2009-03-06 Martin Gieseking + + * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: + implemented splines of tpic specials + + * src/TpicSpecialHandler.cpp, src/TpicSpecialHandler.h: + implemented arc drawing of tpic special set + +2009-03-03 Martin Gieseking + + * doc/dvisvgm.txt.in, src/DvisvgmSpecialHandler.cpp, + src/DvisvgmSpecialHandler.h: + minor code improvements; comments added + + * doc/Makefile.am, doc/dvisvgm.txt.in, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/DvisvgmSpecialHandler.cpp, + src/DvisvgmSpecialHandler.h, src/InputBuffer.cpp, src/InputBuffer.h, + src/SpecialActions.h: + implemented the dvisvgm specials raw, image, and bbox + + * src/BoundingBox.cpp, src/BoundingBox.h, src/Color.cpp, + src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/DVIActions.h, + src/DVIBBoxActions.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/EmSpecialHandler.cpp, + src/Makefile.am, src/SpecialActions.h, src/SpecialHandler.h, + src/TpicSpecialHandler.cpp: + improved computation of the bounding box (works with specials now); + added dummy function for background color assignments + +2009-02-26 Martin Gieseking + + * doc/Makefile.am, doc/dvisvgm.txt.in: + improved manpage + + * doc/Makefile.am, doc/dvisvgm.txt, doc/dvisvgm.txt.in: + removed generated file, added dvisvgm.txt.in + +2009-02-25 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/DvisvgmSpecialHandler.cpp, src/EmSpecialHandler.cpp, + src/SpecialActions.h, src/TpicSpecialHandler.cpp: + renamed appendInPage() to appendToPage + +2009-02-24 Martin Gieseking + + * NEWS, doc/dvisvgm.1.in, src/TpicSpecialHandler.cpp: + few additions to tpic handler + + * NEWS, src/Color.cpp, src/Color.h, src/DVIToSVGActions.cpp, + src/Makefile.am, src/Pair.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/TpicSpecialHandler.cpp, + src/TpicSpecialHandler.h: + first tpic implementations; not complete yet + + * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/DVIToSVGActions.cpp, src/DvisvgmSpecialHandler.cpp, + src/DvisvgmSpecialHandler.h, src/EmSpecialHandler.cpp, + src/EmSpecialHandler.h, src/HtmlSpecialHandler.h, src/Makefile.am, + src/SpecialColorHandler.cpp, src/SpecialColorHandler.h, + src/SpecialDvisvgmHandler.cpp, src/SpecialDvisvgmHandler.h, + src/SpecialEmHandler.cpp, src/SpecialEmHandler.h, src/SpecialHandler.h, + src/SpecialHtmlHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/tests/ColorSpecialTest.h: + improved SpecialHandler is now able to handle unprefixed specials + +2009-02-23 Martin Gieseking + + * NEWS, configure.ac, doc/dvisvgm.1.in, src/DVIBBoxActions.h, + src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/FontEmitter.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, src/XMLNode.cpp, + src/XMLNode.h, src/dvisvgm.cpp, src/options.ggo, + src/tests/ColorSpecialTest.h: + added option --no-fonts wich uses path elements instead of fonts + +2009-02-20 Martin Gieseking + + * NEWS, doc/dvisvgm.1.in, src/Color.cpp, src/Color.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, + src/SpecialActions.h, src/SpecialColorHandler.cpp, + src/SpecialDvisvgmHandler.cpp, src/SpecialDvisvgmHandler.h, + src/SpecialEmHandler.cpp, src/SpecialEmHandler.h, + src/SpecialHtmlHandler.h, src/VerbSpecialHandler.cpp, + src/VerbSpecialHandler.h: + fixed bug in color handler, added skeletons of dvisvgm/hyperref special + handlers + +2009-02-18 Martin Gieseking + + * NEWS, src/SpecialActions.h, src/tests/ColorSpecialTest.h: + adapted color test to new interface, added emtex info + + * src/Color.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/Makefile.am, src/SpecialActions.h, src/SpecialColorHandler.cpp, + src/SpecialEmHandler.cpp: + added color support to emTeX specials, removed Color class + +2009-02-17 Martin Gieseking + + * src/DVIReader.cpp: + made DVICommand local to executeCommand, removed unnecessary if + statement + +2009-02-15 Martin Gieseking + + * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, + src/SpecialActions.h, src/SpecialManager.cpp, src/VerbSpecialHandler.cpp, + src/VerbSpecialHandler.h, src/XMLString.cpp, src/XMLString.h: + added special handler for verbatim output + +2009-02-14 Martin Gieseking + + * NEWS, configure.ac: + prepared release of version 0.7 + + * doc/dvisvgm.1.in, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/dvisvgm.cpp, src/options.ggo: + added option --no-style + + * NEWS, configure.ac: + increased version number to 0.6.2, updated NEWS + + * src/dvisvgm.cpp: + fixed incorrect behavior of option -V/--version + + * src/Color.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h: + finished color support + +2009-02-13 Martin Gieseking + + * src/ColorSpecialHandler.cpp, src/Makefile.am, + src/tests/ColorSpecialTest.h: + added tests for ColorSpecialHandler + + * prepare: + updated administrative files + + * src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Makefile.am, + src/SpecialActions.h, src/SpecialHandler.h, src/SpecialManager.cpp, + src/SpecialManager.h: + color specials are now processed by DVIToSVGActions, but don't create + any results yet + + * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h: + reverted to previous version, removed dependency on Color class + + * hgauthors, prepare: + added administrative files + + * Makefile.am, configure.ac, src/tests/DirectoryTest.h: + removed rpm support + + * src/types.h: + replaced static definition of sized integers by template program + +2009-02-10 Martin Gieseking + + * src/Color.h, src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/Makefile.am: + replaced RGB arrays by Color class + +2009-02-09 Martin Gieseking + + * src/TransformationMatrix.cpp: + made y-coordinate of cmdline-option -t optional + +2009-02-06 Martin Gieseking + + * src/FileFinder.cpp: + changed lookup order of font maps + + * doc/dvisvgm.1.in, src/ColorSpecialHandler.h, src/DVIToSVG.cpp, + src/DVIToSVG.h, src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h, + src/dvisvgm.cpp, src/options.ggo: + added option --list-specials that lists all registered special handlers + +2009-02-05 Martin Gieseking + + * src/DVIToSVGActions.cpp: + replaced special ignore list evaluation algorithm + + * src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/dvisvgm.cpp, src/options.ggo: + added optional prefix list to commandline option --no-specials + + * src/extract-colors.php: + added php-script that extracts color definitions from color.pro + +2009-02-04 Martin Gieseking + + * src/FontMap.cpp: + added output of font encoding in write method + + * src/FileFinder.cpp: + added option for additional loading of user maps + +2009-02-03 Martin Gieseking + + * map/cork-lm.map: + removed deprecated map subdirectory + + * src/FileFinder.cpp, src/FileFinder.h, src/dvisvgm.cpp: + option -m/--map-file is now evaluated properly + + * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/SpecialHandler.h, + src/SpecialManager.cpp, src/SpecialManager.h, src/options.ggo: + more color special implementation (color constants), still not ready + +2009-02-02 Martin Gieseking + + * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h: + some refactorings in color handler + + * src/ColorSpecialHandler.cpp, src/ColorSpecialHandler.h, src/Makefile.am, + src/SpecialHandler.h, src/SpecialManager.cpp, src/SpecialManager.h: + added special support skeletons; not working yet + + * NEWS, src/FileFinder.cpp: + fixed buggy call of maketfm/makemf in Windows version + +2009-01-30 Martin Gieseking + + * NEWS, src/DVIReader.cpp, src/DVIReader.h: + fixed magnification bug + + * src/dvisvgm.cpp: + prevented writing zero-length svg files; simplified main code by using + auto pointers + +2009-01-29 Martin Gieseking + + * src/FileFinder.cpp: + adapted Windows version to new release + +2009-01-28 Martin Gieseking + + * NEWS, configure.ac, doc/dvisvgm.1.in: + adapted configuration and documentation to new dvips map file support + + * src/FileFinder.cpp, src/FontMap.cpp, src/FontMap.h, + src/tests/FontMapTest.h, src/tests/dvips_test.map: + FontMap now supports dvips and dvipdfm maps + + * src/Calculator.cpp, src/DVIToSVG.cpp, src/FontEncoding.cpp, + src/FontMap.cpp, src/SVGFontEmitter.cpp, src/SVGFontTraceEmitter.cpp: + replaced comparisions with "" with calls of empty() + + * src/FontMap.cpp, src/Makefile.am, src/tests/FontMapTest.h, + src/tests/dvipdfm_test.map, src/tests/dvips_test.map: + extensions to FontMap almost complete but not finished yet + + * src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h: + improved GFTracer to support unscaled results + + * src/dvisvgm.cpp: + use new initialisation of FileFinder + + * src/FileFinder.cpp, src/FileFinder.h, src/Makefile.am, + src/tests/DirectoryTest.h, src/tests/FileFinderTest.h, + src/tests/FontManagerTest.h, src/tests/KPSFileFinderTest.h: + refactored FileFinder (implementation as singleton) + +2009-01-27 Martin Gieseking + + * src/GFGlyphTracer.cpp, src/GFGlyphTracer.h, src/GFTracer.cpp, + src/GFTracer.h, src/Makefile.am, src/SVGFontTraceEmitter.cpp, + src/SVGFontTraceEmitter.h: + made GFTracer a generic class with template methods + +2009-01-26 Martin Gieseking + + * src/InputBuffer.h: + fixed incompatible types bug + + * src/Bitmap.cpp, src/Bitmap.h, src/GFReader.cpp, src/GFReader.h, + src/GFTracer.cpp, src/Makefile.am: + improvements to GF handling, first skeletton of gf->metapost (gfprint) + +2009-01-25 Martin Gieseking + + * src/FontMap.cpp: + basic dvips font map support, not complete yet + + * src/CharmapTranslator.cpp, src/DVIToSVG.cpp, src/FileFinder.cpp, + src/FileFinder.h, src/Font.cpp, src/FontEncoding.cpp, + src/FontManager.cpp, src/KPSFileFinder.cpp, src/KPSFileFinder.h, + src/Makefile.am, src/MetafontWrapper.cpp, src/TFM.cpp, src/dvisvgm.cpp: + renamed KPSFileFinder to FileFinder + + * src/FontMap.cpp, src/FontMap.h: + started redesign of FontMap, not complete yet + + * src/InputBuffer.cpp, src/InputBuffer.h: + added missing include + +2009-01-23 Martin Gieseking + + * doc/Makefile.am, doc/dvisvgm.1.in: + manpage updates + +2009-01-22 Martin Gieseking + + * configure.ac: + added test whether dvipdfm.map is available + + * doc/dvisvgm.1.in, rpm/dvisvgm.spec.in, src/Bitmap.cpp, src/Bitmap.h, + src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, + src/Calculator.h, src/CharmapTranslator.cpp, src/CharmapTranslator.h, + src/DVIActions.cpp, src/DVIActions.h, src/DVIBBoxActions.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Directory.cpp, + src/Directory.h, src/FileFinder.cpp, src/FileFinder.h, + src/FileSystem.cpp, src/FileSystem.h, src/Font.cpp, src/Font.h, + src/FontEmitter.h, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, + src/FontInfo.cpp, src/FontInfo.h, src/FontManager.cpp, src/FontManager.h, + src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/InputBuffer.cpp, + src/InputBuffer.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, + src/Makefile.am, src/Makefile.orig, src/Matrix.cpp, src/Matrix.h, + src/Message.cpp, src/Message.h, src/MessageException.h, + src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, + src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, + src/StreamCounter.h, src/StreamReader.cpp, src/StreamReader.h, + src/TFM.cpp, src/TFM.h, src/TransformationMatrix.cpp, + src/TransformationMatrix.h, src/VFActions.h, src/VFReader.cpp, + src/VFReader.h, src/VectorStream.h, src/XMLDocTypeNode.h, + src/XMLDocument.cpp, src/XMLDocument.h, src/XMLNode.cpp, src/XMLNode.h, + src/XMLString.cpp, src/XMLString.h, src/dvisvgm.cpp, src/global.cpp, + src/global.h, src/macros.h, src/options.ggo, src/types.h: + updated file header comments + + * src/tests/CalculatorTest.h, src/tests/DirectoryTest.h, + src/tests/FontManagerTest.h, src/tests/FontMapTest.h, + src/tests/KPSFileFinderTest.h, src/tests/PageSizeTest.h, + src/tests/StreamCounterTest.h, src/tests/VectorStreamTest.h: + updated tests + + * Makefile.am, NEWS, README, configure.ac, potracelib/Makefile.am: + updated version info to 0.6 + + * src/KPSFileFinder.cpp: + fixed throwing of COM exception + + * src/DVIReader.cpp, src/FontManager.cpp, src/KPSFileFinder.cpp: + memory leak fixed + + * src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/dvisvgm.cpp: + added support for MiKTeX' new COM interface + + * src/FontMap.cpp: + forgot to remove address operator + +2009-01-21 Martin Gieseking + + * src/Calculator.cpp, src/DVIReader.cpp, src/DVIToSVGActions.cpp, + src/Directory.cpp, src/FontEncoding.cpp, src/FontEngine.cpp, + src/FontManager.cpp, src/FontMap.cpp, src/KPSFileFinder.cpp, + src/MetafontWrapper.cpp, src/PageSize.cpp, src/StreamReader.cpp, + src/TFM.cpp, src/TransformationMatrix.cpp, src/VFReader.cpp, + src/XMLDocument.cpp, src/XMLNode.cpp: + added in/out attributes to parameter documentation + + * src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/FontEncoding.cpp, src/FontGlyph.cpp: + fixed bugs in handling of font encodings and virtual fonts + +2009-01-20 Martin Gieseking + + * src/SVGFontEmitter.cpp: + fixed memory bug + + * src/FontEngine.cpp, src/FontEngine.h, src/SVGFontEmitter.cpp: + fixed glyph positioning bug occured in conjunction with font encoding + + * src/DVIReader.cpp, src/DVIToSVG.cpp, src/Font.h, src/FontEncoding.cpp, + src/FontEncoding.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontGlyph.cpp, src/FontGlyph.h, src/FontManager.cpp, + src/FontManager.h, src/InputBuffer.cpp, src/InputBuffer.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h: + first working version with font encoding support + +2009-01-19 Martin Gieseking + + * src/DVIReader.cpp, src/FontEncoding.cpp, src/FontEncoding.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontManager.cpp, + src/FontManager.h, src/FontMap.cpp: + partly working mapping support, but yet too slow + + * src/FontEncoding.cpp, src/FontEncoding.h, src/FontEngine.cpp, + src/FontEngine.h, src/FontManager.cpp, src/FontManager.h, + src/FontMap.cpp, src/FontMap.h, src/KPSFileFinder.cpp, + src/KPSFileFinder.h: + more encoding implementations, not complete yet + +2009-01-16 Martin Gieseking + + * src/TransformationMatrix.cpp: + fixed bug in argument assignment of transformation command M + +2009-01-15 Martin Gieseking + + * src/TransformationMatrix.cpp: + removed a dangerous loop remained from previous code + +2009-01-14 Martin Gieseking + + * src/KPSFileFinder.cpp: + added enc-file support + + * src/dvisvgm.cpp: + updated copyright string + + * src/FileSystem.cpp, src/FileSystem.h: + const string parameters + + * src/FontEncoding.cpp, src/FontEncoding.h, src/InputBuffer.cpp, + src/InputBuffer.h, src/Makefile.am: + added basic skeleton for handling of font encodings + + * potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h: + updated libpotrace to version 1.8 + +2009-01-13 Martin Gieseking + + * src/CharmapTranslator.cpp: + fixed crash on loading corrupt pfb-files + +2008-06-18 Martin Gieseking + + * src/Makefile.am: + adapted to latest gengetopt version + +2008-04-07 Martin Gieseking + + * src/DVIReader.cpp: + minor change + +2007-03-26 Martin Gieseking + + * src/DVIActions.cpp, src/DVIReader.cpp, src/DVIReader.h, + src/FontManager.cpp, src/tests/FontManagerTest.h: + few minor changes + + * NEWS, src/CharmapTranslator.cpp, src/CharmapTranslator.h, + src/DVIActions.h, src/DVIReader.cpp, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.h, + src/FontManager.cpp, src/Makefile.am, src/SVGFontTraceEmitter.cpp, + src/SVGFontTraceEmitter.h: + redesigned DVIActions and CharmapTranslator + +2007-03-25 Martin Gieseking + + * src/DVIReader.cpp, src/DVIReader.h, src/VFActions.h: + minor fixes + + * src/DVIActions.cpp, src/DVIActions.h, src/DVIBBoxActions.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, + src/FontManager.cpp, src/FontManager.h, src/StreamReader.cpp, + src/StreamReader.h, src/VFActions.h, src/VFReader.cpp, src/VFReader.h, + src/VectorStream.h: + first working version 0.5, release candidate 1 + +2007-03-23 Martin Gieseking + + * src/DVIReader.cpp, src/FontManager.cpp, src/FontManager.h, + src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/VFReader.cpp: + more vf implementations, not complete yet + +2007-03-22 Martin Gieseking + + * src/DVIReader.cpp, src/Font.cpp, src/Font.h, src/FontManager.cpp, + src/VFActions.h, src/VFReader.cpp, src/VFReader.h: + more vf implementations + + * NEWS, doc/Makefile.in, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/FileSystem.cpp, src/FileSystem.h, + src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile.am, + src/dvisvgm.cpp, src/tests/DirectoryTest.h, src/tests/FontManagerTest.h: + reintegrated font map initialization into KPSFileFinderm adapted some + tests + +2007-03-21 Martin Gieseking + + * src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/dvisvgm.cpp: + implemented options -n and -m + + * src/Directory.cpp, src/Directory.h, src/KPSFileFinder.cpp, + src/KPSFileFinder.h, src/dvisvgm.cpp: + completed MiKTeX font map file look-up, fixed bug in Directory class + + * src/Calculator.cpp, src/DVIReader.cpp, src/Directory.cpp, src/Font.h, + src/FontManager.cpp, src/Makefile, src/Makefile.am, src/Makefile.in, + src/MetafontWrapper.cpp, src/VFReader.cpp, src/VectorStream.h, + src/test-all.cpp, src/tests/VectorStreamTest.h: + removed redundant code and commented code fragments, added + VectorInputStream class + + * AUTHORS, Makefile.am, README, potracelib/Makefile.am, + rpm/dvisvgm.spec.in, src/Directory.cpp, src/Directory.h, + src/KPSFileFinder.cpp, src/Makefile, src/Makefile.am, src/Makefile.in, + src/SVGFontTraceEmitter.cpp, src/test-all.cpp, src/tests/DirectoryTest.h: + implemented Directory class for Linux, added DirectoryTest + +2007-03-20 Martin Gieseking + + * src/Directory.cpp, src/Directory.h, src/FileSystem.cpp, src/FontMap.cpp, + src/FontMap.h, src/KPSFileFinder.cpp: + more changes for MiKTeX support + + * NEWS, doc/Makefile, doc/Makefile.in, doc/dvisvgm.1.in, + src/DVIReader.cpp, src/DVIToSVG.cpp, src/Font.cpp, src/Font.h, + src/FontManager.cpp, src/KPSFileFinder.cpp, src/Makefile, + src/Makefile.am, src/Makefile.in, src/VFReader.cpp, src/dvisvgm.cpp, + src/test-all.cpp, src/tests/KPSFileFinderTest.h: + added KPSFileFinderTest, added EmptyFont, fixed compilation error + +2007-03-19 Martin Gieseking + + * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontMap.cpp, + src/FontMap.h, src/KPSFileFinder.cpp: + made sources comaptible with MikTeX + + * src/KPSFileFinder.cpp: + bug fixed, font maps work now + + * src/CharmapTranslator.cpp, src/DVIToSVG.cpp, src/FontManager.cpp, + src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, + src/Makefile.am, src/Makefile.in, src/MetafontWrapper.cpp, src/TFM.cpp: + added mktexFOO support and font map lookups to KPSFileFinder + +2007-03-16 Martin Gieseking + + * src/Font.cpp, src/Font.h, src/FontManager.cpp, src/FontMap.cpp, + src/FontMap.h, src/KPSFileFinder.cpp, src/Makefile, src/Makefile.am, + src/Makefile.in, src/StreamReader.cpp, src/TFM.cpp, src/options.ggo, + src/tests/FontMapTest.h: + more coding in the font department, not finished yet + +2007-03-09 Martin Gieseking + + * src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, src/Font.cpp, + src/FontInfo.cpp, src/FontManager.cpp, src/GFTracer.cpp, + src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, + src/Makefile.am, src/Makefile.in, src/MetafontWrapper.cpp, + src/MetafontWrapper.h, src/SVGFontTraceEmitter.cpp, + src/SVGFontTraceEmitter.h, src/StreamReader.cpp, src/StreamReader.h, + src/TFM.cpp, src/TFM.h, src/VFReader.cpp, src/VFReader.h, + src/dvisvgm.cpp, src/options.ggo, src/test-all.cpp: + refactorings: extracted StreamReader class, replaced generic FileFinder + support by KPSFileFinder calls + +2007-03-08 Martin Gieseking + + * src/DVIReader.cpp, src/DVIToSVGActions.cpp, src/Font.h, src/Makefile, + src/Makefile.am, src/Makefile.in, src/Makefile.orig, src/VFActions.h, + src/VFReader.cpp, src/VFReader.h, src/dvisvgm.cpp: + plugged VFReader and its actions into the code (not usable yet) + + * src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, src/Font.cpp, src/Font.h, + src/Makefile.orig, src/StreamCounter.h, src/dvisvgm.cpp: + fixed memory bug + + * doc/dvisvgm.1, src/FontEngine.h, src/Makefile.orig, src/dvisvgm.cpp, + src/tests/FontManagerTest.h: + minor changes + + * COPYING, Makefile, Makefile.am, Makefile.in, Martins_svg_neu.svg, NEWS, + aclocal.m4, cmdline.c, config.guess, config.h, config.h.in, + config.status, config.sub, configure.ac, depcomp, doc/Makefile, + doc/dvisvgm.1, doc/dvisvgm.1.in, gpl.txt, install-sh, missing, + src/FontManager.cpp, src/FontManager.h, src/Makefile.am, + src/VFReader.cpp, src/tests/FontManagerTest.h, stamp-h1, table.txt: + removed some garbage from the repository, added initial FontManagerTest + + * src/DVIActions.h, src/DVIBBoxActions.h, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/Font.cpp, src/Font.h, src/FontManager.cpp, + src/FontManager.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, + src/Makefile, src/Makefile.am, src/Makefile.in, src/Message.cpp, + src/dvisvgm.cpp, src/macros.h, src/test-all.cpp: + first unstable version with redesigned font handling + +2007-03-07 Martin Gieseking + + * src/Font.cpp, src/Font.h: + added Font classes (not yet error-free) + +2007-03-06 Martin Gieseking + + * src/DVIReader.h, src/DVIToSVG.cpp, src/FontManager.cpp, + src/FontManager.h: + added FontManager skeleton, fixed bug in makehead + +2007-03-03 Martin Gieseking + + * src/DVIReader.cpp, src/FontManager.cpp, src/VFReader.cpp: + added some more skeleton code + +2007-03-02 Martin Gieseking + + * src/DVIReader.cpp, src/Makefile, src/Makefile.in, src/VFReader.cpp, + src/VFReader.h, src/options.ggo: + added skeleton of VFReader + +2007-01-10 Martin Gieseking + + * INSTALL, Makefile.am, NEWS, README, configure.ac, doc/Makefile, + doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, + gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, + gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, + gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, + gzstream/version, map/cork-lm.map, mkwindist.pl, potracelib/Makefile.am, + potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h, + rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, rpm/dvisvgm.spec, + rpm/dvisvgm.spec.in: + moved sources + +2007-01-09 Martin Gieseking + + * map/cork-lm.map, rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, + rpm/dvisvgm.spec, rpm/dvisvgm.spec.in: + moved files to trunk + + * INSTALL, Makefile.am, NEWS, README, configure.ac, doc/Makefile, + doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, + gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, + gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, + gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, + gzstream/version, mkwindist.pl, potracelib/Makefile.am, + potracelib/auxiliary.h, potracelib/bitmap.h, potracelib/curve.c, + potracelib/curve.h, potracelib/decompose.c, potracelib/decompose.h, + potracelib/lists.h, potracelib/potracelib.c, potracelib/potracelib.h, + potracelib/progress.h, potracelib/trace.c, potracelib/trace.h, + rpm/Makefile, rpm/Makefile.am, rpm/Makefile.in, rpm/dvisvgm.spec, + rpm/dvisvgm.spec.in, src/A, src/Bitmap.cpp, src/Bitmap.h, + src/BoundingBox.cpp, src/BoundingBox.h, src/Calculator.cpp, + src/Calculator.h, src/CharmapTranslator.cpp, src/CharmapTranslator.h, + src/DVIActions.h, src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, + src/DVIBBoxReader.h, src/DVIReader.cpp, src/DVIReader.h, + src/DVIToSVG.cpp, src/DVIToSVG.h, src/DVIToSVGActions.cpp, + src/DVIToSVGActions.h, src/FileFinder.cpp, src/FileFinder.h, + src/FileSystem.cpp, src/FileSystem.h, src/FontEmitter.h, + src/FontEngine.cpp, src/FontEngine.h, src/FontGlyph.cpp, src/FontGlyph.h, + src/FontInfo.cpp, src/FontInfo.h, src/FontMap.cpp, src/FontMap.h, + src/FontTracer.h, src/GFReader.cpp, src/GFReader.h, src/GFTracer.cpp, + src/GFTracer.h, src/KPSFileFinder.cpp, src/KPSFileFinder.h, src/Makefile, + src/Makefile.am, src/Makefile.in, src/Makefile.orig, src/Matrix.cpp, + src/Matrix.h, src/Message.cpp, src/Message.h, src/MessageException.h, + src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, + src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, + src/StreamCounter.h, src/TFM.cpp, src/TFM.h, + src/TransformationMatrix.cpp, src/TransformationMatrix.h, + src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, + src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, + src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp, src/getopt.c, + src/getopt.h, src/getopt1.c, src/global.cpp, src/global.h, + src/gzstream.cpp, src/gzstream.h, src/macros.h, src/miktex-core.def, + src/miktex-kps.def, src/miktex-kps.h, src/options.ggo, src/test-all.cpp, + src/tests/CalculatorTest.h, src/tests/PageSizeTest.h, + src/tests/StreamCounterTest.h, src/types.h: + moved files to trunk subfolder + +2007-01-05 Martin Gieseking + + * Makefile, Makefile.am, Makefile.in, README, config.status, configure.ac, + potracelib/Makefile.am, potracelib/bitops.h, potracelib/flate.c, + potracelib/flate.h, src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, + src/BoundingBox.h, src/Calculator.cpp, src/Calculator.h, + src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIActions.h, + src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, + src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, + src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, + src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, + src/KPSFileFinder.h, src/Makefile.am, src/Matrix.cpp, src/Matrix.h, + src/Message.cpp, src/Message.h, src/MessageException.h, + src/MetafontWrapper.cpp, src/MetafontWrapper.h, src/PSInterpreter.cpp, + src/PSInterpreter.h, src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, + src/PSState.h, src/PageSize.cpp, src/PageSize.h, src/Pair.h, + src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, + src/StreamCounter.h, src/TFM.cpp, src/TFM.h, + src/TransformationMatrix.cpp, src/TransformationMatrix.h, + src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, + src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, + src/dvisvgm.cpp, src/global.cpp, src/global.h, src/macros.h, + src/test-all.cpp, src/types.h: + minor modifications + +2007-01-03 Martin Gieseking + + * configure: + removed configure from repository + + * Makefile, Makefile.am, Makefile.in, config.h, config.h.in, + config.status, configure, configure.ac, doc/Makefile, + potracelib/Makefile.am, potracelib/auxiliary.h, potracelib/bitmap.h, + potracelib/bitops.h, potracelib/curve.c, potracelib/curve.h, + potracelib/decompose.c, potracelib/decompose.h, potracelib/flate.c, + potracelib/flate.h, potracelib/lists.h, potracelib/potracelib.c, + potracelib/potracelib.h, potracelib/progress.h, potracelib/trace.c, + potracelib/trace.h, src/Makefile, src/Makefile.am, src/Makefile.in: + added potracelib to distribution + + * NEWS, mkwindist.pl, src/KPSFileFinder.cpp: + updated homepage + +2006-12-31 Martin Gieseking + + * src/KPSFileFinder.cpp: + fixed namepsace bug + + * Makefile, config.status, configure, configure.ac, doc/Makefile, + doc/dvisvgm.1, src/FileSystem.cpp, src/FontEngine.cpp, + src/KPSFileFinder.cpp, src/Makefile, src/dvisvgm.cpp, src/test-all.cpp: + some minor fixes + + * NEWS, configure.ac, src/DVIToSVG.cpp, src/FileSystem.cpp, + src/FontEngine.cpp, src/GFTracer.cpp, src/KPSFileFinder.cpp, + src/Makefile.orig, src/Matrix.h, src/Message.cpp, src/PageSize.cpp, + src/TransformationMatrix.cpp, src/dvisvgm.cpp: + updated to MikTeX 2.5 support + +2006-08-01 Martin Gieseking + + * configure.ac: + enabled svn keyword expansion + + * Makefile, Makefile.in, NEWS, aclocal.m4, autom4te.cache/output.0, + autom4te.cache/requests, autom4te.cache/traces.0, config.h, config.log, + config.status, configure, configure.ac, doc/Makefile, doc/Makefile.in, + doc/dvisvgm.1, src/FontEngine.cpp, src/Makefile, src/Makefile.in, + src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp: + added support for freetype version >= 2.1.1 + +2006-04-12 Martin Gieseking + + * src/lshort-cm.dvi, src/lshort-cm.svg, src/lshort-cm.svgz, + src/lshort.dvi, src/lshort.svg, src/lshort.svgz: + removed files that need not be version controlled + + * src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, src/BoundingBox.h, + src/Calculator.cpp, src/Calculator.h, src/CharmapTranslator.cpp, + src/CharmapTranslator.h, src/DVIActions.h, src/DVIBBoxActions.h, + src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, src/DVIReader.cpp, + src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, + src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, + src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, + src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, + src/KPSFileFinder.h, src/Message.cpp, src/Message.h, + src/MessageException.h, src/MetafontWrapper.cpp, src/MetafontWrapper.h, + src/PSObject.cpp, src/PSObject.h, src/PageSize.cpp, src/PageSize.h, + src/Pair.h, src/SVGFontEmitter.cpp, src/SVGFontEmitter.h, + src/SVGFontTraceEmitter.cpp, src/SVGFontTraceEmitter.h, + src/StreamCounter.h, src/TFM.cpp, src/TFM.h, + src/TransformationMatrix.cpp, src/TransformationMatrix.h, + src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, + src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, + src/dvisvgm.cpp, src/global.cpp, src/global.h, src/macros.h, + src/test-all.cpp, src/tests/CalculatorTest.h, src/tests/PageSizeTest.h, + src/tests/StreamCounterTest.h, src/types.h: + changed keyword tags + + * COPYING, INSTALL, Makefile, Makefile.am, Makefile.in, + Martins_svg_neu.svg, NEWS, README, aclocal.m4, autom4te.cache/output.0, + autom4te.cache/requests, autom4te.cache/traces.0, cmdline.c, + config.guess, config.h, config.h.in, config.log, config.status, + config.sub, configure, configure.ac, depcomp, doc/Makefile, + doc/Makefile.am, doc/Makefile.in, doc/dvisvgm.1, doc/dvisvgm.1.in, + gpl.txt, gzstream/COPYING.LIB, gzstream/Makefile, gzstream/README, + gzstream/gzstream.cpp, gzstream/gzstream.h, gzstream/index.html, + gzstream/logo.gif, gzstream/test_gunzip.C, gzstream/test_gzip.C, + gzstream/version, install-sh, map/cork-lm.map, missing, mkwindist.pl, + src/A, src/Bitmap.cpp, src/Bitmap.h, src/BoundingBox.cpp, + src/BoundingBox.h, src/Calculator.cpp, src/Calculator.h, + src/CharmapTranslator.cpp, src/CharmapTranslator.h, src/DVIActions.h, + src/DVIBBoxActions.h, src/DVIBBoxReader.cpp, src/DVIBBoxReader.h, + src/DVIReader.cpp, src/DVIReader.h, src/DVIToSVG.cpp, src/DVIToSVG.h, + src/DVIToSVGActions.cpp, src/DVIToSVGActions.h, src/FileFinder.cpp, + src/FileFinder.h, src/FileSystem.cpp, src/FileSystem.h, + src/FontEmitter.h, src/FontEngine.cpp, src/FontEngine.h, + src/FontGlyph.cpp, src/FontGlyph.h, src/FontInfo.cpp, src/FontInfo.h, + src/FontMap.cpp, src/FontMap.h, src/FontTracer.h, src/GFReader.cpp, + src/GFReader.h, src/GFTracer.cpp, src/GFTracer.h, src/KPSFileFinder.cpp, + src/KPSFileFinder.h, src/Makefile, src/Makefile.am, src/Makefile.in, + src/Makefile.orig, src/Matrix.cpp, src/Matrix.h, src/Message.cpp, + src/Message.h, src/MessageException.h, src/MetafontWrapper.cpp, + src/MetafontWrapper.h, src/PSInterpreter.cpp, src/PSInterpreter.h, + src/PSObject.cpp, src/PSObject.h, src/PSState.cpp, src/PSState.h, + src/PageSize.cpp, src/PageSize.h, src/Pair.h, src/SVGFontEmitter.cpp, + src/SVGFontEmitter.h, src/SVGFontTraceEmitter.cpp, + src/SVGFontTraceEmitter.h, src/StreamCounter.h, src/TFM.cpp, src/TFM.h, + src/TransformationMatrix.cpp, src/TransformationMatrix.h, + src/XMLDocTypeNode.h, src/XMLDocument.cpp, src/XMLDocument.h, + src/XMLNode.cpp, src/XMLNode.h, src/XMLString.cpp, src/XMLString.h, + src/cmdline.c, src/cmdline.h, src/dvisvgm.cpp, src/getopt.c, + src/getopt.h, src/getopt1.c, src/global.cpp, src/global.h, + src/gzstream.cpp, src/gzstream.h, src/lshort-cm.dvi, src/lshort-cm.svg, + src/lshort-cm.svgz, src/lshort.dvi, src/lshort.svg, src/lshort.svgz, + src/macros.h, src/miktex-core.def, src/miktex-kps.def, src/miktex-kps.h, + src/options.ggo, src/test-all.cpp, src/tests/CalculatorTest.h, + src/tests/PageSizeTest.h, src/tests/StreamCounterTest.h, src/types.h, + stamp-h1, table.txt: + initial import + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/INSTALL b/Build/source/texk/dvisvgm/dvisvgm-src/INSTALL new file mode 100644 index 00000000000..a4b34144dcf --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/INSTALL @@ -0,0 +1,229 @@ +Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/LGPL-2.1.txt b/Build/source/texk/dvisvgm/dvisvgm-src/LGPL-2.1.txt new file mode 100644 index 00000000000..602bfc94635 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/LGPL-2.1.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am new file mode 100644 index 00000000000..b219497ebca --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am @@ -0,0 +1,26 @@ +## This file is part of dvisvgm +## Copyright (C) 2005-2015 Martin Gieseking +## +## Process this file with automake. + +AUTOMAKE_OPTIONS = foreign +EXTRA_DIST = COPYING LGPL-2.1.txt +SUBDIRS = clipper xxHash src tests doc + +if CODE_COVERAGE_ENABLED +lcov_dir=$(top_builddir)/lcov +lcov_file=$(lcov_dir)/lcov.info + +lcov-report: + @mkdir -p $(lcov_dir) + lcov --capture --directory . --no-external -o $(lcov_file) + lcov --remove $(lcov_file) "gzstream.*" -o $(lcov_file) + genhtml --title "dvisvgm" --num-spaces 2 --legend -o $(lcov_dir) $(lcov_file) + +lcov-clean: + @rm -rf $(lcov_dir) + @find . -name "*.gcda" -exec rm {} \; + lcov --zerocounters --directory . + +coverage: lcov-clean check lcov-report +endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS new file mode 100644 index 00000000000..495d70c6dff --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS @@ -0,0 +1,430 @@ +dvisvgm-1.12 (2015-11-18) +- added option --colornames to replace RGB values by SVG color names +- fixed resolving of character codes for fonts without supported chracater maps +- fixed a memory issue that could occur when calling Metafont + +dvisvgm-1.11 (2015-09-21) +- improved mapping of unknown characters to Unicode +- improved handling of text elements in conjunction with \specials (patch by Till Tantau) +- fixed an issue that could lead to (invalid) U+0000 codepoints +- prevent creating invalid XML by quoting xlink:title attributes properly +- documentation: updated links to new website address + +dvisvgm-1.10 (2015-07-15) +- added support for the new XDV format 6 created by XeTeX 0.99992 +- improved mapping of PostScript character names to Unicode points + +dvisvgm-1.9.2 (2015-04-08) +- avoid retracing of fonts if option --no-fonts and --trace-all=y are given +- skip tracer messages if no glyphs have been traced +- extended the build system to generate code coverage reports +- improved some tests of the test suite +- some general code refactorings and improvements + +dvisvgm-1.9.1 (2015-02-28) +- extended --output pattern syntax by arithmetic expressions and width specifiers +- improved formatting of manpage +- fixed Clang build issue (patch by Peter Breitenlohner) +- fixed a build issue occurred with old MinGW compilers +- code cleanup and refactorings + +dvisvgm-1.9 (2014-12-29) +- added partial implementation of PostScript operator 'shfill' to create color + gradient fills (supported shading types: free-form triangular, lattice-form + triangular, Coons, and tensor-product patch meshes) +- added options --grad-segments, --grad-overlap, and --grad-simplify to control + the approximation of color gradients +- added option --no-merge to create separate text elements for each character + (patch by Khaled Hosny) +- added a simple progress counter to the EPS to SVG converter +- added opt2cpp.py as a free replacement for my non-free opt2cpp.xsl script + (thanks to Khaled Hosny for the implementation and for providing it for free) +- added lookup of Ghostscript library in the Windows registry +- fixed validity check of DVI files +- fixed interaction of color specials and PostScript color operators +- several code refactorings and improvements + +dvisvgm-1.8.1 (2014-08-29) +- unreferenced clipPath elements are now removed from the SVG files +- fixed side-effects caused by unexpected bop/eop operators in + PS specials (LP bug #1350688) +- few improvements to configure.ac (patches by Khaled Hosny) +- removed redundant code + +dvisvgm-1.8 (2014-07-29) +- added option --clipjoin which tells dvisvgm to compute intersections + of clipping paths itself and not to delegate this task to the SVG renderer +- added option --relative to create relative rather than absolute path commands +- added evaluation of PS operator 'clippath' which copies the current clipping + path into the graphics path +- fixed PS operator 'show' to prevent the creation of unintended path overlays +- fixed memory leak in class FontEngine (patch by Khaled Hosny) +- fixed unintended throwing of a DVIException when dvisvgm is called with + option --list-specials +- Cygwin builds of dvisvgm now look for the proper filename of the Ghostscript DLL + +dvisvgm-1.7 (2014-06-18) +- all DVI files are pre-processed now to allow the implementation of + advanced features that rely on data not available on the pages being + converted +- added support for internal hyperref links across pages +- added \special command dvisvgm:rawdef to insert raw SVG fragments to + the section +- added the new \special commands dvisvgm:rawset, dvisvgm:endrawset, and + dvisvgm:rawput to assign and access a sequence of SVG fragments via an + identifier (LP feature request #1215878) +- removed redundant elements from SVG files +- fixed support of external fonts containing characters not mapped by the + embedded unicode tables (LP bug #1276689) +- fixed incorrect extent values shown in conjunction with the preview package +- many refactorings and code improvements + +dvisvgm-1.6 (2014-04-22) +- added option --zoom to "visually" scale the generated SVG graphics while + preserving the original size and position values of the graphic objects +- extended argument syntax of option --linkmark to allow to select the + box/line color +- changed default link marker from 'line' to 'box' +- changed link markers to be only split on line breaks while extended in all + other cases +- if libgs is not directly linked to the binary, dvisvgm now looks for + libgs.so.X instead of libgs.so (supported GS ABIs: X = 7, 8, 9) +- removed time stamp and machine triplet from generated SVG files +- some code improvements and refactorings + +dvisvgm-1.5.3 (2014-04-11) +- improved positioning of PostScript graphics +- fixed positioning of DVI rules/rectangles +- switched internal computations from TeX points (pt) to PostScript points (bp) + +dvisvgm-1.5.2 (2014-01-10) +- fixed handling of global font colors and color specials +- several code improvements + +dvisvgm-1.5.1 (2013-10-29) +- fixed processing of bounding box data created by the preview package +- fixed processing of font definitions across DVI pages +- fixed compilation issues occurred if processing of PS specials is disabled +- don't print the logical page number if it's equal to the physical one +- some minor code improvements + +dvisvgm-1.5 (2013-09-02) +- added support for DVI format 3 as created by pTeX in vertical/tate mode +- added support for DVI format 5 (XDV) as created by XeTeX +- replaced numeric entity references by corresponding UTF-8 characters in + generated SVG files +- added px unit to font-size attributes as used in the stylesheet section + to ensure correct computation of font sizes (LP bug #1215857) +- various code refactorings + +dvisvgm-1.4 (2013-08-02) +- added basic support for CMap files and CID-based fonts +- added character mapping from CIDs to char codes based on the encoding tables of a non-CID font +- added support for OTF fonts +- added evaluation of bounding box data generated by the preview package +- extended option --linkmark to mark hyperlinked areas with an arbitrary background color +- PS handler: improved evaluation of PS header specials +- PS handler: improved evaluation of operator 'show' +- removed DOCTYPE declaration from generated SVG files +- removed encoding attribute from xml declaration (replaces ISO-8859-1 with UTF-8) +- various code improvements and refactorings + +dvisvgm-1.3 (2013-05-13) +- added support for hyperref specials +- added command-line option --linkmarker to select the way how to mark hyperlinked areas +- dvisvgm builds for MiKTeX now try to access the Ghostscript DLL provided by MiKTeX so that + it's no longer necessary to install Ghostscript separately +- improved the handling of TFM files to avoid failures in case of malformed files +- added evaluation of Japanese Font Metric (JFM) files +- the bundled potrace library has been removed from the source tarball as it's easy to build + the latest releases from the original sources available at http://potrace.sourceforge.net +- several code refactorings + +dvisvgm-1.2.2 (2013-04-26) +- fixed a bug that prevented the lookup of fontmap files +- avoid throwing an exception but print a warning message if MiKTeX is not available +- print a warning message if PostScript specials are found but ignored +- added information about "dvisvgm -E" to the --help text and to the manpage +- various code refactorings and cleanups + +dvisvgm-1.2.1 (2013-04-09) +- updated bundled potrace library to version 1.11 +- avoid building bundled potracelib if system library is present (patch by Alexis Ballier) +- allow background color specials to create white background rectangles +- code refactorings and cleanup + +dvisvgm-1.2 (2013-03-01) +- PostScript handler: added support of tiling patterns +- PostScript handler: added support for EPS files with binary headers/footers +- added option --eps to directly convert EPS files to SVG +- added option --precision to select the number of decimal places used in the generated SVG files +- added an optional argument to --help to choose a display variant +- fixed the text alignment of the --help output +- improved handling of PostScript operator "show" +- choose the correct output location if the input file argument contains path specifiers (Windows only) + +dvisvgm-1.1 (2013-01-22) +- added evaluation of pdf:mapline and pdf:mapfile specials +- added evaluation of subfont file definitions (.sfd files) +- added support for TTC (TrueType collection) fonts +- added evaluation of font style parameters given in a font map definition +- renamed option --map-file to --fontmap +- the new option --fontmap allows multiple mapfile arguments and optional mode specifiers +- if a PostScript error occurs, dvisvgm prints an error message together with the + PS operand stack, as generated by Ghostscript +- if font checksums don't match, dvisvgm prints a warning now +- avoid throwing exceptions if referenced encoding files are not available +- added support for 64bit Windows builds +- removed compilation error when using a C++11 compiler (patch by Peter Breitenlohner) +- some code refactorings and improvements + +dvisvgm-1.0.12 (2012-09-27) +- print a message if the processing of PostScript specials is disabled +- the resulting SVG is now scaled to bp ("big point" units) properly +- added the evaluation of PS operators rectclip, rectfill, and rectstroke +- ignore dvips operator bop if present in a PS special +- fixed processing of special strings that contain newline characters + +dvisvgm-1.0.11 (2012-03-09) +- added Ghostscript to library list printed by --version=yes +- fixed a bug in the number parser that could lead to displaced objects (SF bug #3471097) +- corrected the computation of bounding boxes of DVI rules (lp bug #948713) +- improved code compatibility to make dvisvgm compile with clang++ (patch by Vladimir Lomov) +- fixed formatting issues in the manual page +- updated information about bug reporting (tracker moved to Launchpad) + +dvisvgm-1.0.10 (2011-12-18) +- introduced environment variable DVISVGM_COLORS to allow user-defined message colors +- fixed linking issue concerning libfreetype +- fixed potential clashes of character IDs + +dvisvgm-1.0.9 (2011-10-13) +- fixed segfault occurred in TeX Live Win32 caused by mf.exe being unavailable + (thanks to Akira Kakuto for tracking down the issue) +- updated bundled potrace library to version 1.10 +- some minor code improvements + +dvisvgm-1.0.8 (2011-05-31) +- PS handler: added evaluation of PS operators save, restore, and grestoreall +- PS handler: fixed potential segfault caused by invisible zero-length paths +- fixed computation of current drawing position influenced by PS and DVI actions +- don't stop Metafont conversions on errors any longer in order to convert + buggy MF fonts properly + +dvisvgm-1.0.7 (2011-05-06) +- improved overall handling of PS specials +- fixed broken PS special subset 'ps::' +- fixed scaling of PS line properties (width, dash distance, etc.) +- fixed semantics of TPIC special 'ip' (doesn't draw polygon outlines any longer) + +dvisvgm-1.0.6 (2011-04-21) +- fixed segfault occurred if a (malformed) DVI file calls set_char/put_char + without preceding font definition +- added CTRL-C handler +- MiKTeX support updated to version 2.9 +- some code refactorings + +dvisvgm-1.0.5 (2011-03-01) +- added optional integer argument to option -n to disable generation of elements +- added missing unit to width/height attributes of svg root element (SF bug #3185773) +- added integrity check to font cache files +- updated bundled potrace library to version 1.9 +- fixed a couple of minor issues + +dvisvgm-1.0.4 (2010-12-18) +- added missing line width/dash pattern scaling to PS handler +- fixed scaling issue in PS positioning +- fixed compilation issue related to FreeType 2.4.0 + +dvisvgm-1.0.3 (2010-08-06) +- applied some more portability patches for TeX Live +- fixed a potential memory issue +- fixed a transformation issue regarding special 'psfile' (SF bug #3037372) + +dvisvgm-1.0.2 (2010-06-22) +- applied latest TeX Live portability patches sent by Peter Breitenlohner and Karl Berry +- fixed a potrace name clash occurred on Mac OS X Tiger +- fixed putchar() name clash occurred on Solaris +- fixed a couple of conversion warnings +- updated the test suite + +dvisvgm-1.0.1 (2010-06-11) +- fixed a memory issue in the PS handler that could lead to a segfault (SF bug #3013392) +- fixed a recursion issue in the PS handler +- suppress ANSI color code when terminating + +dvisvgm-1.0 (2010-06-08) +- conversion of multiple pages (must be enabled explicitly, see option --pages) +- added transparency support to the PS handler +- improved conversion results of the PS handler +- added support for computation of local bounding boxes +- optional colorization of dvisvgm messages (option --color) +- improved progress indicator (option --progress) +- a couple of improvements of the build system + +dvisvgm-0.9.1 (2010-04-23) +- CSS style definitions omit unnecessary fonts now +- SVG validity was broken when using font elements +- fixed two memory issues that could lead to segfaults + +dvisvgm-0.9 (2010-03-25) +- added option --exact and corresponding algorithms to compute the exact + bounding boxes of characters +- added option --keep that prevents deleting temporary font files +- extended option --trace-all by an optional boolean argument controlling + the re-tracing of glyphs +- fixed bug in evaluation of embedded PS headers +- several code refactorings + +dvisvgm-0.8.8 (2010-02-02) +- added option --libgs and evaluation of environment variable LIBGS + to overwrite the expected file name of the GS shared library + (only available if dvisvgm isn't linked against libgs and GS support + isn't completely disabled) +- option --bbox can now be used to enlarge the minimal bounding box by + a given amount +- fixed bug in evaluation of option --page +- applied patches sent by Peter Breitenlohner to prepare the integration of + dvisvgm into TeX Live +- some code refactorings + +dvisvgm-0.8.7 (2009-11-09) +- fixed a bounding box issue concerning italic corrections +- PS handler: zero-length paths are now drawn as dots +- PS handler: fixed a path positioning issue +- PS handler: colors set by color specials are now considered properly +- added macro {?nl} to be used with special dvisvgm:raw + +dvisvgm-0.8.6 (2009-10-13) +- renamed command-line option --bbox-format to --bbox +- option --bbox can now be used to set an arbitrary bounding box +- added the two special variants "dvisvgm:bbox abs" and "dvisvgm:bbox fix" +- PS clipping path sequences and intersections are now handled correctly +- fixed a PS bounding box bug +- fixed a couple of PS positioning issues reported by John Bowman +- fixed a bit shift overflow in the font tracer occurred on 64-bit systems + +dvisvgm-0.8.5 (2009-10-01) +- added an optional depth parameter to special dvisvgm:raw +- updated the man page +- added LGPL license text needed for the gzstream wrapper classes + +dvisvgm-0.8.4 (2009-09-17) +- improved the command-line parser to be more POSIX-compliant +- added a simple progress indicator for time-consuming special operations +- option --cache prints more information about the cached fonts +- fixed a clipping bug in the PostScript handler + (thanks to John Bowman for also providing a patch for this issue) +- fixed a bug in computation of the PS bounding box +- fixed a memory bug in the GF tracer module + +dvisvgm-0.8.3 (2009-08-28) +- added basic evaluation of the PostScript "show" operator + (handles PSTricks Type 3 fonts properly now) +- improved checks for Ghostscript and potrace library in configure script +- external Ghostscript and potrace development files are used if available +- PostScript header/prologue files are now loaded regardless of converted page +- replaced command-line option variant --cache=? by --cache + +dvisvgm-0.8.2 (2009-08-24) +- changed license of dvisvgm to GPL version 3 or later +- replaced getopt-based command-line parser by own implementation + in order to simplify future internationalizations +- fixed memory bug in fontmap reader + +dvisvgm-0.8.1 (2009-08-02) +- added evaluation of more psfile parameters +- fixed computation of bounding box in psfile special +- fixed compilation errors and a conversion bug occurred on x64 systems + +dvisvgm-0.8 (2009-07-27) +- experimental evaluation of PostScript specials has been added (requires + a recent version of the Ghostscript shared library libgs.so or gsdll32.dll) +- several code improvements and refactorings +- fixed compilation bug occurred when using GCC 4.4.x + +dvisvgm-0.7.3 (2009-04-24) +- fixed bug in font map reader that could cause a segmentation fault +- fixed bug in creation of shorthand path drawing commands +- fixed bug in TPIC special handler + +dvisvgm-0.7.2 (2009-04-02) +- font caching has been added (speeds up embedding of bitmap fonts) +- added option --trace-all that enables tracing of all glyphs of all + bitmap fonts used in the current DVI file. Even glyphs that are currently + not needed are considered. This avoids multiple calls of Metafont for the + same fonts. In combination with the new caching functionality this can + drastically increase the speed of successive dvisvgm calls. +- if option --no-fonts is used, all glyph sizes are now computed correctly +- use shorthand path commands in SVG fonts if possible + +dvisvgm-0.7.1 (2009-03-09) +- evaluation of a subset of emTeX specials has been added +- specials for embedding of raw SVG snippets have been added +- evaluation of TPIC specials has been added +- added background color support +- added option -n, --no-fonts that replaces fonts by paths + (enables applications w/o SVG font support to render dvisvgm's output properly) +- moved defs to top of SVG file to make Firefox's SVG renderer happy +- fixed bug in color handler + +dvisvgm-0.7 (2009-02-16) +- basic support for evaluation of specials has been added +- evaluation of color specials has been added +- renamed command-line option -S to --no-specials and inverted previous behavior +- selected special sets can be disabled by optional arguments to --no-specials + (currently only color specials) +- added option --no-style (see manpage for further details) +- added optional '+' flag to option --map-file (see manpage for further details) +- fixed \magnificaton bug (dvi magnification factor is now applied properly) +- fixed buggy call of maketfm/makemf in Windows/MiKTeX version +- fixed buggy evaluation of command-line argument -m/--map-file +- several internal code improvements + +dvisvgm-0.6.1 (2009-01-29) +- added support for dvips map files +- removed dependency on dvipdfm's map file (now ps2pk.map, psfonts.map or dvipdfm.map is used by default) +- fixed compilation bug #2535497 +- some internal refactorings + +dvisvgm-0.6 (2009-01-23) +- added support for varying font encodings +- updated MiKTeX support using its COM interface +- fixed incomplete handling of nested virtual fonts +- fixed a font handling bug that could cause segmentation faults +- fixed bug in matrix transformation code +- updated bundled potrace library to version 1.8 + +dvisvgm-0.5 (2007-03-26) +- redesigned and improved font handling +- added support for virtual fonts +- evaluation of dvipdfm's map file to find font files with differing + names (e.g. cork-lmr10 => lmr10) +- automatic invocation of mktexmf etc. in case of missing font files (tfm, mf) +- command-line option -m has been renamed to -M +- added command-line options -m/--map-file and -n/--no-mktexmf +- memory bug in StreamCounter class has been fixed +- added sources of Peter Selinger's potrace library (part of potrace, http://potrace.sourceforge.net) + to simplify the build process + +dvisvgm-0.4.3 (2007-01-03) +- problem with changed freetype API (freetype version >= 2.2.1) has been fixed +- updated MiKTeX support to version 2.5 +- minor code improvements +- some unit tests based on CxxTest (http://cxxtest.sourceforge.net) have been added + +dvisvgm-0.4.2 (2005-09-22) +- added SVG transformation options +- some bugfixes in command line frontend and TFM handling +- code refactorings to improve modularity and extensibility + +dvisvgm-0.4.1 (2005-09-02) +- added option -b to specify the bounding box +- added a manual page + +dvisvgm-0.4 (2005-08-24) +- Added a glyph tracing module that vectorizes Metafont's bitmap output + if no corresponding Type 1 font file is available. + +dvisvgm-0.3 (2005-08-10) +- Initial public release with basic conversion functionality. diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/README b/Build/source/texk/dvisvgm/dvisvgm-src/README new file mode 100644 index 00000000000..b596c0f3582 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/README @@ -0,0 +1,117 @@ +dvisvgm -- A DVI to SVG converter + +DESCRIPTION + + dvisvgm is a utility for TeX/LaTeX users. It converts DVI and EPS files to + the XML-based scalable vector graphics format SVG. + + +DEPENDENCIES + + dvisvgm relies on the following free libraries: + * Clipper (http://www.angusj.com/delphi/clipper.php) + To compute the intersections of two curved paths, dvisvgm flattens the paths + to polygons, intersects them using Clipper, and reconstructs the curves + afterwards. + + * FreeType 2 (http://www.freetype.org) + This library is used to extract the glyph outlines from vector fonts + (PFB, OTF, TTF). + + * Ghostscript (http://www.ghostscript.com) + The PostScript special handler requires the Ghostscript library + libgs.so (Linux) or gsdll32.dll/gsdll64.dll (Windows) to be installed. + If the configure script finds the corresponding Ghostscript development + files on the system, it directly links against libgs.so.N, where N is the + library's ABI version. Otherwise, the library is looked up at runtime, + and PostScript support is enabled only if libgs.so can be found. Due to + incompatible changes of the Ghostscript API, dvisvgm requires Ghostscript 8.31 + or later. + + * kpathsea (https://tug.org/kpathsea) + This library is part of the Web2C package and is usually installed in + conjunction with a TeX distribution. kpathsea provides functions for + searching files in the large texmf tree. Please ensure that you use the + kpathsea version coming with or matching your TeX system. + + * potracelib (http://potrace.sourceforge.net) + Peter Selinger's bitmap tracing library is utilized to vectorize Metafont's + bitmap output. + + * xxHash (https://github.com/Cyan4973/xxHash) + The xxHash library provides a fast hash algorithm. dvisvgm uses it to + create unique integer values from PostScript character names in order to + store them in a compact way together with their Unicode points. A recent + version of xxHash is bundled with the dvisvgm sources. + + * zlib (http://www.zlib.org) + Compressed SVG files are produced by using functions of this library and the + Gzstream wrapper classes (http://www.cs.unc.edu/Research/compgeom/gzstream) + which are licensed under LGPL version 2.1 (or optionally any later version) + and should be included with this package. + + If you want to build and run the test suite located in the tests subdirectory, + you also need the Google Test libraries (https://github.com/google/googletest). + + +COMPILATION + + Quick installation info: + * type "./configure" + * type "make" + * type "make install" as root (or "sudo make install") + + For generic configuration instructions see the file INSTALL. + + The configure script should recognize all necessary parameters. + If a library is installed but not detected, specify its location + as commandline parameter of configure, e.g. + ./configure --with-freetype=/usr/local/freetype + (all available options can be displayed with ./configure --help) + + The tracer module calls Metafont in case of lacking TFM or PFB files + via a system call. Please ensure that Metafont is installed and + reachable through the search path. + + If you don't like compiling the sources yourself, you can + download pre-compiled executables for Windows and MiKTeX + from the project website instead (see below). + + +USAGE + Information about the command-line interface and the available options can be + found in the manual page. + + +ADDITIONAL INFORMATION + This package is available from CTAN (dviware/dvisvgm) and can be downloaded + from the project website as well: + + http://dvisvgm.bplaced.net + + Here you can find the sources, pre-compiled binaries and further additional + information about the converter and related topics. + + If you've found a bug, please let me know. You can either send me an email or + preferably use the bug tracker at GitHub (https://github.com/mgieseki/dvisvgm). + + +COPYRIGHT + + Copyright (C) 2005-2015 Martin Gieseking + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as 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 . + + See the file COPYING for details. + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/clipper/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/Makefile.am new file mode 100644 index 00000000000..2da73955400 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/Makefile.am @@ -0,0 +1,9 @@ +noinst_LIBRARIES = libclipper.a +libclipper_a_SOURCES = clipper.cpp clipper.hpp +AM_CXXFLAGS = -Wall + +clipper.cpp: clipper.hpp + +@CODE_COVERAGE_RULES@ + +CLEANFILES = *.gcda *.gcno diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.cpp new file mode 100644 index 00000000000..89b7e8e683d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.cpp @@ -0,0 +1,4457 @@ +/******************************************************************************* +* * +* Author : Angus Johnson * +* Version : 6.2.1 * +* Date : 31 October 2014 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2014 * +* * +* License: * +* Use, modification & distribution is subject to Boost Software License Ver 1. * +* http://www.boost.org/LICENSE_1_0.txt * +* * +* Attributions: * +* The code in this library is an extension of Bala Vatti's clipping algorithm: * +* "A generic solution to polygon clipping" * +* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * +* http://portal.acm.org/citation.cfm?id=129906 * +* * +* Computer graphics and geometric modeling: implementation and algorithms * +* By Max K. Agoston * +* Springer; 1 edition (January 4, 2005) * +* http://books.google.com/books?q=vatti+clipping+agoston * +* * +* See also: * +* "Polygon Offsetting by Computing Winding Numbers" * +* Paper no. DETC2005-85513 pp. 565-575 * +* ASME 2005 International Design Engineering Technical Conferences * +* and Computers and Information in Engineering Conference (IDETC/CIE2005) * +* September 24-28, 2005 , Long Beach, California, USA * +* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * +* * +*******************************************************************************/ + +/******************************************************************************* +* * +* This is a translation of the Delphi Clipper library and the naming style * +* used has retained a Delphi flavour. * +* * +*******************************************************************************/ + +#include "clipper.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace ClipperLib { + +static double const pi = 3.141592653589793238; +static double const two_pi = pi *2; +static double const def_arc_tolerance = 0.25; + +enum Direction { dRightToLeft, dLeftToRight }; + +static int const Unassigned = -1; //edge not currently 'owning' a solution +static int const Skip = -2; //edge that would otherwise close a path + +#define HORIZONTAL (-1.0E+40) +#define TOLERANCE (1.0e-20) +#define NEAR_ZERO(val) (((val) > -TOLERANCE) && ((val) < TOLERANCE)) + +struct TEdge { + IntPoint Bot; + IntPoint Curr; + IntPoint Top; + IntPoint Delta; + double Dx; + PolyType PolyTyp; + EdgeSide Side; + int WindDelta; //1 or -1 depending on winding direction + int WindCnt; + int WindCnt2; //winding count of the opposite polytype + int OutIdx; + TEdge *Next; + TEdge *Prev; + TEdge *NextInLML; + TEdge *NextInAEL; + TEdge *PrevInAEL; + TEdge *NextInSEL; + TEdge *PrevInSEL; +}; + +struct IntersectNode { + TEdge *Edge1; + TEdge *Edge2; + IntPoint Pt; +}; + +struct LocalMinimum { + cInt Y; + TEdge *LeftBound; + TEdge *RightBound; +}; + +struct OutPt; + +struct OutRec { + int Idx; + bool IsHole; + bool IsOpen; + OutRec *FirstLeft; //see comments in clipper.pas + PolyNode *PolyNd; + OutPt *Pts; + OutPt *BottomPt; +}; + +struct OutPt { + int Idx; + IntPoint Pt; + OutPt *Next; + OutPt *Prev; +}; + +struct Join { + OutPt *OutPt1; + OutPt *OutPt2; + IntPoint OffPt; +}; + +struct LocMinSorter +{ + inline bool operator()(const LocalMinimum& locMin1, const LocalMinimum& locMin2) + { + return locMin2.Y < locMin1.Y; + } +}; + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +inline cInt Round(double val) +{ + if ((val < 0)) return static_cast(val - 0.5); + else return static_cast(val + 0.5); +} +//------------------------------------------------------------------------------ + +inline cInt Abs(cInt val) +{ + return val < 0 ? -val : val; +} + +//------------------------------------------------------------------------------ +// PolyTree methods ... +//------------------------------------------------------------------------------ + +void PolyTree::Clear() +{ + for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i) + delete AllNodes[i]; + AllNodes.resize(0); + Childs.resize(0); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyTree::GetFirst() const +{ + if (!Childs.empty()) + return Childs[0]; + else + return 0; +} +//------------------------------------------------------------------------------ + +int PolyTree::Total() const +{ + int result = (int)AllNodes.size(); + //with negative offsets, ignore the hidden outer polygon ... + if (result > 0 && Childs[0] != AllNodes[0]) result--; + return result; +} + +//------------------------------------------------------------------------------ +// PolyNode methods ... +//------------------------------------------------------------------------------ + +PolyNode::PolyNode(): Childs(), Parent(0), Index(0), m_IsOpen(false) +{ +} +//------------------------------------------------------------------------------ + +int PolyNode::ChildCount() const +{ + return (int)Childs.size(); +} +//------------------------------------------------------------------------------ + +void PolyNode::AddChild(PolyNode& child) +{ + unsigned cnt = (unsigned)Childs.size(); + Childs.push_back(&child); + child.Parent = this; + child.Index = cnt; +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNext() const +{ + if (!Childs.empty()) + return Childs[0]; + else + return GetNextSiblingUp(); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNextSiblingUp() const +{ + if (!Parent) //protects against PolyTree.GetNextSiblingUp() + return 0; + else if (Index == Parent->Childs.size() - 1) + return Parent->GetNextSiblingUp(); + else + return Parent->Childs[Index + 1]; +} +//------------------------------------------------------------------------------ + +bool PolyNode::IsHole() const +{ + bool result = true; + PolyNode* node = Parent; + while (node) + { + result = !result; + node = node->Parent; + } + return result; +} +//------------------------------------------------------------------------------ + +bool PolyNode::IsOpen() const +{ + return m_IsOpen; +} +//------------------------------------------------------------------------------ + +#ifndef use_int32 + +//------------------------------------------------------------------------------ +// Int128 class (enables safe math on signed 64bit integers) +// eg Int128 val1((long64)9223372036854775807); //ie 2^63 -1 +// Int128 val2((long64)9223372036854775807); +// Int128 val3 = val1 * val2; +// val3.AsString => "85070591730234615847396907784232501249" (8.5e+37) +//------------------------------------------------------------------------------ + +class Int128 +{ + public: + ulong64 lo; + long64 hi; + + Int128(long64 _lo = 0) + { + lo = (ulong64)_lo; + if (_lo < 0) hi = -1; else hi = 0; + } + + + Int128(const Int128 &val): lo(val.lo), hi(val.hi){} + + Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){} + + Int128& operator = (const long64 &val) + { + lo = (ulong64)val; + if (val < 0) hi = -1; else hi = 0; + return *this; + } + + bool operator == (const Int128 &val) const + {return (hi == val.hi && lo == val.lo);} + + bool operator != (const Int128 &val) const + { return !(*this == val);} + + bool operator > (const Int128 &val) const + { + if (hi != val.hi) + return hi > val.hi; + else + return lo > val.lo; + } + + bool operator < (const Int128 &val) const + { + if (hi != val.hi) + return hi < val.hi; + else + return lo < val.lo; + } + + bool operator >= (const Int128 &val) const + { return !(*this < val);} + + bool operator <= (const Int128 &val) const + { return !(*this > val);} + + Int128& operator += (const Int128 &rhs) + { + hi += rhs.hi; + lo += rhs.lo; + if (lo < rhs.lo) hi++; + return *this; + } + + Int128 operator + (const Int128 &rhs) const + { + Int128 result(*this); + result+= rhs; + return result; + } + + Int128& operator -= (const Int128 &rhs) + { + *this += -rhs; + return *this; + } + + Int128 operator - (const Int128 &rhs) const + { + Int128 result(*this); + result -= rhs; + return result; + } + + Int128 operator-() const //unary negation + { + if (lo == 0) + return Int128(-hi, 0); + else + return Int128(~hi, ~lo + 1); + } + + operator double() const + { + const double shift64 = 18446744073709551616.0; //2^64 + if (hi < 0) + { + if (lo == 0) return (double)hi * shift64; + else return -(double)(~lo + ~hi * shift64); + } + else + return (double)(lo + hi * shift64); + } + +}; +//------------------------------------------------------------------------------ + +Int128 Int128Mul (long64 lhs, long64 rhs) +{ + bool negate = (lhs < 0) != (rhs < 0); + + if (lhs < 0) lhs = -lhs; + ulong64 int1Hi = ulong64(lhs) >> 32; + ulong64 int1Lo = ulong64(lhs & 0xFFFFFFFF); + + if (rhs < 0) rhs = -rhs; + ulong64 int2Hi = ulong64(rhs) >> 32; + ulong64 int2Lo = ulong64(rhs & 0xFFFFFFFF); + + //nb: see comments in clipper.pas + ulong64 a = int1Hi * int2Hi; + ulong64 b = int1Lo * int2Lo; + ulong64 c = int1Hi * int2Lo + int1Lo * int2Hi; + + Int128 tmp; + tmp.hi = long64(a + (c >> 32)); + tmp.lo = long64(c << 32); + tmp.lo += long64(b); + if (tmp.lo < b) tmp.hi++; + if (negate) tmp = -tmp; + return tmp; +}; +#endif + +//------------------------------------------------------------------------------ +// Miscellaneous global functions +//------------------------------------------------------------------------------ + +bool Orientation(const Path &poly) +{ + return Area(poly) >= 0; +} +//------------------------------------------------------------------------------ + +double Area(const Path &poly) +{ + int size = (int)poly.size(); + if (size < 3) return 0; + + double a = 0; + for (int i = 0, j = size -1; i < size; ++i) + { + a += ((double)poly[j].X + poly[i].X) * ((double)poly[j].Y - poly[i].Y); + j = i; + } + return -a * 0.5; +} +//------------------------------------------------------------------------------ + +double Area(const OutRec &outRec) +{ + OutPt *op = outRec.Pts; + if (!op) return 0; + double a = 0; + do { + a += (double)(op->Prev->Pt.X + op->Pt.X) * (double)(op->Prev->Pt.Y - op->Pt.Y); + op = op->Next; + } while (op != outRec.Pts); + return a * 0.5; +} +//------------------------------------------------------------------------------ + +bool PointIsVertex(const IntPoint &Pt, OutPt *pp) +{ + OutPt *pp2 = pp; + do + { + if (pp2->Pt == Pt) return true; + pp2 = pp2->Next; + } + while (pp2 != pp); + return false; +} +//------------------------------------------------------------------------------ + +int PointInPolygon (const IntPoint &pt, const Path &path) +{ + //returns 0 if false, +1 if true, -1 if pt ON polygon boundary + //See "The Point in Polygon Problem for Arbitrary Polygons" by Hormann & Agathos + //http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.5498&rep=rep1&type=pdf + int result = 0; + size_t cnt = path.size(); + if (cnt < 3) return 0; + IntPoint ip = path[0]; + for(size_t i = 1; i <= cnt; ++i) + { + IntPoint ipNext = (i == cnt ? path[0] : path[i]); + if (ipNext.Y == pt.Y) + { + if ((ipNext.X == pt.X) || (ip.Y == pt.Y && + ((ipNext.X > pt.X) == (ip.X < pt.X)))) return -1; + } + if ((ip.Y < pt.Y) != (ipNext.Y < pt.Y)) + { + if (ip.X >= pt.X) + { + if (ipNext.X > pt.X) result = 1 - result; + else + { + double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) - + (double)(ipNext.X - pt.X) * (ip.Y - pt.Y); + if (!d) return -1; + if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result; + } + } else + { + if (ipNext.X > pt.X) + { + double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) - + (double)(ipNext.X - pt.X) * (ip.Y - pt.Y); + if (!d) return -1; + if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result; + } + } + } + ip = ipNext; + } + return result; +} +//------------------------------------------------------------------------------ + +int PointInPolygon (const IntPoint &pt, OutPt *op) +{ + //returns 0 if false, +1 if true, -1 if pt ON polygon boundary + int result = 0; + OutPt* startOp = op; + for(;;) + { + if (op->Next->Pt.Y == pt.Y) + { + if ((op->Next->Pt.X == pt.X) || (op->Pt.Y == pt.Y && + ((op->Next->Pt.X > pt.X) == (op->Pt.X < pt.X)))) return -1; + } + if ((op->Pt.Y < pt.Y) != (op->Next->Pt.Y < pt.Y)) + { + if (op->Pt.X >= pt.X) + { + if (op->Next->Pt.X > pt.X) result = 1 - result; + else + { + double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) - + (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y); + if (!d) return -1; + if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result; + } + } else + { + if (op->Next->Pt.X > pt.X) + { + double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) - + (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y); + if (!d) return -1; + if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result; + } + } + } + op = op->Next; + if (startOp == op) break; + } + return result; +} +//------------------------------------------------------------------------------ + +bool Poly2ContainsPoly1(OutPt *OutPt1, OutPt *OutPt2) +{ + OutPt* op = OutPt1; + do + { + //nb: PointInPolygon returns 0 if false, +1 if true, -1 if pt on polygon + int res = PointInPolygon(op->Pt, OutPt2); + if (res >= 0) return res > 0; + op = op->Next; + } + while (op != OutPt1); + return true; +} +//---------------------------------------------------------------------- + +bool SlopesEqual(const TEdge &e1, const TEdge &e2, bool UseFullInt64Range) +{ +#ifndef use_int32 + if (UseFullInt64Range) + return Int128Mul(e1.Delta.Y, e2.Delta.X) == Int128Mul(e1.Delta.X, e2.Delta.Y); + else +#endif + return e1.Delta.Y * e2.Delta.X == e1.Delta.X * e2.Delta.Y; +} +//------------------------------------------------------------------------------ + +bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, + const IntPoint pt3, bool UseFullInt64Range) +{ +#ifndef use_int32 + if (UseFullInt64Range) + return Int128Mul(pt1.Y-pt2.Y, pt2.X-pt3.X) == Int128Mul(pt1.X-pt2.X, pt2.Y-pt3.Y); + else +#endif + return (pt1.Y-pt2.Y)*(pt2.X-pt3.X) == (pt1.X-pt2.X)*(pt2.Y-pt3.Y); +} +//------------------------------------------------------------------------------ + +bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, + const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range) +{ +#ifndef use_int32 + if (UseFullInt64Range) + return Int128Mul(pt1.Y-pt2.Y, pt3.X-pt4.X) == Int128Mul(pt1.X-pt2.X, pt3.Y-pt4.Y); + else +#endif + return (pt1.Y-pt2.Y)*(pt3.X-pt4.X) == (pt1.X-pt2.X)*(pt3.Y-pt4.Y); +} +//------------------------------------------------------------------------------ + +inline bool IsHorizontal(TEdge &e) +{ + return e.Delta.Y == 0; +} +//------------------------------------------------------------------------------ + +inline double GetDx(const IntPoint pt1, const IntPoint pt2) +{ + return (pt1.Y == pt2.Y) ? + HORIZONTAL : (double)(pt2.X - pt1.X) / (pt2.Y - pt1.Y); +} +//--------------------------------------------------------------------------- + +inline void SetDx(TEdge &e) +{ + e.Delta.X = (e.Top.X - e.Bot.X); + e.Delta.Y = (e.Top.Y - e.Bot.Y); + + if (e.Delta.Y == 0) e.Dx = HORIZONTAL; + else e.Dx = (double)(e.Delta.X) / e.Delta.Y; +} +//--------------------------------------------------------------------------- + +inline void SwapSides(TEdge &Edge1, TEdge &Edge2) +{ + EdgeSide Side = Edge1.Side; + Edge1.Side = Edge2.Side; + Edge2.Side = Side; +} +//------------------------------------------------------------------------------ + +inline void SwapPolyIndexes(TEdge &Edge1, TEdge &Edge2) +{ + int OutIdx = Edge1.OutIdx; + Edge1.OutIdx = Edge2.OutIdx; + Edge2.OutIdx = OutIdx; +} +//------------------------------------------------------------------------------ + +inline cInt TopX(TEdge &edge, const cInt currentY) +{ + return ( currentY == edge.Top.Y ) ? + edge.Top.X : edge.Bot.X + Round(edge.Dx *(currentY - edge.Bot.Y)); +} +//------------------------------------------------------------------------------ + +void IntersectPoint(TEdge &Edge1, TEdge &Edge2, IntPoint &ip) +{ +#ifdef use_xyz + ip.Z = 0; +#endif + + double b1, b2; + if (Edge1.Dx == Edge2.Dx) + { + ip.Y = Edge1.Curr.Y; + ip.X = TopX(Edge1, ip.Y); + return; + } + else if (Edge1.Delta.X == 0) + { + ip.X = Edge1.Bot.X; + if (IsHorizontal(Edge2)) + ip.Y = Edge2.Bot.Y; + else + { + b2 = Edge2.Bot.Y - (Edge2.Bot.X / Edge2.Dx); + ip.Y = Round(ip.X / Edge2.Dx + b2); + } + } + else if (Edge2.Delta.X == 0) + { + ip.X = Edge2.Bot.X; + if (IsHorizontal(Edge1)) + ip.Y = Edge1.Bot.Y; + else + { + b1 = Edge1.Bot.Y - (Edge1.Bot.X / Edge1.Dx); + ip.Y = Round(ip.X / Edge1.Dx + b1); + } + } + else + { + b1 = Edge1.Bot.X - Edge1.Bot.Y * Edge1.Dx; + b2 = Edge2.Bot.X - Edge2.Bot.Y * Edge2.Dx; + double q = (b2-b1) / (Edge1.Dx - Edge2.Dx); + ip.Y = Round(q); + if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx)) + ip.X = Round(Edge1.Dx * q + b1); + else + ip.X = Round(Edge2.Dx * q + b2); + } + + if (ip.Y < Edge1.Top.Y || ip.Y < Edge2.Top.Y) + { + if (Edge1.Top.Y > Edge2.Top.Y) + ip.Y = Edge1.Top.Y; + else + ip.Y = Edge2.Top.Y; + if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx)) + ip.X = TopX(Edge1, ip.Y); + else + ip.X = TopX(Edge2, ip.Y); + } + //finally, don't allow 'ip' to be BELOW curr.Y (ie bottom of scanbeam) ... + if (ip.Y > Edge1.Curr.Y) + { + ip.Y = Edge1.Curr.Y; + //use the more vertical edge to derive X ... + if (std::fabs(Edge1.Dx) > std::fabs(Edge2.Dx)) + ip.X = TopX(Edge2, ip.Y); else + ip.X = TopX(Edge1, ip.Y); + } +} +//------------------------------------------------------------------------------ + +void ReversePolyPtLinks(OutPt *pp) +{ + if (!pp) return; + OutPt *pp1, *pp2; + pp1 = pp; + do { + pp2 = pp1->Next; + pp1->Next = pp1->Prev; + pp1->Prev = pp2; + pp1 = pp2; + } while( pp1 != pp ); +} +//------------------------------------------------------------------------------ + +void DisposeOutPts(OutPt*& pp) +{ + if (pp == 0) return; + pp->Prev->Next = 0; + while( pp ) + { + OutPt *tmpPp = pp; + pp = pp->Next; + delete tmpPp; + } +} +//------------------------------------------------------------------------------ + +inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt) +{ + std::memset(e, 0, sizeof(TEdge)); + e->Next = eNext; + e->Prev = ePrev; + e->Curr = Pt; + e->OutIdx = Unassigned; +} +//------------------------------------------------------------------------------ + +void InitEdge2(TEdge& e, PolyType Pt) +{ + if (e.Curr.Y >= e.Next->Curr.Y) + { + e.Bot = e.Curr; + e.Top = e.Next->Curr; + } else + { + e.Top = e.Curr; + e.Bot = e.Next->Curr; + } + SetDx(e); + e.PolyTyp = Pt; +} +//------------------------------------------------------------------------------ + +TEdge* RemoveEdge(TEdge* e) +{ + //removes e from double_linked_list (but without removing from memory) + e->Prev->Next = e->Next; + e->Next->Prev = e->Prev; + TEdge* result = e->Next; + e->Prev = 0; //flag as removed (see ClipperBase.Clear) + return result; +} +//------------------------------------------------------------------------------ + +inline void ReverseHorizontal(TEdge &e) +{ + //swap horizontal edges' Top and Bottom x's so they follow the natural + //progression of the bounds - ie so their xbots will align with the + //adjoining lower edge. [Helpful in the ProcessHorizontal() method.] + std::swap(e.Top.X, e.Bot.X); +#ifdef use_xyz + std::swap(e.Top.Z, e.Bot.Z); +#endif +} +//------------------------------------------------------------------------------ + +void SwapPoints(IntPoint &pt1, IntPoint &pt2) +{ + IntPoint tmp = pt1; + pt1 = pt2; + pt2 = tmp; +} +//------------------------------------------------------------------------------ + +bool GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, + IntPoint pt2b, IntPoint &pt1, IntPoint &pt2) +{ + //precondition: segments are Collinear. + if (Abs(pt1a.X - pt1b.X) > Abs(pt1a.Y - pt1b.Y)) + { + if (pt1a.X > pt1b.X) SwapPoints(pt1a, pt1b); + if (pt2a.X > pt2b.X) SwapPoints(pt2a, pt2b); + if (pt1a.X > pt2a.X) pt1 = pt1a; else pt1 = pt2a; + if (pt1b.X < pt2b.X) pt2 = pt1b; else pt2 = pt2b; + return pt1.X < pt2.X; + } else + { + if (pt1a.Y < pt1b.Y) SwapPoints(pt1a, pt1b); + if (pt2a.Y < pt2b.Y) SwapPoints(pt2a, pt2b); + if (pt1a.Y < pt2a.Y) pt1 = pt1a; else pt1 = pt2a; + if (pt1b.Y > pt2b.Y) pt2 = pt1b; else pt2 = pt2b; + return pt1.Y > pt2.Y; + } +} +//------------------------------------------------------------------------------ + +bool FirstIsBottomPt(const OutPt* btmPt1, const OutPt* btmPt2) +{ + OutPt *p = btmPt1->Prev; + while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Prev; + double dx1p = std::fabs(GetDx(btmPt1->Pt, p->Pt)); + p = btmPt1->Next; + while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Next; + double dx1n = std::fabs(GetDx(btmPt1->Pt, p->Pt)); + + p = btmPt2->Prev; + while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Prev; + double dx2p = std::fabs(GetDx(btmPt2->Pt, p->Pt)); + p = btmPt2->Next; + while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Next; + double dx2n = std::fabs(GetDx(btmPt2->Pt, p->Pt)); + return (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n); +} +//------------------------------------------------------------------------------ + +OutPt* GetBottomPt(OutPt *pp) +{ + OutPt* dups = 0; + OutPt* p = pp->Next; + while (p != pp) + { + if (p->Pt.Y > pp->Pt.Y) + { + pp = p; + dups = 0; + } + else if (p->Pt.Y == pp->Pt.Y && p->Pt.X <= pp->Pt.X) + { + if (p->Pt.X < pp->Pt.X) + { + dups = 0; + pp = p; + } else + { + if (p->Next != pp && p->Prev != pp) dups = p; + } + } + p = p->Next; + } + if (dups) + { + //there appears to be at least 2 vertices at BottomPt so ... + while (dups != p) + { + if (!FirstIsBottomPt(p, dups)) pp = dups; + dups = dups->Next; + while (dups->Pt != pp->Pt) dups = dups->Next; + } + } + return pp; +} +//------------------------------------------------------------------------------ + +bool Pt2IsBetweenPt1AndPt3(const IntPoint pt1, + const IntPoint pt2, const IntPoint pt3) +{ + if ((pt1 == pt3) || (pt1 == pt2) || (pt3 == pt2)) + return false; + else if (pt1.X != pt3.X) + return (pt2.X > pt1.X) == (pt2.X < pt3.X); + else + return (pt2.Y > pt1.Y) == (pt2.Y < pt3.Y); +} +//------------------------------------------------------------------------------ + +bool HorzSegmentsOverlap(cInt seg1a, cInt seg1b, cInt seg2a, cInt seg2b) +{ + if (seg1a > seg1b) std::swap(seg1a, seg1b); + if (seg2a > seg2b) std::swap(seg2a, seg2b); + return (seg1a < seg2b) && (seg2a < seg1b); +} + +//------------------------------------------------------------------------------ +// ClipperBase class methods ... +//------------------------------------------------------------------------------ + +ClipperBase::ClipperBase() //constructor +{ + m_CurrentLM = m_MinimaList.begin(); //begin() == end() here + m_UseFullRange = false; +} +//------------------------------------------------------------------------------ + +ClipperBase::~ClipperBase() //destructor +{ + Clear(); +} +//------------------------------------------------------------------------------ + +void RangeTest(const IntPoint& Pt, bool& useFullRange) +{ + if (useFullRange) + { + if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange) + throw "Coordinate outside allowed range"; + } + else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange) + { + useFullRange = true; + RangeTest(Pt, useFullRange); + } +} +//------------------------------------------------------------------------------ + +TEdge* FindNextLocMin(TEdge* E) +{ + for (;;) + { + while (E->Bot != E->Prev->Bot || E->Curr == E->Top) E = E->Next; + if (!IsHorizontal(*E) && !IsHorizontal(*E->Prev)) break; + while (IsHorizontal(*E->Prev)) E = E->Prev; + TEdge* E2 = E; + while (IsHorizontal(*E)) E = E->Next; + if (E->Top.Y == E->Prev->Bot.Y) continue; //ie just an intermediate horz. + if (E2->Prev->Bot.X < E->Bot.X) E = E2; + break; + } + return E; +} +//------------------------------------------------------------------------------ + +TEdge* ClipperBase::ProcessBound(TEdge* E, bool NextIsForward) +{ + TEdge *Result = E; + TEdge *Horz = 0; + + if (E->OutIdx == Skip) + { + //if edges still remain in the current bound beyond the skip edge then + //create another LocMin and call ProcessBound once more + if (NextIsForward) + { + while (E->Top.Y == E->Next->Bot.Y) E = E->Next; + //don't include top horizontals when parsing a bound a second time, + //they will be contained in the opposite bound ... + while (E != Result && IsHorizontal(*E)) E = E->Prev; + } + else + { + while (E->Top.Y == E->Prev->Bot.Y) E = E->Prev; + while (E != Result && IsHorizontal(*E)) E = E->Next; + } + + if (E == Result) + { + if (NextIsForward) Result = E->Next; + else Result = E->Prev; + } + else + { + //there are more edges in the bound beyond result starting with E + if (NextIsForward) + E = Result->Next; + else + E = Result->Prev; + MinimaList::value_type locMin; + locMin.Y = E->Bot.Y; + locMin.LeftBound = 0; + locMin.RightBound = E; + E->WindDelta = 0; + Result = ProcessBound(E, NextIsForward); + m_MinimaList.push_back(locMin); + } + return Result; + } + + TEdge *EStart; + + if (IsHorizontal(*E)) + { + //We need to be careful with open paths because this may not be a + //true local minima (ie E may be following a skip edge). + //Also, consecutive horz. edges may start heading left before going right. + if (NextIsForward) + EStart = E->Prev; + else + EStart = E->Next; + if (EStart->OutIdx != Skip) + { + if (IsHorizontal(*EStart)) //ie an adjoining horizontal skip edge + { + if (EStart->Bot.X != E->Bot.X && EStart->Top.X != E->Bot.X) + ReverseHorizontal(*E); + } + else if (EStart->Bot.X != E->Bot.X) + ReverseHorizontal(*E); + } + } + + EStart = E; + if (NextIsForward) + { + while (Result->Top.Y == Result->Next->Bot.Y && Result->Next->OutIdx != Skip) + Result = Result->Next; + if (IsHorizontal(*Result) && Result->Next->OutIdx != Skip) + { + //nb: at the top of a bound, horizontals are added to the bound + //only when the preceding edge attaches to the horizontal's left vertex + //unless a Skip edge is encountered when that becomes the top divide + Horz = Result; + while (IsHorizontal(*Horz->Prev)) Horz = Horz->Prev; + if (Horz->Prev->Top.X == Result->Next->Top.X) + { + if (!NextIsForward) Result = Horz->Prev; + } + else if (Horz->Prev->Top.X > Result->Next->Top.X) Result = Horz->Prev; + } + while (E != Result) + { + E->NextInLML = E->Next; + if (IsHorizontal(*E) && E != EStart && + E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E); + E = E->Next; + } + if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Prev->Top.X) + ReverseHorizontal(*E); + Result = Result->Next; //move to the edge just beyond current bound + } else + { + while (Result->Top.Y == Result->Prev->Bot.Y && Result->Prev->OutIdx != Skip) + Result = Result->Prev; + if (IsHorizontal(*Result) && Result->Prev->OutIdx != Skip) + { + Horz = Result; + while (IsHorizontal(*Horz->Next)) Horz = Horz->Next; + if (Horz->Next->Top.X == Result->Prev->Top.X) + { + if (!NextIsForward) Result = Horz->Next; + } + else if (Horz->Next->Top.X > Result->Prev->Top.X) Result = Horz->Next; + } + + while (E != Result) + { + E->NextInLML = E->Prev; + if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X) + ReverseHorizontal(*E); + E = E->Prev; + } + if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X) + ReverseHorizontal(*E); + Result = Result->Prev; //move to the edge just beyond current bound + } + + return Result; +} +//------------------------------------------------------------------------------ + +bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed) +{ +#ifdef use_lines + if (!Closed && PolyTyp == ptClip) + throw clipperException("AddPath: Open paths must be subject."); +#else + if (!Closed) + throw clipperException("AddPath: Open paths have been disabled."); +#endif + + int highI = (int)pg.size() -1; + if (Closed) while (highI > 0 && (pg[highI] == pg[0])) --highI; + while (highI > 0 && (pg[highI] == pg[highI -1])) --highI; + if ((Closed && highI < 2) || (!Closed && highI < 1)) return false; + + //create a new edge array ... + TEdge *edges = new TEdge [highI +1]; + + bool IsFlat = true; + //1. Basic (first) edge initialization ... + try + { + edges[1].Curr = pg[1]; + RangeTest(pg[0], m_UseFullRange); + RangeTest(pg[highI], m_UseFullRange); + InitEdge(&edges[0], &edges[1], &edges[highI], pg[0]); + InitEdge(&edges[highI], &edges[0], &edges[highI-1], pg[highI]); + for (int i = highI - 1; i >= 1; --i) + { + RangeTest(pg[i], m_UseFullRange); + InitEdge(&edges[i], &edges[i+1], &edges[i-1], pg[i]); + } + } + catch(...) + { + delete [] edges; + throw; //range test fails + } + TEdge *eStart = &edges[0]; + + //2. Remove duplicate vertices, and (when closed) collinear edges ... + TEdge *E = eStart, *eLoopStop = eStart; + for (;;) + { + //nb: allows matching start and end points when not Closed ... + if (E->Curr == E->Next->Curr && (Closed || E->Next != eStart)) + { + if (E == E->Next) break; + if (E == eStart) eStart = E->Next; + E = RemoveEdge(E); + eLoopStop = E; + continue; + } + if (E->Prev == E->Next) + break; //only two vertices + else if (Closed && + SlopesEqual(E->Prev->Curr, E->Curr, E->Next->Curr, m_UseFullRange) && + (!m_PreserveCollinear || + !Pt2IsBetweenPt1AndPt3(E->Prev->Curr, E->Curr, E->Next->Curr))) + { + //Collinear edges are allowed for open paths but in closed paths + //the default is to merge adjacent collinear edges into a single edge. + //However, if the PreserveCollinear property is enabled, only overlapping + //collinear edges (ie spikes) will be removed from closed paths. + if (E == eStart) eStart = E->Next; + E = RemoveEdge(E); + E = E->Prev; + eLoopStop = E; + continue; + } + E = E->Next; + if ((E == eLoopStop) || (!Closed && E->Next == eStart)) break; + } + + if ((!Closed && (E == E->Next)) || (Closed && (E->Prev == E->Next))) + { + delete [] edges; + return false; + } + + if (!Closed) + { + m_HasOpenPaths = true; + eStart->Prev->OutIdx = Skip; + } + + //3. Do second stage of edge initialization ... + E = eStart; + do + { + InitEdge2(*E, PolyTyp); + E = E->Next; + if (IsFlat && E->Curr.Y != eStart->Curr.Y) IsFlat = false; + } + while (E != eStart); + + //4. Finally, add edge bounds to LocalMinima list ... + + //Totally flat paths must be handled differently when adding them + //to LocalMinima list to avoid endless loops etc ... + if (IsFlat) + { + if (Closed) + { + delete [] edges; + return false; + } + E->Prev->OutIdx = Skip; + if (E->Prev->Bot.X < E->Prev->Top.X) ReverseHorizontal(*E->Prev); + MinimaList::value_type locMin; + locMin.Y = E->Bot.Y; + locMin.LeftBound = 0; + locMin.RightBound = E; + locMin.RightBound->Side = esRight; + locMin.RightBound->WindDelta = 0; + while (E->Next->OutIdx != Skip) + { + E->NextInLML = E->Next; + if (E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E); + E = E->Next; + } + m_MinimaList.push_back(locMin); + m_edges.push_back(edges); + return true; + } + + m_edges.push_back(edges); + bool leftBoundIsForward; + TEdge* EMin = 0; + + //workaround to avoid an endless loop in the while loop below when + //open paths have matching start and end points ... + if (E->Prev->Bot == E->Prev->Top) E = E->Next; + + for (;;) + { + E = FindNextLocMin(E); + if (E == EMin) break; + else if (!EMin) EMin = E; + + //E and E.Prev now share a local minima (left aligned if horizontal). + //Compare their slopes to find which starts which bound ... + MinimaList::value_type locMin; + locMin.Y = E->Bot.Y; + if (E->Dx < E->Prev->Dx) + { + locMin.LeftBound = E->Prev; + locMin.RightBound = E; + leftBoundIsForward = false; //Q.nextInLML = Q.prev + } else + { + locMin.LeftBound = E; + locMin.RightBound = E->Prev; + leftBoundIsForward = true; //Q.nextInLML = Q.next + } + locMin.LeftBound->Side = esLeft; + locMin.RightBound->Side = esRight; + + if (!Closed) locMin.LeftBound->WindDelta = 0; + else if (locMin.LeftBound->Next == locMin.RightBound) + locMin.LeftBound->WindDelta = -1; + else locMin.LeftBound->WindDelta = 1; + locMin.RightBound->WindDelta = -locMin.LeftBound->WindDelta; + + E = ProcessBound(locMin.LeftBound, leftBoundIsForward); + if (E->OutIdx == Skip) E = ProcessBound(E, leftBoundIsForward); + + TEdge* E2 = ProcessBound(locMin.RightBound, !leftBoundIsForward); + if (E2->OutIdx == Skip) E2 = ProcessBound(E2, !leftBoundIsForward); + + if (locMin.LeftBound->OutIdx == Skip) + locMin.LeftBound = 0; + else if (locMin.RightBound->OutIdx == Skip) + locMin.RightBound = 0; + m_MinimaList.push_back(locMin); + if (!leftBoundIsForward) E = E2; + } + return true; +} +//------------------------------------------------------------------------------ + +bool ClipperBase::AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed) +{ + bool result = false; + for (Paths::size_type i = 0; i < ppg.size(); ++i) + if (AddPath(ppg[i], PolyTyp, Closed)) result = true; + return result; +} +//------------------------------------------------------------------------------ + +void ClipperBase::Clear() +{ + DisposeLocalMinimaList(); + for (EdgeList::size_type i = 0; i < m_edges.size(); ++i) + { + //for each edge array in turn, find the first used edge and + //check for and remove any hiddenPts in each edge in the array. + TEdge* edges = m_edges[i]; + delete [] edges; + } + m_edges.clear(); + m_UseFullRange = false; + m_HasOpenPaths = false; +} +//------------------------------------------------------------------------------ + +void ClipperBase::Reset() +{ + m_CurrentLM = m_MinimaList.begin(); + if (m_CurrentLM == m_MinimaList.end()) return; //ie nothing to process + std::sort(m_MinimaList.begin(), m_MinimaList.end(), LocMinSorter()); + + //reset all edges ... + for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm) + { + TEdge* e = lm->LeftBound; + if (e) + { + e->Curr = e->Bot; + e->Side = esLeft; + e->OutIdx = Unassigned; + } + + e = lm->RightBound; + if (e) + { + e->Curr = e->Bot; + e->Side = esRight; + e->OutIdx = Unassigned; + } + } +} +//------------------------------------------------------------------------------ + +void ClipperBase::DisposeLocalMinimaList() +{ + m_MinimaList.clear(); + m_CurrentLM = m_MinimaList.begin(); +} +//------------------------------------------------------------------------------ + +void ClipperBase::PopLocalMinima() +{ + if (m_CurrentLM == m_MinimaList.end()) return; + ++m_CurrentLM; +} +//------------------------------------------------------------------------------ + +IntRect ClipperBase::GetBounds() +{ + IntRect result; + MinimaList::iterator lm = m_MinimaList.begin(); + if (lm == m_MinimaList.end()) + { + result.left = result.top = result.right = result.bottom = 0; + return result; + } + result.left = lm->LeftBound->Bot.X; + result.top = lm->LeftBound->Bot.Y; + result.right = lm->LeftBound->Bot.X; + result.bottom = lm->LeftBound->Bot.Y; + while (lm != m_MinimaList.end()) + { + result.bottom = std::max(result.bottom, lm->LeftBound->Bot.Y); + TEdge* e = lm->LeftBound; + for (;;) { + TEdge* bottomE = e; + while (e->NextInLML) + { + if (e->Bot.X < result.left) result.left = e->Bot.X; + if (e->Bot.X > result.right) result.right = e->Bot.X; + e = e->NextInLML; + } + result.left = std::min(result.left, e->Bot.X); + result.right = std::max(result.right, e->Bot.X); + result.left = std::min(result.left, e->Top.X); + result.right = std::max(result.right, e->Top.X); + result.top = std::min(result.top, e->Top.Y); + if (bottomE == lm->LeftBound) e = lm->RightBound; + else break; + } + ++lm; + } + return result; +} + +//------------------------------------------------------------------------------ +// TClipper methods ... +//------------------------------------------------------------------------------ + +Clipper::Clipper(int initOptions) : ClipperBase() //constructor +{ + m_ActiveEdges = 0; + m_SortedEdges = 0; + m_ExecuteLocked = false; + m_UseFullRange = false; + m_ReverseOutput = ((initOptions & ioReverseSolution) != 0); + m_StrictSimple = ((initOptions & ioStrictlySimple) != 0); + m_PreserveCollinear = ((initOptions & ioPreserveCollinear) != 0); + m_HasOpenPaths = false; +#ifdef use_xyz + m_ZFill = 0; +#endif +} +//------------------------------------------------------------------------------ + +Clipper::~Clipper() //destructor +{ + Clear(); +} +//------------------------------------------------------------------------------ + +#ifdef use_xyz +void Clipper::ZFillFunction(ZFillCallback zFillFunc) +{ + m_ZFill = zFillFunc; +} +//------------------------------------------------------------------------------ +#endif + +void Clipper::Reset() +{ + ClipperBase::Reset(); + m_Scanbeam = ScanbeamList(); + m_ActiveEdges = 0; + m_SortedEdges = 0; + for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm) + InsertScanbeam(lm->Y); +} +//------------------------------------------------------------------------------ + +bool Clipper::Execute(ClipType clipType, Paths &solution, + PolyFillType subjFillType, PolyFillType clipFillType) +{ + if( m_ExecuteLocked ) return false; + if (m_HasOpenPaths) + throw clipperException("Error: PolyTree struct is need for open path clipping."); + m_ExecuteLocked = true; + solution.resize(0); + m_SubjFillType = subjFillType; + m_ClipFillType = clipFillType; + m_ClipType = clipType; + m_UsingPolyTree = false; + bool succeeded = ExecuteInternal(); + if (succeeded) BuildResult(solution); + DisposeAllOutRecs(); + m_ExecuteLocked = false; + return succeeded; +} +//------------------------------------------------------------------------------ + +bool Clipper::Execute(ClipType clipType, PolyTree& polytree, + PolyFillType subjFillType, PolyFillType clipFillType) +{ + if( m_ExecuteLocked ) return false; + m_ExecuteLocked = true; + m_SubjFillType = subjFillType; + m_ClipFillType = clipFillType; + m_ClipType = clipType; + m_UsingPolyTree = true; + bool succeeded = ExecuteInternal(); + if (succeeded) BuildResult2(polytree); + DisposeAllOutRecs(); + m_ExecuteLocked = false; + return succeeded; +} +//------------------------------------------------------------------------------ + +void Clipper::FixHoleLinkage(OutRec &outrec) +{ + //skip OutRecs that (a) contain outermost polygons or + //(b) already have the correct owner/child linkage ... + if (!outrec.FirstLeft || + (outrec.IsHole != outrec.FirstLeft->IsHole && + outrec.FirstLeft->Pts)) return; + + OutRec* orfl = outrec.FirstLeft; + while (orfl && ((orfl->IsHole == outrec.IsHole) || !orfl->Pts)) + orfl = orfl->FirstLeft; + outrec.FirstLeft = orfl; +} +//------------------------------------------------------------------------------ + +bool Clipper::ExecuteInternal() +{ + bool succeeded = true; + try { + Reset(); + if (m_CurrentLM == m_MinimaList.end()) return true; + cInt botY = PopScanbeam(); + do { + InsertLocalMinimaIntoAEL(botY); + ClearGhostJoins(); + ProcessHorizontals(false); + if (m_Scanbeam.empty()) break; + cInt topY = PopScanbeam(); + succeeded = ProcessIntersections(topY); + if (!succeeded) break; + ProcessEdgesAtTopOfScanbeam(topY); + botY = topY; + } while (!m_Scanbeam.empty() || m_CurrentLM != m_MinimaList.end()); + } + catch(...) + { + succeeded = false; + } + + if (succeeded) + { + //fix orientations ... + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec *outRec = m_PolyOuts[i]; + if (!outRec->Pts || outRec->IsOpen) continue; + if ((outRec->IsHole ^ m_ReverseOutput) == (Area(*outRec) > 0)) + ReversePolyPtLinks(outRec->Pts); + } + + if (!m_Joins.empty()) JoinCommonEdges(); + + //unfortunately FixupOutPolygon() must be done after JoinCommonEdges() + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec *outRec = m_PolyOuts[i]; + if (outRec->Pts && !outRec->IsOpen) + FixupOutPolygon(*outRec); + } + + if (m_StrictSimple) DoSimplePolygons(); + } + + ClearJoins(); + ClearGhostJoins(); + return succeeded; +} +//------------------------------------------------------------------------------ + +void Clipper::InsertScanbeam(const cInt Y) +{ + //if (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) return;// avoid duplicates. + m_Scanbeam.push(Y); +} +//------------------------------------------------------------------------------ + +cInt Clipper::PopScanbeam() +{ + const cInt Y = m_Scanbeam.top(); + m_Scanbeam.pop(); + while (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) { m_Scanbeam.pop(); } // Pop duplicates. + return Y; +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeAllOutRecs(){ + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + DisposeOutRec(i); + m_PolyOuts.clear(); +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeOutRec(PolyOutList::size_type index) +{ + OutRec *outRec = m_PolyOuts[index]; + if (outRec->Pts) DisposeOutPts(outRec->Pts); + delete outRec; + m_PolyOuts[index] = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::SetWindingCount(TEdge &edge) +{ + TEdge *e = edge.PrevInAEL; + //find the edge of the same polytype that immediately preceeds 'edge' in AEL + while (e && ((e->PolyTyp != edge.PolyTyp) || (e->WindDelta == 0))) e = e->PrevInAEL; + if (!e) + { + edge.WindCnt = (edge.WindDelta == 0 ? 1 : edge.WindDelta); + edge.WindCnt2 = 0; + e = m_ActiveEdges; //ie get ready to calc WindCnt2 + } + else if (edge.WindDelta == 0 && m_ClipType != ctUnion) + { + edge.WindCnt = 1; + edge.WindCnt2 = e->WindCnt2; + e = e->NextInAEL; //ie get ready to calc WindCnt2 + } + else if (IsEvenOddFillType(edge)) + { + //EvenOdd filling ... + if (edge.WindDelta == 0) + { + //are we inside a subj polygon ... + bool Inside = true; + TEdge *e2 = e->PrevInAEL; + while (e2) + { + if (e2->PolyTyp == e->PolyTyp && e2->WindDelta != 0) + Inside = !Inside; + e2 = e2->PrevInAEL; + } + edge.WindCnt = (Inside ? 0 : 1); + } + else + { + edge.WindCnt = edge.WindDelta; + } + edge.WindCnt2 = e->WindCnt2; + e = e->NextInAEL; //ie get ready to calc WindCnt2 + } + else + { + //nonZero, Positive or Negative filling ... + if (e->WindCnt * e->WindDelta < 0) + { + //prev edge is 'decreasing' WindCount (WC) toward zero + //so we're outside the previous polygon ... + if (Abs(e->WindCnt) > 1) + { + //outside prev poly but still inside another. + //when reversing direction of prev poly use the same WC + if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt; + //otherwise continue to 'decrease' WC ... + else edge.WindCnt = e->WindCnt + edge.WindDelta; + } + else + //now outside all polys of same polytype so set own WC ... + edge.WindCnt = (edge.WindDelta == 0 ? 1 : edge.WindDelta); + } else + { + //prev edge is 'increasing' WindCount (WC) away from zero + //so we're inside the previous polygon ... + if (edge.WindDelta == 0) + edge.WindCnt = (e->WindCnt < 0 ? e->WindCnt - 1 : e->WindCnt + 1); + //if wind direction is reversing prev then use same WC + else if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt; + //otherwise add to WC ... + else edge.WindCnt = e->WindCnt + edge.WindDelta; + } + edge.WindCnt2 = e->WindCnt2; + e = e->NextInAEL; //ie get ready to calc WindCnt2 + } + + //update WindCnt2 ... + if (IsEvenOddAltFillType(edge)) + { + //EvenOdd filling ... + while (e != &edge) + { + if (e->WindDelta != 0) + edge.WindCnt2 = (edge.WindCnt2 == 0 ? 1 : 0); + e = e->NextInAEL; + } + } else + { + //nonZero, Positive or Negative filling ... + while ( e != &edge ) + { + edge.WindCnt2 += e->WindDelta; + e = e->NextInAEL; + } + } +} +//------------------------------------------------------------------------------ + +bool Clipper::IsEvenOddFillType(const TEdge& edge) const +{ + if (edge.PolyTyp == ptSubject) + return m_SubjFillType == pftEvenOdd; else + return m_ClipFillType == pftEvenOdd; +} +//------------------------------------------------------------------------------ + +bool Clipper::IsEvenOddAltFillType(const TEdge& edge) const +{ + if (edge.PolyTyp == ptSubject) + return m_ClipFillType == pftEvenOdd; else + return m_SubjFillType == pftEvenOdd; +} +//------------------------------------------------------------------------------ + +bool Clipper::IsContributing(const TEdge& edge) const +{ + PolyFillType pft, pft2; + if (edge.PolyTyp == ptSubject) + { + pft = m_SubjFillType; + pft2 = m_ClipFillType; + } else + { + pft = m_ClipFillType; + pft2 = m_SubjFillType; + } + + switch(pft) + { + case pftEvenOdd: + //return false if a subj line has been flagged as inside a subj polygon + if (edge.WindDelta == 0 && edge.WindCnt != 1) return false; + break; + case pftNonZero: + if (Abs(edge.WindCnt) != 1) return false; + break; + case pftPositive: + if (edge.WindCnt != 1) return false; + break; + default: //pftNegative + if (edge.WindCnt != -1) return false; + } + + switch(m_ClipType) + { + case ctIntersection: + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.WindCnt2 != 0); + case pftPositive: + return (edge.WindCnt2 > 0); + default: + return (edge.WindCnt2 < 0); + } + break; + case ctUnion: + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.WindCnt2 == 0); + case pftPositive: + return (edge.WindCnt2 <= 0); + default: + return (edge.WindCnt2 >= 0); + } + break; + case ctDifference: + if (edge.PolyTyp == ptSubject) + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.WindCnt2 == 0); + case pftPositive: + return (edge.WindCnt2 <= 0); + default: + return (edge.WindCnt2 >= 0); + } + else + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.WindCnt2 != 0); + case pftPositive: + return (edge.WindCnt2 > 0); + default: + return (edge.WindCnt2 < 0); + } + break; + case ctXor: + if (edge.WindDelta == 0) //XOr always contributing unless open + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.WindCnt2 == 0); + case pftPositive: + return (edge.WindCnt2 <= 0); + default: + return (edge.WindCnt2 >= 0); + } + else + return true; + break; + default: + return true; + } +} +//------------------------------------------------------------------------------ + +OutPt* Clipper::AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt) +{ + OutPt* result; + TEdge *e, *prevE; + if (IsHorizontal(*e2) || ( e1->Dx > e2->Dx )) + { + result = AddOutPt(e1, Pt); + e2->OutIdx = e1->OutIdx; + e1->Side = esLeft; + e2->Side = esRight; + e = e1; + if (e->PrevInAEL == e2) + prevE = e2->PrevInAEL; + else + prevE = e->PrevInAEL; + } else + { + result = AddOutPt(e2, Pt); + e1->OutIdx = e2->OutIdx; + e1->Side = esRight; + e2->Side = esLeft; + e = e2; + if (e->PrevInAEL == e1) + prevE = e1->PrevInAEL; + else + prevE = e->PrevInAEL; + } + + if (prevE && prevE->OutIdx >= 0 && + (TopX(*prevE, Pt.Y) == TopX(*e, Pt.Y)) && + SlopesEqual(*e, *prevE, m_UseFullRange) && + (e->WindDelta != 0) && (prevE->WindDelta != 0)) + { + OutPt* outPt = AddOutPt(prevE, Pt); + AddJoin(result, outPt, e->Top); + } + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt) +{ + AddOutPt( e1, Pt ); + if (e2->WindDelta == 0) AddOutPt(e2, Pt); + if( e1->OutIdx == e2->OutIdx ) + { + e1->OutIdx = Unassigned; + e2->OutIdx = Unassigned; + } + else if (e1->OutIdx < e2->OutIdx) + AppendPolygon(e1, e2); + else + AppendPolygon(e2, e1); +} +//------------------------------------------------------------------------------ + +void Clipper::AddEdgeToSEL(TEdge *edge) +{ + //SEL pointers in PEdge are reused to build a list of horizontal edges. + //However, we don't need to worry about order with horizontal edge processing. + if( !m_SortedEdges ) + { + m_SortedEdges = edge; + edge->PrevInSEL = 0; + edge->NextInSEL = 0; + } + else + { + edge->NextInSEL = m_SortedEdges; + edge->PrevInSEL = 0; + m_SortedEdges->PrevInSEL = edge; + m_SortedEdges = edge; + } +} +//------------------------------------------------------------------------------ + +void Clipper::CopyAELToSEL() +{ + TEdge* e = m_ActiveEdges; + m_SortedEdges = e; + while ( e ) + { + e->PrevInSEL = e->PrevInAEL; + e->NextInSEL = e->NextInAEL; + e = e->NextInAEL; + } +} +//------------------------------------------------------------------------------ + +void Clipper::AddJoin(OutPt *op1, OutPt *op2, const IntPoint OffPt) +{ + Join* j = new Join; + j->OutPt1 = op1; + j->OutPt2 = op2; + j->OffPt = OffPt; + m_Joins.push_back(j); +} +//------------------------------------------------------------------------------ + +void Clipper::ClearJoins() +{ + for (JoinList::size_type i = 0; i < m_Joins.size(); i++) + delete m_Joins[i]; + m_Joins.resize(0); +} +//------------------------------------------------------------------------------ + +void Clipper::ClearGhostJoins() +{ + for (JoinList::size_type i = 0; i < m_GhostJoins.size(); i++) + delete m_GhostJoins[i]; + m_GhostJoins.resize(0); +} +//------------------------------------------------------------------------------ + +void Clipper::AddGhostJoin(OutPt *op, const IntPoint OffPt) +{ + Join* j = new Join; + j->OutPt1 = op; + j->OutPt2 = 0; + j->OffPt = OffPt; + m_GhostJoins.push_back(j); +} +//------------------------------------------------------------------------------ + +void Clipper::InsertLocalMinimaIntoAEL(const cInt botY) +{ + while (m_CurrentLM != m_MinimaList.end() && (m_CurrentLM->Y == botY)) + { + TEdge* lb = m_CurrentLM->LeftBound; + TEdge* rb = m_CurrentLM->RightBound; + PopLocalMinima(); + OutPt *Op1 = 0; + if (!lb) + { + //nb: don't insert LB into either AEL or SEL + InsertEdgeIntoAEL(rb, 0); + SetWindingCount(*rb); + if (IsContributing(*rb)) + Op1 = AddOutPt(rb, rb->Bot); + } + else if (!rb) + { + InsertEdgeIntoAEL(lb, 0); + SetWindingCount(*lb); + if (IsContributing(*lb)) + Op1 = AddOutPt(lb, lb->Bot); + InsertScanbeam(lb->Top.Y); + } + else + { + InsertEdgeIntoAEL(lb, 0); + InsertEdgeIntoAEL(rb, lb); + SetWindingCount( *lb ); + rb->WindCnt = lb->WindCnt; + rb->WindCnt2 = lb->WindCnt2; + if (IsContributing(*lb)) + Op1 = AddLocalMinPoly(lb, rb, lb->Bot); + InsertScanbeam(lb->Top.Y); + } + + if (rb) + { + if(IsHorizontal(*rb)) AddEdgeToSEL(rb); + else InsertScanbeam( rb->Top.Y ); + } + + if (!lb || !rb) continue; + + //if any output polygons share an edge, they'll need joining later ... + if (Op1 && IsHorizontal(*rb) && + m_GhostJoins.size() > 0 && (rb->WindDelta != 0)) + { + for (JoinList::size_type i = 0; i < m_GhostJoins.size(); ++i) + { + Join* jr = m_GhostJoins[i]; + //if the horizontal Rb and a 'ghost' horizontal overlap, then convert + //the 'ghost' join to a real join ready for later ... + if (HorzSegmentsOverlap(jr->OutPt1->Pt.X, jr->OffPt.X, rb->Bot.X, rb->Top.X)) + AddJoin(jr->OutPt1, Op1, jr->OffPt); + } + } + + if (lb->OutIdx >= 0 && lb->PrevInAEL && + lb->PrevInAEL->Curr.X == lb->Bot.X && + lb->PrevInAEL->OutIdx >= 0 && + SlopesEqual(*lb->PrevInAEL, *lb, m_UseFullRange) && + (lb->WindDelta != 0) && (lb->PrevInAEL->WindDelta != 0)) + { + OutPt *Op2 = AddOutPt(lb->PrevInAEL, lb->Bot); + AddJoin(Op1, Op2, lb->Top); + } + + if(lb->NextInAEL != rb) + { + + if (rb->OutIdx >= 0 && rb->PrevInAEL->OutIdx >= 0 && + SlopesEqual(*rb->PrevInAEL, *rb, m_UseFullRange) && + (rb->WindDelta != 0) && (rb->PrevInAEL->WindDelta != 0)) + { + OutPt *Op2 = AddOutPt(rb->PrevInAEL, rb->Bot); + AddJoin(Op1, Op2, rb->Top); + } + + TEdge* e = lb->NextInAEL; + if (e) + { + while( e != rb ) + { + //nb: For calculating winding counts etc, IntersectEdges() assumes + //that param1 will be to the Right of param2 ABOVE the intersection ... + IntersectEdges(rb , e , lb->Curr); //order important here + e = e->NextInAEL; + } + } + } + + } +} +//------------------------------------------------------------------------------ + +void Clipper::DeleteFromAEL(TEdge *e) +{ + TEdge* AelPrev = e->PrevInAEL; + TEdge* AelNext = e->NextInAEL; + if( !AelPrev && !AelNext && (e != m_ActiveEdges) ) return; //already deleted + if( AelPrev ) AelPrev->NextInAEL = AelNext; + else m_ActiveEdges = AelNext; + if( AelNext ) AelNext->PrevInAEL = AelPrev; + e->NextInAEL = 0; + e->PrevInAEL = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::DeleteFromSEL(TEdge *e) +{ + TEdge* SelPrev = e->PrevInSEL; + TEdge* SelNext = e->NextInSEL; + if( !SelPrev && !SelNext && (e != m_SortedEdges) ) return; //already deleted + if( SelPrev ) SelPrev->NextInSEL = SelNext; + else m_SortedEdges = SelNext; + if( SelNext ) SelNext->PrevInSEL = SelPrev; + e->NextInSEL = 0; + e->PrevInSEL = 0; +} +//------------------------------------------------------------------------------ + +#ifdef use_xyz +void Clipper::SetZ(IntPoint& pt, TEdge& e1, TEdge& e2) +{ + if (pt.Z != 0 || !m_ZFill) return; + else if (pt == e1.Bot) pt.Z = e1.Bot.Z; + else if (pt == e1.Top) pt.Z = e1.Top.Z; + else if (pt == e2.Bot) pt.Z = e2.Bot.Z; + else if (pt == e2.Top) pt.Z = e2.Top.Z; + else (*m_ZFill)(e1.Bot, e1.Top, e2.Bot, e2.Top, pt); +} +//------------------------------------------------------------------------------ +#endif + +void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &Pt) +{ + bool e1Contributing = ( e1->OutIdx >= 0 ); + bool e2Contributing = ( e2->OutIdx >= 0 ); + +#ifdef use_xyz + SetZ(Pt, *e1, *e2); +#endif + +#ifdef use_lines + //if either edge is on an OPEN path ... + if (e1->WindDelta == 0 || e2->WindDelta == 0) + { + //ignore subject-subject open path intersections UNLESS they + //are both open paths, AND they are both 'contributing maximas' ... + if (e1->WindDelta == 0 && e2->WindDelta == 0) return; + + //if intersecting a subj line with a subj poly ... + else if (e1->PolyTyp == e2->PolyTyp && + e1->WindDelta != e2->WindDelta && m_ClipType == ctUnion) + { + if (e1->WindDelta == 0) + { + if (e2Contributing) + { + AddOutPt(e1, Pt); + if (e1Contributing) e1->OutIdx = Unassigned; + } + } + else + { + if (e1Contributing) + { + AddOutPt(e2, Pt); + if (e2Contributing) e2->OutIdx = Unassigned; + } + } + } + else if (e1->PolyTyp != e2->PolyTyp) + { + //toggle subj open path OutIdx on/off when Abs(clip.WndCnt) == 1 ... + if ((e1->WindDelta == 0) && abs(e2->WindCnt) == 1 && + (m_ClipType != ctUnion || e2->WindCnt2 == 0)) + { + AddOutPt(e1, Pt); + if (e1Contributing) e1->OutIdx = Unassigned; + } + else if ((e2->WindDelta == 0) && (abs(e1->WindCnt) == 1) && + (m_ClipType != ctUnion || e1->WindCnt2 == 0)) + { + AddOutPt(e2, Pt); + if (e2Contributing) e2->OutIdx = Unassigned; + } + } + return; + } +#endif + + //update winding counts... + //assumes that e1 will be to the Right of e2 ABOVE the intersection + if ( e1->PolyTyp == e2->PolyTyp ) + { + if ( IsEvenOddFillType( *e1) ) + { + int oldE1WindCnt = e1->WindCnt; + e1->WindCnt = e2->WindCnt; + e2->WindCnt = oldE1WindCnt; + } else + { + if (e1->WindCnt + e2->WindDelta == 0 ) e1->WindCnt = -e1->WindCnt; + else e1->WindCnt += e2->WindDelta; + if ( e2->WindCnt - e1->WindDelta == 0 ) e2->WindCnt = -e2->WindCnt; + else e2->WindCnt -= e1->WindDelta; + } + } else + { + if (!IsEvenOddFillType(*e2)) e1->WindCnt2 += e2->WindDelta; + else e1->WindCnt2 = ( e1->WindCnt2 == 0 ) ? 1 : 0; + if (!IsEvenOddFillType(*e1)) e2->WindCnt2 -= e1->WindDelta; + else e2->WindCnt2 = ( e2->WindCnt2 == 0 ) ? 1 : 0; + } + + PolyFillType e1FillType, e2FillType, e1FillType2, e2FillType2; + if (e1->PolyTyp == ptSubject) + { + e1FillType = m_SubjFillType; + e1FillType2 = m_ClipFillType; + } else + { + e1FillType = m_ClipFillType; + e1FillType2 = m_SubjFillType; + } + if (e2->PolyTyp == ptSubject) + { + e2FillType = m_SubjFillType; + e2FillType2 = m_ClipFillType; + } else + { + e2FillType = m_ClipFillType; + e2FillType2 = m_SubjFillType; + } + + cInt e1Wc, e2Wc; + switch (e1FillType) + { + case pftPositive: e1Wc = e1->WindCnt; break; + case pftNegative: e1Wc = -e1->WindCnt; break; + default: e1Wc = Abs(e1->WindCnt); + } + switch(e2FillType) + { + case pftPositive: e2Wc = e2->WindCnt; break; + case pftNegative: e2Wc = -e2->WindCnt; break; + default: e2Wc = Abs(e2->WindCnt); + } + + if ( e1Contributing && e2Contributing ) + { + if ((e1Wc != 0 && e1Wc != 1) || (e2Wc != 0 && e2Wc != 1) || + (e1->PolyTyp != e2->PolyTyp && m_ClipType != ctXor) ) + { + AddLocalMaxPoly(e1, e2, Pt); + } + else + { + AddOutPt(e1, Pt); + AddOutPt(e2, Pt); + SwapSides( *e1 , *e2 ); + SwapPolyIndexes( *e1 , *e2 ); + } + } + else if ( e1Contributing ) + { + if (e2Wc == 0 || e2Wc == 1) + { + AddOutPt(e1, Pt); + SwapSides(*e1, *e2); + SwapPolyIndexes(*e1, *e2); + } + } + else if ( e2Contributing ) + { + if (e1Wc == 0 || e1Wc == 1) + { + AddOutPt(e2, Pt); + SwapSides(*e1, *e2); + SwapPolyIndexes(*e1, *e2); + } + } + else if ( (e1Wc == 0 || e1Wc == 1) && (e2Wc == 0 || e2Wc == 1)) + { + //neither edge is currently contributing ... + + cInt e1Wc2, e2Wc2; + switch (e1FillType2) + { + case pftPositive: e1Wc2 = e1->WindCnt2; break; + case pftNegative : e1Wc2 = -e1->WindCnt2; break; + default: e1Wc2 = Abs(e1->WindCnt2); + } + switch (e2FillType2) + { + case pftPositive: e2Wc2 = e2->WindCnt2; break; + case pftNegative: e2Wc2 = -e2->WindCnt2; break; + default: e2Wc2 = Abs(e2->WindCnt2); + } + + if (e1->PolyTyp != e2->PolyTyp) + { + AddLocalMinPoly(e1, e2, Pt); + } + else if (e1Wc == 1 && e2Wc == 1) + switch( m_ClipType ) { + case ctIntersection: + if (e1Wc2 > 0 && e2Wc2 > 0) + AddLocalMinPoly(e1, e2, Pt); + break; + case ctUnion: + if ( e1Wc2 <= 0 && e2Wc2 <= 0 ) + AddLocalMinPoly(e1, e2, Pt); + break; + case ctDifference: + if (((e1->PolyTyp == ptClip) && (e1Wc2 > 0) && (e2Wc2 > 0)) || + ((e1->PolyTyp == ptSubject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) + AddLocalMinPoly(e1, e2, Pt); + break; + case ctXor: + AddLocalMinPoly(e1, e2, Pt); + } + else + SwapSides( *e1, *e2 ); + } +} +//------------------------------------------------------------------------------ + +void Clipper::SetHoleState(TEdge *e, OutRec *outrec) +{ + bool IsHole = false; + TEdge *e2 = e->PrevInAEL; + while (e2) + { + if (e2->OutIdx >= 0 && e2->WindDelta != 0) + { + IsHole = !IsHole; + if (! outrec->FirstLeft) + outrec->FirstLeft = m_PolyOuts[e2->OutIdx]; + } + e2 = e2->PrevInAEL; + } + if (IsHole) outrec->IsHole = true; +} +//------------------------------------------------------------------------------ + +OutRec* GetLowermostRec(OutRec *outRec1, OutRec *outRec2) +{ + //work out which polygon fragment has the correct hole state ... + if (!outRec1->BottomPt) + outRec1->BottomPt = GetBottomPt(outRec1->Pts); + if (!outRec2->BottomPt) + outRec2->BottomPt = GetBottomPt(outRec2->Pts); + OutPt *OutPt1 = outRec1->BottomPt; + OutPt *OutPt2 = outRec2->BottomPt; + if (OutPt1->Pt.Y > OutPt2->Pt.Y) return outRec1; + else if (OutPt1->Pt.Y < OutPt2->Pt.Y) return outRec2; + else if (OutPt1->Pt.X < OutPt2->Pt.X) return outRec1; + else if (OutPt1->Pt.X > OutPt2->Pt.X) return outRec2; + else if (OutPt1->Next == OutPt1) return outRec2; + else if (OutPt2->Next == OutPt2) return outRec1; + else if (FirstIsBottomPt(OutPt1, OutPt2)) return outRec1; + else return outRec2; +} +//------------------------------------------------------------------------------ + +bool Param1RightOfParam2(OutRec* outRec1, OutRec* outRec2) +{ + do + { + outRec1 = outRec1->FirstLeft; + if (outRec1 == outRec2) return true; + } while (outRec1); + return false; +} +//------------------------------------------------------------------------------ + +OutRec* Clipper::GetOutRec(int Idx) +{ + OutRec* outrec = m_PolyOuts[Idx]; + while (outrec != m_PolyOuts[outrec->Idx]) + outrec = m_PolyOuts[outrec->Idx]; + return outrec; +} +//------------------------------------------------------------------------------ + +void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) +{ + //get the start and ends of both output polygons ... + OutRec *outRec1 = m_PolyOuts[e1->OutIdx]; + OutRec *outRec2 = m_PolyOuts[e2->OutIdx]; + + OutRec *holeStateRec; + if (Param1RightOfParam2(outRec1, outRec2)) + holeStateRec = outRec2; + else if (Param1RightOfParam2(outRec2, outRec1)) + holeStateRec = outRec1; + else + holeStateRec = GetLowermostRec(outRec1, outRec2); + + //get the start and ends of both output polygons and + //join e2 poly onto e1 poly and delete pointers to e2 ... + + OutPt* p1_lft = outRec1->Pts; + OutPt* p1_rt = p1_lft->Prev; + OutPt* p2_lft = outRec2->Pts; + OutPt* p2_rt = p2_lft->Prev; + + EdgeSide Side; + //join e2 poly onto e1 poly and delete pointers to e2 ... + if( e1->Side == esLeft ) + { + if( e2->Side == esLeft ) + { + //z y x a b c + ReversePolyPtLinks(p2_lft); + p2_lft->Next = p1_lft; + p1_lft->Prev = p2_lft; + p1_rt->Next = p2_rt; + p2_rt->Prev = p1_rt; + outRec1->Pts = p2_rt; + } else + { + //x y z a b c + p2_rt->Next = p1_lft; + p1_lft->Prev = p2_rt; + p2_lft->Prev = p1_rt; + p1_rt->Next = p2_lft; + outRec1->Pts = p2_lft; + } + Side = esLeft; + } else + { + if( e2->Side == esRight ) + { + //a b c z y x + ReversePolyPtLinks(p2_lft); + p1_rt->Next = p2_rt; + p2_rt->Prev = p1_rt; + p2_lft->Next = p1_lft; + p1_lft->Prev = p2_lft; + } else + { + //a b c x y z + p1_rt->Next = p2_lft; + p2_lft->Prev = p1_rt; + p1_lft->Prev = p2_rt; + p2_rt->Next = p1_lft; + } + Side = esRight; + } + + outRec1->BottomPt = 0; + if (holeStateRec == outRec2) + { + if (outRec2->FirstLeft != outRec1) + outRec1->FirstLeft = outRec2->FirstLeft; + outRec1->IsHole = outRec2->IsHole; + } + outRec2->Pts = 0; + outRec2->BottomPt = 0; + outRec2->FirstLeft = outRec1; + + int OKIdx = e1->OutIdx; + int ObsoleteIdx = e2->OutIdx; + + e1->OutIdx = Unassigned; //nb: safe because we only get here via AddLocalMaxPoly + e2->OutIdx = Unassigned; + + TEdge* e = m_ActiveEdges; + while( e ) + { + if( e->OutIdx == ObsoleteIdx ) + { + e->OutIdx = OKIdx; + e->Side = Side; + break; + } + e = e->NextInAEL; + } + + outRec2->Idx = outRec1->Idx; +} +//------------------------------------------------------------------------------ + +OutRec* Clipper::CreateOutRec() +{ + OutRec* result = new OutRec; + result->IsHole = false; + result->IsOpen = false; + result->FirstLeft = 0; + result->Pts = 0; + result->BottomPt = 0; + result->PolyNd = 0; + m_PolyOuts.push_back(result); + result->Idx = (int)m_PolyOuts.size()-1; + return result; +} +//------------------------------------------------------------------------------ + +OutPt* Clipper::AddOutPt(TEdge *e, const IntPoint &pt) +{ + bool ToFront = (e->Side == esLeft); + if( e->OutIdx < 0 ) + { + OutRec *outRec = CreateOutRec(); + outRec->IsOpen = (e->WindDelta == 0); + OutPt* newOp = new OutPt; + outRec->Pts = newOp; + newOp->Idx = outRec->Idx; + newOp->Pt = pt; + newOp->Next = newOp; + newOp->Prev = newOp; + if (!outRec->IsOpen) + SetHoleState(e, outRec); + e->OutIdx = outRec->Idx; + return newOp; + } else + { + OutRec *outRec = m_PolyOuts[e->OutIdx]; + //OutRec.Pts is the 'Left-most' point & OutRec.Pts.Prev is the 'Right-most' + OutPt* op = outRec->Pts; + + if (ToFront && (pt == op->Pt)) return op; + else if (!ToFront && (pt == op->Prev->Pt)) return op->Prev; + + OutPt* newOp = new OutPt; + newOp->Idx = outRec->Idx; + newOp->Pt = pt; + newOp->Next = op; + newOp->Prev = op->Prev; + newOp->Prev->Next = newOp; + op->Prev = newOp; + if (ToFront) outRec->Pts = newOp; + return newOp; + } +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessHorizontals(bool IsTopOfScanbeam) +{ + TEdge* horzEdge = m_SortedEdges; + while(horzEdge) + { + DeleteFromSEL(horzEdge); + ProcessHorizontal(horzEdge, IsTopOfScanbeam); + horzEdge = m_SortedEdges; + } +} +//------------------------------------------------------------------------------ + +inline bool IsMinima(TEdge *e) +{ + return e && (e->Prev->NextInLML != e) && (e->Next->NextInLML != e); +} +//------------------------------------------------------------------------------ + +inline bool IsMaxima(TEdge *e, const cInt Y) +{ + return e && e->Top.Y == Y && !e->NextInLML; +} +//------------------------------------------------------------------------------ + +inline bool IsIntermediate(TEdge *e, const cInt Y) +{ + return e->Top.Y == Y && e->NextInLML; +} +//------------------------------------------------------------------------------ + +TEdge *GetMaximaPair(TEdge *e) +{ + TEdge* result = 0; + if ((e->Next->Top == e->Top) && !e->Next->NextInLML) + result = e->Next; + else if ((e->Prev->Top == e->Top) && !e->Prev->NextInLML) + result = e->Prev; + + if (result && (result->OutIdx == Skip || + //result is false if both NextInAEL & PrevInAEL are nil & not horizontal ... + (result->NextInAEL == result->PrevInAEL && !IsHorizontal(*result)))) + return 0; + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::SwapPositionsInAEL(TEdge *Edge1, TEdge *Edge2) +{ + //check that one or other edge hasn't already been removed from AEL ... + if (Edge1->NextInAEL == Edge1->PrevInAEL || + Edge2->NextInAEL == Edge2->PrevInAEL) return; + + if( Edge1->NextInAEL == Edge2 ) + { + TEdge* Next = Edge2->NextInAEL; + if( Next ) Next->PrevInAEL = Edge1; + TEdge* Prev = Edge1->PrevInAEL; + if( Prev ) Prev->NextInAEL = Edge2; + Edge2->PrevInAEL = Prev; + Edge2->NextInAEL = Edge1; + Edge1->PrevInAEL = Edge2; + Edge1->NextInAEL = Next; + } + else if( Edge2->NextInAEL == Edge1 ) + { + TEdge* Next = Edge1->NextInAEL; + if( Next ) Next->PrevInAEL = Edge2; + TEdge* Prev = Edge2->PrevInAEL; + if( Prev ) Prev->NextInAEL = Edge1; + Edge1->PrevInAEL = Prev; + Edge1->NextInAEL = Edge2; + Edge2->PrevInAEL = Edge1; + Edge2->NextInAEL = Next; + } + else + { + TEdge* Next = Edge1->NextInAEL; + TEdge* Prev = Edge1->PrevInAEL; + Edge1->NextInAEL = Edge2->NextInAEL; + if( Edge1->NextInAEL ) Edge1->NextInAEL->PrevInAEL = Edge1; + Edge1->PrevInAEL = Edge2->PrevInAEL; + if( Edge1->PrevInAEL ) Edge1->PrevInAEL->NextInAEL = Edge1; + Edge2->NextInAEL = Next; + if( Edge2->NextInAEL ) Edge2->NextInAEL->PrevInAEL = Edge2; + Edge2->PrevInAEL = Prev; + if( Edge2->PrevInAEL ) Edge2->PrevInAEL->NextInAEL = Edge2; + } + + if( !Edge1->PrevInAEL ) m_ActiveEdges = Edge1; + else if( !Edge2->PrevInAEL ) m_ActiveEdges = Edge2; +} +//------------------------------------------------------------------------------ + +void Clipper::SwapPositionsInSEL(TEdge *Edge1, TEdge *Edge2) +{ + if( !( Edge1->NextInSEL ) && !( Edge1->PrevInSEL ) ) return; + if( !( Edge2->NextInSEL ) && !( Edge2->PrevInSEL ) ) return; + + if( Edge1->NextInSEL == Edge2 ) + { + TEdge* Next = Edge2->NextInSEL; + if( Next ) Next->PrevInSEL = Edge1; + TEdge* Prev = Edge1->PrevInSEL; + if( Prev ) Prev->NextInSEL = Edge2; + Edge2->PrevInSEL = Prev; + Edge2->NextInSEL = Edge1; + Edge1->PrevInSEL = Edge2; + Edge1->NextInSEL = Next; + } + else if( Edge2->NextInSEL == Edge1 ) + { + TEdge* Next = Edge1->NextInSEL; + if( Next ) Next->PrevInSEL = Edge2; + TEdge* Prev = Edge2->PrevInSEL; + if( Prev ) Prev->NextInSEL = Edge1; + Edge1->PrevInSEL = Prev; + Edge1->NextInSEL = Edge2; + Edge2->PrevInSEL = Edge1; + Edge2->NextInSEL = Next; + } + else + { + TEdge* Next = Edge1->NextInSEL; + TEdge* Prev = Edge1->PrevInSEL; + Edge1->NextInSEL = Edge2->NextInSEL; + if( Edge1->NextInSEL ) Edge1->NextInSEL->PrevInSEL = Edge1; + Edge1->PrevInSEL = Edge2->PrevInSEL; + if( Edge1->PrevInSEL ) Edge1->PrevInSEL->NextInSEL = Edge1; + Edge2->NextInSEL = Next; + if( Edge2->NextInSEL ) Edge2->NextInSEL->PrevInSEL = Edge2; + Edge2->PrevInSEL = Prev; + if( Edge2->PrevInSEL ) Edge2->PrevInSEL->NextInSEL = Edge2; + } + + if( !Edge1->PrevInSEL ) m_SortedEdges = Edge1; + else if( !Edge2->PrevInSEL ) m_SortedEdges = Edge2; +} +//------------------------------------------------------------------------------ + +TEdge* GetNextInAEL(TEdge *e, Direction dir) +{ + return dir == dLeftToRight ? e->NextInAEL : e->PrevInAEL; +} +//------------------------------------------------------------------------------ + +void GetHorzDirection(TEdge& HorzEdge, Direction& Dir, cInt& Left, cInt& Right) +{ + if (HorzEdge.Bot.X < HorzEdge.Top.X) + { + Left = HorzEdge.Bot.X; + Right = HorzEdge.Top.X; + Dir = dLeftToRight; + } else + { + Left = HorzEdge.Top.X; + Right = HorzEdge.Bot.X; + Dir = dRightToLeft; + } +} +//------------------------------------------------------------------------ + +/******************************************************************************* +* Notes: Horizontal edges (HEs) at scanline intersections (ie at the Top or * +* Bottom of a scanbeam) are processed as if layered. The order in which HEs * +* are processed doesn't matter. HEs intersect with other HE Bot.Xs only [#] * +* (or they could intersect with Top.Xs only, ie EITHER Bot.Xs OR Top.Xs), * +* and with other non-horizontal edges [*]. Once these intersections are * +* processed, intermediate HEs then 'promote' the Edge above (NextInLML) into * +* the AEL. These 'promoted' edges may in turn intersect [%] with other HEs. * +*******************************************************************************/ + +void Clipper::ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam) +{ + Direction dir; + cInt horzLeft, horzRight; + + GetHorzDirection(*horzEdge, dir, horzLeft, horzRight); + + TEdge* eLastHorz = horzEdge, *eMaxPair = 0; + while (eLastHorz->NextInLML && IsHorizontal(*eLastHorz->NextInLML)) + eLastHorz = eLastHorz->NextInLML; + if (!eLastHorz->NextInLML) + eMaxPair = GetMaximaPair(eLastHorz); + + for (;;) + { + bool IsLastHorz = (horzEdge == eLastHorz); + TEdge* e = GetNextInAEL(horzEdge, dir); + while(e) + { + //Break if we've got to the end of an intermediate horizontal edge ... + //nb: Smaller Dx's are to the right of larger Dx's ABOVE the horizontal. + if (e->Curr.X == horzEdge->Top.X && horzEdge->NextInLML && + e->Dx < horzEdge->NextInLML->Dx) break; + + TEdge* eNext = GetNextInAEL(e, dir); //saves eNext for later + + if ((dir == dLeftToRight && e->Curr.X <= horzRight) || + (dir == dRightToLeft && e->Curr.X >= horzLeft)) + { + //so far we're still in range of the horizontal Edge but make sure + //we're at the last of consec. horizontals when matching with eMaxPair + if(e == eMaxPair && IsLastHorz) + { + + if (horzEdge->OutIdx >= 0) + { + OutPt* op1 = AddOutPt(horzEdge, horzEdge->Top); + TEdge* eNextHorz = m_SortedEdges; + while (eNextHorz) + { + if (eNextHorz->OutIdx >= 0 && + HorzSegmentsOverlap(horzEdge->Bot.X, + horzEdge->Top.X, eNextHorz->Bot.X, eNextHorz->Top.X)) + { + OutPt* op2 = AddOutPt(eNextHorz, eNextHorz->Bot); + AddJoin(op2, op1, eNextHorz->Top); + } + eNextHorz = eNextHorz->NextInSEL; + } + AddGhostJoin(op1, horzEdge->Bot); + AddLocalMaxPoly(horzEdge, eMaxPair, horzEdge->Top); + } + DeleteFromAEL(horzEdge); + DeleteFromAEL(eMaxPair); + return; + } + else if(dir == dLeftToRight) + { + IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y); + IntersectEdges(horzEdge, e, Pt); + } + else + { + IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y); + IntersectEdges( e, horzEdge, Pt); + } + SwapPositionsInAEL( horzEdge, e ); + } + else if( (dir == dLeftToRight && e->Curr.X >= horzRight) || + (dir == dRightToLeft && e->Curr.X <= horzLeft) ) break; + e = eNext; + } //end while + + if (horzEdge->NextInLML && IsHorizontal(*horzEdge->NextInLML)) + { + UpdateEdgeIntoAEL(horzEdge); + if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Bot); + GetHorzDirection(*horzEdge, dir, horzLeft, horzRight); + } else + break; + } //end for (;;) + + if(horzEdge->NextInLML) + { + if(horzEdge->OutIdx >= 0) + { + OutPt* op1 = AddOutPt( horzEdge, horzEdge->Top); + if (isTopOfScanbeam) AddGhostJoin(op1, horzEdge->Bot); + UpdateEdgeIntoAEL(horzEdge); + if (horzEdge->WindDelta == 0) return; + //nb: HorzEdge is no longer horizontal here + TEdge* ePrev = horzEdge->PrevInAEL; + TEdge* eNext = horzEdge->NextInAEL; + if (ePrev && ePrev->Curr.X == horzEdge->Bot.X && + ePrev->Curr.Y == horzEdge->Bot.Y && ePrev->WindDelta != 0 && + (ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y && + SlopesEqual(*horzEdge, *ePrev, m_UseFullRange))) + { + OutPt* op2 = AddOutPt(ePrev, horzEdge->Bot); + AddJoin(op1, op2, horzEdge->Top); + } + else if (eNext && eNext->Curr.X == horzEdge->Bot.X && + eNext->Curr.Y == horzEdge->Bot.Y && eNext->WindDelta != 0 && + eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y && + SlopesEqual(*horzEdge, *eNext, m_UseFullRange)) + { + OutPt* op2 = AddOutPt(eNext, horzEdge->Bot); + AddJoin(op1, op2, horzEdge->Top); + } + } + else + UpdateEdgeIntoAEL(horzEdge); + } + else + { + if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Top); + DeleteFromAEL(horzEdge); + } +} +//------------------------------------------------------------------------------ + +void Clipper::UpdateEdgeIntoAEL(TEdge *&e) +{ + if( !e->NextInLML ) throw + clipperException("UpdateEdgeIntoAEL: invalid call"); + + e->NextInLML->OutIdx = e->OutIdx; + TEdge* AelPrev = e->PrevInAEL; + TEdge* AelNext = e->NextInAEL; + if (AelPrev) AelPrev->NextInAEL = e->NextInLML; + else m_ActiveEdges = e->NextInLML; + if (AelNext) AelNext->PrevInAEL = e->NextInLML; + e->NextInLML->Side = e->Side; + e->NextInLML->WindDelta = e->WindDelta; + e->NextInLML->WindCnt = e->WindCnt; + e->NextInLML->WindCnt2 = e->WindCnt2; + e = e->NextInLML; + e->Curr = e->Bot; + e->PrevInAEL = AelPrev; + e->NextInAEL = AelNext; + if (!IsHorizontal(*e)) InsertScanbeam(e->Top.Y); +} +//------------------------------------------------------------------------------ + +bool Clipper::ProcessIntersections(const cInt topY) +{ + if( !m_ActiveEdges ) return true; + try { + BuildIntersectList(topY); + size_t IlSize = m_IntersectList.size(); + if (IlSize == 0) return true; + if (IlSize == 1 || FixupIntersectionOrder()) ProcessIntersectList(); + else return false; + } + catch(...) + { + m_SortedEdges = 0; + DisposeIntersectNodes(); + throw clipperException("ProcessIntersections error"); + } + m_SortedEdges = 0; + return true; +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeIntersectNodes() +{ + for (size_t i = 0; i < m_IntersectList.size(); ++i ) + delete m_IntersectList[i]; + m_IntersectList.clear(); +} +//------------------------------------------------------------------------------ + +void Clipper::BuildIntersectList(const cInt topY) +{ + if ( !m_ActiveEdges ) return; + + //prepare for sorting ... + TEdge* e = m_ActiveEdges; + m_SortedEdges = e; + while( e ) + { + e->PrevInSEL = e->PrevInAEL; + e->NextInSEL = e->NextInAEL; + e->Curr.X = TopX( *e, topY ); + e = e->NextInAEL; + } + + //bubblesort ... + bool isModified; + do + { + isModified = false; + e = m_SortedEdges; + while( e->NextInSEL ) + { + TEdge *eNext = e->NextInSEL; + IntPoint Pt; + if(e->Curr.X > eNext->Curr.X) + { + IntersectPoint(*e, *eNext, Pt); + IntersectNode * newNode = new IntersectNode; + newNode->Edge1 = e; + newNode->Edge2 = eNext; + newNode->Pt = Pt; + m_IntersectList.push_back(newNode); + + SwapPositionsInSEL(e, eNext); + isModified = true; + } + else + e = eNext; + } + if( e->PrevInSEL ) e->PrevInSEL->NextInSEL = 0; + else break; + } + while ( isModified ); + m_SortedEdges = 0; //important +} +//------------------------------------------------------------------------------ + + +void Clipper::ProcessIntersectList() +{ + for (size_t i = 0; i < m_IntersectList.size(); ++i) + { + IntersectNode* iNode = m_IntersectList[i]; + { + IntersectEdges( iNode->Edge1, iNode->Edge2, iNode->Pt); + SwapPositionsInAEL( iNode->Edge1 , iNode->Edge2 ); + } + delete iNode; + } + m_IntersectList.clear(); +} +//------------------------------------------------------------------------------ + +bool IntersectListSort(IntersectNode* node1, IntersectNode* node2) +{ + return node2->Pt.Y < node1->Pt.Y; +} +//------------------------------------------------------------------------------ + +inline bool EdgesAdjacent(const IntersectNode &inode) +{ + return (inode.Edge1->NextInSEL == inode.Edge2) || + (inode.Edge1->PrevInSEL == inode.Edge2); +} +//------------------------------------------------------------------------------ + +bool Clipper::FixupIntersectionOrder() +{ + //pre-condition: intersections are sorted Bottom-most first. + //Now it's crucial that intersections are made only between adjacent edges, + //so to ensure this the order of intersections may need adjusting ... + CopyAELToSEL(); + std::sort(m_IntersectList.begin(), m_IntersectList.end(), IntersectListSort); + size_t cnt = m_IntersectList.size(); + for (size_t i = 0; i < cnt; ++i) + { + if (!EdgesAdjacent(*m_IntersectList[i])) + { + size_t j = i + 1; + while (j < cnt && !EdgesAdjacent(*m_IntersectList[j])) j++; + if (j == cnt) return false; + std::swap(m_IntersectList[i], m_IntersectList[j]); + } + SwapPositionsInSEL(m_IntersectList[i]->Edge1, m_IntersectList[i]->Edge2); + } + return true; +} +//------------------------------------------------------------------------------ + +void Clipper::DoMaxima(TEdge *e) +{ + TEdge* eMaxPair = GetMaximaPair(e); + if (!eMaxPair) + { + if (e->OutIdx >= 0) + AddOutPt(e, e->Top); + DeleteFromAEL(e); + return; + } + + TEdge* eNext = e->NextInAEL; + while(eNext && eNext != eMaxPair) + { + IntersectEdges(e, eNext, e->Top); + SwapPositionsInAEL(e, eNext); + eNext = e->NextInAEL; + } + + if(e->OutIdx == Unassigned && eMaxPair->OutIdx == Unassigned) + { + DeleteFromAEL(e); + DeleteFromAEL(eMaxPair); + } + else if( e->OutIdx >= 0 && eMaxPair->OutIdx >= 0 ) + { + if (e->OutIdx >= 0) AddLocalMaxPoly(e, eMaxPair, e->Top); + DeleteFromAEL(e); + DeleteFromAEL(eMaxPair); + } +#ifdef use_lines + else if (e->WindDelta == 0) + { + if (e->OutIdx >= 0) + { + AddOutPt(e, e->Top); + e->OutIdx = Unassigned; + } + DeleteFromAEL(e); + + if (eMaxPair->OutIdx >= 0) + { + AddOutPt(eMaxPair, e->Top); + eMaxPair->OutIdx = Unassigned; + } + DeleteFromAEL(eMaxPair); + } +#endif + else throw clipperException("DoMaxima error"); +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessEdgesAtTopOfScanbeam(const cInt topY) +{ + TEdge* e = m_ActiveEdges; + while( e ) + { + //1. process maxima, treating them as if they're 'bent' horizontal edges, + // but exclude maxima with horizontal edges. nb: e can't be a horizontal. + bool IsMaximaEdge = IsMaxima(e, topY); + + if(IsMaximaEdge) + { + TEdge* eMaxPair = GetMaximaPair(e); + IsMaximaEdge = (!eMaxPair || !IsHorizontal(*eMaxPair)); + } + + if(IsMaximaEdge) + { + TEdge* ePrev = e->PrevInAEL; + DoMaxima(e); + if( !ePrev ) e = m_ActiveEdges; + else e = ePrev->NextInAEL; + } + else + { + //2. promote horizontal edges, otherwise update Curr.X and Curr.Y ... + if (IsIntermediate(e, topY) && IsHorizontal(*e->NextInLML)) + { + UpdateEdgeIntoAEL(e); + if (e->OutIdx >= 0) + AddOutPt(e, e->Bot); + AddEdgeToSEL(e); + } + else + { + e->Curr.X = TopX( *e, topY ); + e->Curr.Y = topY; + } + + if (m_StrictSimple) + { + TEdge* ePrev = e->PrevInAEL; + if ((e->OutIdx >= 0) && (e->WindDelta != 0) && ePrev && (ePrev->OutIdx >= 0) && + (ePrev->Curr.X == e->Curr.X) && (ePrev->WindDelta != 0)) + { + IntPoint pt = e->Curr; +#ifdef use_xyz + SetZ(pt, *ePrev, *e); +#endif + OutPt* op = AddOutPt(ePrev, pt); + OutPt* op2 = AddOutPt(e, pt); + AddJoin(op, op2, pt); //StrictlySimple (type-3) join + } + } + + e = e->NextInAEL; + } + } + + //3. Process horizontals at the Top of the scanbeam ... + ProcessHorizontals(true); + + //4. Promote intermediate vertices ... + e = m_ActiveEdges; + while(e) + { + if(IsIntermediate(e, topY)) + { + OutPt* op = 0; + if( e->OutIdx >= 0 ) + op = AddOutPt(e, e->Top); + UpdateEdgeIntoAEL(e); + + //if output polygons share an edge, they'll need joining later ... + TEdge* ePrev = e->PrevInAEL; + TEdge* eNext = e->NextInAEL; + if (ePrev && ePrev->Curr.X == e->Bot.X && + ePrev->Curr.Y == e->Bot.Y && op && + ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y && + SlopesEqual(*e, *ePrev, m_UseFullRange) && + (e->WindDelta != 0) && (ePrev->WindDelta != 0)) + { + OutPt* op2 = AddOutPt(ePrev, e->Bot); + AddJoin(op, op2, e->Top); + } + else if (eNext && eNext->Curr.X == e->Bot.X && + eNext->Curr.Y == e->Bot.Y && op && + eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y && + SlopesEqual(*e, *eNext, m_UseFullRange) && + (e->WindDelta != 0) && (eNext->WindDelta != 0)) + { + OutPt* op2 = AddOutPt(eNext, e->Bot); + AddJoin(op, op2, e->Top); + } + } + e = e->NextInAEL; + } +} +//------------------------------------------------------------------------------ + +void Clipper::FixupOutPolygon(OutRec &outrec) +{ + //FixupOutPolygon() - removes duplicate points and simplifies consecutive + //parallel edges by removing the middle vertex. + OutPt *lastOK = 0; + outrec.BottomPt = 0; + OutPt *pp = outrec.Pts; + + for (;;) + { + if (pp->Prev == pp || pp->Prev == pp->Next ) + { + DisposeOutPts(pp); + outrec.Pts = 0; + return; + } + + //test for duplicate points and collinear edges ... + if ((pp->Pt == pp->Next->Pt) || (pp->Pt == pp->Prev->Pt) || + (SlopesEqual(pp->Prev->Pt, pp->Pt, pp->Next->Pt, m_UseFullRange) && + (!m_PreserveCollinear || + !Pt2IsBetweenPt1AndPt3(pp->Prev->Pt, pp->Pt, pp->Next->Pt)))) + { + lastOK = 0; + OutPt *tmp = pp; + pp->Prev->Next = pp->Next; + pp->Next->Prev = pp->Prev; + pp = pp->Prev; + delete tmp; + } + else if (pp == lastOK) break; + else + { + if (!lastOK) lastOK = pp; + pp = pp->Next; + } + } + outrec.Pts = pp; +} +//------------------------------------------------------------------------------ + +int PointCount(OutPt *Pts) +{ + if (!Pts) return 0; + int result = 0; + OutPt* p = Pts; + do + { + result++; + p = p->Next; + } + while (p != Pts); + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::BuildResult(Paths &polys) +{ + polys.reserve(m_PolyOuts.size()); + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + if (!m_PolyOuts[i]->Pts) continue; + Path pg; + OutPt* p = m_PolyOuts[i]->Pts->Prev; + int cnt = PointCount(p); + if (cnt < 2) continue; + pg.reserve(cnt); + for (int i = 0; i < cnt; ++i) + { + pg.push_back(p->Pt); + p = p->Prev; + } + polys.push_back(pg); + } +} +//------------------------------------------------------------------------------ + +void Clipper::BuildResult2(PolyTree& polytree) +{ + polytree.Clear(); + polytree.AllNodes.reserve(m_PolyOuts.size()); + //add each output polygon/contour to polytree ... + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + int cnt = PointCount(outRec->Pts); + if ((outRec->IsOpen && cnt < 2) || (!outRec->IsOpen && cnt < 3)) continue; + FixHoleLinkage(*outRec); + PolyNode* pn = new PolyNode(); + //nb: polytree takes ownership of all the PolyNodes + polytree.AllNodes.push_back(pn); + outRec->PolyNd = pn; + pn->Parent = 0; + pn->Index = 0; + pn->Contour.reserve(cnt); + OutPt *op = outRec->Pts->Prev; + for (int j = 0; j < cnt; j++) + { + pn->Contour.push_back(op->Pt); + op = op->Prev; + } + } + + //fixup PolyNode links etc ... + polytree.Childs.reserve(m_PolyOuts.size()); + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + if (!outRec->PolyNd) continue; + if (outRec->IsOpen) + { + outRec->PolyNd->m_IsOpen = true; + polytree.AddChild(*outRec->PolyNd); + } + else if (outRec->FirstLeft && outRec->FirstLeft->PolyNd) + outRec->FirstLeft->PolyNd->AddChild(*outRec->PolyNd); + else + polytree.AddChild(*outRec->PolyNd); + } +} +//------------------------------------------------------------------------------ + +void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2) +{ + //just swap the contents (because fIntersectNodes is a single-linked-list) + IntersectNode inode = int1; //gets a copy of Int1 + int1.Edge1 = int2.Edge1; + int1.Edge2 = int2.Edge2; + int1.Pt = int2.Pt; + int2.Edge1 = inode.Edge1; + int2.Edge2 = inode.Edge2; + int2.Pt = inode.Pt; +} +//------------------------------------------------------------------------------ + +inline bool E2InsertsBeforeE1(TEdge &e1, TEdge &e2) +{ + if (e2.Curr.X == e1.Curr.X) + { + if (e2.Top.Y > e1.Top.Y) + return e2.Top.X < TopX(e1, e2.Top.Y); + else return e1.Top.X > TopX(e2, e1.Top.Y); + } + else return e2.Curr.X < e1.Curr.X; +} +//------------------------------------------------------------------------------ + +bool GetOverlap(const cInt a1, const cInt a2, const cInt b1, const cInt b2, + cInt& Left, cInt& Right) +{ + if (a1 < a2) + { + if (b1 < b2) {Left = std::max(a1,b1); Right = std::min(a2,b2);} + else {Left = std::max(a1,b2); Right = std::min(a2,b1);} + } + else + { + if (b1 < b2) {Left = std::max(a2,b1); Right = std::min(a1,b2);} + else {Left = std::max(a2,b2); Right = std::min(a1,b1);} + } + return Left < Right; +} +//------------------------------------------------------------------------------ + +inline void UpdateOutPtIdxs(OutRec& outrec) +{ + OutPt* op = outrec.Pts; + do + { + op->Idx = outrec.Idx; + op = op->Prev; + } + while(op != outrec.Pts); +} +//------------------------------------------------------------------------------ + +void Clipper::InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge) +{ + if(!m_ActiveEdges) + { + edge->PrevInAEL = 0; + edge->NextInAEL = 0; + m_ActiveEdges = edge; + } + else if(!startEdge && E2InsertsBeforeE1(*m_ActiveEdges, *edge)) + { + edge->PrevInAEL = 0; + edge->NextInAEL = m_ActiveEdges; + m_ActiveEdges->PrevInAEL = edge; + m_ActiveEdges = edge; + } + else + { + if(!startEdge) startEdge = m_ActiveEdges; + while(startEdge->NextInAEL && + !E2InsertsBeforeE1(*startEdge->NextInAEL , *edge)) + startEdge = startEdge->NextInAEL; + edge->NextInAEL = startEdge->NextInAEL; + if(startEdge->NextInAEL) startEdge->NextInAEL->PrevInAEL = edge; + edge->PrevInAEL = startEdge; + startEdge->NextInAEL = edge; + } +} +//---------------------------------------------------------------------- + +OutPt* DupOutPt(OutPt* outPt, bool InsertAfter) +{ + OutPt* result = new OutPt; + result->Pt = outPt->Pt; + result->Idx = outPt->Idx; + if (InsertAfter) + { + result->Next = outPt->Next; + result->Prev = outPt; + outPt->Next->Prev = result; + outPt->Next = result; + } + else + { + result->Prev = outPt->Prev; + result->Next = outPt; + outPt->Prev->Next = result; + outPt->Prev = result; + } + return result; +} +//------------------------------------------------------------------------------ + +bool JoinHorz(OutPt* op1, OutPt* op1b, OutPt* op2, OutPt* op2b, + const IntPoint Pt, bool DiscardLeft) +{ + Direction Dir1 = (op1->Pt.X > op1b->Pt.X ? dRightToLeft : dLeftToRight); + Direction Dir2 = (op2->Pt.X > op2b->Pt.X ? dRightToLeft : dLeftToRight); + if (Dir1 == Dir2) return false; + + //When DiscardLeft, we want Op1b to be on the Left of Op1, otherwise we + //want Op1b to be on the Right. (And likewise with Op2 and Op2b.) + //So, to facilitate this while inserting Op1b and Op2b ... + //when DiscardLeft, make sure we're AT or RIGHT of Pt before adding Op1b, + //otherwise make sure we're AT or LEFT of Pt. (Likewise with Op2b.) + if (Dir1 == dLeftToRight) + { + while (op1->Next->Pt.X <= Pt.X && + op1->Next->Pt.X >= op1->Pt.X && op1->Next->Pt.Y == Pt.Y) + op1 = op1->Next; + if (DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next; + op1b = DupOutPt(op1, !DiscardLeft); + if (op1b->Pt != Pt) + { + op1 = op1b; + op1->Pt = Pt; + op1b = DupOutPt(op1, !DiscardLeft); + } + } + else + { + while (op1->Next->Pt.X >= Pt.X && + op1->Next->Pt.X <= op1->Pt.X && op1->Next->Pt.Y == Pt.Y) + op1 = op1->Next; + if (!DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next; + op1b = DupOutPt(op1, DiscardLeft); + if (op1b->Pt != Pt) + { + op1 = op1b; + op1->Pt = Pt; + op1b = DupOutPt(op1, DiscardLeft); + } + } + + if (Dir2 == dLeftToRight) + { + while (op2->Next->Pt.X <= Pt.X && + op2->Next->Pt.X >= op2->Pt.X && op2->Next->Pt.Y == Pt.Y) + op2 = op2->Next; + if (DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next; + op2b = DupOutPt(op2, !DiscardLeft); + if (op2b->Pt != Pt) + { + op2 = op2b; + op2->Pt = Pt; + op2b = DupOutPt(op2, !DiscardLeft); + }; + } else + { + while (op2->Next->Pt.X >= Pt.X && + op2->Next->Pt.X <= op2->Pt.X && op2->Next->Pt.Y == Pt.Y) + op2 = op2->Next; + if (!DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next; + op2b = DupOutPt(op2, DiscardLeft); + if (op2b->Pt != Pt) + { + op2 = op2b; + op2->Pt = Pt; + op2b = DupOutPt(op2, DiscardLeft); + }; + }; + + if ((Dir1 == dLeftToRight) == DiscardLeft) + { + op1->Prev = op2; + op2->Next = op1; + op1b->Next = op2b; + op2b->Prev = op1b; + } + else + { + op1->Next = op2; + op2->Prev = op1; + op1b->Prev = op2b; + op2b->Next = op1b; + } + return true; +} +//------------------------------------------------------------------------------ + +bool Clipper::JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2) +{ + OutPt *op1 = j->OutPt1, *op1b; + OutPt *op2 = j->OutPt2, *op2b; + + //There are 3 kinds of joins for output polygons ... + //1. Horizontal joins where Join.OutPt1 & Join.OutPt2 are a vertices anywhere + //along (horizontal) collinear edges (& Join.OffPt is on the same horizontal). + //2. Non-horizontal joins where Join.OutPt1 & Join.OutPt2 are at the same + //location at the Bottom of the overlapping segment (& Join.OffPt is above). + //3. StrictSimple joins where edges touch but are not collinear and where + //Join.OutPt1, Join.OutPt2 & Join.OffPt all share the same point. + bool isHorizontal = (j->OutPt1->Pt.Y == j->OffPt.Y); + + if (isHorizontal && (j->OffPt == j->OutPt1->Pt) && + (j->OffPt == j->OutPt2->Pt)) + { + //Strictly Simple join ... + if (outRec1 != outRec2) return false; + op1b = j->OutPt1->Next; + while (op1b != op1 && (op1b->Pt == j->OffPt)) + op1b = op1b->Next; + bool reverse1 = (op1b->Pt.Y > j->OffPt.Y); + op2b = j->OutPt2->Next; + while (op2b != op2 && (op2b->Pt == j->OffPt)) + op2b = op2b->Next; + bool reverse2 = (op2b->Pt.Y > j->OffPt.Y); + if (reverse1 == reverse2) return false; + if (reverse1) + { + op1b = DupOutPt(op1, false); + op2b = DupOutPt(op2, true); + op1->Prev = op2; + op2->Next = op1; + op1b->Next = op2b; + op2b->Prev = op1b; + j->OutPt1 = op1; + j->OutPt2 = op1b; + return true; + } else + { + op1b = DupOutPt(op1, true); + op2b = DupOutPt(op2, false); + op1->Next = op2; + op2->Prev = op1; + op1b->Prev = op2b; + op2b->Next = op1b; + j->OutPt1 = op1; + j->OutPt2 = op1b; + return true; + } + } + else if (isHorizontal) + { + //treat horizontal joins differently to non-horizontal joins since with + //them we're not yet sure where the overlapping is. OutPt1.Pt & OutPt2.Pt + //may be anywhere along the horizontal edge. + op1b = op1; + while (op1->Prev->Pt.Y == op1->Pt.Y && op1->Prev != op1b && op1->Prev != op2) + op1 = op1->Prev; + while (op1b->Next->Pt.Y == op1b->Pt.Y && op1b->Next != op1 && op1b->Next != op2) + op1b = op1b->Next; + if (op1b->Next == op1 || op1b->Next == op2) return false; //a flat 'polygon' + + op2b = op2; + while (op2->Prev->Pt.Y == op2->Pt.Y && op2->Prev != op2b && op2->Prev != op1b) + op2 = op2->Prev; + while (op2b->Next->Pt.Y == op2b->Pt.Y && op2b->Next != op2 && op2b->Next != op1) + op2b = op2b->Next; + if (op2b->Next == op2 || op2b->Next == op1) return false; //a flat 'polygon' + + cInt Left, Right; + //Op1 --> Op1b & Op2 --> Op2b are the extremites of the horizontal edges + if (!GetOverlap(op1->Pt.X, op1b->Pt.X, op2->Pt.X, op2b->Pt.X, Left, Right)) + return false; + + //DiscardLeftSide: when overlapping edges are joined, a spike will created + //which needs to be cleaned up. However, we don't want Op1 or Op2 caught up + //on the discard Side as either may still be needed for other joins ... + IntPoint Pt; + bool DiscardLeftSide; + if (op1->Pt.X >= Left && op1->Pt.X <= Right) + { + Pt = op1->Pt; DiscardLeftSide = (op1->Pt.X > op1b->Pt.X); + } + else if (op2->Pt.X >= Left&& op2->Pt.X <= Right) + { + Pt = op2->Pt; DiscardLeftSide = (op2->Pt.X > op2b->Pt.X); + } + else if (op1b->Pt.X >= Left && op1b->Pt.X <= Right) + { + Pt = op1b->Pt; DiscardLeftSide = op1b->Pt.X > op1->Pt.X; + } + else + { + Pt = op2b->Pt; DiscardLeftSide = (op2b->Pt.X > op2->Pt.X); + } + j->OutPt1 = op1; j->OutPt2 = op2; + return JoinHorz(op1, op1b, op2, op2b, Pt, DiscardLeftSide); + } else + { + //nb: For non-horizontal joins ... + // 1. Jr.OutPt1.Pt.Y == Jr.OutPt2.Pt.Y + // 2. Jr.OutPt1.Pt > Jr.OffPt.Y + + //make sure the polygons are correctly oriented ... + op1b = op1->Next; + while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Next; + bool Reverse1 = ((op1b->Pt.Y > op1->Pt.Y) || + !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange)); + if (Reverse1) + { + op1b = op1->Prev; + while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Prev; + if ((op1b->Pt.Y > op1->Pt.Y) || + !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange)) return false; + }; + op2b = op2->Next; + while ((op2b->Pt == op2->Pt) && (op2b != op2))op2b = op2b->Next; + bool Reverse2 = ((op2b->Pt.Y > op2->Pt.Y) || + !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange)); + if (Reverse2) + { + op2b = op2->Prev; + while ((op2b->Pt == op2->Pt) && (op2b != op2)) op2b = op2b->Prev; + if ((op2b->Pt.Y > op2->Pt.Y) || + !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange)) return false; + } + + if ((op1b == op1) || (op2b == op2) || (op1b == op2b) || + ((outRec1 == outRec2) && (Reverse1 == Reverse2))) return false; + + if (Reverse1) + { + op1b = DupOutPt(op1, false); + op2b = DupOutPt(op2, true); + op1->Prev = op2; + op2->Next = op1; + op1b->Next = op2b; + op2b->Prev = op1b; + j->OutPt1 = op1; + j->OutPt2 = op1b; + return true; + } else + { + op1b = DupOutPt(op1, true); + op2b = DupOutPt(op2, false); + op1->Next = op2; + op2->Prev = op1; + op1b->Prev = op2b; + op2b->Next = op1b; + j->OutPt1 = op1; + j->OutPt2 = op1b; + return true; + } + } +} +//---------------------------------------------------------------------- + +static OutRec* ParseFirstLeft(OutRec* FirstLeft) +{ + while (FirstLeft && !FirstLeft->Pts) + FirstLeft = FirstLeft->FirstLeft; + return FirstLeft; +} +//------------------------------------------------------------------------------ + +void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) +{ + //tests if NewOutRec contains the polygon before reassigning FirstLeft + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (!outRec->Pts || !outRec->FirstLeft) continue; + OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft); + if (firstLeft == OldOutRec) + { + if (Poly2ContainsPoly1(outRec->Pts, NewOutRec->Pts)) + outRec->FirstLeft = NewOutRec; + } + } +} +//---------------------------------------------------------------------- + +void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) +{ + //reassigns FirstLeft WITHOUT testing if NewOutRec contains the polygon + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (outRec->FirstLeft == OldOutRec) outRec->FirstLeft = NewOutRec; + } +} +//---------------------------------------------------------------------- + +void Clipper::JoinCommonEdges() +{ + for (JoinList::size_type i = 0; i < m_Joins.size(); i++) + { + Join* join = m_Joins[i]; + + OutRec *outRec1 = GetOutRec(join->OutPt1->Idx); + OutRec *outRec2 = GetOutRec(join->OutPt2->Idx); + + if (!outRec1->Pts || !outRec2->Pts) continue; + + //get the polygon fragment with the correct hole state (FirstLeft) + //before calling JoinPoints() ... + OutRec *holeStateRec; + if (outRec1 == outRec2) holeStateRec = outRec1; + else if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2; + else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1; + else holeStateRec = GetLowermostRec(outRec1, outRec2); + + if (!JoinPoints(join, outRec1, outRec2)) continue; + + if (outRec1 == outRec2) + { + //instead of joining two polygons, we've just created a new one by + //splitting one polygon into two. + outRec1->Pts = join->OutPt1; + outRec1->BottomPt = 0; + outRec2 = CreateOutRec(); + outRec2->Pts = join->OutPt2; + + //update all OutRec2.Pts Idx's ... + UpdateOutPtIdxs(*outRec2); + + //We now need to check every OutRec.FirstLeft pointer. If it points + //to OutRec1 it may need to point to OutRec2 instead ... + if (m_UsingPolyTree) + for (PolyOutList::size_type j = 0; j < m_PolyOuts.size() - 1; j++) + { + OutRec* oRec = m_PolyOuts[j]; + if (!oRec->Pts || ParseFirstLeft(oRec->FirstLeft) != outRec1 || + oRec->IsHole == outRec1->IsHole) continue; + if (Poly2ContainsPoly1(oRec->Pts, join->OutPt2)) + oRec->FirstLeft = outRec2; + } + + if (Poly2ContainsPoly1(outRec2->Pts, outRec1->Pts)) + { + //outRec2 is contained by outRec1 ... + outRec2->IsHole = !outRec1->IsHole; + outRec2->FirstLeft = outRec1; + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); + + if ((outRec2->IsHole ^ m_ReverseOutput) == (Area(*outRec2) > 0)) + ReversePolyPtLinks(outRec2->Pts); + + } else if (Poly2ContainsPoly1(outRec1->Pts, outRec2->Pts)) + { + //outRec1 is contained by outRec2 ... + outRec2->IsHole = outRec1->IsHole; + outRec1->IsHole = !outRec2->IsHole; + outRec2->FirstLeft = outRec1->FirstLeft; + outRec1->FirstLeft = outRec2; + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2); + + if ((outRec1->IsHole ^ m_ReverseOutput) == (Area(*outRec1) > 0)) + ReversePolyPtLinks(outRec1->Pts); + } + else + { + //the 2 polygons are completely separate ... + outRec2->IsHole = outRec1->IsHole; + outRec2->FirstLeft = outRec1->FirstLeft; + + //fixup FirstLeft pointers that may need reassigning to OutRec2 + if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2); + } + + } else + { + //joined 2 polygons together ... + + outRec2->Pts = 0; + outRec2->BottomPt = 0; + outRec2->Idx = outRec1->Idx; + + outRec1->IsHole = holeStateRec->IsHole; + if (holeStateRec == outRec2) + outRec1->FirstLeft = outRec2->FirstLeft; + outRec2->FirstLeft = outRec1; + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); + } + } +} + +//------------------------------------------------------------------------------ +// ClipperOffset support functions ... +//------------------------------------------------------------------------------ + +DoublePoint GetUnitNormal(const IntPoint &pt1, const IntPoint &pt2) +{ + if(pt2.X == pt1.X && pt2.Y == pt1.Y) + return DoublePoint(0, 0); + + double Dx = (double)(pt2.X - pt1.X); + double dy = (double)(pt2.Y - pt1.Y); + double f = 1 *1.0/ std::sqrt( Dx*Dx + dy*dy ); + Dx *= f; + dy *= f; + return DoublePoint(dy, -Dx); +} + +//------------------------------------------------------------------------------ +// ClipperOffset class +//------------------------------------------------------------------------------ + +ClipperOffset::ClipperOffset(double miterLimit, double arcTolerance) +{ + this->MiterLimit = miterLimit; + this->ArcTolerance = arcTolerance; + m_lowest.X = -1; +} +//------------------------------------------------------------------------------ + +ClipperOffset::~ClipperOffset() +{ + Clear(); +} +//------------------------------------------------------------------------------ + +void ClipperOffset::Clear() +{ + for (int i = 0; i < m_polyNodes.ChildCount(); ++i) + delete m_polyNodes.Childs[i]; + m_polyNodes.Childs.clear(); + m_lowest.X = -1; +} +//------------------------------------------------------------------------------ + +void ClipperOffset::AddPath(const Path& path, JoinType joinType, EndType endType) +{ + int highI = (int)path.size() - 1; + if (highI < 0) return; + PolyNode* newNode = new PolyNode(); + newNode->m_jointype = joinType; + newNode->m_endtype = endType; + + //strip duplicate points from path and also get index to the lowest point ... + if (endType == etClosedLine || endType == etClosedPolygon) + while (highI > 0 && path[0] == path[highI]) highI--; + newNode->Contour.reserve(highI + 1); + newNode->Contour.push_back(path[0]); + int j = 0, k = 0; + for (int i = 1; i <= highI; i++) + if (newNode->Contour[j] != path[i]) + { + j++; + newNode->Contour.push_back(path[i]); + if (path[i].Y > newNode->Contour[k].Y || + (path[i].Y == newNode->Contour[k].Y && + path[i].X < newNode->Contour[k].X)) k = j; + } + if (endType == etClosedPolygon && j < 2) + { + delete newNode; + return; + } + m_polyNodes.AddChild(*newNode); + + //if this path's lowest pt is lower than all the others then update m_lowest + if (endType != etClosedPolygon) return; + if (m_lowest.X < 0) + m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k); + else + { + IntPoint ip = m_polyNodes.Childs[(int)m_lowest.X]->Contour[(int)m_lowest.Y]; + if (newNode->Contour[k].Y > ip.Y || + (newNode->Contour[k].Y == ip.Y && + newNode->Contour[k].X < ip.X)) + m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k); + } +} +//------------------------------------------------------------------------------ + +void ClipperOffset::AddPaths(const Paths& paths, JoinType joinType, EndType endType) +{ + for (Paths::size_type i = 0; i < paths.size(); ++i) + AddPath(paths[i], joinType, endType); +} +//------------------------------------------------------------------------------ + +void ClipperOffset::FixOrientations() +{ + //fixup orientations of all closed paths if the orientation of the + //closed path with the lowermost vertex is wrong ... + if (m_lowest.X >= 0 && + !Orientation(m_polyNodes.Childs[(int)m_lowest.X]->Contour)) + { + for (int i = 0; i < m_polyNodes.ChildCount(); ++i) + { + PolyNode& node = *m_polyNodes.Childs[i]; + if (node.m_endtype == etClosedPolygon || + (node.m_endtype == etClosedLine && Orientation(node.Contour))) + ReversePath(node.Contour); + } + } else + { + for (int i = 0; i < m_polyNodes.ChildCount(); ++i) + { + PolyNode& node = *m_polyNodes.Childs[i]; + if (node.m_endtype == etClosedLine && !Orientation(node.Contour)) + ReversePath(node.Contour); + } + } +} +//------------------------------------------------------------------------------ + +void ClipperOffset::Execute(Paths& solution, double delta) +{ + solution.clear(); + FixOrientations(); + DoOffset(delta); + + //now clean up 'corners' ... + Clipper clpr; + clpr.AddPaths(m_destPolys, ptSubject, true); + if (delta > 0) + { + clpr.Execute(ctUnion, solution, pftPositive, pftPositive); + } + else + { + IntRect r = clpr.GetBounds(); + Path outer(4); + outer[0] = IntPoint(r.left - 10, r.bottom + 10); + outer[1] = IntPoint(r.right + 10, r.bottom + 10); + outer[2] = IntPoint(r.right + 10, r.top - 10); + outer[3] = IntPoint(r.left - 10, r.top - 10); + + clpr.AddPath(outer, ptSubject, true); + clpr.ReverseSolution(true); + clpr.Execute(ctUnion, solution, pftNegative, pftNegative); + if (solution.size() > 0) solution.erase(solution.begin()); + } +} +//------------------------------------------------------------------------------ + +void ClipperOffset::Execute(PolyTree& solution, double delta) +{ + solution.Clear(); + FixOrientations(); + DoOffset(delta); + + //now clean up 'corners' ... + Clipper clpr; + clpr.AddPaths(m_destPolys, ptSubject, true); + if (delta > 0) + { + clpr.Execute(ctUnion, solution, pftPositive, pftPositive); + } + else + { + IntRect r = clpr.GetBounds(); + Path outer(4); + outer[0] = IntPoint(r.left - 10, r.bottom + 10); + outer[1] = IntPoint(r.right + 10, r.bottom + 10); + outer[2] = IntPoint(r.right + 10, r.top - 10); + outer[3] = IntPoint(r.left - 10, r.top - 10); + + clpr.AddPath(outer, ptSubject, true); + clpr.ReverseSolution(true); + clpr.Execute(ctUnion, solution, pftNegative, pftNegative); + //remove the outer PolyNode rectangle ... + if (solution.ChildCount() == 1 && solution.Childs[0]->ChildCount() > 0) + { + PolyNode* outerNode = solution.Childs[0]; + solution.Childs.reserve(outerNode->ChildCount()); + solution.Childs[0] = outerNode->Childs[0]; + solution.Childs[0]->Parent = outerNode->Parent; + for (int i = 1; i < outerNode->ChildCount(); ++i) + solution.AddChild(*outerNode->Childs[i]); + } + else + solution.Clear(); + } +} +//------------------------------------------------------------------------------ + +void ClipperOffset::DoOffset(double delta) +{ + m_destPolys.clear(); + m_delta = delta; + + //if Zero offset, just copy any CLOSED polygons to m_p and return ... + if (NEAR_ZERO(delta)) + { + m_destPolys.reserve(m_polyNodes.ChildCount()); + for (int i = 0; i < m_polyNodes.ChildCount(); i++) + { + PolyNode& node = *m_polyNodes.Childs[i]; + if (node.m_endtype == etClosedPolygon) + m_destPolys.push_back(node.Contour); + } + return; + } + + //see offset_triginometry3.svg in the documentation folder ... + if (MiterLimit > 2) m_miterLim = 2/(MiterLimit * MiterLimit); + else m_miterLim = 0.5; + + double y; + if (ArcTolerance <= 0.0) y = def_arc_tolerance; + else if (ArcTolerance > std::fabs(delta) * def_arc_tolerance) + y = std::fabs(delta) * def_arc_tolerance; + else y = ArcTolerance; + //see offset_triginometry2.svg in the documentation folder ... + double steps = pi / std::acos(1 - y / std::fabs(delta)); + if (steps > std::fabs(delta) * pi) + steps = std::fabs(delta) * pi; //ie excessive precision check + m_sin = std::sin(two_pi / steps); + m_cos = std::cos(two_pi / steps); + m_StepsPerRad = steps / two_pi; + if (delta < 0.0) m_sin = -m_sin; + + m_destPolys.reserve(m_polyNodes.ChildCount() * 2); + for (int i = 0; i < m_polyNodes.ChildCount(); i++) + { + PolyNode& node = *m_polyNodes.Childs[i]; + m_srcPoly = node.Contour; + + int len = (int)m_srcPoly.size(); + if (len == 0 || (delta <= 0 && (len < 3 || node.m_endtype != etClosedPolygon))) + continue; + + m_destPoly.clear(); + if (len == 1) + { + if (node.m_jointype == jtRound) + { + double X = 1.0, Y = 0.0; + for (cInt j = 1; j <= steps; j++) + { + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[0].X + X * delta), + Round(m_srcPoly[0].Y + Y * delta))); + double X2 = X; + X = X * m_cos - m_sin * Y; + Y = X2 * m_sin + Y * m_cos; + } + } + else + { + double X = -1.0, Y = -1.0; + for (int j = 0; j < 4; ++j) + { + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[0].X + X * delta), + Round(m_srcPoly[0].Y + Y * delta))); + if (X < 0) X = 1; + else if (Y < 0) Y = 1; + else X = -1; + } + } + m_destPolys.push_back(m_destPoly); + continue; + } + //build m_normals ... + m_normals.clear(); + m_normals.reserve(len); + for (int j = 0; j < len - 1; ++j) + m_normals.push_back(GetUnitNormal(m_srcPoly[j], m_srcPoly[j + 1])); + if (node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon) + m_normals.push_back(GetUnitNormal(m_srcPoly[len - 1], m_srcPoly[0])); + else + m_normals.push_back(DoublePoint(m_normals[len - 2])); + + if (node.m_endtype == etClosedPolygon) + { + int k = len - 1; + for (int j = 0; j < len; ++j) + OffsetPoint(j, k, node.m_jointype); + m_destPolys.push_back(m_destPoly); + } + else if (node.m_endtype == etClosedLine) + { + int k = len - 1; + for (int j = 0; j < len; ++j) + OffsetPoint(j, k, node.m_jointype); + m_destPolys.push_back(m_destPoly); + m_destPoly.clear(); + //re-build m_normals ... + DoublePoint n = m_normals[len -1]; + for (int j = len - 1; j > 0; j--) + m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y); + m_normals[0] = DoublePoint(-n.X, -n.Y); + k = 0; + for (int j = len - 1; j >= 0; j--) + OffsetPoint(j, k, node.m_jointype); + m_destPolys.push_back(m_destPoly); + } + else + { + int k = 0; + for (int j = 1; j < len - 1; ++j) + OffsetPoint(j, k, node.m_jointype); + + IntPoint pt1; + if (node.m_endtype == etOpenButt) + { + int j = len - 1; + pt1 = IntPoint((cInt)Round(m_srcPoly[j].X + m_normals[j].X * + delta), (cInt)Round(m_srcPoly[j].Y + m_normals[j].Y * delta)); + m_destPoly.push_back(pt1); + pt1 = IntPoint((cInt)Round(m_srcPoly[j].X - m_normals[j].X * + delta), (cInt)Round(m_srcPoly[j].Y - m_normals[j].Y * delta)); + m_destPoly.push_back(pt1); + } + else + { + int j = len - 1; + k = len - 2; + m_sinA = 0; + m_normals[j] = DoublePoint(-m_normals[j].X, -m_normals[j].Y); + if (node.m_endtype == etOpenSquare) + DoSquare(j, k); + else + DoRound(j, k); + } + + //re-build m_normals ... + for (int j = len - 1; j > 0; j--) + m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y); + m_normals[0] = DoublePoint(-m_normals[1].X, -m_normals[1].Y); + + k = len - 1; + for (int j = k - 1; j > 0; --j) OffsetPoint(j, k, node.m_jointype); + + if (node.m_endtype == etOpenButt) + { + pt1 = IntPoint((cInt)Round(m_srcPoly[0].X - m_normals[0].X * delta), + (cInt)Round(m_srcPoly[0].Y - m_normals[0].Y * delta)); + m_destPoly.push_back(pt1); + pt1 = IntPoint((cInt)Round(m_srcPoly[0].X + m_normals[0].X * delta), + (cInt)Round(m_srcPoly[0].Y + m_normals[0].Y * delta)); + m_destPoly.push_back(pt1); + } + else + { + k = 1; + m_sinA = 0; + if (node.m_endtype == etOpenSquare) + DoSquare(0, 1); + else + DoRound(0, 1); + } + m_destPolys.push_back(m_destPoly); + } + } +} +//------------------------------------------------------------------------------ + +void ClipperOffset::OffsetPoint(int j, int& k, JoinType jointype) +{ + //cross product ... + m_sinA = (m_normals[k].X * m_normals[j].Y - m_normals[j].X * m_normals[k].Y); + if (std::fabs(m_sinA * m_delta) < 1.0) + { + //dot product ... + double cosA = (m_normals[k].X * m_normals[j].X + m_normals[j].Y * m_normals[k].Y ); + if (cosA > 0) // angle => 0 degrees + { + m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta), + Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta))); + return; + } + //else angle => 180 degrees + } + else if (m_sinA > 1.0) m_sinA = 1.0; + else if (m_sinA < -1.0) m_sinA = -1.0; + + if (m_sinA * m_delta < 0) + { + m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta), + Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta))); + m_destPoly.push_back(m_srcPoly[j]); + m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[j].X * m_delta), + Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta))); + } + else + switch (jointype) + { + case jtMiter: + { + double r = 1 + (m_normals[j].X * m_normals[k].X + + m_normals[j].Y * m_normals[k].Y); + if (r >= m_miterLim) DoMiter(j, k, r); else DoSquare(j, k); + break; + } + case jtSquare: DoSquare(j, k); break; + case jtRound: DoRound(j, k); break; + } + k = j; +} +//------------------------------------------------------------------------------ + +void ClipperOffset::DoSquare(int j, int k) +{ + double dx = std::tan(std::atan2(m_sinA, + m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y) / 4); + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[j].X + m_delta * (m_normals[k].X - m_normals[k].Y * dx)), + Round(m_srcPoly[j].Y + m_delta * (m_normals[k].Y + m_normals[k].X * dx)))); + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[j].X + m_delta * (m_normals[j].X + m_normals[j].Y * dx)), + Round(m_srcPoly[j].Y + m_delta * (m_normals[j].Y - m_normals[j].X * dx)))); +} +//------------------------------------------------------------------------------ + +void ClipperOffset::DoMiter(int j, int k, double r) +{ + double q = m_delta / r; + m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + (m_normals[k].X + m_normals[j].X) * q), + Round(m_srcPoly[j].Y + (m_normals[k].Y + m_normals[j].Y) * q))); +} +//------------------------------------------------------------------------------ + +void ClipperOffset::DoRound(int j, int k) +{ + double a = std::atan2(m_sinA, + m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y); + int steps = std::max((int)Round(m_StepsPerRad * std::fabs(a)), 1); + + double X = m_normals[k].X, Y = m_normals[k].Y, X2; + for (int i = 0; i < steps; ++i) + { + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[j].X + X * m_delta), + Round(m_srcPoly[j].Y + Y * m_delta))); + X2 = X; + X = X * m_cos - m_sin * Y; + Y = X2 * m_sin + Y * m_cos; + } + m_destPoly.push_back(IntPoint( + Round(m_srcPoly[j].X + m_normals[j].X * m_delta), + Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta))); +} + +//------------------------------------------------------------------------------ +// Miscellaneous public functions +//------------------------------------------------------------------------------ + +void Clipper::DoSimplePolygons() +{ + PolyOutList::size_type i = 0; + while (i < m_PolyOuts.size()) + { + OutRec* outrec = m_PolyOuts[i++]; + OutPt* op = outrec->Pts; + if (!op || outrec->IsOpen) continue; + do //for each Pt in Polygon until duplicate found do ... + { + OutPt* op2 = op->Next; + while (op2 != outrec->Pts) + { + if ((op->Pt == op2->Pt) && op2->Next != op && op2->Prev != op) + { + //split the polygon into two ... + OutPt* op3 = op->Prev; + OutPt* op4 = op2->Prev; + op->Prev = op4; + op4->Next = op; + op2->Prev = op3; + op3->Next = op2; + + outrec->Pts = op; + OutRec* outrec2 = CreateOutRec(); + outrec2->Pts = op2; + UpdateOutPtIdxs(*outrec2); + if (Poly2ContainsPoly1(outrec2->Pts, outrec->Pts)) + { + //OutRec2 is contained by OutRec1 ... + outrec2->IsHole = !outrec->IsHole; + outrec2->FirstLeft = outrec; + if (m_UsingPolyTree) FixupFirstLefts2(outrec2, outrec); + } + else + if (Poly2ContainsPoly1(outrec->Pts, outrec2->Pts)) + { + //OutRec1 is contained by OutRec2 ... + outrec2->IsHole = outrec->IsHole; + outrec->IsHole = !outrec2->IsHole; + outrec2->FirstLeft = outrec->FirstLeft; + outrec->FirstLeft = outrec2; + if (m_UsingPolyTree) FixupFirstLefts2(outrec, outrec2); + } + else + { + //the 2 polygons are separate ... + outrec2->IsHole = outrec->IsHole; + outrec2->FirstLeft = outrec->FirstLeft; + if (m_UsingPolyTree) FixupFirstLefts1(outrec, outrec2); + } + op2 = op; //ie get ready for the Next iteration + } + op2 = op2->Next; + } + op = op->Next; + } + while (op != outrec->Pts); + } +} +//------------------------------------------------------------------------------ + +void ReversePath(Path& p) +{ + std::reverse(p.begin(), p.end()); +} +//------------------------------------------------------------------------------ + +void ReversePaths(Paths& p) +{ + for (Paths::size_type i = 0; i < p.size(); ++i) + ReversePath(p[i]); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType) +{ + Clipper c; + c.StrictlySimple(true); + c.AddPath(in_poly, ptSubject, true); + c.Execute(ctUnion, out_polys, fillType, fillType); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType) +{ + Clipper c; + c.StrictlySimple(true); + c.AddPaths(in_polys, ptSubject, true); + c.Execute(ctUnion, out_polys, fillType, fillType); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygons(Paths &polys, PolyFillType fillType) +{ + SimplifyPolygons(polys, polys, fillType); +} +//------------------------------------------------------------------------------ + +inline double DistanceSqrd(const IntPoint& pt1, const IntPoint& pt2) +{ + double Dx = ((double)pt1.X - pt2.X); + double dy = ((double)pt1.Y - pt2.Y); + return (Dx*Dx + dy*dy); +} +//------------------------------------------------------------------------------ + +double DistanceFromLineSqrd( + const IntPoint& pt, const IntPoint& ln1, const IntPoint& ln2) +{ + //The equation of a line in general form (Ax + By + C = 0) + //given 2 points (x¹,y¹) & (x²,y²) is ... + //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0 + //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹ + //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²) + //see http://en.wikipedia.org/wiki/Perpendicular_distance + double A = double(ln1.Y - ln2.Y); + double B = double(ln2.X - ln1.X); + double C = A * ln1.X + B * ln1.Y; + C = A * pt.X + B * pt.Y - C; + return (C * C) / (A * A + B * B); +} +//--------------------------------------------------------------------------- + +bool SlopesNearCollinear(const IntPoint& pt1, + const IntPoint& pt2, const IntPoint& pt3, double distSqrd) +{ + //this function is more accurate when the point that's geometrically + //between the other 2 points is the one that's tested for distance. + //ie makes it more likely to pick up 'spikes' ... + if (Abs(pt1.X - pt2.X) > Abs(pt1.Y - pt2.Y)) + { + if ((pt1.X > pt2.X) == (pt1.X < pt3.X)) + return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd; + else if ((pt2.X > pt1.X) == (pt2.X < pt3.X)) + return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd; + else + return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd; + } + else + { + if ((pt1.Y > pt2.Y) == (pt1.Y < pt3.Y)) + return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd; + else if ((pt2.Y > pt1.Y) == (pt2.Y < pt3.Y)) + return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd; + else + return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd; + } +} +//------------------------------------------------------------------------------ + +bool PointsAreClose(IntPoint pt1, IntPoint pt2, double distSqrd) +{ + double Dx = (double)pt1.X - pt2.X; + double dy = (double)pt1.Y - pt2.Y; + return ((Dx * Dx) + (dy * dy) <= distSqrd); +} +//------------------------------------------------------------------------------ + +OutPt* ExcludeOp(OutPt* op) +{ + OutPt* result = op->Prev; + result->Next = op->Next; + op->Next->Prev = result; + result->Idx = 0; + return result; +} +//------------------------------------------------------------------------------ + +void CleanPolygon(const Path& in_poly, Path& out_poly, double distance) +{ + //distance = proximity in units/pixels below which vertices + //will be stripped. Default ~= sqrt(2). + + size_t size = in_poly.size(); + + if (size == 0) + { + out_poly.clear(); + return; + } + + OutPt* outPts = new OutPt[size]; + for (size_t i = 0; i < size; ++i) + { + outPts[i].Pt = in_poly[i]; + outPts[i].Next = &outPts[(i + 1) % size]; + outPts[i].Next->Prev = &outPts[i]; + outPts[i].Idx = 0; + } + + double distSqrd = distance * distance; + OutPt* op = &outPts[0]; + while (op->Idx == 0 && op->Next != op->Prev) + { + if (PointsAreClose(op->Pt, op->Prev->Pt, distSqrd)) + { + op = ExcludeOp(op); + size--; + } + else if (PointsAreClose(op->Prev->Pt, op->Next->Pt, distSqrd)) + { + ExcludeOp(op->Next); + op = ExcludeOp(op); + size -= 2; + } + else if (SlopesNearCollinear(op->Prev->Pt, op->Pt, op->Next->Pt, distSqrd)) + { + op = ExcludeOp(op); + size--; + } + else + { + op->Idx = 1; + op = op->Next; + } + } + + if (size < 3) size = 0; + out_poly.resize(size); + for (size_t i = 0; i < size; ++i) + { + out_poly[i] = op->Pt; + op = op->Next; + } + delete [] outPts; +} +//------------------------------------------------------------------------------ + +void CleanPolygon(Path& poly, double distance) +{ + CleanPolygon(poly, poly, distance); +} +//------------------------------------------------------------------------------ + +void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance) +{ + for (Paths::size_type i = 0; i < in_polys.size(); ++i) + CleanPolygon(in_polys[i], out_polys[i], distance); +} +//------------------------------------------------------------------------------ + +void CleanPolygons(Paths& polys, double distance) +{ + CleanPolygons(polys, polys, distance); +} +//------------------------------------------------------------------------------ + +void Minkowski(const Path& poly, const Path& path, + Paths& solution, bool isSum, bool isClosed) +{ + int delta = (isClosed ? 1 : 0); + size_t polyCnt = poly.size(); + size_t pathCnt = path.size(); + Paths pp; + pp.reserve(pathCnt); + if (isSum) + for (size_t i = 0; i < pathCnt; ++i) + { + Path p; + p.reserve(polyCnt); + for (size_t j = 0; j < poly.size(); ++j) + p.push_back(IntPoint(path[i].X + poly[j].X, path[i].Y + poly[j].Y)); + pp.push_back(p); + } + else + for (size_t i = 0; i < pathCnt; ++i) + { + Path p; + p.reserve(polyCnt); + for (size_t j = 0; j < poly.size(); ++j) + p.push_back(IntPoint(path[i].X - poly[j].X, path[i].Y - poly[j].Y)); + pp.push_back(p); + } + + solution.clear(); + solution.reserve((pathCnt + delta) * (polyCnt + 1)); + for (size_t i = 0; i < pathCnt - 1 + delta; ++i) + for (size_t j = 0; j < polyCnt; ++j) + { + Path quad; + quad.reserve(4); + quad.push_back(pp[i % pathCnt][j % polyCnt]); + quad.push_back(pp[(i + 1) % pathCnt][j % polyCnt]); + quad.push_back(pp[(i + 1) % pathCnt][(j + 1) % polyCnt]); + quad.push_back(pp[i % pathCnt][(j + 1) % polyCnt]); + if (!Orientation(quad)) ReversePath(quad); + solution.push_back(quad); + } +} +//------------------------------------------------------------------------------ + +void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed) +{ + Minkowski(pattern, path, solution, true, pathIsClosed); + Clipper c; + c.AddPaths(solution, ptSubject, true); + c.Execute(ctUnion, solution, pftNonZero, pftNonZero); +} +//------------------------------------------------------------------------------ + +void TranslatePath(const Path& input, Path& output, IntPoint delta) +{ + //precondition: input != output + output.resize(input.size()); + for (size_t i = 0; i < input.size(); ++i) + output[i] = IntPoint(input[i].X + delta.X, input[i].Y + delta.Y); +} +//------------------------------------------------------------------------------ + +void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed) +{ + Clipper c; + for (size_t i = 0; i < paths.size(); ++i) + { + Paths tmp; + Minkowski(pattern, paths[i], tmp, true, pathIsClosed); + c.AddPaths(tmp, ptSubject, true); + if (pathIsClosed) + { + Path tmp2; + TranslatePath(paths[i], tmp2, pattern[0]); + c.AddPath(tmp2, ptClip, true); + } + } + c.Execute(ctUnion, solution, pftNonZero, pftNonZero); +} +//------------------------------------------------------------------------------ + +void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution) +{ + Minkowski(poly1, poly2, solution, false, true); + Clipper c; + c.AddPaths(solution, ptSubject, true); + c.Execute(ctUnion, solution, pftNonZero, pftNonZero); +} +//------------------------------------------------------------------------------ + +enum NodeType {ntAny, ntOpen, ntClosed}; + +void AddPolyNodeToPaths(const PolyNode& polynode, NodeType nodetype, Paths& paths) +{ + bool match = true; + if (nodetype == ntClosed) match = !polynode.IsOpen(); + else if (nodetype == ntOpen) return; + + if (!polynode.Contour.empty() && match) + paths.push_back(polynode.Contour); + for (int i = 0; i < polynode.ChildCount(); ++i) + AddPolyNodeToPaths(*polynode.Childs[i], nodetype, paths); +} +//------------------------------------------------------------------------------ + +void PolyTreeToPaths(const PolyTree& polytree, Paths& paths) +{ + paths.resize(0); + paths.reserve(polytree.Total()); + AddPolyNodeToPaths(polytree, ntAny, paths); +} +//------------------------------------------------------------------------------ + +void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths) +{ + paths.resize(0); + paths.reserve(polytree.Total()); + AddPolyNodeToPaths(polytree, ntClosed, paths); +} +//------------------------------------------------------------------------------ + +void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths) +{ + paths.resize(0); + paths.reserve(polytree.Total()); + //Open paths are top level only, so ... + for (int i = 0; i < polytree.ChildCount(); ++i) + if (polytree.Childs[i]->IsOpen()) + paths.push_back(polytree.Childs[i]->Contour); +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, const IntPoint &p) +{ + s << "(" << p.X << "," << p.Y << ")"; + return s; +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, const Path &p) +{ + if (p.empty()) return s; + Path::size_type last = p.size() -1; + for (Path::size_type i = 0; i < last; i++) + s << "(" << p[i].X << "," << p[i].Y << "), "; + s << "(" << p[last].X << "," << p[last].Y << ")\n"; + return s; +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, const Paths &p) +{ + for (Paths::size_type i = 0; i < p.size(); i++) + s << p[i]; + s << "\n"; + return s; +} +//------------------------------------------------------------------------------ + +} //ClipperLib namespace diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.hpp new file mode 100644 index 00000000000..566289f82b1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/clipper/clipper.hpp @@ -0,0 +1,429 @@ +/******************************************************************************* +* * +* Author : Angus Johnson * +* Version : 6.2.1 * +* Date : 31 October 2014 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2014 * +* * +* License: * +* Use, modification & distribution is subject to Boost Software License Ver 1. * +* http://www.boost.org/LICENSE_1_0.txt * +* * +* Attributions: * +* The code in this library is an extension of Bala Vatti's clipping algorithm: * +* "A generic solution to polygon clipping" * +* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * +* http://portal.acm.org/citation.cfm?id=129906 * +* * +* Computer graphics and geometric modeling: implementation and algorithms * +* By Max K. Agoston * +* Springer; 1 edition (January 4, 2005) * +* http://books.google.com/books?q=vatti+clipping+agoston * +* * +* See also: * +* "Polygon Offsetting by Computing Winding Numbers" * +* Paper no. DETC2005-85513 pp. 565-575 * +* ASME 2005 International Design Engineering Technical Conferences * +* and Computers and Information in Engineering Conference (IDETC/CIE2005) * +* September 24-28, 2005 , Long Beach, California, USA * +* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * +* * +*******************************************************************************/ + +#ifndef clipper_hpp +#define clipper_hpp + +#define CLIPPER_VERSION "6.2.1" + +//use_int32: When enabled 32bit ints are used instead of 64bit ints. This +//improve performance but coordinate values are limited to the range +/- 46340 +//#define use_int32 + +//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance. +#define use_xyz + +//use_lines: Enables line clipping. Adds a very minor cost to performance. +#define use_lines + +//use_deprecated: Enables temporary support for the obsolete functions +//#define use_deprecated + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../src/types.h" + +namespace ClipperLib { + +enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor }; +enum PolyType { ptSubject, ptClip }; +//By far the most widely used winding rules for polygon filling are +//EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32) +//Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL) +//see http://glprogramming.com/red/chapter11.html +enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }; + +struct ZLabel { + ZLabel () : id(0), t(0) {} + ZLabel (Int32 ii) : id(ii), t(0) {} + ZLabel (Int32 ii, double tt) : id(ii), t(tt) {} + bool operator == (const ZLabel &l) const {return id == l.id;} + Int32 id; + double t; +}; + +inline std::ostream& operator << (std::ostream &os, const ZLabel &l) { + return os << l.id << ':' << l.t; +} + +struct ZType { + ZType (UInt64 v) : label1(v >> 32), label2(v & 0xffffffff) {} + ZType (Int32 id1, Int32 id2) : label1(id1), label2(id2) {} + ZType (const ZLabel &l1, const ZLabel &l2) : label1(l1), label2(l2) {} + const ZLabel& minLabel () const {return (label1.id < label2.id) ? label1 : label2;} + const ZLabel& maxLabel () const {return (label1.id > label2.id) ? label1 : label2;} + + const ZLabel& otherLabel (const ZLabel &l) const { + return (l.id == label1.id && l.t == label1.t) ? label2 : label1; + } + + bool operator == (const ZType &p) const {return minLabel() == p.minLabel() && maxLabel() == p.maxLabel();} + operator UInt64 () const {return (UInt64(label1.id) << 32) & label2.id;} + ZLabel label1, label2; +}; + +inline std::ostream& operator << (std::ostream &os, const ZType &z) { + return os << '[' << z.label1 << '|' << z.label2 << ']'; +} + +#ifdef use_int32 + typedef int cInt; + static cInt const loRange = 0x7FFF; + static cInt const hiRange = 0x7FFF; +#else + typedef signed long long cInt; + static cInt const loRange = 0x3FFFFFFF; + static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL; + typedef signed long long long64; //used by Int128 class + typedef unsigned long long ulong64; + +#endif + +struct IntPoint { + cInt X; + cInt Y; +#ifdef use_xyz + ZType Z; + IntPoint(cInt x = 0, cInt y = 0, ZType z = 0): X(x), Y(y), Z(z) {}; +#else + IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {}; +#endif + + friend inline bool operator== (const IntPoint& a, const IntPoint& b) + { + return a.X == b.X && a.Y == b.Y; + } + friend inline bool operator!= (const IntPoint& a, const IntPoint& b) + { + return a.X != b.X || a.Y != b.Y; + } +}; +//------------------------------------------------------------------------------ + +typedef std::vector< IntPoint > Path; +typedef std::vector< Path > Paths; + +inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;} +inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;} + +std::ostream& operator <<(std::ostream &s, const IntPoint &p); +std::ostream& operator <<(std::ostream &s, const Path &p); +std::ostream& operator <<(std::ostream &s, const Paths &p); + +struct DoublePoint +{ + double X; + double Y; + DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {} + DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {} +}; +//------------------------------------------------------------------------------ + +#ifdef use_xyz +typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt); +#endif + +enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4}; +enum JoinType {jtSquare, jtRound, jtMiter}; +enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound}; + +class PolyNode; +typedef std::vector< PolyNode* > PolyNodes; + +class PolyNode +{ +public: + PolyNode(); + virtual ~PolyNode(){}; + Path Contour; + PolyNodes Childs; + PolyNode* Parent; + PolyNode* GetNext() const; + bool IsHole() const; + bool IsOpen() const; + int ChildCount() const; +private: + unsigned Index; //node index in Parent.Childs + bool m_IsOpen; + JoinType m_jointype; + EndType m_endtype; + PolyNode* GetNextSiblingUp() const; + void AddChild(PolyNode& child); + friend class Clipper; //to access Index + friend class ClipperOffset; +}; + +class PolyTree: public PolyNode +{ +public: + ~PolyTree(){Clear();}; + PolyNode* GetFirst() const; + void Clear(); + int Total() const; +private: + PolyNodes AllNodes; + friend class Clipper; //to access AllNodes +}; + +bool Orientation(const Path &poly); +double Area(const Path &poly); +int PointInPolygon(const IntPoint &pt, const Path &path); + +void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); +void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); +void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); + +void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415); +void CleanPolygon(Path& poly, double distance = 1.415); +void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); +void CleanPolygons(Paths& polys, double distance = 1.415); + +void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed); +void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed); +void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution); + +void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); +void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths); +void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths); + +void ReversePath(Path& p); +void ReversePaths(Paths& p); + +struct IntRect { cInt left; cInt top; cInt right; cInt bottom; }; + +//enums that are used internally ... +enum EdgeSide { esLeft = 1, esRight = 2}; + +//forward declarations (for stuff used internally) ... +struct TEdge; +struct IntersectNode; +struct LocalMinimum; +struct Scanbeam; +struct OutPt; +struct OutRec; +struct Join; + +typedef std::vector < OutRec* > PolyOutList; +typedef std::vector < TEdge* > EdgeList; +typedef std::vector < Join* > JoinList; +typedef std::vector < IntersectNode* > IntersectList; + +//------------------------------------------------------------------------------ + +//ClipperBase is the ancestor to the Clipper class. It should not be +//instantiated directly. This class simply abstracts the conversion of sets of +//polygon coordinates into edge objects that are stored in a LocalMinima list. +class ClipperBase +{ +public: + ClipperBase(); + virtual ~ClipperBase(); + bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed); + bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed); + virtual void Clear(); + IntRect GetBounds(); + bool PreserveCollinear() {return m_PreserveCollinear;}; + void PreserveCollinear(bool value) {m_PreserveCollinear = value;}; +protected: + void DisposeLocalMinimaList(); + TEdge* AddBoundsToLML(TEdge *e, bool IsClosed); + void PopLocalMinima(); + virtual void Reset(); + TEdge* ProcessBound(TEdge* E, bool IsClockwise); + void DoMinimaLML(TEdge* E1, TEdge* E2, bool IsClosed); + TEdge* DescendToMin(TEdge *&E); + void AscendToMax(TEdge *&E, bool Appending, bool IsClosed); + + typedef std::vector MinimaList; + MinimaList::iterator m_CurrentLM; + MinimaList m_MinimaList; + + bool m_UseFullRange; + EdgeList m_edges; + bool m_PreserveCollinear; + bool m_HasOpenPaths; +}; +//------------------------------------------------------------------------------ + +class Clipper : public virtual ClipperBase +{ +public: + Clipper(int initOptions = 0); + ~Clipper(); + bool Execute(ClipType clipType, + Paths &solution, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); + bool Execute(ClipType clipType, + PolyTree &polytree, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); + bool ReverseSolution() {return m_ReverseOutput;}; + void ReverseSolution(bool value) {m_ReverseOutput = value;}; + bool StrictlySimple() {return m_StrictSimple;}; + void StrictlySimple(bool value) {m_StrictSimple = value;}; + //set the callback function for z value filling on intersections (otherwise Z is 0) +#ifdef use_xyz + void ZFillFunction(ZFillCallback zFillFunc); +#endif +protected: + void Reset(); + virtual bool ExecuteInternal(); +private: + PolyOutList m_PolyOuts; + JoinList m_Joins; + JoinList m_GhostJoins; + IntersectList m_IntersectList; + ClipType m_ClipType; + typedef std::priority_queue ScanbeamList; + ScanbeamList m_Scanbeam; + TEdge *m_ActiveEdges; + TEdge *m_SortedEdges; + bool m_ExecuteLocked; + PolyFillType m_ClipFillType; + PolyFillType m_SubjFillType; + bool m_ReverseOutput; + bool m_UsingPolyTree; + bool m_StrictSimple; +#ifdef use_xyz + ZFillCallback m_ZFill; //custom callback +#endif + void SetWindingCount(TEdge& edge); + bool IsEvenOddFillType(const TEdge& edge) const; + bool IsEvenOddAltFillType(const TEdge& edge) const; + void InsertScanbeam(const cInt Y); + cInt PopScanbeam(); + void InsertLocalMinimaIntoAEL(const cInt botY); + void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge); + void AddEdgeToSEL(TEdge *edge); + void CopyAELToSEL(); + void DeleteFromSEL(TEdge *e); + void DeleteFromAEL(TEdge *e); + void UpdateEdgeIntoAEL(TEdge *&e); + void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); + bool IsContributing(const TEdge& edge) const; + bool IsTopHorz(const cInt XPos); + void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); + void DoMaxima(TEdge *e); + void ProcessHorizontals(bool IsTopOfScanbeam); + void ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam); + void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); + OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); + OutRec* GetOutRec(int idx); + void AppendPolygon(TEdge *e1, TEdge *e2); + void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt); + OutRec* CreateOutRec(); + OutPt* AddOutPt(TEdge *e, const IntPoint &pt); + void DisposeAllOutRecs(); + void DisposeOutRec(PolyOutList::size_type index); + bool ProcessIntersections(const cInt topY); + void BuildIntersectList(const cInt topY); + void ProcessIntersectList(); + void ProcessEdgesAtTopOfScanbeam(const cInt topY); + void BuildResult(Paths& polys); + void BuildResult2(PolyTree& polytree); + void SetHoleState(TEdge *e, OutRec *outrec); + void DisposeIntersectNodes(); + bool FixupIntersectionOrder(); + void FixupOutPolygon(OutRec &outrec); + bool IsHole(TEdge *e); + bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl); + void FixHoleLinkage(OutRec &outrec); + void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt); + void ClearJoins(); + void ClearGhostJoins(); + void AddGhostJoin(OutPt *op, const IntPoint offPt); + bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2); + void JoinCommonEdges(); + void DoSimplePolygons(); + void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); + void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); +#ifdef use_xyz + void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2); +#endif +}; +//------------------------------------------------------------------------------ + +class ClipperOffset +{ +public: + ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25); + ~ClipperOffset(); + void AddPath(const Path& path, JoinType joinType, EndType endType); + void AddPaths(const Paths& paths, JoinType joinType, EndType endType); + void Execute(Paths& solution, double delta); + void Execute(PolyTree& solution, double delta); + void Clear(); + double MiterLimit; + double ArcTolerance; +private: + Paths m_destPolys; + Path m_srcPoly; + Path m_destPoly; + std::vector m_normals; + double m_delta, m_sinA, m_sin, m_cos; + double m_miterLim, m_StepsPerRad; + IntPoint m_lowest; + PolyNode m_polyNodes; + + void FixOrientations(); + void DoOffset(double delta); + void OffsetPoint(int j, int& k, JoinType jointype); + void DoSquare(int j, int k); + void DoMiter(int j, int k, double r); + void DoRound(int j, int k); +}; +//------------------------------------------------------------------------------ + +class clipperException : public std::exception +{ + public: + clipperException(const char* description): m_descr(description) {} + virtual ~clipperException() throw() {} + virtual const char* what() const throw() {return m_descr.c_str();} + private: + std::string m_descr; +}; +//------------------------------------------------------------------------------ + +} //ClipperLib namespace + +#endif //clipper_hpp + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/config.h.in b/Build/source/texk/dvisvgm/dvisvgm-src/config.h.in new file mode 100644 index 00000000000..fcd8cf41872 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/config.h.in @@ -0,0 +1,169 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Set to 1 if PostScript support should be disabled */ +#undef DISABLE_GS + +/* Define to 1 if `TIOCGWINSZ' requires . */ +#undef GWINSZ_IN_SYS_IOCTL + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `dl' library (-ldl). */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `gs' library (-lgs). */ +#undef HAVE_LIBGS + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the `kpathsea' library (-lkpathsea). */ +#undef HAVE_LIBKPATHSEA + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `potrace' library (-lpotrace). */ +#undef HAVE_LIBPOTRACE + +/* Define to 1 if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMEB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if the kpathsea headers are not C++ safe. */ +#undef KPSE_CXX_UNSAFE + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* The machine triplet of the target system */ +#undef TARGET_SYSTEM + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac new file mode 100644 index 00000000000..57586feedc1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac @@ -0,0 +1,176 @@ +# This file is part of dvisvgm +# Copyright (C) 2005-2015 Martin Gieseking +# +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.59) +AC_INIT([dvisvgm],[1.12],[martin.gieseking@uos.de]) +DATE="November 2015" +AC_CONFIG_SRCDIR(src) +AC_CONFIG_HEADER(config.h) +AC_CONFIG_MACRO_DIR([m4]) +AC_CANONICAL_HOST +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE + +AH_TEMPLATE([TARGET_SYSTEM], [The machine triplet of the target system]) +AC_DEFINE_UNQUOTED([TARGET_SYSTEM], ["$target"]) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC + +AC_PROG_RANLIB +AC_LANG(C) + +AC_CHECK_FUNCS([ftime gettimeofday]) +AC_CHECK_HEADERS([sys/time.h sys/timeb.h]) +AC_HEADER_TIOCGWINSZ + +AC_CHECK_HEADER([kpathsea/kpathsea.h], , + [AC_MSG_ERROR([please install the kpathsea development package])]) +AC_CHECK_LIB(kpathsea, kpse_find_file, , + [AC_MSG_ERROR([libkpathsea not found, please install the corresponding package first])]) + +AC_MSG_CHECKING([kpathsea version]) +AC_RUN_IFELSE([AC_LANG_SOURCE([#include + #include + int main() { + FILE *f; + f = fopen("kpseversion", "w"); + if(!f) exit(1); + fprintf(f, "%s\n", KPSEVERSION); + fclose(f); + exit(0); + }])], + [kpseversion=`cat kpseversion|sed 's/kpathsea version //'`], [kpseversion=], [kpseversion=unknown]) +AC_MSG_RESULT("$kpseversion") +rm -f kpseversion +if test -z "$kpseversion"; then + AC_MSG_ERROR([Could not compile a simple kpathsea program -- check your installation]) +fi + + +# Check how to link potracelib +HAVE_LIBPOTRACE=1 +AC_CHECK_HEADER([potracelib.h], + [AC_CHECK_LIB(m, sqrt) # required to pass potrace check + AC_CHECK_LIB(potrace, potrace_trace, , HAVE_LIBPOTRACE=0)], HAVE_LIBPOTRACE=0) + +if test "$HAVE_LIBPOTRACE" -eq 0; then + AC_MSG_ERROR([potrace library not found]) +fi + + +# Check how to link Ghostscript +HAVE_LIBGS=1 +AC_CHECK_HEADER([ghostscript/iapi.h], + AC_CHECK_LIB(gs, gsapi_new_instance, , HAVE_LIBGS=0), HAVE_LIBGS=0) + +if test "$HAVE_LIBGS" -eq 0; then + AC_CHECK_LIB(dl, dlopen, , + [AC_DEFINE(DISABLE_GS, 1, [Set to 1 if PostScript support is to be disabled]) + AC_MSG_WARN(PostScript support disabled)]) +else + # query Ghostscript version + AC_MSG_CHECKING([Ghostscript version]) + AC_RUN_IFELSE([AC_LANG_SOURCE([#include + #include + int main () { + gsapi_revision_t r; + if (gsapi_revision(&r, sizeof(gsapi_revision_t)) == 0) { + FILE *f; + f = fopen("gsversion", "w"); + if (!f) exit(1); + fprintf(f, "%ld\n", r.revision); + fclose(f); + exit(0); + } + }])], + [gsversion=`cat gsversion`], [gsversion=], [gsversion=unknown]) + AC_MSG_RESULT("$gsversion") + rm -f gsversion + if test "$gsversion" -lt 831; then + # current Ghostscript API was introduced in version 8.31 + # older versions are not supported + LIBS=`echo $LIBS | sed "s/-lgs //" $LIBS` + AC_DEFINE(DISABLE_GS, 1, [Set to 1 if PostScript support should be disabled]) + AC_MSG_WARN([Ghostscript version < 8.31 found; PostScript support disabled]) + fi +fi + +# Check for pkg-config +PKG_PROG_PKG_CONFIG + +# Check for libraries. +PKG_CHECK_MODULES([FREETYPE], [freetype2]) + +AC_CHECK_LIB(z, gzopen) + +# Check for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS([libintl.h stdlib.h string.h strings.h unistd.h]) + +# Check for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_STRUCT_TM + +# Check for library functions. +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_ERROR_AT_LINE +AC_FUNC_MALLOC +AC_FUNC_STAT +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([memset strcasecmp strtol]) + +# add options for selection of "optional" library locations +# currently these libraries are mandatory; the --with-foo options +# are used to specify the locations explicitely + +AC_ARG_WITH(zlib,[ --with-zlib=DIR location of the zlib library], + [if test "$withval" != no; then + if test "$withval" != yes; then + ZLIB_DIR=$withval + fi + fi]) + +if test "$withval" != no; then + if test -n "$ZLIB_DIR"; then + ZLIB_CFLAGS="-I$ZLIB_DIR -I$ZLIB_DIR/include" + ZLIB_LIBS="-L$ZLIB_DIR/lib" + fi +fi + +AC_SUBST([ZLIB_CFLAGS]) +AC_SUBST([ZLIB_LIBS]) + +# Check if the kpathsea headers are C++ safe +AC_MSG_CHECKING([if the kpathsea headers are C++ safe]) +AC_LANG_PUSH([C++]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[printf("%s\n", concat("one", "two"))]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_DEFINE([KPSE_CXX_UNSAFE], 1, + [Define to 1 if the kpathsea headers are not C++ safe.])]) +AC_LANG_POP([C++]) + +AX_CODE_COVERAGE +AS_IF([ test "$enable_code_coverage" = "yes" ], [ + # disable optimization + changequote({,}) + CFLAGS=`echo $CFLAGS | sed 's/-O[1-9s]//g'` + CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[1-9s]//g'` + changequote([,]) +]) + +AC_SUBST(DATE) +AC_SUBST(AM_CPPFLAGS) +AC_SUBST(AM_LDFLAGS) +AC_CONFIG_FILES([Makefile clipper/Makefile xxHash/Makefile src/Makefile tests/Makefile doc/dvisvgm.txt doc/Makefile]) +AC_OUTPUT + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/doc/Makefile.am new file mode 100644 index 00000000000..3acae1631c4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/Makefile.am @@ -0,0 +1,54 @@ +## This file is part of dvisvgm +## Copyright (C) 2005-2015 Martin Gieseking +## +## Process this file with automake. + +man_MANS = dvisvgm.1 +EXTRA_DIST = $(man_MANS) conf-dblatex-man.xsl conf-dblatex-pdf.xsl tweak-dblatex-pdf.xsl + +CONF_DBLATEX_MAN = $(top_srcdir)/doc/conf-dblatex-man.xsl +CONF_DBLATEX_PDF = $(top_srcdir)/doc/conf-dblatex-pdf.xsl +TWEAK_DBLATEX_PDF = $(top_srcdir)/doc/tweak-dblatex-pdf.xsl + +DB_VARS = man.endnotes.list.enabled=0 man.endnotes.are.numbered=0 man.authors.section.enabled=0 + +dvisvgm.1: dvisvgm.xml $(CONF_DBLATEX_MAN) + if [ `type -p xmlto` ]; then \ + xmlto -m $(CONF_DBLATEX_MAN) $(addprefix --stringparam , $(DB_VARS)) man $<; \ + fi + +dvisvgm.pdf: dvisvgm.xml $(CONF_DBLATEX_PDF) $(TWEAK_DBLATEX_PDF) + mv $< $<.tmp + xsltproc -o $< $(TWEAK_DBLATEX_PDF) $<.tmp + dblatex -bxetex --texstyle=./dvisvgm.sty -p $(CONF_DBLATEX_PDF) $< + mv $<.tmp $< + +dvi-pdf: dvisvgm.dvi + dvipdfm $< + rm -f $< + +dvisvgm.dvi: dvisvgm.1 + groff -Tdvi -mandoc ./$< >$@ + +dvisvgm.html: dvisvgm.xml + xsltproc -o $@ db2html.xsl $< + +dvisvgm.epub: dvisvgm.xml + a2x -dmanpage -fmanpage -L -a icons $<; + +dvisvgm.xml: dvisvgm.txt + if [ `type -p asciidoc` ]; then \ + asciidoc -a icons -a 'iconsdir=.' -a badges -a 'revnumber=@VERSION@' --unsafe -bdocbook -dmanpage $<; \ + sed -i "s#\(\)#$(shell stat -c %y $<)\n\1#" $@; \ + fi + +epub: dvisvgm.epub +html: dvisvgm.html +man: dvisvgm.1 +pdf: dvisvgm.pdf + +clean: + rm -f dvisvgm.pdf dvisvgm.html dvisvgm.xml dvisvgm.txt dvisvgm.dvi dvisvgm.epub + +distclean-local: + rm -f dvisvgm.pdf dvisvgm.html dvisvgm.xml dvisvgm.txt dvisvgm.dvi dvisvgm.epub dvisvgm.1 diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-man.xsl b/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-man.xsl new file mode 100644 index 00000000000..23283210027 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-man.xsl @@ -0,0 +1,19 @@ + + + + + + + \fB + + \fR + + + + + + (\m[blue] + + \m[]) + + \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-pdf.xsl b/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-pdf.xsl new file mode 100644 index 00000000000..2a8aeec290a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/conf-dblatex-pdf.xsl @@ -0,0 +1,52 @@ + + + + + + \setmainfont{Source Sans Pro} + \setsansfont{Source Sans Pro} + \setmonofont{Source Code Pro} + + + 0 + 0 + caution + note + tabular + 0 + 1 + + + basicstyle=\ttfamily\small,backgroundcolor=\color[gray]{0.9},columns=fullflexible,frame=single + + + + + + + + + + + + + + + + \tableofcontents + + 2 + 1 + + + + + + + + 2 + 1 + + + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 new file mode 100644 index 00000000000..bcd2f4d5728 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 @@ -0,0 +1,1259 @@ +'\" t +.\" Title: dvisvgm +.\" Author: Martin Gieseking +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 11/18/2015 +.\" Manual: dvisvgm Manual +.\" Source: dvisvgm 1.12 +.\" Language: English +.\" +.TH "DVISVGM" "1" "11/18/2015" "dvisvgm 1\&.12" "dvisvgm Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +dvisvgm \- converts DVI and EPS files to the XML\-based SVG format +.SH "SYNOPSIS" +.sp +\fBdvisvgm\fR [ \fIoptions\fR ] \fIfile\fR [\&.dvi] +.sp +\fBdvisvgm\fR \-E [ \fIoptions\fR ] \fIfile\fR [\&.eps] +.SH "DESCRIPTION" +.sp +The command\-line utility \fBdvisvgm\fR converts DVI files, as generated by TeX/LaTeX, to the XML\-based scalable vector graphics format SVG\&. It supports the classic DVI format 2 as well as format 3 (created by pTeX in vertical mode), and the XeTeX formats 5 and 6 which are also known as XDV\&. Besides the basic DVI commands, dvisvgm also evaluates many so\-called \fIspecials\fR which heavily extend the capabilities of the plain DVI format\&. For a more detailed overview, see section \fBSupported Specials\fR below\&. +.sp +Since the current SVG standard 1\&.1 doesn\(cqt specify multi\-page graphics, dvisvgm creates separate SVG files for each DVI page\&. Because of compatibility reasons, only the first page is converted by default\&. In order to select a different page or arbitrary page sequences, use option \fB\-p\fR which is described below\&. +.sp +SVG is a vector\-based graphics format and therefore dvisvgm tries to convert the glyph outlines of all fonts referenced in a DVI page section to scalable path descriptions\&. The fastest way to achieve this is to extract the path information from vector\-based font files available in PFB, TTF, or OTF format\&. If dvisvgm is able to find such a file, it extracts all necessary outline information about the glyphs from it\&. +.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\fR\&...\fB\fR) to embed the font data into the SVG files\&. Unfortunately, only few SVG renderes 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\&. +.SH "OPTIONS" +.PP +\fB\-a, \-\-trace\-all\fR=[\fIretrace\fR] +.RS 4 +This option forces dvisvgm to vectorize not only the glyphs actually required to render the SVG file correctly \(en which is the default \(en, but processes all glyphs of all fonts referenced in the DVI file\&. Because dvisvgm stores the tracing results a font cache, all following conversions these fonts will speed up significantly\&. The boolean option +\fIretrace\fR +determines how to handle glyphs already stored in the cache\&. By default, these glyphs are skipped\&. Setting argument +\fIretrace\fR +to +\fIyes\fR +or +\fItrue\fR +forces dvisvgm to retrace the corresponding bitmaps again\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +This option only takes effect if font caching is active\&. Therefore, +\fB\-\-trace\-all\fR +cannot be combined with option +\fB\-\-cache=none\fR\&. +.sp .5v +.RE +.RE +.PP +\fB\-b, \-\-bbox\fR=\fIfmt\fR +.RS 4 +Sets the bounding box of the generated graphic to the specified format\&. The parameter +\fIfmt\fR +takes either one of the format specifiers listed below, or a sequence of four comma\- or whitespace\-separated length values +\fIx1\fR, +\fIy1\fR, +\fIx2\fR +and +\fIy2\fR\&. The latter define the absolute coordinates of two diagonal corners of the bounding box\&. Each length value consists of a floating point number and an optional length unit (pt, bp, cm, mm, in, or pc)\&. If the unit is omitted, TeX points (pt) are assumed\&. +.sp +It\(cqs also possible to give only one length value +\fIl\fR\&. In this case, the minimal bounding box is computed and enlarged by adding (\-\fIl\fR,\-\fIl\fR) to the upper left and (\fIl\fR,\fIl\fR) to the lower right corner\&. +.sp +Additionally, dvisvgm also supports the following format specifiers: +.PP +\fBInternational DIN/ISO paper sizes\fR +.RS 4 +A\fIn\fR, B\fIn\fR, C\fIn\fR, D\fIn\fR, where +\fIn\fR +is a non\-negative integer, e\&.g\&. A4 or a4 for DIN/ISO A4 format (210mm \(mu 297mm)\&. +.RE +.PP +\fBNorth American paper sizes\fR +.RS 4 +invoice, executive, legal, letter, ledger +.RE +.PP +\fBSpecial bounding box sizes\fR +.RS 4 +.TS +tab(:); +lt lt +lt lt +lt lt. +T{ +\fBdvi\fR +T}:T{ +page size stored in the DVI file +T} +T{ +\fBmin\fR +T}:T{ +computes the minimal/tightest bounding box +T} +T{ +\fBnone\fR +T}:T{ +no bounding box is assigned +T} +.TE +.sp 1 +.RE +.PP +\fBPage orientation\fR +.RS 4 +The default page orientation for DIN/ISO and American paper sizes is +\fIportrait\fR, i\&.e\&. +\fIwidth\fR +< +\fIheight\fR\&. Appending +\fB\-landscape\fR +or simply +\fB\-l\fR +to the format string switches to +\fIlandscape\fR +mode (\fIwidth\fR +> +\fIheight\fR)\&. For symmetry reasons you can also explicitly add +\fB\-portrait\fR +or +\fB\-p\fR +to indicate the default portrait format\&. Note that these suffixes are part of the size string and not separate options\&. Thus, they must directly follow the size specifier without additional blanks\&. Furthermore, the orientation suffixes can\(cqt be used with +\fBdvi\fR, +\fBmin\fR, and +\fBnone\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Option +\fB\-b, \-\-bbox\fR +only affects the bounding box and does not transform the page content\&. Hence, if you choose a landscape format, the page won\(cqt be rotated\&. +.sp .5v +.RE +.RE +.RE +.PP +\fB\-C, \-\-cache\fR[=\fIdir\fR] +.RS 4 +To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion information in cache files\&. By default, these files are stored in +\fB$HOME/\&.dvisvgm/cache\fR\&. If you prefer a different location, use option +\fB\-\-cache\fR +to overwrite the default\&. Furthermore, it is also possible to disable the font caching mechanism completely with option +\fB\-\-cache=none\fR\&. If argument +\fIdir\fR +is omitted, dvisvgm prints the path of the default cache directory together with further information about the stored fonts\&. Additionally, outdated and corrupted cache files are removed\&. +.RE +.PP +\fB\-j, \-\-clipjoin\fR +.RS 4 +This option tells dvisvgm to compute all intersections of clipping paths itself rather than delegating this task to the SVG renderer\&. The resulting SVG files are more portable because some SVG viewers don\(cqt support intersecting clipping paths which are defined by +\fIclipPath\fR +elements containing a +\fIclip\-path\fR +attribute\&. +.RE +.PP +\fB\-\-color\fR +.RS 4 +Enables colorization of messages printed during the conversion process\&. The colors can be customized via the environment variable +\fBDVISVGM_COLORS\fR\&. See the +Environment section +below for further information\&. +.RE +.PP +\fB\-\-colornames\fR +.RS 4 +By default, dvisvgm exclusively uses RGB values of the form +\fI#RRGGBB\fR +to represent colors in the SVG file\&. According to the SVG standard, it\(cqs also possible to use color names (like +\fBblack\fR +and +\fBdarkblue\fR) for a limited number of predefined colors\&. In order to apply these color names rather than their RGB values, call dvisvgm with option +\fB\-\-colornames\fR\&. All colors without an SVG color name will still be represented by RGB values\&. +.RE +.PP +\fB\-E, \-\-eps\fR +.RS 4 +If this option is given, dvisvgm does not expect a DVI but an EPS input file, and tries to convert it to SVG\&. In order to do so, a single +\fIpsfile\fR +special command is created and forwarded to the PostScript special handler\&. This option is only available if dvisvgm was built with PostScript support enabled, and requires Ghostscript to be available\&. See option +\fB\-\-libgs\fR +for further information\&. +.RE +.PP +\fB\-e, \-\-exact\fR +.RS 4 +This option tells dvisvgm to compute the precise bounding box of each character\&. By default, the values stored in a font\(cqs TFM file are used to determine a glyph\(cqs extent\&. As these values are intended to implement optimal character placements and are not designed to represent the exact dimensions, they don\(cqt necessarily correspond with the bounds of the visual glyphs\&. Thus, width and/or height of some glyphs may be larger (or smaller) than the respective TFM values\&. As a result, this can lead to clipped characters at the bounds of the SVG graphics\&. With option +\fB\-\-exact\fR +given, dvisvgm analyzes the actual shape of each character and derives a usually tight bounding box\&. +.RE +.PP +\fB\-m, \-\-fontmap\fR=\fIfilenames\fR +.RS 4 +Loads and evaluates a single font map file or a sequence of font map files\&. These files are required to resolve font file names and encodings\&. dvisvgm does not provide its own map files but tries to read available ones coming with dvips or dvipdfm\&. If option +\fB\-\-fontmap\fR +is omitted, dvisvgm looks for the default map files +\fIps2pk\&.map\fR, +\fIdvipdfm\&.map\fR, and +\fIpsfonts\&.map\fR +(in this order)\&. Otherwise, the files as option arguments are evaluated in the given order\&. Multiple filenames must be separated by commas without leading and/or trailing whitespace\&. By default, redefined mappings do not replace previous ones\&. However, each filename can be preceded by an optional mode specifier (\fB+\fR, +\fB\-\fR, or +\fB=\fR) to change this behavior: +.PP ++mapfile +.RS 4 +Only those entries in the given map file that don\(cqt redefine a font mapping are applied, i\&.e\&. fonts already mapped keep untouched\&. That\(cqs also the default mode if no mode specifier is given\&. +.RE +.PP +\-mapfile +.RS 4 +Ensures that none of the font mappings defined in the given map file are used, i\&.e\&. previously defined mappings for the specified fonts are removed\&. +.RE +.PP +=mapfile +.RS 4 +All mappings defined in the map file are applied\&. Previously defined settings for the same fonts are replaced\&. +.sp +If the first filename in the filename sequence is preceded by a mode specifier, dvisvgm loads the default font map (see above) and applies the other map files afterwards\&. Otherwise, none of default map files will be loaded automatically\&. +.sp +Examples: +\fB\-\-fontmap=myfile1\&.map,+myfile2\&.map\fR +loads +\fImyfile1\&.map\fR +followed by +\fImyfile2\&.map\fR +where all redefinitions of +\fBmyfile2\&.map\fR +are ignored\&. +\fB\-\-fontmap==myfile1\&.map,\-myfile2\&.map\fR +loads the default map file followed by +\fImyfile1\&.map\fR +and +\fImyfile2\&.map\fR +where all redefinitions of +\fImyfile1\&.map\fR +replace previous entries\&. Afterwards, all definitions for the fonts given in +\fImyfile2\&.map\fR +are removed from the font map tree\&. +.sp +For further information about the map file formats and the mode specifiers, see the manuals of dvips and dvipdfm\&. +.RE +.RE +.PP +\fB\-\-grad\-overlap\fR +.RS 4 +Tells dvisvgm to create overlapping grid segments when approximating color gradient fills (also see option +\fB\-\-grad\-segments\fR +below)\&. By default, adjacent segments don\(cqt overlap but only touch each other like separate tiles\&. However, this alignment can lead to visible gaps between the segments because the background color usually influences the color at the boundary of the segments if the SVG renderer uses anti\-aliasing to create smooth contours\&. One way to avoid this and to create seamlessly touching color regions is to enlarge the segments so that they extent into the area of their right and bottom neighbors\&. Since the latter are drawn on top of the overlapping parts, the visible size of all segments keeps unchanged\&. Just the former gaps disappear as the background is now completely covered by the correct colors\&. Currently, dvisvgm computes the overlapping segments separately for each patch of the mesh (a patch mesh may consist of multiple patches of the same type)\&. Therefore, there still might be visible gaps at the seam of two adjacent patches\&. +.RE +.PP +\fB\-\-grad\-segments\fR=\fInumber\fR +.RS 4 +Determines the maximal number of segments per column and row used to approximate gradient color fills\&. Since SVG 1\&.1 only supports a small subset of the shading algorithms available in PostScript, dvisvgm approximates some of them by subdividing the area to be filled into smaller, monochromatic segments\&. Each of these segments gets the average color of the region it covers\&. Thus, increasing the number of segments leads to smaller monochromatic areas and therefore a better approximation of the actual color gradient\&. As a drawback, more segments imply bigger SVG files because every segment is represented by a separate path element\&. +.sp +Currently, dvisvgm supports free\- and lattice\-form triangular patch meshes as well as Coons and tensor\-product patch meshes\&. They are approximated by subdividing the area of each patch into a +\fIn\fR\(mu\fIn\fR +grid of smaller segments\&. The maximal number of segments per column and row can be changed with option +\fB\-\-grad\-segments\fR\&. +.RE +.PP +\fB\-\-grad\-simplify\fR=\fIdelta\fR +.RS 4 +If the size of the segments created to approximate gradient color fills falls below the given delta value, dvisvgm reduces their level of detail\&. For example, B\('ezier curves are replaced by straight lines, and triangular segments are combined to tetragons\&. For a small +\fIdelta\fR, these simplifications are usually not noticeable but reduce the size of the generated SVG files significantly\&. +.RE +.PP +\fB\-h, \-\-help\fR[=\fImode\fR] +.RS 4 +Prints a short summary of all available command\-line options\&. The optional +\fImode\fR +parameter is an integer value between 0 and 2\&. It selects the display variant of the help text\&. Mode 0 lists all options divided into categories with section headers\&. This is also the default if dvisvgm is called without parameters\&. Mode 1 lists all options ordered by the short option names, while mode 2 sorts the lines by the long option names\&. +.RE +.PP +\fB\-\-keep\fR +.RS 4 +Disables the removal of temporary files as created by Metafont (usually \&.gf, \&.tfm, and \&.log files)\&. +.RE +.PP +\fB\-\-libgs\fR=\fIfilename\fR +.RS 4 +This option is only available if the Ghostscript library is not directly linked to dvisvgm and if PostScript support was not completely disabled during compilation\&. In this case, dvisvgm tries to load the shared GS library dynamically during runtime\&. By default, it expects the library\(cqs name to be +\fBlibgs\&.so\&.X\fR +(on Unix\-like systems, where +\fBX\fR +is the ABI version of the library) or +\fBgsdll32\&.dll\fR/\fBgsdll64\&.dll\fR +(Windows)\&. Option +\fB\-\-libgs\fR +can be used to give a different name\&. Alternatively, it\(cqs also possible to set the GS library name by the environment variable +\fBLIBGS\fR\&. The latter has less precedence than the command\-line option, i\&.e\&. dvisvgm ignores variable +\fBLIBGS\fR +if +\fB\-\-libgs\fR +is given\&. +.RE +.PP +\fB\-L, \-\-linkmark\fR=\fIstyle\fR +.RS 4 +Selects the method how to mark hyperlinked areas\&. The +\fIstyle\fR +argument can take one of the values +\fInone\fR, +\fIbox\fR, and +\fIline\fR, where +\fIbox\fR +is the default, i\&.e\&. a rectangle is drawn around the linked region if option +\fB\-\-linkmark\fR +is omitted\&. Style argument +\fIline\fR +just draws the lower edge of the bounding rectangle, and +\fInone\fR +tells dvisvgm not to add any visible objects to hyperlinks\&. The lines and boxes get the current text color selected\&. In order to apply a different, constant color, a colon followed by a color specifier can be appended to the style string\&. A +\fIcolor specifier\fR +is either a hexadecimal RGB value of the form +\fI#RRGGBB\fR, or a +dvips color name (\m[blue]http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips\m[])\&. +.sp +Moreover, argument +\fIstyle\fR +can take a single color specifier to highlight the linked region by a frameless box filled with that color\&. An optional second color specifier separated by a colon selects the frame color\&. +.sp +Examples: +\fBbox:red\fR +or +\fBbox:#ff0000\fR +draws red boxes around the linked areas\&. +\fByellow:blue\fR +creates yellow filled rectangles with blue frames\&. +.RE +.PP +\fB\-l, \-\-list\-specials\fR +.RS 4 +Prints a list of registered special handlers and exits\&. Each handler processes a set of special statements belonging to the same category\&. In most cases, the categories are identified by the prefix of the special statements\&. It\(cqs usually a leading word separated from the rest of the statement by a colon or a blank, e\&.g\&. +\fIcolor\fR +or +\fIps\fR\&. +.RE +.PP +\fB\-M, \-\-mag\fR=\fIfactor\fR +.RS 4 +Sets the magnification factor applied in conjunction with Metafont calls prior tracing the glyphs\&. The larger this value, the better the tracing results\&. Nevertheless, large magnification values can cause Metafont arithmetic errors due to number overflows\&. So, use this option with care\&. The default setting usually produces nice results\&. +.RE +.PP +\fB\-\-no\-merge\fR +.RS 4 +Puts every single character in a separate +\fItext\fR +element with corresponding +\fIx\fR +and +\fIy\fR +attributes\&. By default, new +\fItext\fR +or +\fItspan\fR +elements are only created if a string starts at a location that differs from the regular position defined by the characters\*(Aq advance values\&. +.RE +.PP +\fB\-\-no\-mktexmf\fR +.RS 4 +Suppresses the generation of missing font files\&. If dvisvgm can\(cqt find a font file through the kpathsea lookup mechanism, it calls the external tools +\fImktextfm\fR +or +\fImktexmf\fR\&. This option disables these calls\&. +.RE +.PP +\fB\-n, \-\-no\-fonts\fR[=\fIvariant\fR] +.RS 4 +If this option is given, dvisvgm doesn\(cqt create SVG +\fIfont\fR +elements but uses +\fIpaths\fR +instead\&. The resulting SVG files tend to be larger but they are concurrently more compatible with most applications that don\(cqt support SVG fonts yet\&. The optional argument +\fIvariant\fR +selects the method how to substitute fonts by paths\&. Variant 0 creates +\fIpath\fR +and +\fIuse\fR +elements in order to avoid lengthy duplicates\&. Variant 1 creates +\fIpath\fR +elements only\&. Option +\fB\-\-no\-fonts\fR +implies +\fB\-\-no\-styles\fR\&. +.RE +.PP +\fB\-c, \-\-scale\fR=\fIsx\fR[,\fIsy\fR] +.RS 4 +Scales the page content horizontally by +\fIsx\fR +and vertically by +\fIsy\fR\&. This option is equivalent to +\fB\-TS\fR\fIsx\fR,\fIsy\fR\&. +.RE +.PP +\fB\-S, \-\-no\-specials\fR[=\fInames\fR] +.RS 4 +Disable processing of special commands embedded in the DVI file\&. If no further parameter is given, all specials are ignored\&. To disable a selected set of specials, an optional comma\-separated list of names can be appended to this option\&. A +\fIname\fR +is the unique identifier referencing the intended special handler\&. Option +\fB\-\-list\-specials\fR +lists all handlers currently available together with their names\&. All unsupported special statements are silently ignored\&. +.RE +.PP +\fB\-\-no\-styles\fR +.RS 4 +By default, dvisvgm creates CSS styles and class attributes to reference fonts\&. This variant is more compact than adding the complete font information to each text element over and over again\&. However, if you prefer direct font references, the default behavior can be disabled with option +\fB\-\-no\-styles\fR\&. +.RE +.PP +\fB\-o, \-\-output\fR=\fIpattern\fR +.RS 4 +Sets the pattern specifying the names of the generated SVG files\&. Parameter +\fIpattern\fR +is a string that may contain static character sequences as well as the variables +\fB%f\fR, +\fB%p\fR, and +\fB%P\fR\&. +\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: +\fB%3p\fR +enforces 3 digits for the current page number (001, 002, etc\&.)\&. Without an explicit width specifier, +\fB%p\fR +gets the same number of digits as +\fB%P\fR\&. +.sp +If you need more control over the numbering, you can use arithmetic expressions as part of a pattern\&. The syntax is +\fB%(expr)\fR +where +\fIexpr\fR +may contain additions, subtractions, multiplications, and integer divisions with common precedence\&. The variables +\fBp\fR +and +\fBP\fR +contain the current page number and the total number of pages, respectively\&. For example, +\fB\-\-output="%f\-%(p\-1)"\fR +creates filenames where the numbering starts with 0 rather than 1\&. +.sp +The default pattern is +\fB%f\-%p\&.svg\fR +if the DVI file consists of more than one page, and +\fB%f\&.svg\fR +otherwise\&. That means, a DVI file +\fIfoo\&.dvi\fR +is converted to +\fIfoo\&.svg\fR +if +\fIfoo\&.dvi\fR +is a single\-page document\&. Otherwise, multiple SVG files +\fIfoo\-01\&.svg\fR, +\fIfoo\-02\&.svg\fR, etc\&. are produced\&. In Windows environments, the percent sign indicates dereferenced environment variables, and must therefore be protected by a second percent sign, e\&.g\&. +\fB\-\-output=%%f\-%%p\fR\&. +.RE +.PP +\fB\-p, \-\-page\fR=\fIranges\fR +.RS 4 +This option selects the pages to be processed\&. Parameter +\fIranges\fR +consists of a comma\-separated list of single page numbers and/or page ranges\&. A page range is a pair of numbers separated by a hyphen, e\&.g\&. 5\-12\&. Thus, a page sequence might look like this: 2\-4,6,9\-12,15\&. It doesn\(cqt matter if a page is given more than once or if page ranges overlap\&. dvisvgm always extracts the page numbers in ascending order and converts them only once\&. In order to stay compatible with previous versions, the default page sequence is 1\&. dvisvgm therefore converts only the first page and not the whole document if option +\fB\-\-page\fR +is omitted\&. Usually, page ranges consist of two numbers denoting the first and last page to be converted\&. If the conversion should start at page 1, or if it should continue up to the last DVI page, the first or second range number can be omitted, respectively\&. Example: +\fB\-\-page=\-10\fR +converts all pages up to page 10, +\fB\-\-page=10\-\fR +converts all pages starting with page 10\&. Please consider that the page values don\(cqt refer to the page numbers printed on the corresponding page\&. Instead, the physical page count is expected, where the first page always gets number 1\&. +.RE +.PP +\fB\-d, \-\-precision\fR=\fIdigits\fR +.RS 4 +Specifies the maximal number of decimal places applied to floating\-point attribute values\&. All attribute values written to the generated SVG file(s) are rounded accordingly\&. The parameter +\fIdigits\fR +allows integer values from 0 to 6, where 0 enables the automatic selection of significant decimal places\&. This is also the default value if dvisvgm is called without option +\fB\-\-precision\fR\&. +.RE +.PP +\fB\-P, \-\-progress\fR[=\fIdelay\fR] +.RS 4 +Enables a simple progress indicator shown when time\-consuming operations like PostScript specials are processed\&. The indicator doesn\(cqt appear before the given delay (in seconds) has elapsed\&. The default delay value is 0\&.5 seconds\&. +.RE +.PP +\fB\-r, \-\-rotate\fR=\fIangle\fR +.RS 4 +Rotates the page content clockwise by +\fIangle\fR +degrees around the page center\&. This option is equivalent to +\fB\-TR\fR\fIangle\fR\&. +.RE +.PP +\fB\-R, \-\-relative\fR +.RS 4 +SVG allows to define graphics paths by a sequence of absolute and/or relative path commands, i\&.e\&. each command expects either absolute coordinates or coordinates relative to the current drawing position\&. By default, dvisvgm creates paths made up of absolute commands\&. If option +\fB\-\-relative\fR +is given, relative commands are created instead\&. This slightly reduces the size of the SVG files in most cases\&. +.RE +.PP +\fB\-s, \-\-stdout\fR +.RS 4 +Don\(cqt write the SVG output to a file but redirect it to +\fBstdout\fR\&. +.RE +.PP +\fB\-T, \-\-transform\fR=\fIcommands\fR +.RS 4 +Applies a sequence of transformations to the SVG content\&. Each transformation is described by a +\fIcommand\fR +beginning with a capital letter followed by a list of comma\-separated parameters\&. Following transformation commands are supported: +.PP +\fBT\fR \fItx\fR[,\fIty\fR] +.RS 4 +Translates (moves/shifts) the page in direction of vector (\fItx\fR,\fIty\fR)\&. If +\fIty\fR +is omitted, +\fIty\fR=0 is assumed\&. The expected unit length of +\fItx\fR +and +\fIty\fR +are TeX points (1pt = 1/72\&.27in)\&. However, there are several constants defined to simplify the unit conversion (see below)\&. +.RE +.PP +\fBS\fR \fIsx\fR[,\fIsy\fR] +.RS 4 +Scales the page horizontally by +\fIsx\fR +and vertically by +\fIsy\fR\&. If +\fIsy\fR +is omitted, +\fIsy\fR=\fIsx\fR +is assumed\&. +.RE +.PP +\fBR\fR \fIangle\fR[,\fIx\fR,\fIy\fR] +.RS 4 +Rotates the page clockwise by +\fIangle\fR +degrees around point (\fIx\fR,\fIy\fR)\&. If the optional arguments +\fIx\fR +and +\fIy\fR +are omitted, the page will be rotated around its center depending on the chosen page format\&. When option +\fB\-bnone\fR +is given, the rotation center is origin (0,0)\&. +.RE +.PP +\fBKX\fR \fIangle\fR +.RS 4 +Skews the page along the +\fIx\fR\-axis by +\fIangle\fR +degrees\&. Argument +\fIangle\fR +can take any value except 90+180\fIk\fR, where +\fIk\fR +is an integer\&. +.RE +.PP +\fBKY\fR \fIangle\fR +.RS 4 +Skews the page along the +\fIy\fR\-axis by +\fIangle\fR +degrees\&. Argument +\fIangle\fR +can take any value except 90+180\fIk\fR, where +\fIk\fR +is an integer\&. +.RE +.PP +\fBFH\fR [\fIy\fR] +.RS 4 +Mirrors (flips) the page at the horizontal line through point (0,\fIy\fR)\&. Omitting the optional argument leads to +\fIy\fR=\fIh\fR/2, where +\fIh\fR +denotes the page height (see +\fIpre\-defined constants\fR +below)\&. +.RE +.PP +\fBFV\fR [\fIx\fR] +.RS 4 +Mirrors (flips) the page at the vertical line through point (\fIx\fR,0)\&. Omitting the optional argument leads to +\fIx\fR=\fIw\fR/2, where +\fIw\fR +denotes the page width (see +\fIpre\-defined constants\fR +below)\&. +.RE +.PP +\fBM\fR \fIm1\fR,\&...,\fIm6\fR +.RS 4 +Applies a transformation described by the 3\(mu3 matrix ((\fIm1\fR,\fIm2\fR,\fIm3\fR),(\fIm4\fR,\fIm5\fR,\fIm6\fR),(0,0,1)), where the inner triples denote the rows\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +All transformation commands of option +\fB\-T, \-\-transform\fR +are applied in the order of their appearance\&. Multiple commands can optionally be separated by spaces\&. In this case the whole transformation string has to be enclosed in double quotes to keep them together\&. All parameters are expressions of floating point type\&. You can either give plain numbers or arithmetic terms combined by the operators +\fB+\fR +(addition), +\fB\-\fR +(subtraction), +\fB*\fR +(multiplication), +\fB/\fR +(division) or +\fB%\fR +(modulo) with common associativity and precedence rules\&. Parentheses may be used as well\&. +.sp +Additionally, some pre\-defined constants are provided: +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +\fBux\fR +T}:T{ +horizontal position of upper left page corner in TeX point units +T} +T{ +\fBuy\fR +T}:T{ +vertical position of upper left page corner in TeX point units +T} +T{ +\fBh\fR +T}:T{ +page height in TeX point units (0 in case of +\fB\-bnone\fR) +T} +T{ +\fBw\fR +T}:T{ +page width in TeX point units (0 in case of +\fB\-bnone\fR) +T} +.TE +.sp 1 +Furthermore, you can use the length constants +\fBpt\fR, +\fBmm\fR, +\fBcm\fR +and +\fBin\fR, e\&.g\&. +\fB2cm\fR +or +\fB1\&.6in\fR\&. Thus, option +\fB\-TT1in,0R45\fR +moves the page content 1 inch to the right and rotates it by 45 degrees around the page center afterwards\&. +.sp +For single transformations, there are also the short\-hand options +\fB\-c\fR, +\fB\-t\fR +and +\fB\-r\fR +available\&. In contrast to the +\fB\-\-transform\fR* commands, the order of these options is not significant, so that it\(cqs not possible to describe transformation sequences with them\&. +.sp .5v +.RE +.RE +.RE +.PP +\fB\-t, \-\-translate\fR=\fItx\fR[,\fIty\fR] +.RS 4 +Translates (moves) the page content in direction of vector (\fItx\fR,\fIty\fR)\&. This option is equivalent to +\fB\-TT\fR\fItx\fR,\fIty\fR\&. +.RE +.PP +\fB\-v, \-\-verbosity\fR=\fIlevel\fR +.RS 4 +Controls the type of messages printed during a dvisvgm run: +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +\fB0\fR +T}:T{ +no message output at all +T} +T{ +\fB1\fR +T}:T{ +error messages only +T} +T{ +\fB2\fR +T}:T{ +warning messages only +T} +T{ +\fB4\fR +T}:T{ +informational messages only +T} +.TE +.sp 1 +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +By adding these values you can combine the categories\&. The default level is 7, i\&.e\&. all messages are printed\&. +.sp .5v +.RE +.RE +.PP +\fB\-V, \-\-version\fR[=\fIextended\fR] +.RS 4 +Prints the version of dvisvgm and exits\&. If the optional argument is set to +\fIyes\fR, the version numbers of the linked libraries are printed as well\&. +.RE +.PP +\fB\-z, \-\-zip\fR[=\fIlevel\fR] +.RS 4 +Creates a compressed SVG file with suffix \&.svgz\&. The optional argument specifies the compression level\&. Valid values are in the range of 1 to 9 (default value is 9)\&. Larger values cause better compression results but may take slightly more computation time\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +This option cannot be combined with +\fB\-s, \-\-stdout\fR\&. +.sp .5v +.RE +.RE +.PP +\fB\-Z, \-\-zoom\fR[=\fIfactor\fR] +.RS 4 +Multiplies the +\fIwidth\fR +and +\fIheight\fR +attributes of the SVG root element by argument +\fIfactor\fR +while the coordinate system of the graphic content is retained\&. As a result, most SVG viewers zoom the graphics accordingly\&. If a negative zoom factor is given, the +\fIwidth\fR +and +\fIheight\fR +attributes are omitted\&. +.RE +.SH "SUPPORTED SPECIALS" +.sp +dvisvgm supports several sets of \fIspecial commands\fR that can be used to enrich DVI files with additional features, like color, graphics, and hyperlinks\&. The evaluation of special commands is delegated to dedicated handlers provided by dvisvgm\&. Each handler is responsible for all special statements of the same command set, i\&.e\&. commands beginning with the same prefix\&. To get a list of the actually provided special handlers, use option \fB\-\-list\-specials\fR (see above)\&. This section gives an overview of the special commands currently supported\&. +.PP +\fBbgcolor\fR +.RS 4 +Special statement for changing the background/page color\&. Since SVG 1\&.1 doesn\(cqt support background colors, dvisvgm inserts a rectangle of the chosen color into the generated SVG document\&. This rectangle always gets the same size as the selected or computed bounding box\&. This background color command is part of the color special set but is handled separately in order to let the user turn it off\&. For an overview of the command syntax, see the documentation of dvips, for instance\&. +.RE +.PP +\fBcolor\fR +.RS 4 +Statements of this command set provide instructions to change the text/paint color\&. For an overview of the exact syntax, see the documentation of dvips, for instance\&. +.RE +.PP +\fBdvisvgm\fR +.RS 4 +dvisvgm offers its own small set of specials\&. The following list gives a brief overview\&. +.PP +\fBdvisvgm:raw\fR \fItext\fR +.RS 4 +Adds an arbitrary sequence of characters to the page section of the SVG document\&. dvisvgm does not perform any validation here, thus the user has to ensure that the resulting SVG is still valid\&. Parameter +\fItext\fR +may contain the expressions +\fB{?x}\fR, +\fB{?y}\fR, and +\fB{?color}\fR +that expand to the current +\fIx\fR +or +\fIy\fR +coordinate and the current color, respectively\&. Furthermore, +\fB{?nl}\fR +expands to a newline character\&. +.RE +.PP +\fBdvisvgm:rawdef\fR \fItext\fR +.RS 4 +This command is similar to +\fBdvisvgm:raw\fR, but puts the raw text into the section of the SVG document currently being generated\&. +.RE +.PP +\fBdvisvgm:rawset\fR \fIname\fR \&... \fBdvisvgm:endrawset\fR +.RS 4 +This pair of specials marks the begin and end of a definition of a named raw SVG fragment\&. All +\fBdvisvgm:raw\fR +and +\fBdvisvgm:rawdef\fR +specials enclosed by +\fBdvisvgm:rawset\fR +and +\fBdvisvgm:endrawset\fR +are not evaluated immediately but jointly stored under the given +\fIname\fR +for later use\&. Once defined, the named fragment can be referenced throughout the DVI file by +\fBdvisvgm:rawput\fR +(see below)\&. The two commands +\fBdvisvgm:rawset\fR +and +\fBdvisvgm:endrawset\fR +must not be nested, i\&.e\&. each call of +\fBdvisvgm:rawset\fR +has to be followed by a corresponding call of +\fBdvisvgm:endrawset\fR +before another +\fBdvisvgm:rawset\fR +may occur\&. Also, the identifier +\fIname\fR +must be unique throughout the DVI file\&. Using +\fBdvisvgm:rawset\fR +multiple times together with the same +\fIname\fR +leads to warning messages\&. +.RE +.PP +\fBdvisvgm:rawput\fR \fIname\fR +.RS 4 +Inserts raw SVG fragments previously stored under the given +\fIname\fR\&. dvisvgm distinguishes between fragments that were specified with +\fBdvisvgm:raw\fR +or +\fBdvisvgm:rawdef\fR, and handles them differently: It inserts all +\fBdvisvgm:raw\fR +parts every time +\fBdvisvgm:rawput\fR +is called, whereas the +\fBdvisvgm:rawdef\fR +portions go to the section of the current SVG document only once\&. +.RE +.PP +\fBdvisvgm:img\fR \fIwidth\fR \fIheight\fR \fIfile\fR +.RS 4 +Creates an image element at the current graphic position referencing the given file\&. JPEG, PNG, and SVG images can be used here\&. However, dvisvgm does not check the file format or the file name suffix\&. The lengths +\fIwidth\fR +and +\fIheight\fR +must be given as plain floating point numbers in TeX point units (1in = 72\&.27pt)\&. +.RE +.PP +\fBdvisvgm:bbox\fR n[ew] \fIname\fR +.RS 4 +Defines or resets a local bounding box called +\fIname\fR\&. The name may consist of letters and digits\&. While processing a DVI page, dvisvgm continuously updates the (global) bounding box of the current page in order to determine the minimal rectangle containing all visible page components (characters, images, drawing elements etc\&.) Additionally to the global bounding box, the user can request an arbitrary number of named local bounding boxes\&. Once defined, these boxes are updated together with the global bounding box starting with the first character that follows the definition\&. Thus, the local boxes can be used to compute the extent of parts of the page\&. This is useful for scenarios where the generated SVG file is post\-processed\&. In conjunction with special +\fBdvisvgm:raw\fR, the macro +\fB{?bbox \fR\fB\fIname\fR\fR\fB}\fR +expands to the four values +\fIx\fR, +\fIy\fR, +\fIw\fR, and +\fIh\fR +(separated by spaces) specifying the coordinates of the upper left corner, width, and height of the local box +\fIname\fR\&. If box +\fIname\fR +wasn\(cqt previously defined, all four values equal to zero\&. +.RE +.PP +\fBdvisvgm:bbox\fR \fIwidth\fR \fIheight\fR [\fIdepth\fR] +.RS 4 +Updates the bounding box of the current page by embedding a virtual rectangle (\fIx\fR, +\fIy\fR, +\fIwidth\fR, +\fIheight\fR) where the lower left corner is located at the current DVI drawing position (\fIx\fR,\fIy\fR)\&. If the optional parameter +\fIdepth\fR +is specified, dvisvgm embeds a second rectangle (\fIx\fR, +\fIy\fR, +\fIwidth\fR, \-\fIdepth\fR)\&. The lengths +\fIwidth\fR, +\fIheight\fR +and +\fIdepth\fR +must be given as plain floating point numbers in TeX point units (1in = 72\&.27pt)\&. Depending on size and position of the virtual rectangle, this command either enlarges the overall bounding box or leaves it as is\&. It\(cqs not possible to reduce its extent\&. This special should be used in conjunction with +\fBdvisvgm:raw\fR +in order to update the viewport of the page properly\&. +.RE +.PP +\fBdvisvgm:bbox\fR a[bs] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR +.RS 4 +This variant of the bbox special updates the bounding box by embedding a virtual rectangle (\fIx1\fR,\fIy1\fR,\fIx2\fR,\fIy2\fR)\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote two diagonal corners of the rectangle given in TeX point units\&. +.RE +.PP +\fBdvisvgm:bbox\fR f[ix] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR +.RS 4 +This variant of the bbox special assigns an absolute (final) bounding box to the resulting SVG\&. After executing this command, dvisvgm doesn\(cqt further alter the bounding box coordinates, except this special is called again later\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote two diagonal corners of the rectangle given in TeX point units\&. +.sp +The following TeX snippet adds two raw SVG elements to the output and updates the bounding box accordingly: +.sp +.if n \{\ +.RS 4 +.\} +.nf +\especial{dvisvgm:raw } +\especial{dvisvgm:bbox 20 10 10} + +\especial{dvisvgm:raw } +\especial{dvisvgm:bbox abs 10 200 100 250} +.fi +.if n \{\ +.RE +.\} +.RE +.RE +.PP +\fBem\fR +.RS 4 +These specials were introduced with the emTeX distribution by Eberhard Mattes\&. They provide line drawing statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands\&. dvisvgm supports only the line drawing statements and ignores all other em specials silently\&. A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN)\&. +.RE +.PP +\fBhtml\fR +.RS 4 +The hyperref specification defines several variants on how to mark hyperlinked areas in a DVI file\&. dvisvgm supports the plain HyperTeX special constructs as created with hyperref package option +\fIhypertex\fR\&. By default, all linked areas of the document are marked by a rectangle\&. Option +\fB\-\-linkmark\fR +allows to change this behavior\&. See above for further details\&. Information on syntax and semantics of the HyperTeX specials can be found in the hyperref manual\&. +.RE +.PP +\fBpdf\fR +.RS 4 +pdfTeX and dvipdfmx introduced several special commands related to the generation of PDF files\&. Currently, only two of them, +\fIpdf:mapfile\fR +and +\fIpdf:mapline\fR +are supported by dvisvgm\&. These specials allow modifying the font map tree during the processing of DVI files\&. They are used by CTeX, for example\&. dvisvgm supports both, the dvips and dvipdfm font map format\&. For further information on the command syntax and semantics, see the documentation of +\fB\epdfmapfile\fR +in the pdfTeX user manual\&. +.RE +.PP +\fBps\fR +.RS 4 +The famous DVI driver dvips introduced its own set of specials in order to embed PostScript code into DVI files, which greatly improves the capabilities of DVI documents\&. One aim of dvisvgm is to completely evaluate all PostScript snippets and to convert as many of them as possible to SVG\&. In contrast to dvips, dvisvgm uses floating point arithmetics to compute the precise position of each graphic element, i\&.e\&. it doesn\(cqt round the coordinates\&. Therefore, the relative locations of the graphic elements may slightly differ from those computed by dvips\&. +.sp +Since PostScript is a rather complex language, dvisvgm does not try to implement its own PostScript interpreter but relies on +Ghostscript (\m[blue]http://ghostscript.com\m[]) +instead\&. If the Ghostscript library was not linked to the dvisvgm binary, it is looked up and loaded dynamically during runtime\&. In this case, dvisvgm looks for +\fIlibgs\&.so\&.X\fR +on Unix\-like systems (supported ABI versions: 7,8,9), and for +\fIgsdll32\&.dll\fR +or +\fIgsdll64\&.dll\fR +on Windows\&. You can override the default file names with environment variable +\fBLIBGS\fR +or the command\-line option +\fB\-\-libgs\fR\&. The library must be reachable through the ld search path (*nix) or the PATH environment variable (Windows)\&. Alternatively, the absolute file path can be specified\&. If the library cannot be found, dvisvgm disables the processing of PostScript specials and prints a warning message\&. Use option +\fB\-\-list\-specials\fR +to check whether PostScript support is available, i\&.e\&. entry +\fIps\fR +is present\&. +.sp +The PostScript handler also recognizes and evaluates bounding box data generated by the +\fIpreview\fR +package with option +\fItightpage\fR\&. If such data is present in a DVI file, dvisvgm adapts the bounding box of the generated SVG file accordingly, and prints a message showing the width, height, and depth of the box in TeX point units\&. Especially, the depth value can be used to vertically align the SVG graphics with the baseline of surrounding text in HTML or XSL\-FO documents, for example\&. +.RE +.PP +\fBtpic\fR +.RS 4 +The TPIC special set defines instructions for drawing simple geometric objects\&. Some LaTeX packages, like eepic and tplot, use these specials to describe graphics\&. +.RE +.SH "EXAMPLES" +.sp +.if n \{\ +.RS 4 +.\} +.nf +dvisvgm file +.fi +.if n \{\ +.RE +.\} +.sp +Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svg\fR\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +dvisvgm \-z file +.fi +.if n \{\ +.RE +.\} +.sp +Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svgz\fR with default compression level 9\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +dvisvgm \-p5 \-z3 \-ba4\-l \-onewfile file +.fi +.if n \{\ +.RE +.\} +.sp +Converts the fifth page of \fIfile\&.dvi\fR to \fInewfile\&.svgz\fR with compression level 3\&. The bounding box is set to DIN/ISO A4 in landscape format\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +dvisvgm \-\-transform="R20,w/3,2h/5 T1cm,1cm S2,3" file +.fi +.if n \{\ +.RE +.\} +.sp +Converts the first page of \fIfile\&.dvi\fR to \fIfile\&.svg\fR where three transformations are applied\&. +.SH "ENVIRONMENT" +.sp +dvisvgm uses the \fBkpathsea\fR library for locating the files that it opens\&. Hence, the environment variables described in the library\(cqs documentation influence the converter\&. +.sp +If dvisvgm was linked without the Ghostscript library, and if PostScript support has not been disabled, the shared Ghostscript library is looked up during runtime via dlopen()\&. The environment variable \fBLIBGS\fR can be used to specify path and file name of the library\&. +.sp +The pre\-compiled Windows versions of dvisvgm require a working installation of MiKTeX 2\&.9 or above\&. dvisvgm does not work together with the portable edition of MiKTeX because it relies on MiKTeX\(cqs COM interface that is only accessible in a local installation\&. To enable the evaluation of PostScript specials, the original Ghostscript DLL \fIgsdll32\&.dll\fR must be present and reachable through the search path\&. 64\-bit Windows builds require the 64\-bit Ghostscript DLL \fIgsdll64\&.dll\fR\&. Both DLLs come with the corresponding Ghostscript installers available from \m[blue]\fBhttp://ghostscript\&.com\fR\m[]\&. +.sp +The environment variable \fBDVISVGM_COLORS\fR specifies the colors used to highlight various parts of dvisvgm\(cqs message output\&. It is only evaluated if option \fB\-\-color\fR is given\&. The value of \fBDVISVGM_COLORS\fR is a list of colon\-separated entries of the form \fIgg\fR=\fIBF\fR, where \fIgg\fR denotes one of the color group indicators listed below, and \fIBF\fR are two hexadecimal digits specifying the background (first digit) and foreground/text color (second digit)\&. The color values are defined as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=gray, 8=bright red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta, D=bright cyan, E=bright gray, F=white\&. Depending on the terminal, the colors may differ\&. Rather than changing both the text and background color, it\(cqs also possible to change only one of them: An asterisk (*) in place of a hexadecimal digit indicates the default text or background color of the terminal\&. +.sp +All malformed entries in the list are silently ignored\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +\fBer\fR +T}:T{ +.sp +error messages +T} +T{ +.sp +\fBwn\fR +T}:T{ +.sp +warning messages +T} +T{ +.sp +\fBpn\fR +T}:T{ +.sp +messages about page numbers +T} +T{ +.sp +\fBps\fR +T}:T{ +.sp +page size messages +T} +T{ +.sp +\fBfw\fR +T}:T{ +.sp +information about the files written +T} +T{ +.sp +\fBsm\fR +T}:T{ +.sp +state messages +T} +T{ +.sp +\fBtr\fR +T}:T{ +.sp +messages of the glyph tracer +T} +T{ +.sp +\fBpi\fR +T}:T{ +.sp +progress indicator +T} +.TE +.sp 1 +.sp +\fBExample:\fR \fBer=01:pi=*5\fR sets the colors of error messages (\fBer\fR) to red (\fB1\fR) on black (\fB0\fR), and those of progress indicators (\fBpi\fR) to cyan (\fB5\fR) on default background (\fB*\fR)\&. +.SH "FILES" +.sp +The location of the following files is determined by the kpathsea library\&. To check the actual kpathsea configuration you can use the \fBkpsewhich\fR utility\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +\fB*\&.enc\fR +T}:T{ +.sp +Font encoding files +T} +T{ +.sp +\fB*\&.fgd\fR +T}:T{ +.sp +Font glyph data files (cache files created by dvisvgm) +T} +T{ +.sp +\fB*\&.map\fR +T}:T{ +.sp +Font map files +T} +T{ +.sp +\fB*\&.mf\fR +T}:T{ +.sp +Metafont input files +T} +T{ +.sp +\fB*\&.pfb\fR +T}:T{ +.sp +PostScript Type 1 font files +T} +T{ +.sp +\fB*\&.pro\fR +T}:T{ +.sp +PostScript header/prologue files +T} +T{ +.sp +\fB*\&.tfm\fR +T}:T{ +.sp +TeX font metric files +T} +T{ +.sp +\fB*\&.ttf\fR +T}:T{ +.sp +TrueType font files +T} +T{ +.sp +\fB*\&.vf\fR +T}:T{ +.sp +Virtual font files +T} +.TE +.sp 1 +.SH "SEE ALSO" +.sp +\fBtex(1), mf(1), mktexmf(1), grodvi(1), potrace(1)\fR, and the \fBkpathsea library\fR info documentation\&. +.SH "RESOURCES" +.PP +Project home page +.RS 4 +\m[blue]\fBhttp://dvisvgm\&.bplaced\&.net\fR\m[] +.RE +.PP +Code repository +.RS 4 +\m[blue]\fBhttps://github\&.com/mgieseki/dvisvgm\fR\m[] +.RE +.SH "BUGS" +.sp +Please report bugs using the bug tracker at GitHub (\m[blue]https://github.com/mgieseki/dvisvgm/issues\m[])\&. +.SH "AUTHOR" +.sp +Written by Martin Gieseking <\m[blue]\fBmartin\&.gieseking@uos\&.de\fR\m[]> +.SH "COPYING" +.sp +Copyright \(co 2005\-2015 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/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in new file mode 100644 index 00000000000..7189d5c874d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in @@ -0,0 +1,789 @@ +////////////////////////////////////////////////////////////////////////// +// This file is part of dvisvgm -- the DVI to SVG converter // +// Copyright (C) 2005-2015 Martin Gieseking // +// // +// This program is free software; you can redistribute it and/or // +// modify it under the terms of the GNU General Public License as // +// 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 . // +////////////////////////////////////////////////////////////////////////// + +dvisvgm(1) +========== +Martin Gieseking <@PACKAGE_BUGREPORT@> +:man source: dvisvgm +:man version: @VERSION@ +:man manual: dvisvgm Manual + +NAME +---- +dvisvgm - converts DVI and EPS files to the XML-based SVG format + + +SYNOPSIS +-------- +*dvisvgm* [ 'options' ] 'file' [.dvi] + +*dvisvgm* -E [ 'options' ] 'file' [.eps] + + +DESCRIPTION +----------- +The command-line utility *dvisvgm* converts DVI files, as generated by TeX/LaTeX, to the +XML-based scalable vector graphics format SVG. It supports the classic DVI format 2 as +well as format 3 (created by pTeX in vertical mode), and the XeTeX formats 5 and 6 which are +also known as XDV. Besides the basic DVI commands, dvisvgm also evaluates many so-called +'specials' which heavily extend the capabilities of the plain DVI format. For a more detailed +overview, see section <> below. + +Since the current SVG standard 1.1 doesn't specify multi-page graphics, dvisvgm creates +separate SVG files for each DVI page. Because of compatibility reasons, only the first page +is converted by default. In order to select a different page or arbitrary page sequences, +use option *-p* which is described below. + +SVG is a vector-based graphics format and therefore dvisvgm tries to convert the glyph outlines +of all fonts referenced in a DVI page section to scalable path descriptions. The fastest way +to achieve this is to extract the path information from vector-based font files available in +PFB, TTF, or OTF format. If dvisvgm is able to find such a file, it extracts all necessary +outline information about the glyphs from it. + +However, TeX's main source for font descriptions is Metafont, which produces bitmap output +(GF files). That's why not all obtainable TeX fonts are available in a scalable format. +In these cases, dvisvgm tries to vectorize Metafont's 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. + +When running dvisvgm without option *--no-fonts*, it creates 'font' elements (++...++) +to embed the font data into the SVG files. Unfortunately, only few SVG renderes support these +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. + + +OPTIONS +------- +*-a, --trace-all*=['retrace']:: +This option forces dvisvgm to vectorize not only the glyphs actually required to render the +SVG file correctly – which is the default –, but processes all glyphs of all fonts referenced in +the DVI file. Because dvisvgm stores the tracing results a font cache, all following conversions these +fonts will speed up significantly. +The boolean option 'retrace' determines how to handle glyphs already stored in the cache. +By default, these glyphs are skipped. Setting argument 'retrace' to 'yes' or 'true' forces dvisvgm +to retrace the corresponding bitmaps again. ++ +[NOTE] +This option only takes effect if font caching is active. Therefore, *--trace-all* cannot be +combined with option *--cache=none*. ++ + + +*-b, --bbox*='fmt':: +Sets the bounding box of the generated graphic to the specified format. The parameter 'fmt' +takes either one of the format specifiers listed below, or a sequence of four comma- or +whitespace-separated length values 'x1', 'y1', 'x2' and 'y2'. The latter define the absolute +coordinates of two diagonal corners of the bounding box. Each length value consists of a floating +point number and an optional length unit (pt, bp, cm, mm, in, or pc). If the unit is omitted, +TeX points (pt) are assumed. ++ +It's also possible to give only one length value 'l'. In this case, the minimal bounding box +is computed and enlarged by adding (-'l',-'l') to the upper left and ('l','l') to the lower +right corner. ++ +Additionally, dvisvgm also supports the following format specifiers: + + *International DIN/ISO paper sizes*;; + A__n__, B__n__, C__n__, D__n__, where 'n' is a non-negative integer, e.g. A4 or a4 for DIN/ISO A4 + format (210mm × 297mm). + + *North American paper sizes*;; + invoice, executive, legal, letter, ledger + + *Special bounding box sizes*;; +[horizontal] + *dvi*::: page size stored in the DVI file + *min*::: computes the minimal/tightest bounding box + *none*::: no bounding box is assigned +// + *Page orientation*;; + The default page orientation for DIN/ISO and American paper sizes is 'portrait', + i.e. 'width' < 'height'. Appending *-landscape* or simply *-l* to the format + string switches to 'landscape' mode ('width' > 'height'). For symmetry reasons you can + also explicitly add *-portrait* or *-p* to indicate the default portrait format. + Note that these suffixes are part of the size string and not separate options. Thus, + they must directly follow the size specifier without additional blanks. + Furthermore, the orientation suffixes can't be used with *dvi*, *min*, and *none*. ++ +[NOTE] +Option *-b, --bbox* only affects the bounding box and does not transform the page content. +Hence, if you choose a landscape format, the page won't be rotated. ++ +// + +// +*-C, --cache*[='dir']:: +To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion +information in cache files. By default, these files are stored in +$HOME/.dvisvgm/cache+. +If you prefer a different location, use option *--cache* to overwrite the default. Furthermore, +it is also possible to disable the font caching mechanism completely with option *--cache=none*. +If argument 'dir' is omitted, dvisvgm prints the path of the default cache directory together +with further information about the stored fonts. Additionally, outdated and corrupted cache files +are removed. + + +*-j, --clipjoin*:: +This option tells dvisvgm to compute all intersections of clipping paths itself rather than +delegating this task to the SVG renderer. The resulting SVG files are more portable because +some SVG viewers don't support intersecting clipping paths which are defined by 'clipPath' +elements containing a 'clip-path' attribute. + + +*--color*:: +Enables colorization of messages printed during the conversion process. The colors can be +customized via the environment variable *DVISVGM_COLORS*. See the <> +below for further information. + + +*--colornames*:: +By default, dvisvgm exclusively uses RGB values of the form '#RRGGBB' to represent colors in +the SVG file. According to the SVG standard, it's also possible to use color names (like +black+ +and +darkblue+) for a limited number of predefined colors. In order to apply these color names +rather than their RGB values, call dvisvgm with option *--colornames*. All colors without an +SVG color name will still be represented by RGB values. + + +*-E, --eps*:: +If this option is given, dvisvgm does not expect a DVI but an EPS input file, and tries to convert +it to SVG. In order to do so, a single 'psfile' special command is created and forwarded to the +PostScript special handler. +This option is only available if dvisvgm was built with PostScript support enabled, and requires +Ghostscript to be available. See option *--libgs* for further information. + + +*-e, --exact*:: +This option tells dvisvgm to compute the precise bounding box of each character. By default, +the values stored in a font's TFM file are used to determine a glyph's extent. As these values are +intended to implement optimal character placements and are not designed to represent the exact +dimensions, they don't necessarily correspond with the bounds of the visual glyphs. Thus, width +and/or height of some glyphs may be larger (or smaller) than the respective TFM values. As a result, +this can lead to clipped characters at the bounds of the SVG graphics. With option *--exact* given, +dvisvgm analyzes the actual shape of each character and derives a usually tight bounding box. + + +*-m, --fontmap*='filenames':: +Loads and evaluates a single font map file or a sequence of font map files. These files are required +to resolve font file names and encodings. dvisvgm does not provide its own map files but tries to read +available ones coming with dvips or dvipdfm. If option *--fontmap* is omitted, dvisvgm looks for the +default map files 'ps2pk.map', 'dvipdfm.map', and 'psfonts.map' (in this order). Otherwise, the +files as option arguments are evaluated in the given order. Multiple filenames must be separated by +commas without leading and/or trailing whitespace. +By default, redefined mappings do not replace previous ones. However, each filename can be preceded by +an optional mode specifier (*+*, *-*, or *=*) to change this behavior: + + +mapfile;; + Only those entries in the given map file that don't redefine a font mapping are applied, i.e. + fonts already mapped keep untouched. That's also the default mode if no mode specifier is given. + + -mapfile;; + Ensures that none of the font mappings defined in the given map file are used, i.e. previously + defined mappings for the specified fonts are removed. + + =mapfile;; + All mappings defined in the map file are applied. Previously defined settings for the same fonts + are replaced. ++ +If the first filename in the filename sequence is preceded by a mode specifier, dvisvgm loads the +default font map (see above) and applies the other map files afterwards. Otherwise, none of default +map files will be loaded automatically. ++ +Examples: +--fontmap=myfile1.map,+myfile2.map+ loads 'myfile1.map' followed by 'myfile2.map' where all +redefinitions of `myfile2.map` are ignored. ++--fontmap==myfile1.map,-myfile2.map+ loads the default map file followed by 'myfile1.map' and 'myfile2.map' +where all redefinitions of 'myfile1.map' replace previous entries. Afterwards, all definitions for the fonts +given in 'myfile2.map' are removed from the font map tree. ++ +For further information about the map file formats and the mode specifiers, see the manuals of +dvips and dvipdfm. + + +*--grad-overlap*:: +Tells dvisvgm to create overlapping grid segments when approximating color gradient fills (also see +option *--grad-segments* below). By default, adjacent segments don't overlap but only touch each other +like separate tiles. However, this alignment can lead to visible gaps between the segments +because the background color usually influences the color at the boundary of the segments if the +SVG renderer uses anti-aliasing to create smooth contours. +One way to avoid this and to create seamlessly touching color regions is to enlarge the segments so +that they extent into the area of their right and bottom neighbors. Since the latter are drawn on top +of the overlapping parts, the visible size of all segments keeps unchanged. Just the former gaps +disappear as the background is now completely covered by the correct colors. +Currently, dvisvgm computes the overlapping segments separately for each patch of the mesh (a patch mesh +may consist of multiple patches of the same type). Therefore, there still might be visible gaps +at the seam of two adjacent patches. + + +*--grad-segments*='number':: +Determines the maximal number of segments per column and row used to approximate gradient color fills. +Since SVG 1.1 only supports a small subset of the shading algorithms available in PostScript, +dvisvgm approximates some of them by subdividing the area to be filled into smaller, monochromatic +segments. Each of these segments gets the average color of the region it covers. Thus, increasing the +number of segments leads to smaller monochromatic areas and therefore a better approximation of the +actual color gradient. As a drawback, more segments imply bigger SVG files because every segment is +represented by a separate path element. ++ +Currently, dvisvgm supports free- and lattice-form triangular patch meshes as well as Coons and +tensor-product patch meshes. They are approximated by subdividing the area of each patch into a +__n__×__n__ grid of smaller segments. The maximal number of segments per column and row can be +changed with option *--grad-segments*. + + +*--grad-simplify*='delta':: +If the size of the segments created to approximate gradient color fills falls below the given delta +value, dvisvgm reduces their level of detail. For example, Bézier curves are replaced by straight +lines, and triangular segments are combined to tetragons. For a small 'delta', these simplifications +are usually not noticeable but reduce the size of the generated SVG files significantly. + + +*-h, --help*[='mode']:: +Prints a short summary of all available command-line options. The optional 'mode' parameter is +an integer value between 0 and 2. It selects the display variant of the help text. Mode 0 +lists all options divided into categories with section headers. This is also the default if +dvisvgm is called without parameters. Mode 1 lists all options ordered by the short option names, +while mode 2 sorts the lines by the long option names. + + +*--keep*:: +Disables the removal of temporary files as created by Metafont (usually .gf, .tfm, and .log files). + + +*--libgs*='filename':: +This option is only available if the Ghostscript library is not directly linked to dvisvgm and if +PostScript support was not completely disabled during compilation. In this case, dvisvgm tries +to load the shared GS library dynamically during runtime. By default, it expects the library's name +to be +libgs.so.X+ (on Unix-like systems, where +X+ is the ABI version of the library) or ++gsdll32.dll+/+gsdll64.dll+ (Windows). Option *--libgs* can be used to give a different name. +Alternatively, it's also possible to set the GS library name by the environment variable *LIBGS*. +The latter has less precedence than the command-line option, i.e. dvisvgm ignores variable *LIBGS* +if *--libgs* is given. + + +*-L, --linkmark*='style':: +Selects the method how to mark hyperlinked areas. The 'style' argument can take one of the values +'none', 'box', and 'line', where 'box' is the default, i.e. a rectangle is drawn around +the linked region if option *--linkmark* is omitted. Style argument 'line' just draws the lower edge of +the bounding rectangle, and 'none' tells dvisvgm not to add any visible objects to hyperlinks. +The lines and boxes get the current text color selected. In order to apply a different, constant color, +a colon followed by a color specifier can be appended to the style string. A 'color specifier' is either +a hexadecimal RGB value of the form '#RRGGBB', or a +http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips[dvips color name]. ++ +Moreover, argument 'style' can take a single color specifier to highlight the linked region by +a frameless box filled with that color. An optional second color specifier separated by a colon +selects the frame color. ++ +Examples: +box:red+ or +box:#ff0000+ draws red boxes around the linked areas. +yellow:blue+ creates +yellow filled rectangles with blue frames. + + +*-l, --list-specials*:: +Prints a list of registered special handlers and exits. Each handler processes a set of special +statements belonging to the same category. In most cases, the categories are identified by the +prefix of the special statements. It's usually a leading word separated from the rest of the +statement by a colon or a blank, e.g. 'color' or 'ps'. + + +*-M, --mag*='factor':: +Sets the magnification factor applied in conjunction with Metafont calls prior tracing the glyphs. +The larger this value, the better the tracing results. Nevertheless, large magnification values +can cause Metafont arithmetic errors due to number overflows. So, use this option with care. +The default setting usually produces nice results. + + +*--no-merge*:: +Puts every single character in a separate 'text' element with corresponding 'x' and 'y' attributes. +By default, new 'text' or 'tspan' elements are only created if a string starts at a location that +differs from the regular position defined by the characters' advance values. + + +*--no-mktexmf*:: +Suppresses the generation of missing font files. If dvisvgm can't find a font file +through the kpathsea lookup mechanism, it calls the external tools 'mktextfm' or 'mktexmf'. +This option disables these calls. + + +*-n, --no-fonts*[='variant']:: +If this option is given, dvisvgm doesn't create SVG 'font' elements but uses 'paths' instead. The +resulting SVG files tend to be larger but they are concurrently more compatible with most applications that +don't support SVG fonts yet. The optional argument 'variant' selects the method how to substitute fonts +by paths. Variant 0 creates 'path' and 'use' elements in order to avoid lengthy duplicates. +Variant 1 creates 'path' elements only. +Option *--no-fonts* implies *--no-styles*. + + +*-c, --scale*='sx'[,'sy']:: +Scales the page content horizontally by 'sx' and vertically by 'sy'. This option is equivalent +to *-TS*'sx','sy'. + + +*-S, --no-specials*[='names']:: +Disable processing of special commands embedded in the DVI file. If no further +parameter is given, all specials are ignored. To disable a selected set of specials, +an optional comma-separated list of names can be appended to this option. A 'name' is the unique +identifier referencing the intended special handler. Option *--list-specials* lists all handlers +currently available together with their names. +All unsupported special statements are silently ignored. + + +*--no-styles*:: +By default, dvisvgm creates CSS styles and class attributes to reference fonts. This variant is +more compact than adding the complete font information to each text element over and over again. +However, if you prefer direct font references, the default behavior can be disabled with +option *--no-styles*. + + +*-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*, +and *%P*. *%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*. ++ +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 integer divisions with common precedence. The variables +*p* and *P* contain the current page number and the total number of pages, respectively. +For example, +--output="%f-%(p-1)"+ creates filenames where the numbering starts with 0 rather +than 1. ++ +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' +is a single-page document. Otherwise, multiple SVG files 'foo-01.svg', 'foo-02.svg', etc. are +produced. In Windows environments, the percent sign indicates dereferenced environment +variables, and must therefore be protected by a second percent sign, e.g. +--output=%%f-%%p+. + + +*-p, --page*='ranges':: +This option selects the pages to be processed. Parameter 'ranges' consists of a comma-separated +list of single page numbers and/or page ranges. A page range is a pair of numbers separated by +a hyphen, e.g. 5-12. Thus, a page sequence might look like this: 2-4,6,9-12,15. It doesn't matter +if a page is given more than once or if page ranges overlap. dvisvgm always extracts the page +numbers in ascending order and converts them only once. +In order to stay compatible with previous versions, the default page sequence is 1. dvisvgm +therefore converts only the first page and not the whole document if option *--page* is omitted. +Usually, page ranges consist of two numbers denoting the first and last page to be converted. +If the conversion should start at page 1, or if it should continue up to the last DVI page, the +first or second range number can be omitted, respectively. Example: +--page=-10+ converts all +pages up to page 10, +--page=10-+ converts all pages starting with page 10. +Please consider that the page values don't refer to the page numbers printed on the +corresponding page. Instead, the physical page count is expected, where the first page always +gets number 1. + + +*-d, --precision*='digits':: +Specifies the maximal number of decimal places applied to floating-point attribute values. +All attribute values written to the generated SVG file(s) are rounded accordingly. The +parameter 'digits' allows integer values from 0 to 6, where 0 enables the automatic selection +of significant decimal places. This is also the default value if dvisvgm is called without +option *--precision*. + + +*-P, --progress*[='delay']:: +Enables a simple progress indicator shown when time-consuming operations like +PostScript specials are processed. The indicator doesn't appear before the given +delay (in seconds) has elapsed. The default delay value is 0.5 seconds. + + +*-r, --rotate*='angle':: +Rotates the page content clockwise by 'angle' degrees around the page center. +This option is equivalent to *-TR*'angle'. + + +*-R, --relative*:: +SVG allows to define graphics paths by a sequence of absolute and/or relative path commands, +i.e. each command expects either absolute coordinates or coordinates relative to the +current drawing position. By default, dvisvgm creates paths made up of absolute commands. +If option *--relative* is given, relative commands are created instead. This slightly reduces +the size of the SVG files in most cases. + + +*-s, --stdout*:: +Don't write the SVG output to a file but redirect it to *stdout*. + + +*-T, --transform*='commands':: +Applies a sequence of transformations to the SVG content. Each transformation is described +by a 'command' beginning with a capital letter followed by a list of comma-separated +parameters. Following transformation commands are supported: + + *T* 'tx'[,'ty'];; + Translates (moves/shifts) the page in direction of vector ('tx','ty'). If 'ty' is omitted, + 'ty'=0 is assumed. + The expected unit length of 'tx' and 'ty' are TeX points (1pt = 1/72.27in). However, there + are several constants defined to simplify the unit conversion (see below). + + *S* 'sx'[,'sy'];; + Scales the page horizontally by 'sx' and vertically by 'sy'. If 'sy' is omitted, + 'sy'='sx' is assumed. + + *R* 'angle'[,'x','y'];; + Rotates the page clockwise by 'angle' degrees around point ('x','y'). If the optional + arguments 'x' and 'y' are omitted, the page will be rotated around its center depending on + the chosen page format. When option *-bnone* is given, the rotation center is origin (0,0). + + *KX* 'angle';; + Skews the page along the 'x'-axis by 'angle' degrees. Argument 'angle' can take any value + except 90+180__k__, where 'k' is an integer. + + *KY* 'angle';; + Skews the page along the 'y'-axis by 'angle' degrees. Argument 'angle' can take any value + except 90+180__k__, where 'k' is an integer. + + *FH* ['y'];; + Mirrors (flips) the page at the horizontal line through point (0,'y'). Omitting the optional argument + leads to 'y'='h'/2, where 'h' denotes the page height (see <> below). + + *FV* ['x'];; + Mirrors (flips) the page at the vertical line through point ('x',0). Omitting the optional argument + leads to 'x'='w'/2, where 'w' denotes the page width (see <> below). + + *M* 'm1',...,'m6';; + Applies a transformation described by the 3×3 matrix + \(('m1','m2','m3'),('m4','m5','m6'),(0,0,1)), where the inner triples denote + the rows. ++ +[NOTE] +================================================================================================= +All transformation commands of option *-T, --transform* are applied in the order of their appearance. +Multiple commands can optionally be separated by spaces. In this case the whole transformation string +has to be enclosed in double quotes to keep them together. All parameters are expressions of floating +point type. You can either give plain numbers or arithmetic terms combined by the operators *+* (addition), +*-* (subtraction), *** (multiplication), */* (division) or *%* (modulo) with common associativity and +precedence rules. Parentheses may be used as well. + +[[constants]] +Additionally, some pre-defined constants are provided: + +[horizontal] +*ux*:: horizontal position of upper left page corner in TeX point units +*uy*:: vertical position of upper left page corner in TeX point units +*h*:: page height in TeX point units (0 in case of *-bnone*) +*w*:: page width in TeX point units (0 in case of *-bnone*) + +Furthermore, you can use the length constants *pt*, *mm*, *cm* and *in*, e.g. ++2cm+ or +1.6in+. Thus, option +-TT1in,0R45+ moves the page content 1 inch to the right and rotates it +by 45 degrees around the page center afterwards. + +For single transformations, there are also the short-hand options *-c*, *-t* and *-r* available. +In contrast to the *--transform** commands, the order of these options is not significant, so +that it's not possible to describe transformation sequences with them. + +================================================================================================= ++ +// + +// +*-t, --translate*='tx'[,'ty']:: +Translates (moves) the page content in direction of vector ('tx','ty'). This option is +equivalent to *-TT*'tx','ty'. + + +*-v, --verbosity*='level':: +Controls the type of messages printed during a dvisvgm run: +[horizontal] + *0*;; no message output at all + *1*;; error messages only + *2*;; warning messages only + *4*;; informational messages only + ++ +[NOTE] +By adding these values you can combine the categories. The default level is 7, i.e. all +messages are printed. ++ + + +*-V, --version*[='extended']:: +Prints the version of dvisvgm and exits. If the optional argument is set to 'yes', the +version numbers of the linked libraries are printed as well. + + +*-z, --zip*[='level']:: +Creates a compressed SVG file with suffix .svgz. The optional argument specifies the compression +level. Valid values are in the range of 1 to 9 (default value is 9). Larger values cause better +compression results but may take slightly more computation time. ++ +CAUTION: This option cannot be combined with *-s, --stdout*. + + +*-Z, --zoom*[='factor']:: +Multiplies the 'width' and 'height' attributes of the SVG root element by argument 'factor' while +the coordinate system of the graphic content is retained. As a result, most SVG viewers zoom the +graphics accordingly. If a negative zoom factor is given, the 'width' and 'height' attributes are omitted. + + +[[specials]] +SUPPORTED SPECIALS +------------------ +dvisvgm supports several sets of 'special commands' that can be used to enrich DVI files with additional +features, like color, graphics, and hyperlinks. The evaluation of special commands is delegated to dedicated +handlers provided by dvisvgm. Each handler is responsible for all special statements of the same command set, +i.e. commands beginning with the same prefix. To get a list of the actually provided special handlers, use +option *--list-specials* (see above). This section gives an overview of the special commands currently +supported. + +*bgcolor*:: +Special statement for changing the background/page color. Since SVG 1.1 doesn't support background colors, +dvisvgm inserts a rectangle of the chosen color into the generated SVG document. This rectangle always gets +the same size as the selected or computed bounding box. This background color command is part of the color +special set but is handled separately in order to let the user turn it off. For an overview of the command +syntax, see the documentation of dvips, for instance. + +*color*:: +Statements of this command set provide instructions to change the text/paint color. For an overview of the +exact syntax, see the documentation of dvips, for instance. + +*dvisvgm*:: +dvisvgm offers its own small set of specials. The following list gives a brief overview. + *dvisvgm:raw* 'text';; + Adds an arbitrary sequence of characters to the page section of the SVG document. dvisvgm does not perform + any validation here, thus the user has to ensure that the resulting SVG is still valid. Parameter 'text' + may contain the expressions *{?x}*, *{?y}*, and *{?color}* that expand to the current 'x' or 'y' coordinate + and the current color, respectively. Furthermore, *{?nl}* expands to a newline character. + + *dvisvgm:rawdef* 'text';; + This command is similar to *dvisvgm:raw*, but puts the raw text into the section of the SVG document + currently being generated. + + *dvisvgm:rawset* 'name' ... *dvisvgm:endrawset*;; + This pair of specials marks the begin and end of a definition of a named raw SVG fragment. All *dvisvgm:raw* + and *dvisvgm:rawdef* specials enclosed by *dvisvgm:rawset* and *dvisvgm:endrawset* are not evaluated + immediately but jointly stored under the given 'name' for later use. Once defined, the named fragment can be + referenced throughout the DVI file by *dvisvgm:rawput* (see below). + The two commands *dvisvgm:rawset* and *dvisvgm:endrawset* must not be nested, i.e. each call of *dvisvgm:rawset* + has to be followed by a corresponding call of *dvisvgm:endrawset* before another *dvisvgm:rawset* may occur. + Also, the identifier 'name' must be unique throughout the DVI file. Using *dvisvgm:rawset* multiple times + together with the same 'name' leads to warning messages. + + *dvisvgm:rawput* 'name';; + Inserts raw SVG fragments previously stored under the given 'name'. dvisvgm distinguishes between fragments + that were specified with *dvisvgm:raw* or *dvisvgm:rawdef*, and handles them differently: It inserts all + *dvisvgm:raw* parts every time *dvisvgm:rawput* is called, whereas the *dvisvgm:rawdef* portions go to the + section of the current SVG document only once. + + *dvisvgm:img* 'width' 'height' 'file';; + Creates an image element at the current graphic position referencing the given file. JPEG, PNG, and SVG images + can be used here. However, dvisvgm does not check the file format or the file name suffix. The lengths 'width' + and 'height' must be given as plain floating point numbers in TeX point units (1in = 72.27pt). + + *dvisvgm:bbox* n[ew] 'name';; + Defines or resets a local bounding box called 'name'. The name may consist of letters and digits. + While processing a DVI page, dvisvgm continuously updates the (global) bounding box of the current page in order to + determine the minimal rectangle containing all visible page components (characters, images, drawing elements etc.) + Additionally to the global bounding box, the user can request an arbitrary number of named local bounding boxes. + Once defined, these boxes are updated together with the global bounding box starting with the first character that + follows the definition. Thus, the local boxes can be used to compute the extent of parts of the page. This is useful + for scenarios where the generated SVG file is post-processed. + In conjunction with special *dvisvgm:raw*, the macro *{?bbox 'name'}* expands to the four values 'x', 'y', 'w', and 'h' + (separated by spaces) specifying the coordinates of the upper left corner, width, and height of the local box 'name'. + If box 'name' wasn't previously defined, all four values equal to zero. + + *dvisvgm:bbox* 'width' 'height' ['depth'];; + Updates the bounding box of the current page by embedding a virtual rectangle ('x', 'y', 'width', 'height') + where the lower left corner is located at the current DVI drawing position ('x','y'). If the optional parameter 'depth' + is specified, dvisvgm embeds a second rectangle ('x', 'y', 'width', -__depth__). The lengths 'width', 'height' and + 'depth' must be given as plain floating point numbers in TeX point units (1in = 72.27pt). Depending on size and position + of the virtual rectangle, this command either enlarges the overall bounding box or leaves it as is. It's not possible + to reduce its extent. This special should be used in conjunction with *dvisvgm:raw* in order to update the viewport + of the page properly. + + *dvisvgm:bbox* a[bs] 'x1' 'y1' 'x2' 'y2';; + This variant of the bbox special updates the bounding box by embedding a virtual rectangle ('x1','y1','x2','y2'). + The points ('x1','y1') and ('x2','y2') denote two diagonal corners of the rectangle given in TeX point units. + + *dvisvgm:bbox* f[ix] 'x1' 'y1' 'x2' 'y2';; + This variant of the bbox special assigns an absolute (final) bounding box to the resulting SVG. After executing + this command, dvisvgm doesn't further alter the bounding box coordinates, except this special is called again later. + The points ('x1','y1') and ('x2','y2') denote two diagonal corners of the rectangle given in TeX point units. ++ +The following TeX snippet adds two raw SVG elements to the output and updates the bounding box accordingly: ++ +[source,tex] +------------------------------------------------------------------------------------ +\special{dvisvgm:raw } +\special{dvisvgm:bbox 20 10 10} + +\special{dvisvgm:raw } +\special{dvisvgm:bbox abs 10 200 100 250} +------------------------------------------------------------------------------------ ++ + +*em*:: +These specials were introduced with the emTeX distribution by Eberhard Mattes. They provide line drawing +statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands. +dvisvgm supports only the line drawing statements and ignores all other em specials silently. +A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN). + +*html*:: +The hyperref specification defines several variants on how to mark hyperlinked areas in a DVI file. dvisvgm +supports the plain HyperTeX special constructs as created with hyperref package option 'hypertex'. +By default, all linked areas of the document are marked by a rectangle. Option *--linkmark* allows to change +this behavior. See above for further details. Information on syntax and semantics of the HyperTeX specials can be +found in the hyperref manual. + +*pdf*:: +pdfTeX and dvipdfmx introduced several special commands related to the generation of PDF files. Currently, only +two of them, 'pdf:mapfile' and 'pdf:mapline' are supported by dvisvgm. These specials allow modifying the font map +tree during the processing of DVI files. They are used by CTeX, for example. dvisvgm supports both, the dvips and +dvipdfm font map format. For further information on the command syntax and semantics, see the documentation of ++\pdfmapfile+ in the pdfTeX user manual. + +*ps*:: +The famous DVI driver dvips introduced its own set of specials in order to embed PostScript code into DVI files, +which greatly improves the capabilities of DVI documents. One aim of dvisvgm is to completely evaluate all +PostScript snippets and to convert as many of them as possible to SVG. In contrast to dvips, dvisvgm uses +floating point arithmetics to compute the precise position of each graphic element, i.e. it doesn't round the +coordinates. Therefore, the relative locations of the graphic elements may slightly differ from those computed +by dvips. ++ +Since PostScript is a rather complex language, dvisvgm does not try to implement its own PostScript interpreter +but relies on http://ghostscript.com[Ghostscript] instead. If the Ghostscript library was not linked to the +dvisvgm binary, it is looked up and loaded dynamically during runtime. In this case, dvisvgm looks for +'libgs.so.X' on Unix-like systems (supported ABI versions: 7,8,9), and for 'gsdll32.dll' or 'gsdll64.dll' on +Windows. You can override the default file names with environment variable *LIBGS* or the command-line +option *--libgs*. The library must be reachable through the ld search path (\*nix) or the PATH environment +variable (Windows). Alternatively, the absolute file path can be specified. If the library cannot be found, +dvisvgm disables the processing of PostScript specials and prints a warning message. +Use option *--list-specials* to check whether PostScript support is available, i.e. entry 'ps' is present. ++ +The PostScript handler also recognizes and evaluates bounding box data generated by the 'preview' package with +option 'tightpage'. If such data is present in a DVI file, dvisvgm adapts the bounding box of the generated SVG file +accordingly, and prints a message showing the width, height, and depth of the box in TeX point units. Especially, +the depth value can be used to vertically align the SVG graphics with the baseline of surrounding text in HTML +or XSL-FO documents, for example. + +*tpic*:: +The TPIC special set defines instructions for drawing simple geometric objects. Some LaTeX packages, like +eepic and tplot, use these specials to describe graphics. + + +EXAMPLES +-------- +-------------- +dvisvgm file +-------------- +Converts the first page of 'file.dvi' to 'file.svg'. + +--------------- +dvisvgm -z file +--------------- +Converts the first page of 'file.dvi' to 'file.svgz' with default compression level 9. + +------------------------------------- +dvisvgm -p5 -z3 -ba4-l -onewfile file +------------------------------------- +Converts the fifth page of 'file.dvi' to 'newfile.svgz' with compression level 3. +The bounding box is set to DIN/ISO A4 in landscape format. + +----------------------------------------------------- +dvisvgm --transform="R20,w/3,2h/5 T1cm,1cm S2,3" file +----------------------------------------------------- +Converts the first page of 'file.dvi' to 'file.svg' where three transformations are applied. + + +[[environment]] +ENVIRONMENT +----------- +dvisvgm uses the *kpathsea* library for locating the files that it opens. +Hence, the environment variables described in the library's documentation influence the converter. + +If dvisvgm was linked without the Ghostscript library, and if PostScript support has not been disabled, +the shared Ghostscript library is looked up during runtime via dlopen(). The environment variable *LIBGS* +can be used to specify path and file name of the library. + +The pre-compiled Windows versions of dvisvgm require a working installation of MiKTeX 2.9 or above. +dvisvgm does not work together with the portable edition of MiKTeX because it relies on MiKTeX's COM +interface that is only accessible in a local installation. +To enable the evaluation of PostScript specials, the original Ghostscript DLL 'gsdll32.dll' must be present +and reachable through the search path. 64-bit Windows builds require the 64-bit Ghostscript DLL 'gsdll64.dll'. +Both DLLs come with the corresponding Ghostscript installers available from http://ghostscript.com. + +The environment variable *DVISVGM_COLORS* specifies the colors used to highlight various parts of dvisvgm's +message output. It is only evaluated if option *--color* is given. The value of *DVISVGM_COLORS* is a list of +colon-separated entries of the form 'gg'='BF', where 'gg' denotes one of the color group indicators listed +below, and 'BF' are two hexadecimal digits specifying the background (first digit) and foreground/text color +(second digit). The color values are defined as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, +5=magenta, 6=cyan, 7=gray, 8=bright red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta, +D=bright cyan, E=bright gray, F=white. Depending on the terminal, the colors may differ. Rather than changing +both the text and background color, it's also possible to change only one of them: An asterisk (*) in +place of a hexadecimal digit indicates the default text or background color of the terminal. + +All malformed entries in the list are silently ignored. + +[horizontal] +*er*:: error messages +*wn*:: warning messages +*pn*:: messages about page numbers +*ps*:: page size messages +*fw*:: information about the files written +*sm*:: state messages +*tr*:: messages of the glyph tracer +*pi*:: progress indicator + +*Example:* +er=01:pi=\*5+ sets the colors of error messages (+er+) to red (+1+) on black (+0+), and those +of progress indicators (+pi+) to cyan (+5+) on default background (+*+). + +FILES +----- +The location of the following files is determined by the kpathsea library. +To check the actual kpathsea configuration you can use the *kpsewhich* utility. + +[horizontal] +**.enc*:: Font encoding files +**.fgd*:: Font glyph data files (cache files created by dvisvgm) +**.map*:: Font map files +**.mf*:: Metafont input files +**.pfb*:: PostScript Type 1 font files +**.pro*:: PostScript header/prologue files +**.tfm*:: TeX font metric files +**.ttf*:: TrueType font files +**.vf*:: Virtual font files + +SEE ALSO +-------- +*tex(1), mf(1), mktexmf(1), grodvi(1), potrace(1)*, and the *kpathsea library* info documentation. + + +RESOURCES +--------- +Project home page::: http://dvisvgm.bplaced.net +Code repository::: https://github.com/mgieseki/dvisvgm + + +BUGS +---- +Please report bugs using the bug tracker at https://github.com/mgieseki/dvisvgm/issues[GitHub]. + + +AUTHOR +------ +Written by {author} <{email}> + + +COPYING +------- +Copyright (C) 2005-2015 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. + +// vim: set syntax=asciidoc: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/tweak-dblatex-pdf.xsl b/Build/source/texk/dvisvgm/dvisvgm-src/doc/tweak-dblatex-pdf.xsl new file mode 100644 index 00000000000..a28bbb97e30 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/tweak-dblatex-pdf.xsl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + SYNOPSIS + + + + + + + + + + + \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/m4/ax_code_coverage.m4 b/Build/source/texk/dvisvgm/dvisvgm-src/m4/ax_code_coverage.m4 new file mode 100644 index 00000000000..2751459c1d1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/m4/ax_code_coverage.m4 @@ -0,0 +1,229 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CODE_COVERAGE() +# +# DESCRIPTION +# +# Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be +# included in the CFLAGS and LIBS/LDFLAGS variables of every build target +# (program or library) which should be built with code coverage support. +# Also defines CODE_COVERAGE_RULES which should be substituted in your +# Makefile; and $enable_code_coverage which can be used in subsequent +# configure output. CODE_COVERAGE_ENABLED is defined and substituted, and +# corresponds to the value of the --enable-code-coverage option, which +# defaults to being disabled. +# +# Test also for gcov program and create GCOV variable that could be +# substituted. +# +# Note that all optimisation flags in CFLAGS must be disabled when code +# coverage is enabled. +# +# Usage example: +# +# configure.ac: +# +# AX_CODE_COVERAGE +# +# Makefile.am: +# +# @CODE_COVERAGE_RULES@ +# my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ... +# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... +# +# This results in a "check-code-coverage" rule being added to any +# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module +# has been configured with --enable-code-coverage). Running `make +# check-code-coverage` in that directory will run the module's test suite +# (`make check`) and build a code coverage report detailing the code which +# was touched, then print the URI for the report. +# +# This code was derived from Makefile.decl in GLib, originally licenced +# under LGPLv2.1+. +# +# LICENSE +# +# Copyright (c) 2012 Philip Withnall +# Copyright (c) 2012 Xan Lopez +# Copyright (c) 2012 Christian Persch +# Copyright (c) 2012 Paolo Borelli +# Copyright (c) 2012 Dan Winship +# Copyright (c) 2015 Bastien ROUCARIES +# +# This library is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This library 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 Lesser +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . + +#serial 5 + +AC_DEFUN([AX_CODE_COVERAGE],[ + dnl Check for --enable-code-coverage + AC_REQUIRE([AC_PROG_SED]) + + # allow to override gcov location + AC_ARG_WITH([gcov], + [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) + + AC_MSG_CHECKING([whether to build with code coverage support]) + AC_ARG_ENABLE([code-coverage], + AS_HELP_STRING([--enable-code-coverage], + [Whether to enable code coverage support]),, + enable_code_coverage=no) + + AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) + AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) + AC_MSG_RESULT($enable_code_coverage) + + AS_IF([ test "$enable_code_coverage" = "yes" ], [ + # check for gcov + AC_CHECK_TOOL([GCOV], + [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], + [:]) + AS_IF([test "X$GCOV" = "X:"], + [AC_MSG_ERROR([gcov is needed to do coverage])]) + AC_SUBST([GCOV]) + + dnl Check if gcc is being used + AS_IF([ test "$GCC" = "no" ], [ + AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) + ]) + + # List of supported lcov versions. + lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11" + + AC_CHECK_PROG([LCOV], [lcov], [lcov]) + AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) + + AS_IF([ test "$LCOV" ], [ + AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [ + ax_cv_lcov_version=invalid + lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` + for lcov_check_version in $lcov_version_list; do + if test "$lcov_version" = "$lcov_check_version"; then + ax_cv_lcov_version="$lcov_check_version (ok)" + fi + done + ]) + ], [ + lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" + AC_MSG_ERROR([$lcov_msg]) + ]) + + case $ax_cv_lcov_version in + ""|invalid[)] + lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." + AC_MSG_ERROR([$lcov_msg]) + LCOV="exit 0;" + ;; + esac + + AS_IF([ test -z "$GENHTML" ], [ + AC_MSG_ERROR([Could not find genhtml from the lcov package]) + ]) + + dnl Build the code coverage flags + CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_LDFLAGS="-lgcov" + + AC_SUBST([CODE_COVERAGE_CFLAGS]) + AC_SUBST([CODE_COVERAGE_LDFLAGS]) + ]) + +CODE_COVERAGE_RULES=' +# Code coverage +# +# Optional: +# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. +# (Default: $(top_builddir)) +# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated +# by lcov for code coverage. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) +# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage +# reports to be created. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) +# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov +# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the lcov instance. +# (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance. +# (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml +# instance. (Default: empty) +# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore +# +# The generated report will be titled using the $(PACKAGE_NAME) and +# $(PACKAGE_VERSION). In order to add the current git hash to the title, +# use the git-version-gen script, available online. + +# Optional variables +CODE_COVERAGE_DIRECTORY ?= $(top_builddir) +CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info +CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage +CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" +CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +CODE_COVERAGE_GENHTML_OPTIONS ?= +CODE_COVERAGE_IGNORE_PATTERN ?= + +code_coverage_quiet = $(code_coverage_quiet_$(V)) +code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) +code_coverage_quiet_0 = --quiet + +# Use recursive makes in order to ignore errors during check +check-code-coverage: +ifeq ($(CODE_COVERAGE_ENABLED),yes) + -$(MAKE) $(AM_MAKEFLAGS) -k check + $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture +else + @echo "Need to reconfigure with --enable-code-coverage" +endif + +# Capture code coverage data +code-coverage-capture: code-coverage-capture-hook +ifeq ($(CODE_COVERAGE_ENABLED),yes) + $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS) + $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" + -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp + LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) + @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" +else + @echo "Need to reconfigure with --enable-code-coverage" +endif + +# Hook rule executed before code-coverage-capture, overridable by the user +code-coverage-capture-hook: + +ifeq ($(CODE_COVERAGE_ENABLED),yes) +clean: code-coverage-clean +code-coverage-clean: + -$(LCOV) --directory $(top_builddir) -z + -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) + -find . -name "*.gcda" -o -name "*.gcov" -delete +endif + +GITIGNOREFILES ?= +GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) + +DISTCHECK_CONFIGURE_FLAGS ?= +DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage + +.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean +' + + AC_SUBST([CODE_COVERAGE_RULES]) + m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) +]) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp new file mode 100644 index 00000000000..475a94566b0 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.cpp @@ -0,0 +1,293 @@ +/************************************************************************* +** BasicDVIReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "BasicDVIReader.h" + +using namespace std; + + +BasicDVIReader::BasicDVIReader (std::istream &is) : StreamReader(is), _dviFormat(DVI_NONE) +{ +} + + +/** Evaluates the next DVI command, and computes the corresponding handler. + * @param[out] handler handler for current DVI command + * @param[out] param the handler must be called with this parameter + * @return opcode of current DVI command */ +int BasicDVIReader::evalCommand (CommandHandler &handler, int ¶m) { + struct DVICommand { + CommandHandler handler; + int length; // number of parameter bytes + }; + + /* Each cmdFOO command reads the necessary number of bytes from the stream, so executeCommand + doesn't need to know the exact DVI command format. Some cmdFOO methods are used for multiple + DVI commands because they only differ in length of their parameters. */ + static const DVICommand commands[] = { + {&BasicDVIReader::cmdSetChar, 1}, {&BasicDVIReader::cmdSetChar, 2}, // 128-129 + {&BasicDVIReader::cmdSetChar, 3}, {&BasicDVIReader::cmdSetChar, 4}, // 130-131 + {&BasicDVIReader::cmdSetRule, 8}, // 132 + {&BasicDVIReader::cmdPutChar, 1}, {&BasicDVIReader::cmdPutChar, 2}, // 133-134 + {&BasicDVIReader::cmdPutChar, 3}, {&BasicDVIReader::cmdPutChar, 4}, // 135-136 + {&BasicDVIReader::cmdPutRule, 8}, // 137 + {&BasicDVIReader::cmdNop, 0}, // 138 + {&BasicDVIReader::cmdBop, 44}, {&BasicDVIReader::cmdEop, 0}, // 139-140 + {&BasicDVIReader::cmdPush, 0}, {&BasicDVIReader::cmdPop, 0}, // 141-142 + {&BasicDVIReader::cmdRight, 1}, {&BasicDVIReader::cmdRight, 2}, // 143-144 + {&BasicDVIReader::cmdRight, 3}, {&BasicDVIReader::cmdRight, 4}, // 145-146 + {&BasicDVIReader::cmdW0, 0}, // 147 + {&BasicDVIReader::cmdW, 1}, {&BasicDVIReader::cmdW, 2}, // 148-149 + {&BasicDVIReader::cmdW, 3}, {&BasicDVIReader::cmdW, 4}, // 150-151 + {&BasicDVIReader::cmdX0, 0}, // 152 + {&BasicDVIReader::cmdX, 1}, {&BasicDVIReader::cmdX, 2}, // 153-154 + {&BasicDVIReader::cmdX, 3}, {&BasicDVIReader::cmdX, 4}, // 155-156 + {&BasicDVIReader::cmdDown, 1}, {&BasicDVIReader::cmdDown, 2}, // 157-158 + {&BasicDVIReader::cmdDown, 3}, {&BasicDVIReader::cmdDown, 4}, // 159-160 + {&BasicDVIReader::cmdY0, 0}, // 161 + {&BasicDVIReader::cmdY, 1}, {&BasicDVIReader::cmdY, 2}, // 162-163 + {&BasicDVIReader::cmdY, 3}, {&BasicDVIReader::cmdY, 4}, // 164-165 + {&BasicDVIReader::cmdZ0, 0}, // 166 + {&BasicDVIReader::cmdZ, 1}, {&BasicDVIReader::cmdZ, 2}, // 167-168 + {&BasicDVIReader::cmdZ, 3}, {&BasicDVIReader::cmdZ, 4}, // 169-170 + + {&BasicDVIReader::cmdFontNum, 1}, {&BasicDVIReader::cmdFontNum, 2}, // 235-236 + {&BasicDVIReader::cmdFontNum, 3}, {&BasicDVIReader::cmdFontNum, 4}, // 237-238 + {&BasicDVIReader::cmdXXX, 1}, {&BasicDVIReader::cmdXXX, 2}, // 239-240 + {&BasicDVIReader::cmdXXX, 3}, {&BasicDVIReader::cmdXXX, 4}, // 241-242 + {&BasicDVIReader::cmdFontDef, 1}, {&BasicDVIReader::cmdFontDef, 2}, // 243-244 + {&BasicDVIReader::cmdFontDef, 3}, {&BasicDVIReader::cmdFontDef, 4}, // 245-246 + {&BasicDVIReader::cmdPre, 0}, {&BasicDVIReader::cmdPost, 0}, // 247-248 + {&BasicDVIReader::cmdPostPost, 0}, // 249 + }; + + const int opcode = readByte(); + if (!isStreamValid() || opcode < 0) // at end of file + throw InvalidDVIFileException("invalid DVI file"); + + int num_param_bytes = 0; + param = -1; + if (opcode >= 0 && opcode <= 127) { + handler = &BasicDVIReader::cmdSetChar0; + param = opcode; + } + else if (opcode >= 171 && opcode <= 234) { + handler = &BasicDVIReader::cmdFontNum0; + param = opcode-171; + } + else if ((_dviFormat == DVI_XDVOLD && opcode >= 251 && opcode <= 254) + || (_dviFormat == DVI_XDVNEW && opcode >= 252 && opcode <= 253)) { // XDV command? + static const CommandHandler handlers[] = { + &BasicDVIReader::cmdXPic, + &BasicDVIReader::cmdXFontDef, + &BasicDVIReader::cmdXGlyphArray, + &BasicDVIReader::cmdXGlyphString + }; + handler = handlers[opcode-251]; + param = 0; + } + else if (_dviFormat == DVI_PTEX && opcode == 255) { // direction command set by pTeX? + handler = &BasicDVIReader::cmdDir; + num_param_bytes = 1; + } + else if (opcode >= 250) { + ostringstream oss; + oss << "undefined DVI command (opcode " << opcode << ')'; + throw DVIException(oss.str()); + } + else { + const int offset = opcode <= 170 ? 128 : 235-(170-128+1); + handler = commands[opcode-offset].handler; + num_param_bytes = commands[opcode-offset].length; + } + if (param < 0) + param = num_param_bytes; + return opcode; +} + + +/** Reads a single DVI command from the current position of the input stream and calls the + * corresponding cmdFOO method. + * @return opcode of the executed command */ +int BasicDVIReader::executeCommand () { + CommandHandler handler; + int param; // parameter of handler + int opcode = evalCommand(handler, param); + (this->*handler)(param); + return opcode; +} + + +void BasicDVIReader::executePostPost () { + clearStream(); // reset all status bits + if (!isStreamValid()) + throw DVIException("invalid DVI file"); + + seek(-1, ios::end); // stream pointer to last byte + int count=0; + while (peek() == 223) { // count trailing fill bytes + seek(-1, ios::cur); + count++; + } + if (count < 4) // the standard requires at least 4 trailing fill bytes + throw DVIException("missing fill bytes at end of file"); + + setDVIFormat((DVIFormat)readUnsigned(1)); +} + + +void BasicDVIReader::executeAllPages () { + if (_dviFormat == DVI_NONE) + executePostPost(); // get version ID from post_post + seek(0); // go to preamble + while (executeCommand() != 248); // execute all commands until postamble is reached +} + + +void BasicDVIReader::setDVIFormat (DVIFormat format) { + _dviFormat = max(_dviFormat, format); + switch (_dviFormat) { + case DVI_STANDARD: + case DVI_PTEX: + case DVI_XDVOLD: + case DVI_XDVNEW: + break; + default: + ostringstream oss; + oss << "DVI format " << _dviFormat << " not supported"; + throw DVIException(oss.str()); + } +} + +///////////////////////////////////// + +/** Executes preamble command. + * Format: pre i[1] num[4] den[4] mag[4] k[1] x[k] */ +void BasicDVIReader::cmdPre (int) { + setDVIFormat((DVIFormat)readUnsigned(1)); // identification number + seek(12, ios::cur); // skip numerator, denominator, and mag factor + UInt32 k = readUnsigned(1); // length of following comment + seek(k, ios::cur); // skip comment +} + + +/** Executes postamble command. + * Format: post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] */ +void BasicDVIReader::cmdPost (int) { + seek(28, ios::cur); +} + + +/** Executes postpost command. + * Format: postpost q[4] i[1] 223’s[>= 4] */ +void BasicDVIReader::cmdPostPost (int) { + seek(4, ios::cur); + setDVIFormat((DVIFormat)readUnsigned(1)); // identification byte + while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now +} + + +/** Executes bop (begin of page) command. + * Format: bop c0[+4] ... c9[+4] p[+4] */ +void BasicDVIReader::cmdBop (int) {seek(44, ios::cur);} +void BasicDVIReader::cmdEop (int) {} +void BasicDVIReader::cmdPush (int) {} +void BasicDVIReader::cmdPop (int) {} +void BasicDVIReader::cmdSetChar0 (int) {} +void BasicDVIReader::cmdSetChar (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdPutChar (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdSetRule (int) {seek(8, ios::cur);} +void BasicDVIReader::cmdPutRule (int) {seek(8, ios::cur);} +void BasicDVIReader::cmdRight (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdDown (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdX0 (int) {} +void BasicDVIReader::cmdY0 (int) {} +void BasicDVIReader::cmdW0 (int) {} +void BasicDVIReader::cmdZ0 (int) {} +void BasicDVIReader::cmdX (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdY (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdW (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdZ (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdNop (int) {} +void BasicDVIReader::cmdDir (int) {seek(1, ios::cur);} +void BasicDVIReader::cmdFontNum0 (int) {} +void BasicDVIReader::cmdFontNum (int len) {seek(len, ios::cur);} +void BasicDVIReader::cmdXXX (int len) {seek(readUnsigned(len), ios::cur);} + + +/** Executes fontdef command. + * Format fontdef k[len] c[4] s[4] d[4] a[1] l[1] n[a+l] + * @param[in] len size of font number variable (in bytes) */ +void BasicDVIReader::cmdFontDef (int len) { + seek(len+12, ios::cur); // skip font number + UInt32 pathlen = readUnsigned(1); // length of font path + UInt32 namelen = readUnsigned(1); // length of font name + seek(pathlen+namelen, ios::cur); +} + + +/** XDV extension: include image or pdf file. + * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ +void BasicDVIReader::cmdXPic (int) { + seek(1+24+2, ios::cur); + UInt16 len = readUnsigned(2); + seek(len, ios::cur); +} + + +void BasicDVIReader::cmdXFontDef (int) { + seek(4+4, ios::cur); + UInt16 flags = readUnsigned(2); + UInt8 len = readUnsigned(1); + if (_dviFormat == DVI_XDVOLD) + len += readUnsigned(1)+readUnsigned(1); + seek(len, ios::cur); + if (_dviFormat == DVI_XDVNEW) + seek(4, ios::cur); // skip subfont index + if (flags & 0x0200) // colored? + seek(4, ios::cur); + if (flags & 0x1000) // extend? + seek(4, ios::cur); + if (flags & 0x2000) // slant? + seek(4, ios::cur); + if (flags & 0x4000) // embolden? + seek(4, ios::cur); + if ((flags & 0x0800) && (_dviFormat == DVI_XDVOLD)) { // variations? + UInt16 num_variations = readSigned(2); + seek(4*num_variations, ios::cur); + } +} + + +void BasicDVIReader::cmdXGlyphArray (int) { + seek(4, ios::cur); + UInt16 num_glyphs = readUnsigned(2); + seek(10*num_glyphs, ios::cur); +} + + +void BasicDVIReader::cmdXGlyphString (int) { + seek(4, ios::cur); + UInt16 num_glyphs = readUnsigned(2); + seek(6*num_glyphs, ios::cur); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h new file mode 100644 index 00000000000..005269616c3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BasicDVIReader.h @@ -0,0 +1,105 @@ +/************************************************************************* +** BasicDVIReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_BASICDVIREADER_H +#define DVISVGM_BASICDVIREADER_H + +#include "MessageException.h" +#include "StreamReader.h" + +struct DVIException : public MessageException +{ + DVIException (const std::string &msg) : MessageException(msg) {} +}; + + +struct InvalidDVIFileException : public DVIException +{ + InvalidDVIFileException(const std::string &msg) : DVIException(msg) {} +}; + +class Matrix; + +class BasicDVIReader : public StreamReader +{ + protected: + typedef void (BasicDVIReader::*CommandHandler)(int); + enum DVIFormat {DVI_NONE=0, DVI_STANDARD=2, DVI_PTEX=3, DVI_XDVOLD=5, DVI_XDVNEW=6}; + + public: + BasicDVIReader (std::istream &is); + virtual ~BasicDVIReader () {} + virtual void executeAllPages (); + virtual double getXPos () const {return 0;} + virtual double getYPos () const {return 0;} + virtual void finishLine () {} + virtual void translateToX (double x) {} + virtual void translateToY (double y) {} + virtual int getStackDepth () const {return 0;} + virtual void getPageTransformation (Matrix &matrix) const {} + virtual unsigned getCurrentPageNumber () const {return 0;} + + protected: + void setDVIFormat (DVIFormat format); + DVIFormat getDVIFormat () const {return _dviFormat;} + virtual int evalCommand (CommandHandler &handler, int ¶m); + virtual int executeCommand (); + void executePostPost (); + + // the following methods represent the DVI commands + // they are called by executeCommand and should not be used directly + virtual void cmdSetChar0 (int c); + virtual void cmdSetChar (int len); + virtual void cmdPutChar (int len); + virtual void cmdSetRule (int len); + virtual void cmdPutRule (int len); + virtual void cmdNop (int len); + virtual void cmdBop (int len); + virtual void cmdEop (int len); + virtual void cmdPush (int len); + virtual void cmdPop (int len); + virtual void cmdDir (int len); + virtual void cmdRight (int len); + virtual void cmdDown (int len); + virtual void cmdX0 (int len); + virtual void cmdY0 (int len); + virtual void cmdW0 (int len); + virtual void cmdZ0 (int len); + virtual void cmdX (int len); + virtual void cmdY (int len); + virtual void cmdW (int len); + virtual void cmdZ (int len); + virtual void cmdFontDef (int len); + virtual void cmdFontNum0 (int n); + virtual void cmdFontNum (int len); + virtual void cmdXXX (int len); + virtual void cmdPre (int len); + virtual void cmdPost (int len); + virtual void cmdPostPost (int len); + virtual void cmdXFontDef (int len); // XDV only + virtual void cmdXGlyphArray (int len); // XDV only + virtual void cmdXGlyphString (int len); // XDV format 5 only + virtual void cmdXPic (int len); // XDV format 5 only + + private: + DVIFormat _dviFormat; ///< format of DVI file being processed +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp new file mode 100644 index 00000000000..46cc79d69d9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.cpp @@ -0,0 +1,256 @@ +/************************************************************************* +** Bezier.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "Bezier.h" + +using namespace std; + +Bezier::Bezier () { + _points[0] = _points[1] = _points[2] = _points[3] = 0; +} + + +/** Creates a quadratic Bézier curve. internally, it's represented as a cubic one. */ +Bezier::Bezier (const DPair &p0, const DPair &p1, const DPair &p2) { + setPoints(p0, p0+(p1-p0)*2.0/3.0, p2+(p1-p2)*2.0/3.0, p2); +} + + +Bezier::Bezier (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3) { + setPoints(p0, p1, p2, p3); +} + + +/** Creates a subcurve of a given Bézier curve. + * @param[in] source original curve to be clipped + * @param[in] t0 'time' parameter \f$\in[0,1]\f$ of source curve where the subcurve starts + * @param[in] t1 'time' parameter \f$\in[0,1]\f$ of source curve where the subcurve ends */ +Bezier::Bezier (const Bezier &source, double t0, double t1) { + if (t0 == t1) + _points[0] = _points[1] = _points[2] = _points[3] = source.valueAt(t0); + else { + if (t0 > t1) + swap(t0, t1); + if (t0 == 0) + source.subdivide(t1, this, 0); + else if (t1 == 1) + source.subdivide(t0, 0, this); + else { + Bezier subcurve; + source.subdivide(t0, 0, &subcurve); + subcurve.subdivide((t1-t0)/(1-t0), this, 0); + } + } +} + + +void Bezier::setPoints(const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3) { + _points[0] = p0; + _points[1] = p1; + _points[2] = p2; + _points[3] = p3; +} + + +void Bezier::reverse() { + swap(_points[0], _points[3]); + swap(_points[1], _points[2]); +} + + +DPair Bezier::valueAt (double t) const { + const double s = 1-t; + return _points[0]*s*s*s + _points[1]*3.0*s*s*t + _points[2]*3.0*s*t*t + _points[3]*t*t*t; +} + + +/** Returns a value of the Bézier curve's blossom representation. */ +DPair Bezier::blossomValue (double u, double v, double w) const { + const double uv = u*v; + const double uw = u*w; + const double vw = v*w; + const double uvw = u*v*w; + return _points[0]*(1.0-u-v-w+uv+uw+vw-uvw) + +_points[1]*(u+v+w-2.0*(uv+uw+vw)+3.0*uvw) + +_points[2]*(uv+uw+vw-3.0*uvw) + +_points[3]*uvw; +} + + +/** Splits the curve at t into two sub-curves. */ +void Bezier::subdivide (double t, Bezier *bezier1, Bezier *bezier2) const { + const double s = 1-t; + DPair p01 = _points[0]*s + _points[1]*t; + DPair p12 = _points[1]*s + _points[2]*t; + DPair p23 = _points[2]*s + _points[3]*t; + DPair p012 = p01*s + p12*t; + DPair p123 = p12*s + p23*t; + DPair p0123 = p012*s + p123*t; + if (bezier1) + bezier1->setPoints(_points[0], p01, p012, p0123); + if (bezier2) + bezier2->setPoints(p0123, p123, p23, _points[3]); +} + + +/** Approximates the current Bézier curve by a sequence of line segments. + * This is done by subdividing the curve several times using De Casteljau's algorithm. + * If a sub-curve is almost flat, i.e. \f$\sum\limits_{k=0}^2 |p_{k+1}-p_k| - |p_3-p_0| < \delta\f$, + * the curve is not further subdivided. + * @param[in] delta threshold where to stop further subdivisions (see description above) + * @param[out] p the resulting sequence of points defining the start/end points of the line segments + * @param[out] t corresponding curve parameters of the approximated points p: \f$ b(t_i)=p_i \f$ + * @return number of points in vector p */ +int Bezier::approximate (double delta, std::vector &p, vector *t) const { + p.push_back(_points[0]); + if (t) + t->push_back(0); + return approximate(delta, 0, 1, p, t); +} + + +int Bezier::approximate (double delta, double t0, double t1, vector &p, vector *t) const { + // compute distance of adjacent control points + const double l01 = (_points[1]-_points[0]).length(); + const double l12 = (_points[2]-_points[1]).length(); + const double l23 = (_points[3]-_points[2]).length(); + const double l03 = (_points[3]-_points[0]).length(); + if (l01+l12+l23-l03 < delta) { // is curve flat enough? + p.push_back(_points[3]); // => store endpoint + if (t) + t->push_back(t1); + } + else { + // subdivide curve at b(0.5) and approximate the resulting parts separately + Bezier b1, b2; + subdivide(0.5, &b1, &b2); + double tmid = (t0+t1)/2; + b1.approximate(delta, t0, tmid, p, t); + b2.approximate(delta, tmid, t1, p, t); + } + return p.size(); +} + + +/** Returns the signed area of the triangle (p1, p2, p3). */ +static inline double signed_area (const DPair &p1, const DPair &p2, const DPair &p3) { + return ((p2.x()-p1.x())*(p3.y()-p1.y()) - (p3.x()-p1.x())*(p2.y()-p1.y()))/2.0; +} + + +static inline double dot_prod (const DPair &p1, const DPair &p2) { + return p1.x()*p2.x() + p1.y()*p2.y(); +} + + +/** Returns true if p3 is located between p1 and p2, i.e. p3 lays almost on the line + * between p1 and p2. */ +static bool between (const DPair &p1, const DPair &p2, const DPair &p3, double delta) { + double sqr_dist = dot_prod(p2-p1, p2-p1); + double factor = sqr_dist == 0.0 ? 1.0 : sqr_dist; + double area2 = fabs(signed_area(p1, p2, p3)); + return area2*area2/factor < delta // does p3 lay almost on the line through p1 and p2... + && min(p1.x(), p2.x()) <= p3.x() // ...and on or inside the rectangle spanned by p1 and p2? + && max(p1.x(), p2.x()) >= p3.x() + && min(p1.y(), p2.y()) <= p3.y() + && max(p1.y(), p2.y()) >= p3.y(); +} + + +static inline bool near (const DPair &p1, const DPair &p2, double delta) { + DPair diff = p2-p1; + return fabs(diff.x()) < delta && fabs(diff.y()) < delta; +} + + +/** Tries to reduce the degree of the Bézier curve. This only works if the number of + * control points can be reduces without changing the shape of the curve significantly. + * @param[in] delta deviation tolerance + * @param[in] p control points of the reduced curve + * @return degree of the reduced curve */ +int Bezier::reduceDegree (double delta, vector &p) const { + p.clear(); + if (near(_points[0], _points[1], delta) && near(_points[0], _points[2], delta) && near(_points[0], _points[3], delta)) + p.push_back(_points[0]); + else if (between(_points[0], _points[3], _points[1], delta) && between(_points[0], _points[3], _points[2], delta)) { + p.push_back(_points[0]); + p.push_back(_points[3]); + } + else if (near((_points[1]-_points[0])*1.5+_points[0], (_points[2]-_points[3])*1.5+_points[3], delta)) { + p.push_back(_points[0]); + p.push_back((_points[1]-_points[0])*1.5 + _points[0]); + p.push_back(_points[3]); + } + else { + p.resize(4); + for (int i=0; i < 4; i++) + p[i] = _points[i]; + } + return p.size()-1; +} + + +/** Try to solve the quadratic equation ax^2 + bx + c = 0. */ +static bool solve_quadratic_equation (double a, double b, double c, double &x1, double &x2) { + if (a == 0) { + if (b == 0) + return false; + x1 = x2 = -c/b; + } + else { + double discr = b*b - 4*a*c; + if (discr < 0) + return false; + double p = -b/a/2; + double r = sqrt(discr)/a/2; + x1 = p+r; + x2 = p-r; + } + return true; +} + + +/** Returns a tight bounding box parallel to the x- and y-axis. */ +void Bezier::getBBox (BoundingBox &bbox) const { + bbox.invalidate(); + // coefficients of the derivative + DPair pa = _points[3] - _points[2]*3.0 + _points[1]*3.0 - _points[0]; + DPair pb = (_points[2]-_points[1]*2.0+_points[0])*2.0; + DPair pc = _points[1]-_points[0]; + + // compute extrema for t > 0 and t < 1 + double t1, t2; + if (solve_quadratic_equation(pa.x(), pb.x(), pc.x(), t1, t2)) { + if (t1 > 0.001 && t1 < 0.999) + bbox.embed(valueAt(t1)); + if (t1 != t2 && t2 > 0.001 && t2 < 0.999) + bbox.embed(valueAt(t2)); + } + if (solve_quadratic_equation(pa.y(), pb.y(), pc.y(), t1, t2)) { + if (t1 > 0.001 && t1 < 0.999) + bbox.embed(valueAt(t1)); + if (t1 != t2 && t2 > 0.001 && t2 < 0.999) + bbox.embed(valueAt(t2)); + } + bbox.embed(_points[0]); + bbox.embed(_points[3]); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h new file mode 100644 index 00000000000..dcb6ee393c6 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bezier.h @@ -0,0 +1,52 @@ +/************************************************************************* +** Bezier.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_BEZIER_H +#define DVISVGM_BEZIER_H + +#include +#include "BoundingBox.h" +#include "Pair.h" + +class Bezier +{ + public: + Bezier (); + Bezier (const DPair &p0, const DPair &p1, const DPair &p2); + Bezier (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3); + Bezier (const Bezier &source, double t0, double t1); + void setPoints (const DPair &p0, const DPair &p1, const DPair &p2, const DPair &p3); + void reverse (); + DPair valueAt (double t) const; + DPair blossomValue (double u, double v, double w) const; + void subdivide (double t, Bezier *bezier1, Bezier *bezier2) const; + int approximate (double delta, std::vector &p, std::vector *t=0) const; + const DPair& point (int i) const {return _points[i];} + int reduceDegree (double delta, std::vector &p) const; + void getBBox (BoundingBox &bbox) const; + + protected: + int approximate (double delta, double t0, double t1, std::vector &p, std::vector *t) const; + + private: + DPair _points[4]; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp new file mode 100644 index 00000000000..43bf3a9f68b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp @@ -0,0 +1,38 @@ +/************************************************************************* +** BgColorSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "BgColorSpecialHandler.h" +#include "ColorSpecialHandler.h" +#include "SpecialActions.h" + +using namespace std; + + +bool BgColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + ColorSpecialHandler csh; + return csh.process(prefix, is, actions); +} + + +const char** BgColorSpecialHandler::prefixes () const { + static const char *pfx[] = {"background", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h new file mode 100644 index 00000000000..1d7ec2fbd10 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h @@ -0,0 +1,34 @@ +/************************************************************************* +** BgColorSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_BGCOLORSPECIALHANDLER_H +#define DVISVGM_BGCOLORSPECIALHANDLER_H + +#include "SpecialHandler.h" + +struct BgColorSpecialHandler : SpecialHandler +{ + const char* info () const {return "background color special";} + const char* name () const {return "bgcolor";} + const char** prefixes () const; + bool process (const char *prefix, std::istream &is, SpecialActions *actions); +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp new file mode 100644 index 00000000000..642f079b7ab --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.cpp @@ -0,0 +1,164 @@ +/************************************************************************* +** Bitmap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "Bitmap.h" +#include "macros.h" + +using namespace std; + +Bitmap::Bitmap () : _rows(0), _cols(0), _xshift(0), _yshift(0), _bpr(0), _bytes(0) +{ +} + + +/** Constructs a Bitmap */ +Bitmap::Bitmap (int minx, int maxx, int miny , int maxy) { + resize(minx, maxx, miny, maxy); +} + + +/** Resizes the bitmap and clears all pixels. + * @param[in] minx index of leftmost pixel column + * @param[in] maxx index of rightmost pixel column + * @param[in] miny index of bottom row + * @param[in] maxy index of top row */ +void Bitmap::resize (int minx, int maxx, int miny , int maxy) { + _rows = abs(maxy-miny)+1; + _cols = abs(maxx-minx)+1; + _xshift = minx; + _yshift = miny; + _bpr = _cols/8 + (_cols % 8 ? 1 : 0); // bytes per row + _bytes.resize(_rows*_bpr); + FORALL(_bytes, vector::iterator, it) + *it = 0; +} + + +/** Sets n pixels of row r to 1 starting at pixel c. + * @param[in] row number of row + * @param[in] col number of column (pixel) + * @param[in] n number of bits to be set */ +void Bitmap::setBits (int row, int col, int n) { + row -= _yshift; + col -= _xshift; + UInt8 *byte = &_bytes[row*_bpr + col/8]; + if (byte < &_bytes[0]) + return; + const UInt8 *maxptr = &_bytes[0]+_bytes.size()-1; + while (n > 0 && byte <= maxptr) { + int b = 7 - col%8; // number of leftmost bit in current byte to be set + int m = min(n, b+1); // number of bits to be set in current byte + int bitseq = (1 << m)-1; // sequence of n set bits (bits 0..n-1 are set) + bitseq <<= b-m+1; // move bit sequence so that bit b is the leftmost set bit + *byte |= UInt8(bitseq); // apply bit sequence to current byte + byte++; + n -= m; + col += m; + } +} + + +void Bitmap::forAllPixels (Callback &data) const { + for (int row=0; row < _rows ; row++) { + for (int col=0; col < _bpr; col++) { + UInt8 byte = _bytes[row*_bpr+col]; + int x; + for (int b=7; (b >= 0) && ((x = 8*col+(7-b)) < _cols); b--) + data.pixel(x, row, byte & (1 << b), *this); + } + } + data.finish(); +} + + +class BBoxCallback : public Bitmap::Callback +{ + public: + BBoxCallback () : _changed(false), _minx(numeric_limits::max()), _miny(_minx), _maxx(0), _maxy(0) {} + int minx () const {return _minx;} + int miny () const {return _miny;} + int maxx () const {return _maxx;} + int maxy () const {return _maxy;} + bool empty () const {return !_changed;} + + void pixel (int x, int y, bool set, const Bitmap&) { + if (set) { + _minx = min(_minx, x); + _miny = min(_miny, y); + _maxx = max(_maxx, x); + _maxy = max(_maxy, y); + _changed = true; + } + } + + void finish () { + if (empty()) + _minx = _miny = 0; + } + + private: + bool _changed; + int _minx, _miny, _maxx, _maxy; +}; + + +/** Computes the bounding box that spans all set pixels. */ +bool Bitmap::getBBox (int &minx, int &miny, int &maxx, int &maxy) const { + BBoxCallback bboxCallback; + forAllPixels(bboxCallback); + minx = bboxCallback.minx(); + miny = bboxCallback.miny(); + maxx = bboxCallback.maxx(); + maxy = bboxCallback.maxy(); + return !bboxCallback.empty(); +} + + +/** Computes width and height of the bounding box that spans all set pixels. */ +void Bitmap::getExtent (int &w, int &h) const { + int minx, miny, maxx, maxy; + if (getBBox(minx, miny, maxx, maxy)) { + w = maxx-minx+1; + h = maxy-miny+1; + } + else + w = h = 0; +} + + +#if 0 +ostream& Bitmap::write (ostream &os) const { + for (int r=_rows-1; r >= 0 ; r--) { + for (int c=0; c < _bpr; c++) { + UInt8 byte = _bytes[r*_bpr+c]; + for (int b=128; b; b>>=1) + os << (byte & b ? '*' : '-'); + os << ' '; + } + os << endl; + } + return os; +} +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h new file mode 100644 index 00000000000..7a8210abeaa --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Bitmap.h @@ -0,0 +1,112 @@ +/************************************************************************* +** Bitmap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_BITMAP_H +#define DVISVGM_BITMAP_H + +#include +#include +#include "types.h" + + +class Bitmap +{ + public: + struct Callback { + virtual ~Callback() {} + virtual void pixel (int x, int y, bool set, Bitmap &bm) {} + virtual void pixel (int x, int y, bool set, const Bitmap &bm) {} + virtual void finish () {} + }; + + public: + Bitmap (); + Bitmap (int minx, int maxx, int miny , int maxy); + void resize (int minx, int maxx, int miny , int maxy); + void setBits(int row, int col, int n); + const UInt8* rowPtr (int row) const {return &_bytes[row*_bpr];} + int height () const {return _rows;} + int width () const {return _cols;} + int xshift () const {return _xshift;} + int yshift () const {return _yshift;} + int bytesPerRow () const {return _bpr;} + bool empty () const {return (!_rows && !_cols) || _bytes.empty();} + bool getBBox (int &minx, int &miny, int &maxx, int &maxy) const; + void getExtent (int &w, int &h) const; + void forAllPixels (Callback &callback) const; + + template + int copy (std::vector &target, bool vflip=false) const; + +// template +// void write (std::ostream &os, const std::vector &v) const; + +// std::ostream& write (std::ostream &os) const; + + private: + int _rows, _cols; ///< number of rows, columns + int _xshift, _yshift; ///< horizontal/vertical shift + int _bpr; ///< number of bytes per row + std::vector _bytes; +}; + + +/** Copies the bitmap to a new target area and reorganizes the bits. + * @tparam T component type of target vector + * @param[out] target points to first T of new bitmap (must be deleted after usage) + * @param[in] vflip true if the new bitmap should be flipped vertically + * @return number of Ts per row */ +template +int Bitmap::copy (std::vector &target, bool vflip) const { + const int s = sizeof(T); + const int tpr = _bpr/s + (_bpr%s ? 1 : 0); // number of Ts per row + target.resize(_rows*tpr); + for (int r=0; r < _rows; r++) { + int targetrow = vflip ? _rows-r-1 : r; + for (int b=0; b < _bpr; b++) { + T &t = target[targetrow*tpr + b/s]; + T chunk = (T)_bytes[r*_bpr+b] << (8*(s-1-b%s)); + if (b % s == 0) + t = chunk; + else + t |= chunk; + } + } + return tpr; +} + + +/* +template +void Bitmap::write (std::ostream &os, const std::vector &v) const { + const int s = sizeof(T); + const int tpr = _bpr/s + (_bpr%s ? 1 : 0); // number of Ts per row + for (int r=_rows-1; r >= 0; r--) { + for (int t=0; t < tpr; t++) { + for (T b=(T)1<<(8*s-1); b; b>>=1) + os << ((v[r*tpr+t] & b) ? '*' : '-'); + os << ' '; + } + os << std::endl; + } +}*/ + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp new file mode 100644 index 00000000000..30d711f0eb2 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp @@ -0,0 +1,287 @@ +/************************************************************************* +** BoundingBox.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "BoundingBox.h" +#include "Matrix.h" +#include "XMLNode.h" +#include "XMLString.h" + +using namespace std; + + +BoundingBox::BoundingBox () + : _ulx(0), _uly(0), _lrx(0), _lry(0), _valid(false), _locked(false) +{ +} + + +BoundingBox::BoundingBox (double ulxx, double ulyy, double lrxx, double lryy) + : _ulx(min(ulxx,lrxx)), _uly(min(ulyy,lryy)), + _lrx(max(ulxx,lrxx)), _lry(max(ulyy,lryy)), + _valid(true), _locked(false) +{ +} + + +BoundingBox::BoundingBox (const DPair &p1, const DPair &p2) + : _ulx(min(p1.x(), p2.x())), _uly(min(p1.y(), p2.y())), + _lrx(max(p1.x(), p2.x())), _lry(max(p1.y(), p2.y())), + _valid(true), _locked(false) +{ +} + + +BoundingBox::BoundingBox (const Length &ulxx, const Length &ulyy, const Length &lrxx, const Length &lryy) + : _ulx(min(ulxx.pt(),lrxx.pt())), _uly(min(ulyy.pt(),lryy.pt())), + _lrx(max(ulxx.pt(),lrxx.pt())), _lry(max(ulyy.pt(),lryy.pt())), + _valid(true), _locked(false) +{ +} + + +BoundingBox::BoundingBox (const string &boxstr) + : _ulx(0), _uly(0), _lrx(0), _lry(0), _valid(false), _locked(false) +{ + set(boxstr); +} + + +/** Removes leading and trailing whitespace from the given string. */ +static string& strip (string &str) { + size_t n=0; + while (n < str.length() && isspace(str[n])) + ++n; + str.erase(0, n); + n=str.length()-1; + while (n > 0 && isspace(str[n])) + --n; + str.erase(n+1); + return str; +} + + +/** Sets or modifies the bounding box. If 'boxstr' consists of 4 length values, + * they denote the absolute position of two diagonal corners of the box. In case + * of a single length value l the current box is enlarged by adding (-l,-l) the upper + * left and (l,l) to the lower right corner. + * @param[in] boxstr whitespace and/or comma separated string of lengths. */ +void BoundingBox::set (string boxstr) { + vector coord; + const size_t len = boxstr.length(); + size_t l=0; + strip(boxstr); + string lenstr; + do { + while (l < len && isspace(boxstr[l])) + l++; + size_t r=l; + while (r < len && !isspace(boxstr[r]) && boxstr[r] != ',') + r++; + lenstr = boxstr.substr(l, r-l); + if (!lenstr.empty()) { + coord.push_back(Length(lenstr)); + if (boxstr[r] == ',') + r++; + l = r; + } + } while (!lenstr.empty() && coord.size() < 4); + + switch (coord.size()) { + case 1: + _ulx -= coord[0].pt(); + _uly -= coord[0].pt(); + _lrx += coord[0].pt(); + _lry += coord[0].pt(); + break; + case 2: + _ulx -= coord[0].pt(); + _uly -= coord[1].pt(); + _lrx += coord[0].pt(); + _lry += coord[1].pt(); + break; + case 4: + _ulx = min(coord[0].pt(), coord[2].pt()); + _uly = min(coord[1].pt(), coord[3].pt()); + _lrx = max(coord[0].pt(), coord[2].pt()); + _lry = max(coord[1].pt(), coord[3].pt()); + break; + default: + throw BoundingBoxException("1, 2 or 4 length parameters expected"); + } + _valid = true; +} + + +/** Enlarges the box so that point (x,y) is enclosed. */ +void BoundingBox::embed (double x, double y) { + if (!_locked) { + if (_valid) { + if (x < _ulx) + _ulx = x; + else if (x > _lrx) + _lrx = x; + if (y < _uly) + _uly = y; + else if (y > _lry) + _lry = y; + } + else { + _ulx = _lrx = x; + _uly = _lry = y; + _valid = true; + } + } +} + + +/** Enlarges the box so that the given bounding box is enclosed. */ +void BoundingBox::embed (const BoundingBox &bbox) { + if (!_locked && bbox._valid) { + if (_valid) { + embed(bbox._ulx, bbox._uly); + embed(bbox._lrx, bbox._lry); + } + else { + _ulx = bbox._ulx; + _uly = bbox._uly; + _lrx = bbox._lrx; + _lry = bbox._lry; + _valid = true; + } + } +} + + +/** Embeds a virtual circle into the box and enlarges it accordingly. + * @param[in] c center of the circle + * @param[in] r radius of the circle */ +void BoundingBox::embed (const DPair &c, double r) { + embed(BoundingBox(c.x()-r, c.y()-r, c.x()+r, c.y()+r)); +} + + +/** Expands the box in all four directions by a given value. */ +void BoundingBox::expand (double m) { + if (!_locked) { + _ulx -= m; + _uly -= m; + _lrx += m; + _lry += m; + } +} + + +/** Intersects the current box with bbox and applies the result to *this. + * If both boxes are disjoint, *this is not altered. + * @param[in] bbox box to intersect with + * @return false if *this is locked or both boxes are disjoint */ +bool BoundingBox::intersect (const BoundingBox &bbox) { + // check if the two boxes are disjoint + if (_locked || _lrx < bbox._ulx || _lry < bbox._uly || _ulx > bbox._lrx || _uly > bbox._lry) + return false; + // not disjoint: compute the intersection + _ulx = max(_ulx, bbox._ulx); + _uly = max(_uly, bbox._uly); + _lrx = min(_lrx, bbox._lrx); + _lry = min(_lry, bbox._lry); + return true; +} + + +void BoundingBox::operator += (const BoundingBox &bbox) { + if (!_locked) { + _ulx += bbox._ulx; + _uly += bbox._uly; + _lrx += bbox._lrx; + _lry += bbox._lry; + } +} + + +bool BoundingBox::operator == (const BoundingBox &bbox) const { + return _valid && bbox._valid + && _ulx == bbox._ulx + && _uly == bbox._uly + && _lrx == bbox._lrx + && _lry == bbox._lry; +} + + +bool BoundingBox::operator != (const BoundingBox &bbox) const { + return !_valid || !bbox._valid + || _ulx != bbox._ulx + || _uly != bbox._uly + || _lrx != bbox._lrx + || _lry != bbox._lry; +} + + +void BoundingBox::scale (double sx, double sy) { + if (!_locked) { + _ulx *= sx; + _lrx *= sx; + if (sx < 0) swap(_ulx, _lrx); + _uly *= sy; + _lry *= sy; + if (sy < 0) swap(_uly, _lry); + } +} + + +void BoundingBox::transform (const Matrix &tm) { + if (!_locked) { + DPair ul = tm * DPair(_lrx, _lry); + DPair lr = tm * DPair(_ulx, _uly); + DPair ll = tm * DPair(_ulx, _lry); + DPair ur = tm * DPair(_lrx, _uly); + _ulx = min(min(ul.x(), lr.x()), min(ur.x(), ll.x())); + _uly = min(min(ul.y(), lr.y()), min(ur.y(), ll.y())); + _lrx = max(max(ul.x(), lr.x()), max(ur.x(), ll.x())); + _lry = max(max(ul.y(), lr.y()), max(ur.y(), ll.y())); + } +} + + +string BoundingBox::toSVGViewBox () const { + ostringstream oss; + oss << XMLString(_ulx) << ' ' << XMLString(_uly) << ' ' << XMLString(width()) << ' ' << XMLString(height()); + return oss.str(); +} + + +ostream& BoundingBox::write (ostream &os) const { + return os << '(' << _ulx << ", " << _uly + << ", " << _lrx << ", " << _lry << ')'; +} + + +XMLElementNode* BoundingBox::createSVGRect () const { + XMLElementNode *rect = new XMLElementNode("rect"); + rect->addAttribute("x", minX()); + rect->addAttribute("y", minY()); + rect->addAttribute("width", width()); + rect->addAttribute("height", height()); + rect->addAttribute("fill", "none"); + return rect; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h new file mode 100644 index 00000000000..223e0433748 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.h @@ -0,0 +1,91 @@ +/************************************************************************* +** BoundingBox.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_BOUNDINGBOX_H +#define DVISVGM_BOUNDINGBOX_H + +#include +#include +#include "Length.h" +#include "MessageException.h" +#include "Pair.h" +#include "macros.h" +#include "types.h" + + +class Matrix; +class XMLElementNode; + + +struct BoundingBoxException : MessageException +{ + BoundingBoxException (const std::string &msg) : MessageException(msg) {} +}; + + +class BoundingBox +{ + public: + BoundingBox (); + BoundingBox (double ulxx, double ulyy, double lrxx, double lryy); + BoundingBox (const DPair &p1, const DPair &p2); + BoundingBox (const Length &ulxx, const Length &ulyy, const Length &lrxx, const Length &lryy); + BoundingBox (const std::string &boxstr); + void set (std::string boxstr); + void embed (double x, double y); + void embed (const BoundingBox &bb); + void embed (const DPair &p) {embed(p.x(), p.y());} + void embed (const DPair &c, double r); + + template + void embed (const Pair &p) {embed(p.x(), p.y());} + + void expand (double m); + bool intersect (const BoundingBox &bbox); + double minX () const {return _ulx;} + double minY () const {return _uly;} + double maxX () const {return _lrx;} + double maxY () const {return _lry;} + double width () const {return _lrx-_ulx;} + double height () const {return _lry-_uly;} + bool valid() const {return _valid;} + bool locked() const {return _locked;} + void lock () {_locked = true;} + void unlock () {_locked = false;} + void invalidate () {_valid = false;} + void operator += (const BoundingBox &bbox); + bool operator == (const BoundingBox &bbox) const; + bool operator != (const BoundingBox &bbox) const; + void scale (double sx, double sy); + void transform (const Matrix &tm); + std::string toSVGViewBox () const; + std::ostream& write (std::ostream &os) const; + XMLElementNode* createSVGRect () const; + + private: + double _ulx, _uly; ///< coordinates of upper left vertex (in PS point units) + double _lrx, _lry; ///< coordinates of lower right vertex (in PS point units) + bool _valid : 1; ///< true if the box coordinates are properly set + bool _locked : 1; ///< if true, the box data is read-only +}; + +IMPLEMENT_OUTPUT_OPERATOR(BoundingBox) + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp new file mode 100644 index 00000000000..2c9a22c8fbb --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.cpp @@ -0,0 +1,75 @@ +/************************************************************************* +** CMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "CMap.h" +#include "CMapManager.h" +#include "FileFinder.h" +#include "InputReader.h" + +using namespace std; + + +const char* CMap::path () const { + return FileFinder::lookup(name(), "cmap", false); +} + + +const FontEncoding* CMap::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { + return CMapManager::instance().findCompatibleBaseFontMap(font, this, charmapID); +} + +////////////////////////////////////////////////////////////////////// + +/** Returns the RO (Registry-Ordering) string of the CMap. */ +string SegmentedCMap::getROString() const { + if (_registry.empty() || _ordering.empty()) + return ""; + return _registry + "-" + _ordering; +} + + +/** Returns the CID for a given character code. */ +UInt32 SegmentedCMap::cid (UInt32 c) const { + if (_cidranges.valueExists(c)) + return _cidranges.valueAt(c); + if (_basemap) + return _basemap->cid(c); + return 0; +} + + +/** Returns the character code of a base font for a given CID. */ +UInt32 SegmentedCMap::bfcode (UInt32 cid) const { + if (_bfranges.valueExists(cid)) + return _bfranges.valueAt(cid); + if (_basemap) + return _basemap->bfcode(cid); + return 0; +} + + +void SegmentedCMap::write (ostream &os) const { + _cidranges.write(os); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h new file mode 100644 index 00000000000..5a58ced5f3a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.h @@ -0,0 +1,116 @@ +/************************************************************************* +** CMap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CMAP_H +#define DVISVGM_CMAP_H + +#include +#include +#include +#include "FontEncoding.h" +#include "RangeMap.h" +#include "types.h" + + +struct CMap : public NamedFontEncoding +{ + virtual ~CMap () {} + virtual bool vertical () const =0; + virtual bool mapsToCID () const =0; + virtual const char* path () const; + virtual UInt32 cid (UInt32 c) const =0; + virtual UInt32 bfcode (UInt32 cid) const =0; + virtual std::string getROString () const =0; + virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; + virtual bool mapsToCharIndex () const {return mapsToCID();} + + Character decode (UInt32 c) const { + if (mapsToCID()) + return Character(Character::INDEX, cid(c)); + return Character(Character::CHRCODE, bfcode(c)); + } +}; + + +struct IdentityCMap : public CMap +{ + UInt32 cid (UInt32 c) const {return c;} + UInt32 bfcode (UInt32 cid) const {return 0;} + std::string getROString () const {return "Adobe-Identity";} + bool mapsToCID() const {return true;} +}; + + +struct IdentityHCMap : public IdentityCMap +{ + bool vertical () const {return false;} + const char* name () const {return "Identity-H";} +}; + + +struct IdentityVCMap : public IdentityCMap +{ + bool vertical () const {return true;} + const char* name () const {return "Identity-V";} +}; + + +struct UnicodeCMap : public CMap +{ + bool vertical () const {return false;} + const char* name () const {return "unicode";} + bool mapsToCID () const {return false;} + const char* path () const {return 0;} + UInt32 cid (UInt32 c) const {return c;} + UInt32 bfcode (UInt32 cid) const {return cid;} + std::string getROString () const {return "";} +}; + + +class SegmentedCMap : public CMap +{ + friend class CMapReader; + + public: + SegmentedCMap (const std::string &name) : _name(name), _basemap(0), _vertical(false), _mapsToCID(true) {} + const char* name () const {return _name.c_str();} + UInt32 cid (UInt32 c) const; + UInt32 bfcode (UInt32 cid) const; + void addCIDRange (UInt32 first, UInt32 last, UInt32 cid) {_cidranges.addRange(first, last, cid);} + void addBFRange (UInt32 first, UInt32 last, UInt32 chrcode) {_bfranges.addRange(first, last, chrcode);} + void write (std::ostream &os) const; + bool vertical () const {return _vertical;} + bool mapsToCID () const {return _mapsToCID;} + size_t numCIDRanges () const {return _cidranges.size();} + size_t numBFRanges () const {return _bfranges.size();} + std::string getROString () const; + + private: + std::string _name; + std::string _registry; + std::string _ordering; + CMap *_basemap; + bool _vertical; + bool _mapsToCID; // true: chrcode->CID, false: CID->charcode + RangeMap _cidranges; + RangeMap _bfranges; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp new file mode 100644 index 00000000000..d3b3fd399d6 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.cpp @@ -0,0 +1,142 @@ +/************************************************************************* +** CMapManager.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "CMap.h" +#include "CMapManager.h" +#include "CMapReader.h" +#include "Font.h" +#include "FileFinder.h" +#include "Message.h" + +using namespace std; + + +CMapManager::~CMapManager () { + for (CMaps::iterator it=_cmaps.begin(); it != _cmaps.end(); ++it) + delete it->second; +} + + +CMapManager& CMapManager::instance () { + static CMapManager cmm; + return cmm; +} + + +/** Loads a cmap and returns the corresponding object. */ +CMap* CMapManager::lookup (const string &name) { + CMaps::iterator it = _cmaps.find(name); + if (it != _cmaps.end()) + return it->second; + + if (_includedCMaps.find(name) != _includedCMaps.end()) { + _level = 0; + ostringstream oss; + oss << "circular reference of CMap " << name; + throw CMapReaderException(oss.str()); + } + + CMap *cmap=0; + if (name == "Identity-H") + cmap = new IdentityHCMap; + else if (name == "Identity-V") + cmap = new IdentityVCMap; + else if (name == "unicode") + cmap = new UnicodeCMap; + if (cmap) { + _cmaps[name] = cmap; + return cmap; + } + // Load cmap data of file and also process all cmaps referenced by operator "usecmap". + // This can lead to a sequence of further calls of lookup(). In order to prevent infinite loops + // due to (disallowed) circular cmap inclusions, we keep track of all cmaps processed during + // a sequence of inclusions. + _includedCMaps.insert(name); // save name of current cmap being processed + _level++; // increase nesting level + try { + CMapReader reader; + if (!(cmap = reader.read(name))) { + _level = 1; + Message::wstream(true) << "CMap file '" << name << "' not found\n"; + } + _cmaps[name] = cmap; + } + catch (const CMapReaderException &e) { + Message::estream(true) << "CMap file " << name << ": " << e.what() << "\n"; + } + if (--_level == 0) // back again at initial nesting level? + _includedCMaps.clear(); // => names of included cmaps are no longer needed + return cmap; +} + + +/** Looks for a base font CMap and a compatible encoding table in a given font. The CMap describe + * the mapping from CIDs to character codes where the latter are relative to the encoding table + * identified by charmapID. + * cmap:X->CID, bfmap:CID->Y, enctable:Y->CharCode + * @param[in] font look for available encoding tables in this font + * @param[in] cmap take the source registry-ordering pair from this CMap + * @param[out] charmapID ID of the compatible character map found in the given font + * @return base font CMap that maps from CIDs to character codes */ +const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID) { + if (!font || !cmap) + return 0; + + static const struct CharMapIDToEncName { + CharMapID id; + const char *encname; + } encodings[] = { + {CharMapID::WIN_UCS4, "UCS4"}, + {CharMapID::WIN_UCS2, "UCS2"}, + {CharMapID::WIN_SHIFTJIS, "90ms-RKSJ"}, + {CharMapID::WIN_PRC, "GBK-EUC"}, + {CharMapID::WIN_BIG5, "ETen-B5"}, + {CharMapID::WIN_WANSUNG, "KSCms-UHC"}, + {CharMapID::MAC_JAPANESE, "90pv-RKSJ"}, + {CharMapID::MAC_TRADCHINESE, "B5pc"}, + {CharMapID::MAC_SIMPLCHINESE, "GBpc-EUC"}, + {CharMapID::MAC_KOREAN, "KSCpc-EUC"} + }; + + // get IDs of all available charmaps in font + vector charmapIDs; + font->collectCharMapIDs(charmapIDs); + + const bool is_unicode_map = dynamic_cast(cmap); + const size_t num_encodings = is_unicode_map ? 2 : sizeof(encodings)/sizeof(CharMapIDToEncName); + + // try to find a compatible encoding CMap + const string ro = cmap->getROString(); + for (const CharMapIDToEncName *enc=encodings; enc < enc+num_encodings; enc++) { + for (size_t i=0; i < charmapIDs.size(); i++) { + if (enc->id == charmapIDs[i]) { + string cmapname = ro+"-"+enc->encname; + if (is_unicode_map || FileFinder::lookup(cmapname, "cmap", false)) { + charmapID = enc->id; + return is_unicode_map ? cmap : lookup(cmapname); + } + } + } + } + return 0; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h new file mode 100644 index 00000000000..5388cb90f94 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapManager.h @@ -0,0 +1,52 @@ +/************************************************************************* +** CMapManager.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CMAPMANAGER_H +#define DVISVGM_CMAPMANAGER_H + +#include +#include +#include +#include "CharMapID.h" +#include "Font.h" + +struct CMap; +struct FontEncoding; +class FontEncodingPair; + +class CMapManager +{ + typedef std::map CMaps; + public: + ~CMapManager (); + CMap* lookup (const std::string &name); + const CMap* findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID); + static CMapManager& instance (); + + protected: + CMapManager () : _level(0) {} + + private: + CMaps _cmaps; ///< loaded cmaps + int _level; ///< current inclusion depth; >0 if a cmap loaded by "usecmap" is being processed + std::set _includedCMaps; ///< names of cmaps loaded by "usecmap" +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp new file mode 100644 index 00000000000..f655eca5139 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.cpp @@ -0,0 +1,265 @@ +/************************************************************************* +** CMapReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "CMap.h" +#include "CMapManager.h" +#include "CMapReader.h" +#include "FileFinder.h" +#include "InputReader.h" + +using namespace std; + + +CMapReader::CMapReader () : _cmap(0), _inCMap(false) +{ +} + + +/** Reads a cmap file and returns the corresponding CMap object. + * @param fname[in] name/path of cmap file + * @return CMap object representing the read data, or 0 if file could not be read */ +CMap* CMapReader::read (const string &fname) { + if (const char *path = FileFinder::lookup(fname.c_str(), "cmap", false)) { + ifstream ifs(path); + if (ifs) + return read(ifs, fname); + } + _tokens.clear(); + return 0; +} + + +/** Reads cmap data from a given stream and returns the corresponding CMap object. + * @param is[in] cmap data input stream + * @param is[in] name name of CMap to be read + * @return CMap object representing the read data, or 0 if file could not be read */ +CMap* CMapReader::read (std::istream& is, const string &name) { + _tokens.clear(); + _cmap = new SegmentedCMap(name); + StreamInputReader ir(is); + try { + while (ir) { + Token token(ir); + if (token.type() == Token::TT_EOF) + break; + if (_inCMap) { + if (token.type() == Token::TT_OPERATOR) + executeOperator(token.strvalue(), ir); + else + _tokens.push_back(token); + } + else if (token.type() == Token::TT_OPERATOR && token.strvalue() == "begincmap") + _inCMap = true; + } + } + catch (CMapReaderException &e) { + delete _cmap; + _cmap = 0; + throw; + } + return _cmap; +} + + +void CMapReader::executeOperator (const string &op, InputReader &ir) { + const struct Operator { + const char *name; + void (CMapReader::*handler)(InputReader&); + } operators[] = { + {"beginbfchar", &CMapReader::op_beginbfchar}, + {"beginbfrange", &CMapReader::op_beginbfrange}, + {"begincidrange", &CMapReader::op_begincidrange}, + {"def", &CMapReader::op_def}, + {"endcmap", &CMapReader::op_endcmap}, + {"usecmap", &CMapReader::op_usecmap}, + }; + + for (size_t i=0; i < sizeof(operators)/sizeof(Operator); i++) { + if (operators[i].name == op) { + (this->*operators[i].handler)(ir); + break; + } + } + _tokens.clear(); +} + + +void CMapReader::op_def (InputReader&) { + size_t size = _tokens.size(); + if (size >= 2) { + const string val = popToken().strvalue(); + const string name = popToken().strvalue(); + if (name == "CMapName") { + if (val != _cmap->_name) + throw CMapReaderException("CMapName doesn't match filename"); + } + else if (name == "WMode") { + if (val == "0" || val == "1") + _cmap->_vertical = (val == "1"); + else + throw CMapReaderException("invalid WMode (0 or 1 expected)"); + } + else if (name == "Registry") + _cmap->_registry = val; + else if (name == "Ordering") + _cmap->_ordering = val; + } +} + + +void CMapReader::op_endcmap (InputReader &) { + _inCMap = false; +} + + +void CMapReader::op_usecmap (InputReader &) { + if (_tokens.empty()) + throw CMapReaderException("stack underflow while processing usecmap"); + else { + const string name = popToken().strvalue(); + if ((_cmap->_basemap = CMapManager::instance().lookup(name)) == 0) + throw CMapReaderException("CMap file '"+name+"' not found"); + } +} + + +static UInt32 parse_hexentry (InputReader &ir) { + ir.skipSpace(); + if (ir.get() != '<') + throw CMapReaderException("invalid range entry ('<' expected)"); + int val; + if (!ir.parseInt(16, val)) + throw CMapReaderException("invalid range entry (hexadecimal value expected)"); + if (ir.get() != '>') + throw CMapReaderException("invalid range entry ('>' expected)"); + return UInt32(val); +} + + +void CMapReader::op_begincidrange (InputReader &ir) { + if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + ir.skipSpace(); + int num_entries = static_cast(popToken().numvalue()); + while (num_entries > 0 && ir.peek() == '<') { + UInt32 first = parse_hexentry(ir); + UInt32 last = parse_hexentry(ir); + UInt32 cid; + ir.skipSpace(); + if (!ir.parseUInt(cid)) + throw CMapReaderException("invalid range entry (decimal value expected)"); + _cmap->addCIDRange(first, last, cid); + ir.skipSpace(); + } + } +} + + +void CMapReader::op_beginbfrange (InputReader &ir) { + if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + ir.skipSpace(); + int num_entries = static_cast(popToken().numvalue()); + while (num_entries > 0 && ir.peek() == '<') { + UInt32 first = parse_hexentry(ir); + UInt32 last = parse_hexentry(ir); + UInt32 chrcode = parse_hexentry(ir); + _cmap->addBFRange(first, last, chrcode); + ir.skipSpace(); + } + _cmap->_mapsToCID = false; + } +} + + +void CMapReader::op_beginbfchar (InputReader &ir) { + if (!_tokens.empty() && _tokens.back().type() == Token::TT_NUMBER) { + ir.skipSpace(); + int num_entries = static_cast(popToken().numvalue()); + while (num_entries > 0 && ir.peek() == '<') { + UInt32 cid = parse_hexentry(ir); + ir.skipSpace(); + if (ir.peek() == '/') + throw CMapReaderException("mapping of named characters is not supported"); + UInt32 chrcode = parse_hexentry(ir); + _cmap->addBFRange(cid, cid, chrcode); + ir.skipSpace(); + } + _cmap->_mapsToCID = false; + } +} + +//////////////////////////////////////////////////////////////////////////////////// + +CMapReader::Token::Token (InputReader &ir) { + scan(ir); +} + + +/** Reads the next characters from the input stream to create a token. */ +void CMapReader::Token::scan (InputReader &ir) { + ir.skipSpace(); + while (ir.peek() == '%') { // comment? + while (ir.peek() != '\n') // => skip until end of line + ir.get(); + ir.skipSpace(); + } + ir.skipSpace(); + if (ir.eof()) + _type = TT_EOF; + else if (ir.peek() == '/') { // PS name? + ir.get(); + while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) + _value += ir.get(); + _type = TT_NAME; + } + else if (ir.peek() == '(') { // string? + ir.get(); + int level=0; + while (ir.peek() != ')' || level > 0) { + if (ir.peek() == '(') + level++; + else if (ir.peek() == ')' && level > 0) + level--; + _value += ir.get(); + } + ir.get(); // skip ')' + _type = TT_STRING; + } + else if (strchr("[]{}<>", ir.peek())) { // PS delimiter + _value = ir.get(); + _type = TT_DELIM; + } + else if (isdigit(ir.peek())) { // number? + double val; + if (ir.parseDouble(val)) { + ostringstream oss; + oss << val; + _value = oss.str(); + _type = TT_NUMBER; + } + } + else { + while (!strchr("[]{}<>", ir.peek()) && !isspace(ir.peek())) + _value += ir.get(); + _type = TT_OPERATOR; + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h new file mode 100644 index 00000000000..a7a243999d7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMapReader.h @@ -0,0 +1,81 @@ +/************************************************************************* +** CMapReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CMAPREADER_H +#define DVISVGM_CMAPREADER_H + +#include +#include +#include +#include +#include "MessageException.h" + + +struct CMap; +class InputReader; + +class CMapReader +{ + class Token + { + public: + enum Type {TT_UNKNOWN, TT_EOF, TT_DELIM, TT_NUMBER, TT_STRING, TT_NAME, TT_OPERATOR}; + + public: + Token (InputReader &ir); + void scan (InputReader &ir); + Type type () const {return _type;} + const std::string& strvalue () const {return _value;} + double numvalue () const {return std::atof(_value.c_str());} + + private: + Type _type; + std::string _value; + }; + + public: + CMapReader (); + CMap* read (const std::string &fname); + CMap* read (std::istream &is, const std::string &name); + + protected: + Token popToken () {Token t=_tokens.back(); _tokens.pop_back(); return t;} + void executeOperator (const std::string &op, InputReader &ir); + void op_beginbfchar (InputReader &ir); + void op_beginbfrange (InputReader &ir); + void op_begincidrange (InputReader &ir); + void op_def (InputReader &ir); + void op_endcmap (InputReader &ir); + void op_usecmap (InputReader &ir); + + private: + SegmentedCMap *_cmap; ///< CMap being read + std::vector _tokens; ///< stack of tokens to be processed + bool _inCMap; ///< operator begincmap has been executed +}; + + + +struct CMapReaderException : public MessageException +{ + CMapReaderException (const std::string &msg) : MessageException(msg) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp new file mode 100644 index 00000000000..09670551baf --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.cpp @@ -0,0 +1,113 @@ +/************************************************************************* +** CRC32.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "CRC32.h" + +using namespace std; + + +CRC32::CRC32 () : _crc32(0xFFFFFFFF) +{ + const UInt32 poly = 0xEDB88320; + for (int i = 0; i < 256; i++) { + UInt32 crc=i; + for (int j=8; j > 0; j--) { + if (crc & 1) + crc = (crc >> 1) ^ poly; + else + crc >>= 1; + } + _tab[i] = crc; + } +} + + +/** Resets CRC32 sum to 0. */ +void CRC32::reset () { + _crc32 = 0xFFFFFFFF; +} + + +/** Appends string bytes to the previous data and computes the resulting checksum. + * @param[in] data string to update the checksum with */ +void CRC32::update (const char *data) { + update((const UInt8*)data, strlen(data)); +} + + +/** Appends a single value to the previous data and computes the resulting checksum. + * @param[in] n value to update the checksum with + * @param[in] bytes number of bytes to consider (0-4) */ +void CRC32::update (UInt32 n, int bytes) { + for (int i=bytes-1; i >= 0; --i) { + UInt8 byte = UInt8((n >> (8*i)) & 0xff); + update(&byte, 1); + } +} + + +/** Appends a sequence of bytes to the previous data and computes the resulting checksum. + * @param[in] bytes pointer to array of bytes + * @param[in] len number of bytes in array */ +void CRC32::update (const UInt8 *bytes, size_t len) { + for (size_t i=0; i < len; ++i) + _crc32 = ((_crc32 >> 8) & 0x00FFFFFF) ^ _tab[(_crc32 ^ *bytes++) & 0xFF]; +} + + +void CRC32::update (istream &is) { + char buf [4096]; + while (is) { + is.read(buf, 4096); + update((UInt8*)buf, is.gcount()); + } +} + + +/** Returns the checksum computed from values added with the update functions. */ +UInt32 CRC32::get () const { + return _crc32 ^ 0xFFFFFFFF; +} + + +/** Computes the CRC32 checksum of a sequence of bytes. + * @param[in] bytes pointer to array of bytes + * @param[in] len number of bytes in array + * @return CRC32 checksum */ +UInt32 CRC32::compute (const UInt8 *bytes, size_t len) { + CRC32 crc32; + crc32.update(bytes, len); + return crc32.get(); +} + + +/** Computes the CRC32 checksum of a string. */ +UInt32 CRC32::compute (const char *str) { + return compute((const UInt8*)str, strlen(str)); +} + + +UInt32 CRC32::compute (istream &is) { + CRC32 crc32; + crc32.update(is); + return crc32.get(); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h new file mode 100644 index 00000000000..3eacb17bf33 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CRC32.h @@ -0,0 +1,51 @@ +/************************************************************************* +** CRC32.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef CRC32_H +#define CRC32_H + +#include +#include +#include "types.h" + +class CRC32 +{ + public: + CRC32 (); + void update (const UInt8 *bytes, size_t len); + void update (UInt32 n, int bytes=4); + void update (const char *str); + void update (std::istream &is); + UInt32 get () const; + void reset (); + static UInt32 compute (const UInt8 *bytes, size_t len); + static UInt32 compute (const char *str); + static UInt32 compute (std::istream &is); + + protected: + CRC32 (const CRC32 &crc32) {} + + private: + UInt32 _crc32; + UInt32 _tab[256]; +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp new file mode 100644 index 00000000000..d90405e8610 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.cpp @@ -0,0 +1,180 @@ +/************************************************************************* +** Calculator.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "Calculator.h" + +using namespace std; + +// token types +const char END = 0; +const char NUMBER = 1; +const char NAME = 2; + + +#include + + +/** 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 ret = expr(is, false); + if (lookAhead(is) > 0) + throw CalculatorException("expression syntax error"); + return ret; +} + + +/** Evaluates a given arithmetic expression and returns its value. + * @param[in] expr expression to evaluate + * @return expression value */ +double Calculator::eval (const string &expr) { + istringstream iss; + iss.str(expr); + return eval(iss); +} + + +/** Evaluates the root rule of the expression grammar. */ +double Calculator::expr (istream &is, bool skip) { // 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 + } + } +} + + +double Calculator::term (istream &is, bool skip) { // term: + double left = prim(is, skip); + for (;;) + switch (lookAhead(is)) { + case '*': left *= prim(is, true); 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: // prim => $1 + return left; + } +} + + +double Calculator::prim (istream &is, bool skip) { // 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); + } + 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"); + } +} + + +/** Determines type of next token without swallowing it. That means + * the same token will be read again next time. */ +char Calculator::lookAhead (istream &is) { + while (isspace(is.peek())) // skip whitespace + is.get(); + if (is.eof()) + return END; + int c = is.peek(); + if (isdigit(c) || c == '.') + return NUMBER; + if (isalpha(c)) + return NAME; + 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. + * @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: + is >> _numValue; + break; + case NAME: { + _strValue.clear(); + while (isalpha(is.peek())) + _strValue += char(is.get()); + break; + } + 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 { + map::const_iterator it = _variables.find(name); + if (it == _variables.end()) + throw CalculatorException("undefined variable '" + name + "'"); + return it->second; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h new file mode 100644 index 00000000000..76b07e40a60 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Calculator.h @@ -0,0 +1,57 @@ +/************************************************************************* +** Calculator.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CALCULATOR_H +#define DVISVGM_CALCULATOR_H + +#include +#include +#include +#include "MessageException.h" + + +struct CalculatorException : public MessageException +{ + CalculatorException (const std::string &msg) : MessageException(msg) {} +}; + +class Calculator +{ + public: + Calculator () : _numValue(0) {} + double eval (std::istream &is); + double eval (const std::string &expr); + 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); + + private: + std::map _variables; + double _numValue; + std::string _strValue; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp new file mode 100644 index 00000000000..0bcd054104f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.cpp @@ -0,0 +1,36 @@ +/************************************************************************* +** CharMapID.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include "CharMapID.h" + +const CharMapID CharMapID::NONE(0, 0); +const CharMapID CharMapID::WIN_SYMBOL(3, 0); +const CharMapID CharMapID::WIN_UCS2(3, 1); +const CharMapID CharMapID::WIN_SHIFTJIS(3, 2); +const CharMapID CharMapID::WIN_PRC(3, 3); +const CharMapID CharMapID::WIN_BIG5(3, 4); +const CharMapID CharMapID::WIN_WANSUNG(3, 5); +const CharMapID CharMapID::WIN_JOHAB(3, 6); +const CharMapID CharMapID::WIN_UCS4(3, 10); + +const CharMapID CharMapID::MAC_JAPANESE(1, 1); +const CharMapID CharMapID::MAC_TRADCHINESE(1, 2); +const CharMapID CharMapID::MAC_KOREAN(1, 3); +const CharMapID CharMapID::MAC_SIMPLCHINESE(1, 25); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h new file mode 100644 index 00000000000..0b4e6bf7e17 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CharMapID.h @@ -0,0 +1,59 @@ +/************************************************************************* +** CharMapID.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CHARMAPID_H +#define DVISVGM_CHARMAPID_H + +#include "types.h" + +/** Represents a character map of a font. */ +struct CharMapID { + CharMapID () : platform_id(0), encoding_id(0) {} + CharMapID (UInt8 plf_id, UInt8 enc_id) : platform_id(plf_id), encoding_id(enc_id) {} + + bool operator == (const CharMapID &ids) const { + return platform_id == ids.platform_id && encoding_id == ids.encoding_id; + } + + bool operator != (const CharMapID &ids) const { + return platform_id != ids.platform_id || encoding_id != ids.encoding_id; + } + + bool valid () const {return platform_id != 0 && encoding_id != 0;} + + static const CharMapID NONE; + static const CharMapID WIN_SYMBOL; + static const CharMapID WIN_UCS2; + static const CharMapID WIN_SHIFTJIS; + static const CharMapID WIN_PRC; + static const CharMapID WIN_BIG5; + static const CharMapID WIN_WANSUNG; + static const CharMapID WIN_JOHAB; + static const CharMapID WIN_UCS4; + static const CharMapID MAC_JAPANESE; + static const CharMapID MAC_TRADCHINESE; + static const CharMapID MAC_SIMPLCHINESE; + static const CharMapID MAC_KOREAN; + + UInt8 platform_id; + UInt8 encoding_id; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h new file mode 100644 index 00000000000..7ad3a7e36ff --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Character.h @@ -0,0 +1,46 @@ +/************************************************************************* +** Character.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CHARACTER_H +#define DVISVGM_CHARACTER_H + +#include "types.h" + +class Character +{ + public: + enum Type {CHRCODE, INDEX, NAME}; + Character (const char *name) : _type(NAME), _name(name) {} + Character (Type type, UInt32 val) : _type(type), _number(val) {} + Character (Type type, const Character &c) : _type(type), _number(c.type() != NAME ? c._number : 0) {} + Type type () const {return _type;} + const char* name () const {return _name;} + UInt32 number () const {return _number;} + + private: + Type _type; + union { + UInt32 _number; + const char *_name; + }; +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp new file mode 100644 index 00000000000..da935b4b0dc --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.cpp @@ -0,0 +1,372 @@ +/************************************************************************* +** CmdLineParserBase.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "CmdLineParserBase.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "Message.h" + +using namespace std; + +void CmdLineParserBase::init () { + _error = false; + _files.clear(); +} + + +/** Parses all options given on the command line. + * @param[in] argc number of command-line arguments + * @param[in] argv array providing the command-line arguments + * @param[in] printErrors enable/disable printing of error messages */ +void CmdLineParserBase::parse (int argc, char **argv, bool printErrors) { + init(); + _printErrors = printErrors; + bool filesOnly = false; // + for (int i=1; i < argc; i++) { + CharInputBuffer ib(argv[i], strlen(argv[i])); + BufferInputReader ir(ib); + if (filesOnly || ir.peek() != '-') + _files.push_back(argv[i]); + else { + ir.get(); + if (ir.peek() == '-') { + // scan long option + ir.get(); + if (ir.eof()) // "--" only + filesOnly = true; // treat all following options as filenames + else { + string longname; + while (isalnum(ir.peek()) || ir.peek() == '-') + longname += char(ir.get()); + if (const Option *opt = option(longname)) + (*opt->handler)(this, ir, *opt, true); + else if (!_error) { + if (printErrors) + Message::estream(false) << "unknown option --" << longname << '\n'; + _error = true; + } + } + } + else { + // scan short option(s) + bool combined = false; // multiple short options combined, e.g -abc + do { + int shortname = ir.get(); + if (const Option *opt = option(shortname)) { + if (!combined || opt->argmode == ARG_NONE) { + if (opt->argmode == ARG_REQUIRED && strlen(argv[i]) == 2) { // required argument separated by whitespace? + if (i+1 < argc && argv[i+1][0] != '-') + ib.assign(argv[++i]); + } + (*opt->handler)(this, ir, *opt, false); + if (opt->argmode == ARG_NONE) + combined = true; + } + else { + if (printErrors) + Message::estream(false) << "option -" << char(shortname) << " must be given separately\n"; + _error = true; + } + } + else if (shortname > 0) { + if (printErrors) + Message::estream(false) << "unknown option -" << char(shortname) << '\n'; + _error = true; + } + } + while (!_error && combined && !ir.eof()); + } + } + } +} + + +/** Prints an error message to stdout. + * @param[in] opt error occurred in this option + * @param[in] longopt the long option name was scanned + * @param[in] msg message to be printed */ +void CmdLineParserBase::error (const Option &opt, bool longopt, const char *msg) const { + if (_printErrors) { + Message::estream(false) << "option "; + if (longopt) + Message::estream(false) << "--" << opt.longname; + else + Message::estream(false) << '-' << opt.shortname; + Message::estream(false) << ": " << msg << '\n'; + } + _error = true; +} + + +#if 0 +#include + +/** Lists the scanned filenames. Just for debugging purposes. */ +void CmdLineParserBase::status () const { + cout << "file names:\n"; + for (size_t i=0; i < _files.size(); i++) + cout << " " << _files[i] << endl; + cout << endl; +} +#endif + + +/** Returns the option information of a given short option name. + * If the option name can't be found 0 is returned. + * @param[in] shortname short version of the option without leading hyphen (e.g. p, not -p) */ +const CmdLineParserBase::Option* CmdLineParserBase::option (char shortname) const { + size_t numopts; // number of available options + for (const Option *opts = options(&numopts); numopts > 0; ++opts) { + if (opts->shortname == shortname) + return opts; + numopts--; + } + return 0; +} + + +/** Returns the option information of a given long option name. + * Parameter 'longname' hasn't to be the complete long option name. The function looks up + * all options that start with 'longname'. If a unique or an exact match was found, it's returned. + * Otherwise, the return value is 0. + * @param[in] longname long version of the option without leading hyphens (e.g. param, not --param) */ +const CmdLineParserBase::Option* CmdLineParserBase::option (const string &longname) const { + vector matches; // all matching options + size_t len = longname.length(); + size_t numopts; // number of available options + for (const Option *opts = options(&numopts); numopts > 0; ++opts) { + if (string(opts->longname, len) == longname) { + if (len == strlen(opts->longname)) // exact match? + return opts; + matches.push_back(opts); + } + numopts--; + } + switch (matches.size()) { + default: + if (_printErrors) { + Message::estream(false) << "option --" << longname << " is ambiguous ("; + for (size_t i=0; i < matches.size(); i++) { + if (i > 0) + Message::estream(false) << ", "; + Message::estream(false) << matches[i]->longname; + } + Message::estream(false) << ")\n"; + } + _error = true; + + case 0 : return 0; + case 1 : return matches[0]; + } +} + + +/** Returns true if a valid separator between option and argument was found. + * Arguments of long options are preceded by a '='. The argument of a short option + * directly follows the option without a separation character. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given */ +bool CmdLineParserBase::checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const { + if (longopt) { + if (ir.peek() == '=') + ir.get(); + else { + error(opt, longopt, "'=' expected"); + return false; + } + } + return true; +} + + +/** Returns true if a given option has no argument, .e.g. -p or --param. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given */ +bool CmdLineParserBase::checkNoArg (InputReader &ir, const Option &opt, bool longopt) const { + if (ir.eof()) + return true; + error(opt, longopt, "no argument expected"); + return false; +} + + +/** Gets an integer argument of a given option, e.g. -p5 or --param=5. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + if (ir.parseInt(arg) && ir.eof()) + return true; + error(opt, longopt, "integer value expected"); + } + return false; +} + + +/** Gets an unsigned integer argument of a given option, e.g. -p5 or --param=5. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + if (ir.parseUInt(arg) && ir.eof()) + return true; + error(opt, longopt, "unsigned integer value expected"); + } + return false; +} + + +/** Gets a double (floating point) argument of a given option, e.g. -p2.5 or --param=2.5. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + if (ir.parseDouble(arg) != 0 && ir.eof()) + return true; + error(opt, longopt, "floating point value expected"); + } + return false; +} + + +/** Gets a string argument of a given option, e.g. -pstr or --param=str. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getStringArg (InputReader &ir, const Option &opt, bool longopt, string &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + arg.clear(); + while (!ir.eof()) + arg += char(ir.get()); + if (!arg.empty()) + return true; + error(opt, longopt, "string argument expected"); + } + return false; +} + + +/** Gets a boolean argument of a given option, e.g. -pyes or --param=yes. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + string str; + while (!ir.eof()) + str += char(ir.get()); + if (str == "yes" || str == "y" || str == "true" || str == "1") { + arg = true; + return true; + } + else if (str == "no" || str == "n" || str == "false" || str == "0") { + arg = false; + return true; + } + error(opt, longopt, "boolean argument expected (yes, no, true, false, 0, 1)"); + } + return false; +} + + +/** Gets a (single) character argument of a given option, e.g. -pc or --param=c. + * @param[in] ir argument is read from this InputReader + * @param[in] opt scans argument of this option + * @param[in] longopt true if the long option name was given + * @param[out] arg the scanned option argument + * @return true if argument could be scanned without errors */ +bool CmdLineParserBase::getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const { + if (checkArgPrefix(ir, opt, longopt)) { + arg = char(ir.get()); + if (arg >= 0 && ir.eof()) + return true; + error(opt, longopt, "character argument expected"); + } + return false; +} + + +/** Compares the short option characters of two help lines. + * @return true if line1 should appear before line2 */ +static bool cmp_short (const char *line1, const char *line2) { + if (*line1 != 'o' || *line2 != 'o' || (line1[1] == ' ' && line2[1] == ' ')) + return strcmp(line1, line2) < 0; + char lopt1 = tolower(line1[2]); + char lopt2 = tolower(line2[2]); + if (lopt1 == lopt2) // same character but different case? + return line1[2] > line2[2]; // line with lower-case letter first + return lopt1 < lopt2; +} + + +/** Compares the long option names of two help lines. + * @return true if line1 should appear before line2 */ +static bool cmp_long (const char *line1, const char *line2) { + if (*line1 != 'o' || *line2 != 'o') + return strcmp(line1, line2) < 0; + return strcmp(line1+6, line2+6) < 0; +} + + +/** Prints the help text to stdout. + * @param[in] mode format of help text */ +void CmdLineParserBase::help (int mode) const { + size_t numlines; + const char **lines = helplines(&numlines); + if (mode == 0) { // list options with section headers + for (size_t i=0; i < numlines; i++) { + switch (*lines[i]) { + case 's': fputc('\n', stdout); break; // section header + case 'o': fputs(" ", stdout); break; // option info + } + puts(lines[i]+1); + } + } + else { + vector linevec(lines, lines+numlines); + sort(linevec.begin(), linevec.end(), mode == 1 ? cmp_short : cmp_long); + for (vector::iterator it=linevec.begin(); it != linevec.end(); ++it) { + if (**it != 's') { // skip section headers + puts(*it+1); + if (**it == 'd') + puts("\nOptions:"); + } + } + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h new file mode 100644 index 00000000000..8096fa6500f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CmdLineParserBase.h @@ -0,0 +1,99 @@ +/************************************************************************* +** CmdLineParserBase.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_CMDLINEPARSERBASE_H +#define DVISVGM_CMDLINEPARSERBASE_H + +#include +#include + +class InputReader; + +class CmdLineParserBase +{ + protected: + struct Option; + + struct OptionHandler { + virtual ~OptionHandler () {} + virtual void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const=0; + }; + + template + class OptionHandlerImpl : public OptionHandler { + protected: + typedef void (T::*LocalHandler)(InputReader &ir, const Option &opt, bool longopt); + + public: + OptionHandlerImpl (LocalHandler handler) : _handler(handler) {} + + void operator () (CmdLineParserBase *obj, InputReader &ir, const Option &opt, bool longopt) const { + if (T *tobj = dynamic_cast(obj)) + (tobj->*_handler)(ir, opt, longopt); + } + + private: + LocalHandler _handler; + }; + + enum ArgMode {ARG_NONE, ARG_OPTIONAL, ARG_REQUIRED}; + + struct Option { + ~Option () {delete handler;} + char shortname; + const char *longname; + ArgMode argmode; // mode of option argument + const OptionHandler *handler; + }; + + public: + virtual void parse (int argc, char **argv, bool printErrors=true); + virtual void help (int mode=0) const; + virtual int numFiles () const {return _files.size();} + virtual const char* file (size_t n) {return n < _files.size() ? _files[n].c_str() : 0;} +// virtual void status () const; + virtual bool error () const {return _error;} + + protected: + CmdLineParserBase () : _printErrors(true), _error(false) {} + CmdLineParserBase (const CmdLineParserBase &cmd) : _printErrors(true), _error(false) {} + virtual ~CmdLineParserBase () {} + virtual void init (); + virtual void error (const Option &opt, bool longopt, const char *msg) const; + virtual const Option* options (size_t *numopts) const =0; + virtual const char** helplines (size_t *numlines) const =0; + bool checkArgPrefix (InputReader &ir, const Option &opt, bool longopt) const; + bool checkNoArg (InputReader &ir, const Option &opt, bool longopt) const; + bool getIntArg (InputReader &ir, const Option &opt, bool longopt, int &arg) const; + bool getUIntArg (InputReader &ir, const Option &opt, bool longopt, unsigned &arg) const; + bool getDoubleArg (InputReader &ir, const Option &opt, bool longopt, double &arg) const; + bool getStringArg (InputReader &ir, const Option &opt, bool longopt, std::string &arg) const; + bool getBoolArg (InputReader &ir, const Option &opt, bool longopt, bool &arg) const; + bool getCharArg (InputReader &ir, const Option &opt, bool longopt, char &arg) const; + const Option* option (char shortname) const; + const Option* option (const std::string &longname) const; + + private: + bool _printErrors; ///< if true, print error messages + mutable bool _error; ///< error occured while parsing options + std::vector _files; ///< filename parameters +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp new file mode 100644 index 00000000000..18c134c696e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp @@ -0,0 +1,679 @@ +/************************************************************************* +** Color.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#define _USE_MATH_DEFINES +#include +#include +#include +#include +#include +#include +#include +#include +#include "Color.h" + +using namespace std; + +bool Color::SUPPRESS_COLOR_NAMES = true; + +const Color Color::BLACK(UInt32(0)); +const Color Color::WHITE(UInt8(255), UInt8(255), UInt8(255)); +const Color Color::TRANSPARENT(UInt32(0xff000000)); + + +static inline UInt8 double_to_byte (double v) { + v = max(0.0, min(1.0, v)); + return UInt8(floor(255*v+0.5)); +} + + +static void tolower (string &str) { + for (size_t i=0; i < str.length(); i++) + str[i] = tolower(str[i]); +} + + +Color::Color (const char *psname) { + if (!setPSName(psname, false)) + setGray(UInt8(0)); +} + + +Color::Color (const string &psname) { + if (!setPSName(psname, false)) + setGray(UInt8(0)); +} + + +void Color::setRGB (double r, double g, double b) { + setRGB(double_to_byte(r), double_to_byte(g), double_to_byte(b)); +} + + +/** Expects a PostScript color name and sets the color accordingly. + * @param[in] name PS color name + * @param[in] case_sensitive if true, upper/lower case spelling is significant + * @return true if color name could be applied properly */ +bool Color::setPSName (string name, bool case_sensitive) { + if (name[0] == '#') { + char *p=0; + _rgb = UInt32(strtol(name.c_str()+1, &p, 16)); + while (isspace(*p)) + p++; + return (*p == 0 && _rgb <= 0xFFFFFF); + } + // converted color constants from color.pro + static const struct ColorConstant { + const char *name; + const UInt32 rgb; + } + constants[] = { + {"Apricot", 0xFFAD7A}, + {"Aquamarine", 0x2DFFB2}, + {"Bittersweet", 0xC10200}, + {"Black", 0x000000}, + {"Blue", 0x0000FF}, + {"BlueGreen", 0x26FFAA}, + {"BlueViolet", 0x190CF4}, + {"BrickRed", 0xB70000}, + {"Brown", 0x660000}, + {"BurntOrange", 0xFF7C00}, + {"CadetBlue", 0x606DC4}, + {"CarnationPink", 0xFF5EFF}, + {"Cerulean", 0x0FE2FF}, + {"CornflowerBlue", 0x59DDFF}, + {"Cyan", 0x00FFFF}, + {"Dandelion", 0xFFB528}, + {"DarkOrchid", 0x9932CC}, + {"Emerald", 0x00FF7F}, + {"ForestGreen", 0x00E000}, + {"Fuchsia", 0x7202EA}, + {"Goldenrod", 0xFFE528}, + {"Gray", 0x7F7F7F}, + {"Green", 0x00FF00}, + {"GreenYellow", 0xD8FF4F}, + {"JungleGreen", 0x02FF7A}, + {"Lavender", 0xFF84FF}, + {"LimeGreen", 0x7FFF00}, + {"Magenta", 0xFF00FF}, + {"Mahogany", 0xA50000}, + {"Maroon", 0xAD0000}, + {"Melon", 0xFF897F}, + {"MidnightBlue", 0x007091}, + {"Mulberry", 0xA314F9}, + {"NavyBlue", 0x0F75FF}, + {"OliveGreen", 0x009900}, + {"Orange", 0xFF6321}, + {"OrangeRed", 0xFF007F}, + {"Orchid", 0xAD5BFF}, + {"Peach", 0xFF7F4C}, + {"Periwinkle", 0x6D72FF}, + {"PineGreen", 0x00BF28}, + {"Plum", 0x7F00FF}, + {"ProcessBlue", 0x0AFFFF}, + {"Purple", 0x8C23FF}, + {"RawSienna", 0x8C0000}, + {"Red", 0xFF0000}, + {"RedOrange", 0xFF3A21}, + {"RedViolet", 0x9600A8}, + {"Rhodamine", 0xFF2DFF}, + {"RoyalBlue", 0x007FFF}, + {"RoyalPurple", 0x3F19FF}, + {"RubineRed", 0xFF00DD}, + {"Salmon", 0xFF779E}, + {"SeaGreen", 0x4FFF7F}, + {"Sepia", 0x4C0000}, + {"SkyBlue", 0x60FFE0}, + {"SpringGreen", 0xBCFF3D}, + {"Tan", 0xDB9370}, + {"TealBlue", 0x1EF9A3}, + {"Thistle", 0xE068FF}, + {"Turquoise", 0x26FFCC}, + {"Violet", 0x351EFF}, + {"VioletRed", 0xFF30FF}, + {"White", 0xFFFFFF}, + {"WildStrawberry", 0xFF0A9B}, + {"Yellow", 0xFFFF00}, + {"YellowGreen", 0x8EFF42}, + {"YellowOrange", 0xFF9300}, + }; + if (!case_sensitive) { + tolower(name); + for (size_t i=0; i < sizeof(constants)/sizeof(ColorConstant); i++) { + string cmpname = constants[i].name; + tolower(cmpname); + if (name == cmpname) { + _rgb = constants[i].rgb; + return true; + } + } + return false; + } + + // binary search + int first=0, last=sizeof(constants)/sizeof(ColorConstant)-1; + while (first <= last) { + int mid = first+(last-first)/2; + int cmp = strcmp(constants[mid].name, name.c_str()); + if (cmp > 0) + last = mid-1; + else if (cmp < 0) + first = mid+1; + else { + _rgb = constants[mid].rgb; + return true; + } + } + return false; +} + + +void Color::setHSB (double h, double s, double b) { + valarray hsb(3), rgb(3); + hsb[0] = h; + hsb[1] = s; + hsb[2] = b; + HSB2RGB(hsb, rgb); + setRGB(rgb); +} + + +void Color::setCMYK (double c, double m, double y, double k) { + valarray cmyk(4), rgb(3); + cmyk[0] = c; + cmyk[1] = m; + cmyk[2] = y; + cmyk[3] = k; + CMYK2RGB(cmyk, rgb); + setRGB(rgb); +} + + +void Color::setCMYK (const std::valarray &cmyk) { + valarray rgb(3); + CMYK2RGB(cmyk, rgb); + setRGB(rgb); +} + + +void Color::set (ColorSpace colorSpace, VectorIterator &it) { + switch (colorSpace) { + case GRAY_SPACE: setGray(*it++); break; + case RGB_SPACE : setRGB(*it, *(it+1), *(it+2)); it+=3; break; + case LAB_SPACE : setLab(*it, *(it+1), *(it+2)); it+=3; break; + case CMYK_SPACE: setCMYK(*it, *(it+1), *(it+2), *(it+3)); it+=4; break; + } +} + + +void Color::operator *= (double c) { + UInt32 rgb=0; + for (int i=0; i < 3; i++) { + rgb |= UInt32(floor((_rgb & 0xff)*c+0.5)) << (8*i); + _rgb >>= 8; + } + _rgb = rgb; +} + + +string Color::rgbString () const { + ostringstream oss; + oss << '#'; + for (int i=2; i >= 0; i--) { + oss << setbase(16) << setfill('0') << setw(2) + << (((_rgb >> (8*i)) & 0xff)); + } + return oss.str(); +} + + +/** Returns an SVG color string representing the current color. The result can + * either be an SVG color name or an RGB string of the form #RRGGBB. The latter + * will be returned if parameter rgbonly is true or if the SVG standard doesn't + * define a name for the current color. */ +string Color::svgColorString (bool rgbonly) const { + if (!rgbonly) { + static const struct ColorName { + UInt32 rgb; + const char *name; + } colornames[] = { + {0x000000, "black"}, + {0x000080, "navy"}, + {0x00008b, "darkblue"}, + {0x0000cd, "mediumblue"}, + {0x0000ff, "blue"}, + {0x006400, "darkgreen"}, + {0x008000, "green"}, + {0x008080, "teal"}, + {0x008b8b, "darkcyan"}, + {0x00bfff, "deepskyblue"}, + {0x00ced1, "darkturquoise"}, + {0x00fa9a, "mediumspringgreen"}, + {0x00ff00, "lime"}, + {0x00ff7f, "springgreen"}, + {0x00ffff, "cyan"}, + {0x191970, "midnightblue"}, + {0x1e90ff, "dodgerblue"}, + {0x20b2aa, "lightseagreen"}, + {0x228b22, "forestgreen"}, + {0x2e8b57, "seagreen"}, + {0x2f4f4f, "darkslategray"}, + {0x32cd32, "limegreen"}, + {0x3cb371, "mediumseagreen"}, + {0x40e0d0, "turquoise"}, + {0x4169e1, "royalblue"}, + {0x4682b4, "steelblue"}, + {0x483d8b, "darkslateblue"}, + {0x48d1cc, "mediumturquoise"}, + {0x4b0082, "indigo"}, + {0x556b2f, "darkolivegreen"}, + {0x5f9ea0, "cadetblue"}, + {0x6495ed, "cornflowerblue"}, + {0x66cdaa, "mediumaquamarine"}, + {0x696969, "dimgray"}, + {0x6a5acd, "slateblue"}, + {0x6b8e23, "olivedrab"}, + {0x708090, "slategray"}, + {0x778899, "lightslategray"}, + {0x7b68ee, "mediumslateblue"}, + {0x7cfc00, "lawngreen"}, + {0x7fff00, "chartreuse"}, + {0x7fffd4, "aquamarine"}, + {0x800000, "maroon"}, + {0x800080, "purple"}, + {0x808000, "olive"}, + {0x808080, "gray"}, + {0x87ceeb, "skyblue"}, + {0x87cefa, "lightskyblue"}, + {0x8a2be2, "blueviolet"}, + {0x8b0000, "darkred"}, + {0x8b008b, "darkmagenta"}, + {0x8b4513, "saddlebrown"}, + {0x8fbc8f, "darkseagreen"}, + {0x90ee90, "lightgreen"}, + {0x9370db, "mediumpurple"}, + {0x9400d3, "darkviolet"}, + {0x98fb98, "palegreen"}, + {0x9932cc, "darkorchid"}, + {0x9acd32, "yellowgreen"}, + {0xa0522d, "sienna"}, + {0xa52a2a, "brown"}, + {0xa9a9a9, "darkgray"}, + {0xadd8e6, "lightblue"}, + {0xadff2f, "greenyellow"}, + {0xafeeee, "paleturquoise"}, + {0xb0c4de, "lightsteelblue"}, + {0xb0e0e6, "powderblue"}, + {0xb22222, "firebrick"}, + {0xb8860b, "darkgoldenrod"}, + {0xba55d3, "mediumorchid"}, + {0xbc8f8f, "rosybrown"}, + {0xbdb76b, "darkkhaki"}, + {0xc0c0c0, "silver"}, + {0xc71585, "mediumvioletred"}, + {0xcd5c5c, "indianred"}, + {0xcd853f, "peru"}, + {0xd2691e, "chocolate"}, + {0xd2b48c, "tan"}, + {0xd3d3d3, "lightgray"}, + {0xd8bfd8, "thistle"}, + {0xda70d6, "orchid"}, + {0xdaa520, "goldenrod"}, + {0xdb7093, "palevioletred"}, + {0xdc143c, "crimson"}, + {0xdcdcdc, "gainsboro"}, + {0xdda0dd, "plum"}, + {0xdeb887, "burlywood"}, + {0xe0ffff, "lightcyan"}, + {0xe6e6fa, "lavender"}, + {0xe9967a, "darksalmon"}, + {0xee82ee, "violet"}, + {0xeee8aa, "palegoldenrod"}, + {0xf08080, "lightcoral"}, + {0xf0e68c, "khaki"}, + {0xf0f8ff, "aliceblue"}, + {0xf0fff0, "honeydew"}, + {0xf0ffff, "azure"}, + {0xf4a460, "sandybrown"}, + {0xf5deb3, "wheat"}, + {0xf5f5dc, "beige"}, + {0xf5f5f5, "whitesmoke"}, + {0xf5fffa, "mintcream"}, + {0xf8f8ff, "ghostwhite"}, + {0xfa8072, "salmon"}, + {0xfaebd7, "antiquewhite"}, + {0xfaf0e6, "linen"}, + {0xfafad2, "lightgoldenrodyellow"}, + {0xfdf5e6, "oldlace"}, + {0xff0000, "red"}, + {0xff00ff, "magenta"}, + {0xff1493, "deeppink"}, + {0xff4500, "orangered"}, + {0xff6347, "tomato"}, + {0xff69b4, "hotpink"}, + {0xff7f50, "coral"}, + {0xff8c00, "darkorange"}, + {0xffa07a, "lightsalmon"}, + {0xffa500, "orange"}, + {0xffb6c1, "lightpink"}, + {0xffc0cb, "pink"}, + {0xffd700, "gold"}, + {0xffdab9, "peachpuff"}, + {0xffdead, "navajowhite"}, + {0xffe4b5, "moccasin"}, + {0xffe4c4, "bisque"}, + {0xffe4e1, "mistyrose"}, + {0xffebcd, "blanchedalmond"}, + {0xffefd5, "papayawhip"}, + {0xfff0f5, "lavenderblush"}, + {0xfff5ee, "seashell"}, + {0xfff8dc, "cornsilk"}, + {0xfffacd, "lemonchiffon"}, + {0xfffaf0, "floralwhite"}, + {0xfffafa, "snow"}, + {0xffff00, "yellow"}, + {0xffffe0, "lightyellow"}, + {0xfffff0, "ivory"}, + {0xffffff, "white"} + }; + int left=0; + int right=sizeof(colornames)/sizeof(ColorName)-1; + while (left <= right) { + int mid = left+(right-left)/2; + if (colornames[mid].rgb == _rgb) + return colornames[mid].name; + if (colornames[mid].rgb > _rgb) + right = mid-1; + else + left = mid+1; + } + } + return rgbString(); +} + + +/** Approximates a CMYK color by an RGB triple. The component values + * are expected to be normalized, i.e. 0 <= cmyk[i],rgb[j] <= 1. + * @param[in] cmyk color in CMYK space + * @param[out] rgb RGB approximation */ +void Color::CMYK2RGB (const valarray &cmyk, valarray &rgb) { + double kc = 1.0-cmyk[3]; + for (int i=0; i < 3; i++) + rgb[i] = min(1.0, max(0.0, (1.0-cmyk[i])*kc)); +} + + +void Color::RGB2CMYK (const valarray &rgb, valarray &cmyk) { + double c = 1-rgb[0]; + double m = 1-rgb[1]; + double y = 1-rgb[2]; + cmyk[3] = min(min(c, m), y); + cmyk[0] = c-cmyk[3]; + cmyk[1] = m-cmyk[3]; + cmyk[2] = y-cmyk[3]; +} + + +/** Converts a color given in HSB coordinates to RGB. + * @param[in] hsb color in HSB space + * @param[out] rgb color in RGB space */ +void Color::HSB2RGB (const valarray &hsb, valarray &rgb) { + if (hsb[1] == 0) + rgb[0] = rgb[1] = rgb[2] = hsb[2]; + else { + double h = hsb[0]-floor(hsb[0]); + int i = int(6*h); + double f = 6*h-i; + double p = hsb[2]*(1-hsb[1]); + double q = hsb[2]*(1-hsb[1]*f); + double t = hsb[2]*(1-hsb[1]*(1-f)); + switch (i) { + case 0 : rgb[0]=hsb[2]; rgb[1]=t; rgb[2]=p; break; + case 1 : rgb[0]=q; rgb[1]=hsb[2]; rgb[2]=p; break; + case 2 : rgb[0]=p; rgb[1]=hsb[2]; rgb[2]=t; break; + case 3 : rgb[0]=p; rgb[1]=q; rgb[2]=hsb[2]; break; + case 4 : rgb[0]=t; rgb[1]=p; rgb[2]=hsb[2]; break; + case 5 : rgb[0]=hsb[2]; rgb[1]=p; rgb[2]=q; break; + default: ; // prevent compiler warning + } + } +} + + +double Color::getGray () const { + double r, g, b; + getRGB(r, g, b); + return r*0.3 + g*0.59 + b*0.11; // gray value according to NTSC video standard +} + + +void Color::getGray (valarray &gray) const { + gray.resize(1); + gray[0] = getGray(); +} + + +void Color::getRGB (double &r, double &g, double &b) const { + r = ((_rgb >> 16) & 255) / 255.0; + g = ((_rgb >> 8) & 255) / 255.0; + b = (_rgb & 255) / 255.0; +} + + +void Color::getRGB (valarray &rgb) const { + rgb.resize(3); + double r, g, b; + getRGB(r, g, b); + rgb[0] = r; + rgb[1] = g; + rgb[2] = b; +} + + +void Color::getCMYK (double &c, double &m, double &y, double &k) const { + valarray rgb(3), cmyk(4); + getRGB(rgb); + RGB2CMYK(rgb, cmyk); + c = cmyk[0]; + m = cmyk[1]; + y = cmyk[2]; + k = cmyk[3]; +} + + +void Color::getCMYK (std::valarray &cmyk) const { + cmyk.resize(4); + valarray rgb(3); + getRGB(rgb); + RGB2CMYK(rgb, cmyk); +} + + +void Color::getXYZ (double &x, double &y, double &z) const { + valarray rgb(3), xyz(3); + getRGB(rgb); + RGB2XYZ(rgb, xyz); + x = xyz[0]; + y = xyz[1]; + z = xyz[2]; +} + + +void Color::setXYZ (double x, double y, double z) { + valarray xyz(3), rgb(3); + xyz[0] = x; + xyz[1] = y; + xyz[2] = z; + XYZ2RGB(xyz, rgb); + setRGB(rgb); +} + + +void Color::setXYZ (const valarray &xyz) { + valarray rgb(3); + XYZ2RGB(xyz, rgb); + setRGB(rgb); +} + + +void Color::setLab (double l, double a, double b) { + valarray lab(3), xyz(3); + lab[0] = l; + lab[1] = a; + lab[2] = b; + Lab2XYZ(lab, xyz); + setXYZ(xyz); +} + + +void Color::setLab (const valarray &lab) { + valarray xyz(3); + Lab2XYZ(lab, xyz); + setXYZ(xyz); +} + + +/** Get the color in CIELAB color space using the sRGB working space and reference white D65. */ +void Color::getLab (double &l, double &a, double &b) const { + valarray rgb(3), lab(3); + getRGB(rgb); + RGB2Lab(rgb, lab); + l = lab[0]; + a = lab[1]; + b = lab[2]; +} + + +void Color::getLab (std::valarray &lab) const { + lab.resize(3); + valarray rgb(3); + getRGB(rgb); + RGB2Lab(rgb, lab); +} + + +static inline double sqr (double x) {return x*x;} +static inline double cube (double x) {return x*x*x;} + + +void Color::Lab2XYZ (const valarray &lab, valarray &xyz) { + xyz.resize(3); + double wx=0.95047, wy=1.00, wz=1.08883; // reference white D65 + double eps = 0.008856; + double kappa = 903.3; + double fy = (lab[0]+16)/116; + double fx = lab[1]/500 + fy; + double fz = fy - lab[2]/200; + double xr = (cube(fx) > eps ? cube(fx) : (116*fx-16)/kappa); + double yr = (lab[0] > kappa*eps ? cube((lab[0]+16)/116) : lab[0]/kappa); + double zr = (cube(fz) > eps ? cube(fz) : (116*fz-16)/kappa); + xyz[0] = xr*wx; + xyz[1] = yr*wy; + xyz[2] = zr*wz; +} + + +void Color::XYZ2RGB (const valarray &xyz, valarray &rgb) { + rgb.resize(3); + rgb[0] = 3.2404542*xyz[0] - 1.5371385*xyz[1] - 0.4985314*xyz[2]; + rgb[1] = -0.9692660*xyz[0] + 1.8760108*xyz[1] + 0.0415560*xyz[2]; + rgb[2] = 0.0556434*xyz[0] - 0.2040259*xyz[1] + 1.0572252*xyz[2]; + for (int i=0; i < 3; i++) + rgb[i] = (rgb[i] <= 0.0031308 ? 12.92*rgb[i] : 1.055*pow(rgb[i], 1/2.4)-0.055); +} + + +void Color::RGB2XYZ (valarray rgb, valarray &xyz) { + xyz.resize(3); + for (int i=0; i < 3; i++) + rgb[i] = (rgb[i] <= 0.04045 ? rgb[i]/12.92 : pow((rgb[i]+0.055)/1.055, 2.4)); + xyz[0] = 0.4124564*rgb[0] + 0.3575761*rgb[1] + 0.1804375*rgb[2]; + xyz[1] = 0.2126729*rgb[0] + 0.7151522*rgb[1] + 0.0721750*rgb[2]; + xyz[2] = 0.0193339*rgb[0] + 0.1191920*rgb[1] + 0.9503041*rgb[2]; +} + + +void Color::RGB2Lab (const valarray &rgb, valarray &lab) { + double wx=0.95047, wy=1.00, wz=1.08883; // reference white D65 + double eps = 0.008856; + double kappa = 903.3; + valarray xyz(3); + RGB2XYZ(rgb, xyz); + xyz[0] /= wx; + xyz[1] /= wy; + xyz[2] /= wz; + double fx = (xyz[0] > eps ? pow(xyz[0], 1.0/3) : (kappa*xyz[0]+16)/116); + double fy = (xyz[1] > eps ? pow(xyz[1], 1.0/3) : (kappa*xyz[1]+16)/116); + double fz = (xyz[2] > eps ? pow(xyz[2], 1.0/3) : (kappa*xyz[2]+16)/116); + lab[0] = 116*fy-16; + lab[1] = 500*(fx-fy); + lab[2] = 200*(fy-fz); +} + + +/** Returns the Delta E difference (CIE 2000) between this and another color. */ +double Color::deltaE (const Color &c) const { + double l1, a1, b1; + double l2, a2, b2; + getLab(l1, a1, b1); + c.getLab(l2, a2, b2); + double dl = l2-l1; + double lm = (l1+l2)/2; + double c1 = sqrt(a1*a1 + b1*b1); + double c2 = sqrt(a2*a2 + b2*b2); + double cm = (c1+c2)/2; + double g = (1-sqrt(pow(cm, 7)/(pow(cm, 7)+pow(25.0, 7))))/2; + double aa1 = a1*(1+g); + double aa2 = a2*(1+g); + double cc1 = sqrt(aa1*aa1 + b1*b1); + double cc2 = sqrt(aa2*aa2 + b2*b2); + double ccm = (cc1+cc2)/2; + double dcc = cc2-cc1; + double h1 = atan2(b1, aa1)*180/M_PI; + if (h1 < 0) h1 += 360; + double h2 = atan2(b2, aa2)*180/M_PI; + if (h2 < 0) h2 += 360; + double hm = (abs(h1-h2) > 180 ? (h1+h2+360) : (h1+h2))/2; + double t = 1 - 0.17*cos(hm-30) + 0.24*cos(2*hm) + 0.32*cos(3*hm+6) - 0.2*cos(4*hm-63); + double dh = h2-h1; + if (h2-h1 < -180) + dh += 360; + else if (h2-h1 > 180) + dh -= 360; + double dhh = 2*sqrt(cc1*cc2)*sin(dh/2); + double sl = 1 + 0.015*(lm-50.0)*(lm-50.0)/sqrt(20.0+(lm-50.0)); + double sc = 1 + 0.045*ccm; + double sh = 1 + 0.015*ccm*t; + double dtheta = 30*exp(-sqr(hm-275)/25); + double rc = 2*sqrt(pow(ccm, 7)/(pow(ccm, 7)+pow(25.0, 7))); + double rt = -rc*sin(2*dtheta); + return sqrt(sqr(dl/sl) + sqr(dcc/sc) + sqr(dhh/sh) + rt*dcc/sc*dhh/sh); +} + + +int Color::numComponents (ColorSpace colorSpace) { + switch (colorSpace) { + case GRAY_SPACE: return 1; + case LAB_SPACE: + case RGB_SPACE: return 3; + case CMYK_SPACE: return 4; + } + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h new file mode 100644 index 00000000000..fe7000897d0 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.h @@ -0,0 +1,98 @@ +/************************************************************************* +** Color.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_COLOR_H +#define DVISVGM_COLOR_H + +#include +#include +#include +#include "types.h" +#include "VectorIterator.h" + +#ifdef TRANSPARENT +#undef TRANSPARENT +#endif + +class Color +{ + public: + static bool SUPPRESS_COLOR_NAMES; + static const Color BLACK; + static const Color WHITE; + static const Color TRANSPARENT; + + enum ColorSpace {GRAY_SPACE, RGB_SPACE, CMYK_SPACE, LAB_SPACE}; + + public: + Color () : _rgb(0) {} + Color (UInt32 rgb) : _rgb(rgb) {} + Color (UInt8 r, UInt8 g, UInt8 b) {setRGB(r,g,b);} + Color (double r, double g, double b) {setRGB(r,g,b);} + Color (const std::valarray &rgb) {setRGB(rgb);} + Color (const char *name); + Color (const std::string &name); +// Color (ColorSpace colorSpace, std::vector::const_iterator &it) {set(colorSpace, it);} + operator UInt32 () const {return _rgb;} + bool operator == (const Color &c) const {return _rgb == c._rgb;} + bool operator != (const Color &c) const {return _rgb != c._rgb;} + void setRGB (UInt8 r, UInt8 g, UInt8 b) {_rgb = (r << 16) | (g << 8) | b;} + void setRGB (double r, double g, double b); + void setRGB (const std::valarray &rgb) {setRGB(rgb[0], rgb[1], rgb[2]);} + bool setPSName (std::string name, bool case_sensitive=true); + void setGray (UInt8 g) {setRGB(g,g,g);} + void setGray (double g) {setRGB(g,g,g);} + void setGray (const std::valarray &gray) {setRGB(gray[0], gray[0], gray[0]);} + void setHSB (double h, double s, double b); + void setCMYK (double c, double m, double y, double k); + void setCMYK (const std::valarray &cmyk); + void setXYZ (double x, double y, double z); + void setXYZ (const std::valarray &xyz); + void setLab (double l, double a, double b); + void setLab (const std::valarray &lab); + void set (ColorSpace colorSpace, VectorIterator &it); + double getGray () const; + void getGray (std::valarray &gray) const; + void getRGB (double &r, double &g, double &b) const; + void getRGB (std::valarray &rgb) const; + void getCMYK (double &c, double &m, double &y, double &k) const; + void getCMYK (std::valarray &cmyk) const; + void getXYZ (double &x, double &y, double &z) const; + void getLab (double &l, double &a, double &b) const; + void getLab (std::valarray &lab) const; + void operator *= (double c); + double deltaE (const Color &c) const; + std::string rgbString () const; + std::string svgColorString (bool rgbonly) const; + std::string svgColorString () const {return svgColorString(SUPPRESS_COLOR_NAMES);} + static void CMYK2RGB (const std::valarray &cmyk, std::valarray &rgb); + static void RGB2CMYK (const std::valarray &rgb, std::valarray &cmyk); + static void HSB2RGB (const std::valarray &hsb, std::valarray &rgb); + static void RGB2XYZ (std::valarray rgb, std::valarray &xyz); + static void XYZ2RGB (const std::valarray &xyz, std::valarray &rgb); + static void RGB2Lab (const std::valarray &rgb, std::valarray &lab); + static void Lab2XYZ (const std::valarray &lab, std::valarray &xyz); + static int numComponents (ColorSpace colorSpace); + + private: + UInt32 _rgb; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp new file mode 100644 index 00000000000..531341b719e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp @@ -0,0 +1,126 @@ +/************************************************************************* +** ColorSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "ColorSpecialHandler.h" +#include "SpecialActions.h" + +using namespace std; + + +static double read_double (istream &is) { + is.clear(); + double v; + is >> v; + if (is.fail()) + throw SpecialException("number expected"); + return v; +} + + +/** Reads multiple double values from a given stream. The number of + * values read is determined by the size of the result vector. + * @param[in] is stream to be read from + * @param[out] v the resulting values */ +static void read_doubles (istream &is, vector &v) { + for (size_t i=0; i < v.size(); i++) + v[i] = read_double(is); +} + + +/** Reads a color statement from an input stream and converts it to RGB. + * A color statement has the following syntax: + * _color model_ _component values_ + * Currently, the following color models are supported: rgb, cmyk, hsb and gray. + * Examples: rgb 1 0.5 0, gray 0.5 + * @param[in] model if model != "" this value specifies the model, otherwise it's read from the stream + * @param[in] is stream to be read from + * @param[out] color italicresulting RGB triple + * @return true if statement has successfully been read */ +static void read_color (string model, istream &is, Color &color) { + if (model.empty()) + is >> model; + if (model == "rgb") { + vector rgb(3); + read_doubles(is, rgb); + color.setRGB(rgb[0], rgb[1], rgb[2]); + } + else if (model == "cmyk") { + vector cmyk(4); + read_doubles(is, cmyk); + color.setCMYK(cmyk[0], cmyk[1], cmyk[2], cmyk[3]); + } + else if (model == "hsb") { + vector hsb(3); + read_doubles(is, hsb); + color.setHSB(hsb[0], hsb[1], hsb[2]); + } + else if (model == "gray") + color.setGray(read_double(is)); + else if (!color.setPSName(model, true)) + throw SpecialException("unknown color statement"); +} + + +bool ColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + Color color; + if (prefix && strcmp(prefix, "background") == 0) { + read_color("", is, color); + actions->setBgColor(color); + } + else { + string cmd; + is >> cmd; + if (cmd == "push") { // color push + read_color("", is, color); + _colorStack.push(color); + } + else if (cmd == "pop") { + if (!_colorStack.empty()) // color pop + _colorStack.pop(); + } + else { // color + read_color(cmd, is, color); + while (!_colorStack.empty()) + _colorStack.pop(); + _colorStack.push(color); + } + if (actions) { + if (_colorStack.empty()) + actions->setColor(Color::BLACK); + else + actions->setColor(_colorStack.top()); + } + } + return true; +} + + +const char** ColorSpecialHandler::prefixes () const { + static const char *pfx[] = {"color", 0}; + return pfx; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h new file mode 100644 index 00000000000..f945492b05b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h @@ -0,0 +1,42 @@ +/************************************************************************* +** ColorSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_COLORSPECIALHANDLER_H +#define DVISVGM_COLORSPECIALHANDLER_H + +#include +#include +#include "Color.h" +#include "SpecialHandler.h" + + +class ColorSpecialHandler : public SpecialHandler +{ + public: + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + const char* name () const {return "color";} + const char* info () const {return "complete support of color specials";} + const char** prefixes () const; + + private: + std::stack _colorStack; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp new file mode 100644 index 00000000000..7513563f6c6 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.cpp @@ -0,0 +1,405 @@ +// This file was automatically generated by opt2cpp. +// 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. +// (C) 2009-2015 Martin Gieseking + +#include +#include +#include +#include +#include "InputReader.h" +#include "CommandLine.h" + +using namespace std; + +const CmdLineParserBase::Option CommandLine::_options[] = { + {'b', "bbox", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_bbox)}, + {'C', "cache", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_cache)}, +#if !defined(DISABLE_GS) + {'j', "clipjoin", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_clipjoin)}, +#endif + {'\0', "color", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_color)}, + {'\0', "colornames", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_colornames)}, +#if !defined(DISABLE_GS) + {'E', "eps", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_eps)}, +#endif + {'e', "exact", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_exact)}, + {'m', "fontmap", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_fontmap)}, +#if !defined(DISABLE_GS) + {'\0', "grad-overlap", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_grad_overlap)}, +#endif +#if !defined(DISABLE_GS) + {'\0', "grad-segments", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_grad_segments)}, +#endif +#if !defined(DISABLE_GS) + {'\0', "grad-simplify", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_grad_simplify)}, +#endif + {'h', "help", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_help)}, + {'\0', "keep", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_keep)}, +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + {'\0', "libgs", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_libgs)}, +#endif + {'L', "linkmark", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_linkmark)}, + {'l', "list-specials", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_list_specials)}, + {'M', "mag", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_mag)}, + {'n', "no-fonts", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_no_fonts)}, + {'\0', "no-merge", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_merge)}, + {'\0', "no-mktexmf", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_mktexmf)}, + {'S', "no-specials", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_no_specials)}, + {'\0', "no-styles", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_no_styles)}, + {'o', "output", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_output)}, + {'p', "page", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_page)}, + {'d', "precision", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_precision)}, + {'P', "progress", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_progress)}, + {'R', "relative", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_relative)}, + {'r', "rotate", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_rotate)}, + {'c', "scale", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_scale)}, + {'s', "stdout", ARG_NONE, new OptionHandlerImpl(&CommandLine::handle_stdout)}, + {'a', "trace-all", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_trace_all)}, + {'T', "transform", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_transform)}, + {'t', "translate", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_translate)}, + {'v', "verbosity", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_verbosity)}, + {'V', "version", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_version)}, + {'z', "zip", ARG_OPTIONAL, new OptionHandlerImpl(&CommandLine::handle_zip)}, + {'Z', "zoom", ARG_REQUIRED, new OptionHandlerImpl(&CommandLine::handle_zoom)}, +}; + +const CmdLineParserBase::Option* CommandLine::options (size_t *numopts) const { + *numopts = sizeof(_options)/sizeof(CmdLineParserBase::Option); + return _options; +} + +void CommandLine::init () { + CmdLineParserBase::init(); + + // disable all options by default + _bbox_given = false; + _cache_given = false; +#if !defined(DISABLE_GS) + _clipjoin_given = false; +#endif + _color_given = false; + _colornames_given = false; +#if !defined(DISABLE_GS) + _eps_given = false; +#endif + _exact_given = false; + _fontmap_given = false; +#if !defined(DISABLE_GS) + _grad_overlap_given = false; +#endif +#if !defined(DISABLE_GS) + _grad_segments_given = false; +#endif +#if !defined(DISABLE_GS) + _grad_simplify_given = false; +#endif + _help_given = false; + _keep_given = false; +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + _libgs_given = false; +#endif + _linkmark_given = false; + _list_specials_given = false; + _mag_given = false; + _no_fonts_given = false; + _no_merge_given = false; + _no_mktexmf_given = false; + _no_specials_given = false; + _no_styles_given = false; + _output_given = false; + _page_given = false; + _precision_given = false; + _progress_given = false; + _relative_given = false; + _rotate_given = false; + _scale_given = false; + _stdout_given = false; + _trace_all_given = false; + _transform_given = false; + _translate_given = false; + _verbosity_given = false; + _version_given = false; + _zip_given = false; + _zoom_given = false; + + // set default option values + _bbox_arg = "min"; + _cache_arg.clear(); + _fontmap_arg.clear(); +#if !defined(DISABLE_GS) + _grad_segments_arg = 20; +#endif +#if !defined(DISABLE_GS) + _grad_simplify_arg = 0.05; +#endif + _help_arg = 0; +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + _libgs_arg.clear(); +#endif + _linkmark_arg = "box"; + _mag_arg = 4; + _no_fonts_arg = 0; + _no_specials_arg.clear(); + _output_arg.clear(); + _page_arg = "1"; + _precision_arg = 0; + _progress_arg = 0.5; + _rotate_arg = 0; + _scale_arg.clear(); + _trace_all_arg = false; + _transform_arg.clear(); + _translate_arg.clear(); + _verbosity_arg = 7; + _version_arg = false; + _zip_arg = 9; + _zoom_arg = 1.0; +} + +const char** CommandLine::helplines (size_t *numlines) const { + static const char *lines[] = { + "dThis program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG.\n\nUsage: dvisvgm [options] dvifile\n dvisvgm -E [options] epsfile", + "sInput options:", + "o-p, --page=ranges choose pages to convert [1]", + "o-m, --fontmap=filenames evaluate (additional) font map files", +#if !defined(DISABLE_GS) + "o-E, --eps convert an EPS file to SVG", +#endif + "sSVG output options:", + "o-b, --bbox=size set size of bounding box [min]", +#if !defined(DISABLE_GS) + "o-j, --clipjoin compute intersection of clipping paths", +#endif + "o --colornames prefer color names to RGB values if possible", +#if !defined(DISABLE_GS) + "o --grad-overlap create operlapping color gradient segments", +#endif +#if !defined(DISABLE_GS) + "o --grad-segments=number number of color gradient segments per row [20]", +#endif +#if !defined(DISABLE_GS) + "o --grad-simplify=delta reduce level of detail for small segments [0.05]", +#endif + "o-L, --linkmark=style select how to mark hyperlinked areas [box]", + "o-o, --output=pattern set name pattern of output files", + "o-d, --precision=number set number of decimal points (0-6) [0]", + "o-R, --relative create relative path commands", + "o-s, --stdout write SVG output to stdout", + "o-n, --no-fonts[=variant] draw glyphs by using path elements [0]", + "o --no-merge don't merge adjacent text elements", + "o --no-styles don't use styles to reference fonts", + "o-z, --zip[=level] create compressed .svgz file [9]", + "sSVG transformations:", + "o-r, --rotate=angle rotate page content clockwise", + "o-c, --scale=sx[,sy] scale page content", + "o-t, --translate=tx[,ty] shift page content", + "o-T, --transform=commands transform page content", + "o-Z, --zoom=factor zoom page content [1.0]", + "sProcessing options:", + "o-C, --cache[=dir] set/print path of cache directory", + "o-e, --exact compute exact glyph boxes", + "o --keep keep temporary files", +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + "o --libgs=filename set name of Ghostscript shared library", +#endif + "o-M, --mag=factor magnification of Metafont output [4]", + "o --no-mktexmf don't try to create missing fonts", + "o-S, --no-specials[=prefixes] don't process [selected] specials", + "o-a, --trace-all[=retrace] trace all glyphs of bitmap fonts [no]", + "sMessage options:", + "o --color colorize messages", + "o-h, --help[=mode] print this summary of options and exit [0]", + "o-l, --list-specials print supported special sets and exit", + "o-P, --progress[=delay] enable progess indicator [0.5]", + "o-v, --verbosity=level set verbosity level (0-7) [7]", + "o-V, --version[=extended] print version and exit [no]", + }; + *numlines = sizeof(lines)/sizeof(char*); + return lines; +} + +void CommandLine::handle_bbox (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _bbox_arg)) + _bbox_given = true; +} + +void CommandLine::handle_cache (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getStringArg(ir, opt, longopt, _cache_arg)) + _cache_given = true; +} + +#if !defined(DISABLE_GS) +void CommandLine::handle_clipjoin (InputReader &ir, const Option &opt, bool longopt) { + _clipjoin_given = true; +} +#endif + +void CommandLine::handle_color (InputReader &ir, const Option &opt, bool longopt) { + _color_given = true; +} + +void CommandLine::handle_colornames (InputReader &ir, const Option &opt, bool longopt) { + _colornames_given = true; +} + +#if !defined(DISABLE_GS) +void CommandLine::handle_eps (InputReader &ir, const Option &opt, bool longopt) { + _eps_given = true; +} +#endif + +void CommandLine::handle_exact (InputReader &ir, const Option &opt, bool longopt) { + _exact_given = true; +} + +void CommandLine::handle_fontmap (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _fontmap_arg)) + _fontmap_given = true; +} + +#if !defined(DISABLE_GS) +void CommandLine::handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt) { + _grad_overlap_given = true; +} +#endif + +#if !defined(DISABLE_GS) +void CommandLine::handle_grad_segments (InputReader &ir, const Option &opt, bool longopt) { + if (getIntArg(ir, opt, longopt, _grad_segments_arg)) + _grad_segments_given = true; +} +#endif + +#if !defined(DISABLE_GS) +void CommandLine::handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt) { + if (getDoubleArg(ir, opt, longopt, _grad_simplify_arg)) + _grad_simplify_given = true; +} +#endif + +void CommandLine::handle_help (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getIntArg(ir, opt, longopt, _help_arg)) + _help_given = true; +} + +void CommandLine::handle_keep (InputReader &ir, const Option &opt, bool longopt) { + _keep_given = true; +} + +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) +void CommandLine::handle_libgs (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _libgs_arg)) + _libgs_given = true; +} +#endif + +void CommandLine::handle_linkmark (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _linkmark_arg)) + _linkmark_given = true; +} + +void CommandLine::handle_list_specials (InputReader &ir, const Option &opt, bool longopt) { + _list_specials_given = true; +} + +void CommandLine::handle_mag (InputReader &ir, const Option &opt, bool longopt) { + if (getDoubleArg(ir, opt, longopt, _mag_arg)) + _mag_given = true; +} + +void CommandLine::handle_no_fonts (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getIntArg(ir, opt, longopt, _no_fonts_arg)) + _no_fonts_given = true; +} + +void CommandLine::handle_no_merge (InputReader &ir, const Option &opt, bool longopt) { + _no_merge_given = true; +} + +void CommandLine::handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt) { + _no_mktexmf_given = true; +} + +void CommandLine::handle_no_specials (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getStringArg(ir, opt, longopt, _no_specials_arg)) + _no_specials_given = true; +} + +void CommandLine::handle_no_styles (InputReader &ir, const Option &opt, bool longopt) { + _no_styles_given = true; +} + +void CommandLine::handle_output (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _output_arg)) + _output_given = true; +} + +void CommandLine::handle_page (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _page_arg)) + _page_given = true; +} + +void CommandLine::handle_precision (InputReader &ir, const Option &opt, bool longopt) { + if (getIntArg(ir, opt, longopt, _precision_arg)) + _precision_given = true; +} + +void CommandLine::handle_progress (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getDoubleArg(ir, opt, longopt, _progress_arg)) + _progress_given = true; +} + +void CommandLine::handle_relative (InputReader &ir, const Option &opt, bool longopt) { + _relative_given = true; +} + +void CommandLine::handle_rotate (InputReader &ir, const Option &opt, bool longopt) { + if (getDoubleArg(ir, opt, longopt, _rotate_arg)) + _rotate_given = true; +} + +void CommandLine::handle_scale (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _scale_arg)) + _scale_given = true; +} + +void CommandLine::handle_stdout (InputReader &ir, const Option &opt, bool longopt) { + _stdout_given = true; +} + +void CommandLine::handle_trace_all (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getBoolArg(ir, opt, longopt, _trace_all_arg)) + _trace_all_given = true; +} + +void CommandLine::handle_transform (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _transform_arg)) + _transform_given = true; +} + +void CommandLine::handle_translate (InputReader &ir, const Option &opt, bool longopt) { + if (getStringArg(ir, opt, longopt, _translate_arg)) + _translate_given = true; +} + +void CommandLine::handle_verbosity (InputReader &ir, const Option &opt, bool longopt) { + if (getUIntArg(ir, opt, longopt, _verbosity_arg)) + _verbosity_given = true; +} + +void CommandLine::handle_version (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getBoolArg(ir, opt, longopt, _version_arg)) + _version_given = true; +} + +void CommandLine::handle_zip (InputReader &ir, const Option &opt, bool longopt) { + if (ir.eof() || getIntArg(ir, opt, longopt, _zip_arg)) + _zip_given = true; +} + +void CommandLine::handle_zoom (InputReader &ir, const Option &opt, bool longopt) { + if (getDoubleArg(ir, opt, longopt, _zoom_arg)) + _zoom_given = true; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h new file mode 100644 index 00000000000..cc85d896fd4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CommandLine.h @@ -0,0 +1,222 @@ +// This file was automatically generated by opt2cpp. +// 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. +// (C) 2009-2015 Martin Gieseking + +#ifndef COMMANDLINE_H +#define COMMANDLINE_H + +#include +#include "CmdLineParserBase.h" + +class CommandLine : public CmdLineParserBase +{ + public: + CommandLine () {init();} + CommandLine (int argc, char **argv, bool printErrors) {parse(argc, argv, printErrors);} + bool bbox_given () const {return _bbox_given;} + const std::string& bbox_arg () const {return _bbox_arg;} + bool cache_given () const {return _cache_given;} + const std::string& cache_arg () const {return _cache_arg;} +#if !defined(DISABLE_GS) + bool clipjoin_given () const {return _clipjoin_given;} +#endif + bool color_given () const {return _color_given;} + bool colornames_given () const {return _colornames_given;} +#if !defined(DISABLE_GS) + bool eps_given () const {return _eps_given;} +#endif + bool exact_given () const {return _exact_given;} + bool fontmap_given () const {return _fontmap_given;} + const std::string& fontmap_arg () const {return _fontmap_arg;} +#if !defined(DISABLE_GS) + bool grad_overlap_given () const {return _grad_overlap_given;} +#endif +#if !defined(DISABLE_GS) + bool grad_segments_given () const {return _grad_segments_given;} + int grad_segments_arg () const {return _grad_segments_arg;} +#endif +#if !defined(DISABLE_GS) + bool grad_simplify_given () const {return _grad_simplify_given;} + double grad_simplify_arg () const {return _grad_simplify_arg;} +#endif + bool help_given () const {return _help_given;} + int help_arg () const {return _help_arg;} + bool keep_given () const {return _keep_given;} +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + bool libgs_given () const {return _libgs_given;} + const std::string& libgs_arg () const {return _libgs_arg;} +#endif + bool linkmark_given () const {return _linkmark_given;} + const std::string& linkmark_arg () const {return _linkmark_arg;} + bool list_specials_given () const {return _list_specials_given;} + bool mag_given () const {return _mag_given;} + double mag_arg () const {return _mag_arg;} + bool no_fonts_given () const {return _no_fonts_given;} + int no_fonts_arg () const {return _no_fonts_arg;} + bool no_merge_given () const {return _no_merge_given;} + bool no_mktexmf_given () const {return _no_mktexmf_given;} + bool no_specials_given () const {return _no_specials_given;} + const std::string& no_specials_arg () const {return _no_specials_arg;} + bool no_styles_given () const {return _no_styles_given;} + bool output_given () const {return _output_given;} + const std::string& output_arg () const {return _output_arg;} + bool page_given () const {return _page_given;} + const std::string& page_arg () const {return _page_arg;} + bool precision_given () const {return _precision_given;} + int precision_arg () const {return _precision_arg;} + bool progress_given () const {return _progress_given;} + double progress_arg () const {return _progress_arg;} + bool relative_given () const {return _relative_given;} + bool rotate_given () const {return _rotate_given;} + double rotate_arg () const {return _rotate_arg;} + bool scale_given () const {return _scale_given;} + const std::string& scale_arg () const {return _scale_arg;} + bool stdout_given () const {return _stdout_given;} + bool trace_all_given () const {return _trace_all_given;} + bool trace_all_arg () const {return _trace_all_arg;} + bool transform_given () const {return _transform_given;} + const std::string& transform_arg () const {return _transform_arg;} + bool translate_given () const {return _translate_given;} + const std::string& translate_arg () const {return _translate_arg;} + bool verbosity_given () const {return _verbosity_given;} + unsigned verbosity_arg () const {return _verbosity_arg;} + bool version_given () const {return _version_given;} + bool version_arg () const {return _version_arg;} + bool zip_given () const {return _zip_given;} + int zip_arg () const {return _zip_arg;} + bool zoom_given () const {return _zoom_given;} + double zoom_arg () const {return _zoom_arg;} + protected: + void init (); + const CmdLineParserBase::Option* options (size_t *numopts) const; + const char** helplines (size_t *numlines) const; + void handle_bbox (InputReader &ir, const Option &opt, bool longopt); + void handle_cache (InputReader &ir, const Option &opt, bool longopt); +#if !defined(DISABLE_GS) + void handle_clipjoin (InputReader &ir, const Option &opt, bool longopt); +#endif + void handle_color (InputReader &ir, const Option &opt, bool longopt); + void handle_colornames (InputReader &ir, const Option &opt, bool longopt); +#if !defined(DISABLE_GS) + void handle_eps (InputReader &ir, const Option &opt, bool longopt); +#endif + void handle_exact (InputReader &ir, const Option &opt, bool longopt); + void handle_fontmap (InputReader &ir, const Option &opt, bool longopt); +#if !defined(DISABLE_GS) + void handle_grad_overlap (InputReader &ir, const Option &opt, bool longopt); +#endif +#if !defined(DISABLE_GS) + void handle_grad_segments (InputReader &ir, const Option &opt, bool longopt); +#endif +#if !defined(DISABLE_GS) + void handle_grad_simplify (InputReader &ir, const Option &opt, bool longopt); +#endif + void handle_help (InputReader &ir, const Option &opt, bool longopt); + void handle_keep (InputReader &ir, const Option &opt, bool longopt); +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + void handle_libgs (InputReader &ir, const Option &opt, bool longopt); +#endif + void handle_linkmark (InputReader &ir, const Option &opt, bool longopt); + void handle_list_specials (InputReader &ir, const Option &opt, bool longopt); + void handle_mag (InputReader &ir, const Option &opt, bool longopt); + void handle_no_fonts (InputReader &ir, const Option &opt, bool longopt); + void handle_no_merge (InputReader &ir, const Option &opt, bool longopt); + void handle_no_mktexmf (InputReader &ir, const Option &opt, bool longopt); + void handle_no_specials (InputReader &ir, const Option &opt, bool longopt); + void handle_no_styles (InputReader &ir, const Option &opt, bool longopt); + void handle_output (InputReader &ir, const Option &opt, bool longopt); + void handle_page (InputReader &ir, const Option &opt, bool longopt); + void handle_precision (InputReader &ir, const Option &opt, bool longopt); + void handle_progress (InputReader &ir, const Option &opt, bool longopt); + void handle_relative (InputReader &ir, const Option &opt, bool longopt); + void handle_rotate (InputReader &ir, const Option &opt, bool longopt); + void handle_scale (InputReader &ir, const Option &opt, bool longopt); + void handle_stdout (InputReader &ir, const Option &opt, bool longopt); + void handle_trace_all (InputReader &ir, const Option &opt, bool longopt); + void handle_transform (InputReader &ir, const Option &opt, bool longopt); + void handle_translate (InputReader &ir, const Option &opt, bool longopt); + void handle_verbosity (InputReader &ir, const Option &opt, bool longopt); + void handle_version (InputReader &ir, const Option &opt, bool longopt); + void handle_zip (InputReader &ir, const Option &opt, bool longopt); + void handle_zoom (InputReader &ir, const Option &opt, bool longopt); + + private: + static const CmdLineParserBase::Option _options[]; + bool _bbox_given; + std::string _bbox_arg; + bool _cache_given; + std::string _cache_arg; +#if !defined(DISABLE_GS) + bool _clipjoin_given; +#endif + bool _color_given; + bool _colornames_given; +#if !defined(DISABLE_GS) + bool _eps_given; +#endif + bool _exact_given; + bool _fontmap_given; + std::string _fontmap_arg; +#if !defined(DISABLE_GS) + bool _grad_overlap_given; +#endif +#if !defined(DISABLE_GS) + bool _grad_segments_given; + int _grad_segments_arg; +#endif +#if !defined(DISABLE_GS) + bool _grad_simplify_given; + double _grad_simplify_arg; +#endif + bool _help_given; + int _help_arg; + bool _keep_given; +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + bool _libgs_given; + std::string _libgs_arg; +#endif + bool _linkmark_given; + std::string _linkmark_arg; + bool _list_specials_given; + bool _mag_given; + double _mag_arg; + bool _no_fonts_given; + int _no_fonts_arg; + bool _no_merge_given; + bool _no_mktexmf_given; + bool _no_specials_given; + std::string _no_specials_arg; + bool _no_styles_given; + bool _output_given; + std::string _output_arg; + bool _page_given; + std::string _page_arg; + bool _precision_given; + int _precision_arg; + bool _progress_given; + double _progress_arg; + bool _relative_given; + bool _rotate_given; + double _rotate_arg; + bool _scale_given; + std::string _scale_arg; + bool _stdout_given; + bool _trace_all_given; + bool _trace_all_arg; + bool _transform_given; + std::string _transform_arg; + bool _translate_given; + std::string _translate_arg; + bool _verbosity_given; + unsigned _verbosity_arg; + bool _version_given; + bool _version_arg; + bool _zip_given; + int _zip_arg; + bool _zoom_given; + double _zoom_arg; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp new file mode 100644 index 00000000000..f227cae1f80 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.cpp @@ -0,0 +1,60 @@ +/************************************************************************* +** DLLoader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "DLLoader.h" + + +DLLoader::DLLoader (const char *dlname) : _handle(0) +{ + if (dlname && *dlname) { +#ifdef __WIN32__ + _handle = LoadLibrary(dlname); +#else + _handle = dlopen(dlname, RTLD_LAZY); +#endif + } +} + + +DLLoader::~DLLoader () { + if (_handle) { +#ifdef __WIN32__ + FreeLibrary(_handle); +#else + dlclose(_handle); +#endif + } +} + + +/** Loads a function or variable from the dynamic/shared library. + * @param[in] name name of function/variable to load + * @return pointer to loaded symbol, or 0 if the symbol could not be loaded */ +void* DLLoader::loadSymbol (const char *name) { + if (_handle) { +#ifdef __WIN32__ + return (void*)GetProcAddress(_handle, name); +#else + return dlsym(_handle, name); +#endif + } + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h new file mode 100644 index 00000000000..6050467277b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DLLoader.h @@ -0,0 +1,50 @@ +/************************************************************************* +** DLLoader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DLLOADER_H +#define DVISVGM_DLLOADER_H + +#ifdef __WIN32__ + #include +#else + #include +#endif + + +class DLLoader +{ + public: + DLLoader (const char *dlname); + virtual ~DLLoader (); + bool loaded () const {return _handle != 0;} + + protected: + DLLoader () : _handle(0) {} + void* loadSymbol (const char *name); + + private: +#ifdef __WIN32__ + HINSTANCE _handle; +#else + void *_handle; +#endif +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h new file mode 100644 index 00000000000..d6248d59cf3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.h @@ -0,0 +1,52 @@ +/************************************************************************* +** DVIActions.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DVIACTIONS_H +#define DVISVGM_DVIACTIONS_H + +#include +#include "Message.h" +#include "types.h" + +class BoundingBox; +struct Font; +class SpecialManager; + + +struct DVIActions +{ + virtual ~DVIActions () {} + virtual void setChar (double x, double y, unsigned c, bool vertical, const Font *f) {} + virtual void setRule (double x, double y, double height, double width) {} + virtual void setTextOrientation (bool vertical) {} + virtual void moveToX (double x) {} + virtual void moveToY (double y) {} + virtual void defineFont (int num, const Font *font) {} + virtual void setFont (int num, const Font *font) {} + virtual void special (const std::string &s, double dvi2bp, bool preprocessing=false) {} + virtual void preamble (const std::string &cmt) {} + virtual void postamble () {} + virtual void beginPage (unsigned pageno, Int32 *c) {} + virtual void endPage (unsigned pageno) {} + virtual BoundingBox& bbox () =0; + virtual void progress (size_t current, size_t total, const char *id=0) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp new file mode 100644 index 00000000000..f84252bff1c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp @@ -0,0 +1,687 @@ +/************************************************************************* +** DVIReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "Color.h" +#include "DVIActions.h" +#include "DVIReader.h" +#include "Font.h" +#include "FontManager.h" +#include "Message.h" +#include "SignalHandler.h" +#include "VectorStream.h" +#include "macros.h" +#include "types.h" + + +using namespace std; + +bool DVIReader::COMPUTE_PROGRESS = false; + + +DVIReader::DVIReader (istream &is, DVIActions *a) : BasicDVIReader(is), _actions(a) +{ + _inPage = false; + _pageHeight = _pageWidth = 0; + _dvi2bp = 0.0; + _tx = _ty = 0; // no cursor translation + _prevYPos = numeric_limits::min(); + _inPostamble = false; + _currFontNum = 0; + _currPageNum = 0; + _pagePos = 0; + _mag = 1; + executePreamble(); + collectBopOffsets(); + executePostamble(); +} + + +DVIActions* DVIReader::replaceActions (DVIActions *a) { + DVIActions *prev_actions = _actions; + _actions = a; + return prev_actions; +} + + +/** Reads a single DVI command from the current position of the input stream and calls the + * corresponding cmdFOO method. + * @return opcode of the command executed */ +int DVIReader::executeCommand () { + SignalHandler::instance().check(); + CommandHandler handler; + int param; // parameter of handler + const streampos cmdpos = tell(); + int opcode = evalCommand(handler, param); + (this->*handler)(param); + if (_dviState.v+_ty != _prevYPos) { + _tx = _ty = 0; + _prevYPos = _dviState.v; + } + if (COMPUTE_PROGRESS && _inPage && _actions) { + size_t pagelen = numberOfPageBytes(_currPageNum-1); + // ensure progress() is called at 0% + if (opcode == 139) // bop? + _actions->progress(0, pagelen); + // ensure progress() is called at 100% + if (peek() == 140) // eop reached? + _pagePos = pagelen; + else + _pagePos += tell()-cmdpos; + _actions->progress(_pagePos, pagelen); + } + return opcode; +} + + +/** Executes all DVI commands read from the input stream. */ +void DVIReader::executeAll () { + int opcode = 0; + while (!eof() && opcode >= 0) { + try { + opcode = executeCommand(); + } + catch (const InvalidDVIFileException &e) { + // end of stream reached + opcode = -1; + } + } +} + + +/** Reads and executes the commands of a single page. + * This methods stops reading after the page's eop command has been executed. + * @param[in] n number of page to be executed + * @returns true if page was read successfully */ +bool DVIReader::executePage (unsigned n) { + clearStream(); // reset all status bits + if (!isStreamValid()) + throw DVIException("invalid DVI file"); + if (n < 1 || n > numberOfPages()) + return false; + + seek(_bopOffsets[n-1]); // goto bop of n-th page + _inPostamble = false; // not in postamble + _currPageNum = n; + while (executeCommand() != 140); // 140 == eop + return true; +} + + +void DVIReader::executePreamble () { + clearStream(); + if (isStreamValid()) { + seek(0); + if (readByte() == 247) { + cmdPre(0); + return; + } + } + throw DVIException("invalid DVI file"); +} + + +/** Moves stream pointer to begin of postamble */ +static void to_postamble (StreamReader &reader) { + reader.clearStream(); + if (!reader.isStreamValid()) + throw DVIException("invalid DVI file"); + + reader.seek(-1, ios::end); // stream pointer to last byte + int count=0; + while (reader.peek() == 223) { + reader.seek(-1, ios::cur); // skip fill bytes + count++; + } + if (count < 4) // the standard requires at least 4 trailing fill bytes + throw DVIException("missing fill bytes at end of file"); + + reader.seek(-4, ios::cur); // now on first byte of q (pointer to begin of postamble) + UInt32 q = reader.readUnsigned(4); // pointer to begin of postamble + reader.seek(q); // now on begin of postamble +} + + +/** Reads and executes the commands of the postamble. */ +void DVIReader::executePostamble () { + to_postamble(*this); + while (executeCommand() != 249); // executes all commands until post_post (= 249) is reached +} + + +/** Collects and records the file offsets of all bop commands. */ +void DVIReader::collectBopOffsets () { + to_postamble(*this); + _bopOffsets.push_back(tell()); // also add offset of postamble + readByte(); // skip post command + UInt32 offset = readUnsigned(4); // offset of final bop + while ((Int32)offset > 0) { // not yet on first bop? + _bopOffsets.push_back(offset); // record offset + seek(offset+41); // skip bop command and the 10 \count values => now on offset of previous bop + offset = readUnsigned(4); + } + reverse(_bopOffsets.begin(), _bopOffsets.end()); +} + + +/** Returns the current x coordinate in PS point units. + * This is the horizontal position where the next output would be placed. */ +double DVIReader::getXPos () const { + return _dviState.h+_tx; +} + + +/** Returns the current y coordinate in PS point units. + * This is the vertical position where the next output would be placed. */ +double DVIReader::getYPos () const { + return _dviState.v+_ty; +} + + +///////////////////////////////////// + +/** Reads and executes DVI preamble command. + * Format: pre ver[1] num[4] den[4] mag[4] cmtlen[1] cmt[cmtlen] */ +void DVIReader::cmdPre (int) { + setDVIFormat((DVIFormat)readUnsigned(1)); // identification number + UInt32 num = readUnsigned(4); // numerator units of measurement + UInt32 den = readUnsigned(4); // denominator units of measurement + if (den == 0) + throw DVIException("denominator of measurement unit is zero"); + _mag = readUnsigned(4); // magnification + UInt32 k = readUnsigned(1); // length of following comment + string cmt = readString(k); // comment + // 1 dviunit * num/den == multiples of 0.0000001m + // 1 dviunit * _dvibp: length of 1 dviunit in PS points * _mag/1000 + _dvi2bp = num/254000.0*72.0/den*_mag/1000.0; + if (_actions) + _actions->preamble(cmt); +} + + +/** Reads and executes DVI postamble command. + * Format: post p[4] num[4] den[4] mag[4] ph[4] pw[4] sd[2] np[2] */ +void DVIReader::cmdPost (int) { + readUnsigned(4); // skip pointer to previous bop + UInt32 num = readUnsigned(4); + UInt32 den = readUnsigned(4); + if (den == 0) + throw DVIException("denominator of measurement unit is zero"); + _mag = readUnsigned(4); + _pageHeight = readUnsigned(4); // height of tallest page in dvi units + _pageWidth = readUnsigned(4); // width of widest page in dvi units + readUnsigned(2); // skip max. stack depth + if (readUnsigned(2) != numberOfPages()) + throw DVIException("page count entry doesn't match actual number of pages"); + + // 1 dviunit * num/den == multiples of 0.0000001m + // 1 dviunit * _dvi2bp: length of 1 dviunit in PS points * _mag/1000 + _dvi2bp = num/254000.0*72.0/den*_mag/1000.0; + _pageHeight *= _dvi2bp; // to pt units + _pageWidth *= _dvi2bp; + _inPostamble = true; + if (_actions) + _actions->postamble(); +} + + +/** Reads and executes DVI post_post command. + * Format: post_post q[4] i[1] 223[>=4] */ +void DVIReader::cmdPostPost (int) { + _inPostamble = false; + readUnsigned(4); // pointer to begin of postamble + setDVIFormat((DVIFormat)readUnsigned(1)); // identification byte + while (readUnsigned(1) == 223); // skip fill bytes (223), eof bit should be set now +} + + +/** Reads and executes Begin-Of-Page command. + * Format: bop c0[+4] ... c9[+4] p[+4] */ +void DVIReader::cmdBop (int) { + Int32 c[10]; + for (int i=0; i < 10; i++) + c[i] = readSigned(4); + readSigned(4); // pointer to peceeding bop (-1 in case of first page) + _dviState.reset(); // set all DVI registers to 0 + while (!_stateStack.empty()) + _stateStack.pop(); + _currFontNum = 0; + _inPage = true; + _pagePos = 0; + beginPage(_currPageNum, c); + if (_actions) + _actions->beginPage(_currPageNum, c); +} + + +/** Reads and executes End-Of-Page command. */ +void DVIReader::cmdEop (int) { + if (!_stateStack.empty()) + throw DVIException("stack not empty at end of page"); + _inPage = false; + endPage(_currPageNum); + if (_actions) + _actions->endPage(_currPageNum); +} + + +/** Reads and executes push command. */ +void DVIReader::cmdPush (int) { + _stateStack.push(_dviState); +} + + +/** Reads and executes pop command (restores pushed position information). */ +void DVIReader::cmdPop (int) { + if (_stateStack.empty()) + throw DVIException("stack empty at pop command"); + else { + DVIState prevState = _dviState; + _dviState = _stateStack.top(); + _stateStack.pop(); + if (_actions) { + if (prevState.h != _dviState.h) + _actions->moveToX(_dviState.h + _tx); + if (prevState.v != _dviState.v) + _actions->moveToY(_dviState.v + _ty); + if (prevState.d != _dviState.d) + _actions->setTextOrientation(_dviState.d != WMODE_LR); + } + } +} + + +/** Helper function that actually sets/puts a charater. It is called by the + * cmdSetChar and cmdPutChar methods. + * @param[in] c character to typeset + * @param[in] moveCursor if true, register h is increased by the character width + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::putChar (UInt32 c, bool moveCursor) { + if (!_inPage) + throw DVIException("set_char/put_char outside of page"); + + FontManager &fm = FontManager::instance(); + Font *font = fm.getFont(_currFontNum); + if (!font) + throw DVIException("no font selected"); + + if (VirtualFont *vf = dynamic_cast(font)) { // is current font a virtual font? + vector *dvi = const_cast*>(vf->getDVI(c)); // get DVI snippet that describes character c + if (dvi) { + DVIState pos = _dviState; // save current cursor position + _dviState.x = _dviState.y = _dviState.w = _dviState.z = 0; + int save_fontnum = _currFontNum; // save current font number + fm.enterVF(vf); // new font number context + cmdFontNum0(fm.vfFirstFontNum(vf)); + double save_scale = _dvi2bp; + // DVI units in virtual fonts are multiples of 1^(-20) times the scaled size of the VF + _dvi2bp = vf->scaledSize()/(1 << 20); + + VectorInputStream vis(*dvi); + istream &is = replaceStream(vis); + try { + executeAll(); // execute DVI fragment + } + catch (const DVIException &e) { + // Message::estream(true) << "invalid dvi in vf: " << e.getMessage() << endl; // @@ + } + replaceStream(is); // restore previous input stream + _dvi2bp = save_scale; // restore previous scale factor + fm.leaveVF(); // restore previous font number context + cmdFontNum0(save_fontnum); // restore previous font number + _dviState = pos; // restore previous cursor position + } + } + else if (_actions) + _actions->setChar(_dviState.h+_tx, _dviState.v+_ty, c, _dviState.d != WMODE_LR, font); + + if (moveCursor) { + double dist = font->charWidth(c) * font->scaleFactor() * _mag/1000.0; + switch (_dviState.d) { + case WMODE_LR: _dviState.h += dist; break; + case WMODE_TB: _dviState.v += dist; break; + case WMODE_BT: _dviState.v -= dist; break; + } + } +} + + +/** Reads and executes set_char_x command. Puts a character at the current + * position and advances the cursor. + * @param[in] c character to set + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::cmdSetChar0 (int c) { + putChar(c, true); +} + + +/** Reads and executes setx command. Puts a character at the current + * position and advances the cursor. + * @param[in] len number of parameter bytes (possible values: 1-4) + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::cmdSetChar (int len) { + // According to the dvi specification all character codes are unsigned + // except len == 4. At the moment all char codes are treated as unsigned... + UInt32 c = readUnsigned(len); // if len == 4 c may be signed + putChar(c, true); +} + + +/** Reads and executes putx command. Puts a character at the current + * position but doesn't change the cursor position. + * @param[in] len number of parameter bytes (possible values: 1-4) + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::cmdPutChar (int len) { + // According to the dvi specification all character codes are unsigned + // except len == 4. At the moment all char codes are treated as unsigned... + Int32 c = readUnsigned(len); + putChar(c, false); +} + + +/** Reads and executes set_rule command. Puts a solid rectangle at the current + * position and updates the cursor position. + * Format: set_rule h[+4] w[+4] + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::cmdSetRule (int) { + if (!_inPage) + throw DVIException("set_rule outside of page"); + double height = _dvi2bp*readSigned(4); + double width = _dvi2bp*readSigned(4); + if (_actions && height > 0 && width > 0) + _actions->setRule(_dviState.h+_tx, _dviState.v+_ty, height, width); + moveRight(width); +} + + +/** Reads and executes set_rule command. Puts a solid rectangle at the current + * position but leaves the cursor position unchanged. + * Format: put_rule h[+4] w[+4] + * @throw DVIException if method is called ouside a bop/eop pair */ +void DVIReader::cmdPutRule (int) { + if (!_inPage) + throw DVIException("put_rule outside of page"); + double height = _dvi2bp*readSigned(4); + double width = _dvi2bp*readSigned(4); + if (_actions && height > 0 && width > 0) + _actions->setRule(_dviState.h+_tx, _dviState.v+_ty, height, width); +} + + +void DVIReader::moveRight (double dx) { + switch (_dviState.d) { + case WMODE_LR: _dviState.h += dx; break; + case WMODE_TB: _dviState.v += dx; break; + case WMODE_BT: _dviState.v -= dx; break; + } + if (_actions) { + if (_dviState.d == WMODE_LR) + _actions->moveToX(_dviState.h+_tx); + else + _actions->moveToY(_dviState.v+_ty); + } +} + + +void DVIReader::moveDown (double dy) { + switch (_dviState.d) { + case WMODE_LR: _dviState.v += dy; break; + case WMODE_TB: _dviState.h -= dy; break; + case WMODE_BT: _dviState.h += dy; break; + } + if (_actions) { + if (_dviState.d == WMODE_LR) + _actions->moveToY(_dviState.v+_ty); + else + _actions->moveToX(_dviState.h+_tx); + } +} + + +void DVIReader::cmdRight (int len) {moveRight(_dvi2bp*readSigned(len));} +void DVIReader::cmdDown (int len) {moveDown(_dvi2bp*readSigned(len));} +void DVIReader::cmdX0 (int) {moveRight(_dviState.x);} +void DVIReader::cmdY0 (int) {moveDown(_dviState.y);} +void DVIReader::cmdW0 (int) {moveRight(_dviState.w);} +void DVIReader::cmdZ0 (int) {moveDown(_dviState.z);} +void DVIReader::cmdX (int len) {_dviState.x = _dvi2bp*readSigned(len); cmdX0(0);} +void DVIReader::cmdY (int len) {_dviState.y = _dvi2bp*readSigned(len); cmdY0(0);} +void DVIReader::cmdW (int len) {_dviState.w = _dvi2bp*readSigned(len); cmdW0(0);} +void DVIReader::cmdZ (int len) {_dviState.z = _dvi2bp*readSigned(len); cmdZ0(0);} +void DVIReader::cmdNop (int) {} + + +/** Sets the text orientation (horizontal, vertical). + * This command is only available in DVI files of format 3 (created by pTeX) */ +void DVIReader::cmdDir (int) { + UInt8 wmode = readUnsigned(1); + if (wmode == 4) // yoko mode (4) equals default LR mode (0) + wmode = 0; + if (wmode == 2 || wmode > 3) { + ostringstream oss; + oss << "invalid writing mode value " << wmode << " (0, 1, or 3 expected)"; + throw DVIException(oss.str()); + } + _dviState.d = (WritingMode)wmode; + if (_actions) + _actions->setTextOrientation(_dviState.d != WMODE_LR); +} + + +void DVIReader::cmdXXX (int len) { + if (!_inPage) + throw DVIException("special outside of page"); + UInt32 numBytes = readUnsigned(len); + string s = readString(numBytes); + if (_actions) + _actions->special(s, _dvi2bp); +} + + +/** Selects a previously defined font by its number. + * @param[in] num font number + * @throw DVIException if font number is undefined */ +void DVIReader::cmdFontNum0 (int num) { + if (Font *font = FontManager::instance().getFont(num)) { + _currFontNum = num; + if (_actions && !dynamic_cast(font)) + _actions->setFont(FontManager::instance().fontID(num), font); // all fonts get a recomputed ID + } + else { + ostringstream oss; + oss << "undefined font number " << num; + throw DVIException(oss.str()); + } +} + + +/** Selects a previously defined font. + * @param[in] len size of font number variable (in bytes) + * @throw DVIException if font number is undefined */ +void DVIReader::cmdFontNum (int len) { + UInt32 num = readUnsigned(len); + cmdFontNum0(num); +} + + +/** Helper function to handle a font definition. + * @param[in] fontnum local font number + * @param[in] name font name + * @param[in] cs checksum to be compared with TFM checksum + * @param[in] ds design size in PS point units + * @param[in] ss scaled size in PS point units */ +void DVIReader::defineFont (UInt32 fontnum, const string &name, UInt32 cs, double ds, double ss) { + if (!_inPostamble) // only process font definitions collected in the postamble; skip all others + return; + + FontManager &fm = FontManager::instance(); + int id = fm.registerFont(fontnum, name, cs, ds, ss); + Font *font = fm.getFontById(id); + if (VirtualFont *vf = dynamic_cast(font)) { + // read vf file, register its font and character definitions + fm.enterVF(vf); + ifstream ifs(vf->path(), ios::binary); + VFReader vfReader(ifs); + vfReader.replaceActions(this); + vfReader.executeAll(); + fm.leaveVF(); + } + if (_actions) + _actions->defineFont(id, font); +} + + +/** Defines a new font. + * @param[in] len size of font number variable (in bytes) */ +void DVIReader::cmdFontDef (int len) { + UInt32 fontnum = readUnsigned(len); // font number + UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) + UInt32 ssize = readUnsigned(4); // scaled size of font in DVI units + UInt32 dsize = readUnsigned(4); // design size of font in DVI units + UInt32 pathlen = readUnsigned(1); // length of font path + UInt32 namelen = readUnsigned(1); // length of font name + readString(pathlen); // skip font path + string fontname = readString(namelen); + + defineFont(fontnum, fontname, checksum, dsize*_dvi2bp, ssize*_dvi2bp); +} + + +/** This template method is called by the VFReader after reading a font definition from a VF file. + * @param[in] fontnum local font number + * @param[in] path path to font file + * @param[in] name font name + * @param[in] checksum checksum to be compared with TFM checksum + * @param[in] dsize design size in PS point units + * @param[in] ssize scaled size in PS point units */ +void DVIReader::defineVFFont (UInt32 fontnum, string path, string name, UInt32 checksum, double dsize, double ssize) { + if (VirtualFont *vf = FontManager::instance().getVF()) + defineFont(fontnum, name, checksum, dsize, ssize * vf->scaleFactor()); +} + + +/** This template method is called by the VFReader after reading a character definition from a VF file. + * @param[in] c character number + * @param[in] dvi DVI fragment describing the character */ +void DVIReader::defineVFChar (UInt32 c, vector *dvi) { + FontManager::instance().assignVfChar(c, dvi); +} + + +/** XDV extension: includes image or pdf file. + * parameters: box[1] matrix[4][6] p[2] len[2] path[l] */ +void DVIReader::cmdXPic (int) { + // just skip the parameters + readUnsigned(1); // box + for (int i=0; i < 6; i++) // matrix + readSigned(4); + readSigned(2); // page number + UInt16 len = readUnsigned(2); + readString(len); // path to image/pdf file +} + + +/** XDV extension: defines a native font */ +void DVIReader::cmdXFontDef (int) { + Int32 fontnum = readSigned(4); + double ptsize = _dvi2bp*readUnsigned(4); + UInt16 flags = readUnsigned(2); + UInt8 psname_len = readUnsigned(1); + UInt8 fmname_len = getDVIFormat() == DVI_XDVOLD ? readUnsigned(1) : 0; + UInt8 stname_len = getDVIFormat() == DVI_XDVOLD ? readUnsigned(1) : 0; + string fontname = readString(psname_len); + UInt32 fontIndex=0; + if (getDVIFormat() == DVI_XDVOLD) + seek(fmname_len+stname_len, ios::cur); + else + fontIndex = readUnsigned(4); + FontStyle style; + Color color; + if (flags & 0x0100) { // vertical? + } + if (flags & 0x0200) { // colored? + // The font color must not interfere with color specials. If the font color is not black, + // all color specials should be ignored, i.e. glyphs of a non-black fonts have a fixed color + // that can't be changed by color specials. + UInt32 rgba = readUnsigned(4); + color.setRGB(UInt8(rgba >> 24), UInt8((rgba >> 16) & 0xff), UInt8((rgba >> 8) & 0xff)); + } + if (flags & 0x1000) // extend? + style.extend = _dvi2bp*readSigned(4); + if (flags & 0x2000) // slant? + style.slant = _dvi2bp*readSigned(4); + if (flags & 0x4000) // embolden? + style.bold = _dvi2bp*readSigned(4); + if ((flags & 0x0800) && (getDVIFormat() == DVI_XDVOLD)) { // variations? + UInt16 num_variations = readSigned(2); + for (int i=0; i < num_variations; i++) + readUnsigned(4); + } + if (_inPage) + FontManager::instance().registerFont(fontnum, fontname, fontIndex, ptsize, style, color); +} + + +/** XDV extension: prints an array of characters where each character + * can take independent x and y coordinates. + * parameters: w[4] n[2] x[4][n] y[4][n] c[2][n] */ +void DVIReader::cmdXGlyphArray (int) { + putGlyphArray(false); +} + + +/** XDV extension: prints an array/string of characters where each character + * can take independent x coordinates whereas all share a single y coordinate. + * parameters: w[4] n[2] x[4][n] y[4] c[2][n] */ +void DVIReader::cmdXGlyphString (int) { + putGlyphArray(true); +} + + +/** Implements the common functionality of cmdXGlyphA and cmdXGlyphS. + * @param[in] xonly indicates if the characters share a single y coordinate (xonly==true) */ +void DVIReader::putGlyphArray (bool xonly) { + double strwidth = _dvi2bp*readSigned(4); + UInt16 num_glyphs = readUnsigned(2); + vector x(num_glyphs); + vector y(num_glyphs); + for (int i=0; i < num_glyphs; i++) { + x[i] = readSigned(4); + y[i] = xonly ? 0 : readSigned(4); + } + if (!_actions) + seek(2*num_glyphs, ios::cur); + else { + if (Font *font = FontManager::instance().getFont(_currFontNum)) { + for (int i=0; i < num_glyphs; i++) { + UInt16 glyph_index = readUnsigned(2); + double xx = _dviState.h + x[i]*_dvi2bp + _tx; + double yy = _dviState.v + y[i]*_dvi2bp + _ty; + _actions->setChar(xx, yy, glyph_index, false, font); + } + } + } + moveRight(strwidth); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h new file mode 100644 index 00000000000..4a1a5f5f899 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h @@ -0,0 +1,144 @@ +/************************************************************************* +** DVIReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DVIREADER_H +#define DVISVGM_DVIREADER_H + +#include +#include +#include +#include +#include "BasicDVIReader.h" +#include "MessageException.h" +#include "StreamReader.h" +#include "VFActions.h" +#include "types.h" + + +struct DVIActions; + +class DVIReader : public BasicDVIReader, protected VFActions +{ + enum WritingMode {WMODE_LR=0, WMODE_TB=1, WMODE_BT=3}; + + struct DVIState + { + double h, v; ///< horizontal and vertical cursor position + double x, w, y, z; ///< additional registers to store horizontal (x, w) and vertical (y, z) positions + WritingMode d; ///< direction: 0: horizontal, 1: vertical(top->bottom), 3: vertical (bottom->top) + DVIState () {reset();} + void reset () {h = v = x = w = y = z = 0.0; d=WMODE_LR;} + }; + + public: + DVIReader (std::istream &is, DVIActions *a=0); + + bool executeDocument (); + void executeAll (); + void executePreamble (); + void executePostamble (); + bool executePage (unsigned n); + bool inPostamble () const {return _inPostamble;} + double getXPos () const; + double getYPos () const; + void finishLine () {_prevYPos = std::numeric_limits::min();} + void translateToX (double x) {_tx = x-_dviState.h-_tx;} + void translateToY (double y) {_ty = y-_dviState.v-_ty;} + double getPageWidth () const {return _pageWidth;} + double getPageHeight () const {return _pageHeight;} + int getStackDepth () const {return _stateStack.size();} + int getCurrentFontNumber () const {return _currFontNum;} + unsigned getCurrentPageNumber () const {return _currPageNum;} + unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} + DVIActions* getActions () const {return _actions;} + DVIActions* replaceActions (DVIActions *a); + + protected: + void collectBopOffsets (); + size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} + int executeCommand (); + void moveRight (double dx); + void moveDown (double dy); + void putChar (UInt32 c, bool moveCursor); + void putGlyphArray (bool xonly); + void defineFont (UInt32 fontnum, const std::string &name, UInt32 cs, double ds, double ss); + virtual void beginPage (unsigned pageno, Int32 *c) {} + virtual void endPage (unsigned pageno) {} + + // VFAction methods + void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize); + void defineVFChar (UInt32 c, std::vector *dvi); + + // the following methods represent the DVI commands + // they are called by executeCommand and should not be used directly + void cmdSetChar0 (int c); + void cmdSetChar (int len); + void cmdPutChar (int len); + void cmdSetRule (int len); + void cmdPutRule (int len); + void cmdNop (int len); + void cmdBop (int len); + void cmdEop (int len); + void cmdPush (int len); + void cmdPop (int len); + void cmdDir (int len); + void cmdRight (int len); + void cmdDown (int len); + void cmdX0 (int len); + void cmdY0 (int len); + void cmdW0 (int len); + void cmdZ0 (int len); + void cmdX (int len); + void cmdY (int len); + void cmdW (int len); + void cmdZ (int len); + void cmdFontDef (int len); + void cmdFontNum0 (int n); + void cmdFontNum (int len); + void cmdXXX (int len); + void cmdPre (int len); + void cmdPost (int len); + void cmdPostPost (int len); + void cmdXPic (int len); + void cmdXFontDef (int len); + void cmdXGlyphArray (int len); + void cmdXGlyphString (int len); + + private: + DVIActions *_actions; ///< actions to be performed on various DVI events + bool _inPage; ///< true if between bop and eop + unsigned _currPageNum; ///< current page number (1 is first page) + int _currFontNum; ///< current font number + double _dvi2bp; ///< factor to convert dvi units to PS points + UInt32 _mag; ///< magnification factor * 1000 + bool _inPostamble; ///< true if stream pointer is inside the postamble + double _pageHeight, _pageWidth; ///< page height and width in PS points + DVIState _dviState; ///< current cursor position + std::stack _stateStack; + std::vector _bopOffsets; + double _prevYPos; ///< previous vertical cursor position + double _tx, _ty; ///< tranlation of cursor position + std::streampos _pagePos; ///< distance of current DVI command from bop (in bytes) + + public: + static bool COMPUTE_PROGRESS; ///< if true, an action to handle the progress ratio of a page is triggered +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp new file mode 100644 index 00000000000..00becb10aeb --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -0,0 +1,340 @@ +/************************************************************************* +** DVIToSVG.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "Calculator.h" +#include "DVIToSVG.h" +#include "DVIToSVGActions.h" +#include "Font.h" +#include "FontManager.h" +#include "FileFinder.h" +#include "GlyphTracerMessages.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "Matrix.h" +#include "Message.h" +#include "PageRanges.h" +#include "PageSize.h" +#include "SVGOutput.h" +// +/////////////////////////////////// +// special handlers + +#include "BgColorSpecialHandler.h" +#include "ColorSpecialHandler.h" +#include "DvisvgmSpecialHandler.h" +#include "EmSpecialHandler.h" +#include "PdfSpecialHandler.h" +#include "HtmlSpecialHandler.h" +#ifndef HAVE_LIBGS + #include "NoPsSpecialHandler.h" +#endif +#ifndef DISABLE_GS + #include "PsSpecialHandler.h" +#endif +#include "TpicSpecialHandler.h" +#include "PreScanDVIReader.h" + +/////////////////////////////////// + +using namespace std; + + +/** 'a': trace all glyphs even if some of them are already cached + * 'm': trace missing glyphs, i.e. glyphs not yet cached + * 0 : only trace actually required glyphs */ +char DVIToSVG::TRACE_MODE = 0; + + +DVIToSVG::DVIToSVG (istream &is, SVGOutputBase &out) : DVIReader(is), _out(out) +{ + replaceActions(new DVIToSVGActions(*this, _svg)); +} + + +DVIToSVG::~DVIToSVG () { + delete replaceActions(0); +} + + +/** Starts the conversion process. + * @param[in] first number of first page to convert + * @param[in] last number of last page to convert + * @param[out] pageinfo (number of converted pages, number of total pages) */ +void DVIToSVG::convert (unsigned first, unsigned last, pair *pageinfo) { + if (first > last) + swap(first, last); + if (first > numberOfPages()) { + ostringstream oss; + oss << "file contains only " << numberOfPages() << " page"; + if (numberOfPages() > 1) + oss << 's'; + throw DVIException(oss.str()); + } + last = min(last, numberOfPages()); + + for (unsigned i=first; i <= last; ++i) { + executePage(i); + _svg.removeRedundantElements(); + embedFonts(_svg.rootNode()); + _svg.write(_out.getPageStream(getCurrentPageNumber(), numberOfPages())); + string fname = _out.filename(i, numberOfPages()); + Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\npage written to " << (fname.empty() ? "" : fname) << '\n'; + _svg.reset(); + static_cast(getActions())->reset(); + } + if (pageinfo) { + pageinfo->first = last-first+1; + pageinfo->second = numberOfPages(); + } +} + + +/** Convert DVI pages specified by a page range string. + * @param[in] rangestr string describing the pages to convert + * @param[out] pageinfo (number of converted pages, number of total pages) */ +void DVIToSVG::convert (const string &rangestr, pair *pageinfo) { + PageRanges ranges; + if (!ranges.parse(rangestr, numberOfPages())) + throw MessageException("invalid page range format"); + + Message::mstream(false, Message::MC_PAGE_NUMBER) << "pre-processing DVI file (format " << getDVIFormat() << ")\n"; + if (DVIToSVGActions *actions = dynamic_cast(getActions())) { + PreScanDVIReader prescan(getInputStream(), actions); + actions->setDVIReader(prescan); + prescan.executeAllPages(); + actions->setDVIReader(*this); + SpecialManager::instance().notifyPreprocessingFinished(); + } + + FORALL(ranges, PageRanges::ConstIterator, it) + convert(it->first, it->second); + if (pageinfo) { + pageinfo->first = ranges.numberOfPages(); + pageinfo->second = numberOfPages(); + } +} + + +/** This template method is called by parent class DVIReader before + * executing the BOP actions. + * @param[in] pageno physical page number (1 = first page) + * @param[in] c contains information about the page (page number etc.) */ +void DVIToSVG::beginPage (unsigned pageno, Int32 *c) { + if (dynamic_cast(getActions())) { + Message::mstream().indent(0); + Message::mstream(false, Message::MC_PAGE_NUMBER) << "processing page " << pageno; + if (pageno != (unsigned)c[0]) // Does page number shown on page differ from physical page number? + Message::mstream(false) << " [" << c[0] << ']'; + Message::mstream().indent(1); + _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); + } +} + + +/** This template method is called by parent class DVIReader before + * executing the EOP actions. */ +void DVIToSVG::endPage (unsigned pageno) { + if (!dynamic_cast(getActions())) + return; + + SpecialManager::instance().notifyEndPage(pageno); + // set bounding box and apply page transformations + BoundingBox &bbox = getActions()->bbox(); + bbox.unlock(); + Matrix matrix; + getPageTransformation(matrix); + static_cast(getActions())->setPageMatrix(matrix); + if (_bboxString == "min") + bbox.transform(matrix); + if (string("dvi none min").find(_bboxString) == string::npos) { + istringstream iss(_bboxString); + StreamInputReader ir(iss); + ir.skipSpace(); + if (isalpha(ir.peek())) { + // set explicitly given page format + PageSize size(_bboxString); + if (size.valid()) { + // convention: DVI position (0,0) equals (1in, 1in) relative + // to the upper left vertex of the page (see DVI specification) + const double border = -72; + bbox = BoundingBox(border, border, size.widthInBP()+border, size.heightInBP()+border); + } + } + else { // set/modify bounding box by explicitly given values + try { + bbox.set(_bboxString); + } + catch (const MessageException &e) { + } + } + } + else if (_bboxString == "dvi") { + // center page content + double dx = (getPageWidth()-bbox.width())/2; + double dy = (getPageHeight()-bbox.height())/2; + bbox += BoundingBox(-dx, -dy, dx, dy); + } + if (_bboxString != "none") { + if (bbox.width() == 0) + Message::wstream(false) << "\npage is empty\n"; + else { + _svg.setBBox(bbox); + + const double bp2pt = 72.27/72; + const double bp2mm = 25.4/72; + Message::mstream(false) << '\n'; + Message::mstream(false, Message::MC_PAGE_SIZE) << "page size: " << XMLString(bbox.width()*bp2pt) << "pt" + " x " << XMLString(bbox.height()*bp2pt) << "pt" + " (" << XMLString(bbox.width()*bp2mm) << "mm" + " x " << XMLString(bbox.height()*bp2mm) << "mm)"; + Message::mstream(false) << '\n'; + } + } +} + + +void DVIToSVG::getPageTransformation(Matrix &matrix) const { + if (_transCmds.empty()) + matrix.set(1); // unity matrix + else { + Calculator calc; + if (getActions()) { + const double bp2pt = 72.27/72; + BoundingBox &bbox = getActions()->bbox(); + calc.setVariable("ux", bbox.minX()*bp2pt); + calc.setVariable("uy", bbox.minY()*bp2pt); + calc.setVariable("w", bbox.width()*bp2pt); + calc.setVariable("h", bbox.height()*bp2pt); + } + calc.setVariable("pt", 1); + calc.setVariable("in", 72.27); + calc.setVariable("cm", 72.27/2.54); + calc.setVariable("mm", 72.27/25.4); + matrix.set(_transCmds, calc); + } +} + + +static void collect_chars (map > &fm) { + typedef const map > UsedCharsMap; + FORALL(fm, UsedCharsMap::const_iterator, it) { + if (it->first->uniqueFont() != it->first) { + FORALL(it->second, set::const_iterator, cit) + fm[it->first->uniqueFont()].insert(*cit); + } + } +} + + +/** Adds the font information to the SVG tree. + * @param[in] svgElement the font nodes are added to this node */ +void DVIToSVG::embedFonts (XMLElementNode *svgElement) { + if (!svgElement) + return; + if (!getActions()) // no dvi actions => no chars written => no fonts to embed + return; + + typedef map > UsedCharsMap; + const DVIToSVGActions *svgActions = static_cast(getActions()); + UsedCharsMap &usedChars = svgActions->getUsedChars(); + + collect_chars(usedChars); + + GlyphTracerMessages messages; + set tracedFonts; // collect unique fonts already traced + FORALL(usedChars, UsedCharsMap::const_iterator, it) { + const Font *font = it->first; + if (const PhysicalFont *ph_font = dynamic_cast(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()) { + ph_font->traceAllGlyphs(TRACE_MODE == 'a', &messages); + tracedFonts.insert(ph_font->uniqueFont()); + } + if (font->path()) // does font file exist? + _svg.append(*ph_font, it->second, &messages); + else + Message::wstream(true) << "can't embed font '" << font->name() << "'\n"; + } + else + Message::wstream(true) << "can't embed font '" << font->name() << "'\n"; + } + _svg.appendFontStyles(svgActions->getUsedFonts()); +} + + +/** Enables or disables processing of specials. If ignorelist == 0, all + * supported special handlers are loaded. To disable selected sets of specials, + * the corresponding prefixes can be given separated by non alpha-numeric characters, + * e.g. "color, ps, em" or "color: ps em" etc. + * A single "*" in the ignore list disables all specials. + * @param[in] ignorelist list of special prefixes to ignore + * @param[in] pswarning if true, shows warning about disabled PS support + * @return the SpecialManager that handles special statements */ +void DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) { + if (ignorelist && strcmp(ignorelist, "*") == 0) { // ignore all specials? + SpecialManager::instance().unregisterHandlers(); + } + else { + // add special handlers + SpecialHandler *handlers[] = { + 0, // placeholder for PsSpecialHandler + new BgColorSpecialHandler, // handles background color special + new ColorSpecialHandler, // handles color specials + new DvisvgmSpecialHandler, // handles raw SVG embeddings + new EmSpecialHandler, // handles emTeX specials + new HtmlSpecialHandler, // handles hyperref specials + new PdfSpecialHandler, // handles pdf specials + new TpicSpecialHandler, // handles tpic specials + 0 + }; + SpecialHandler **p = handlers; +#ifndef DISABLE_GS + if (Ghostscript().available()) + *p = new PsSpecialHandler; + else +#endif + { +#ifndef HAVE_LIBGS + *p = new NoPsSpecialHandler; // dummy PS special handler that only prints warning messages + if (pswarning) { +#ifdef DISABLE_GS + Message::wstream() << "processing of PostScript specials has been disabled permanently\n"; +#else + Message::wstream() << "processing of PostScript specials is disabled (Ghostscript not found)\n"; +#endif + } +#endif + } + SpecialManager::instance().unregisterHandlers(); + SpecialManager::instance().registerHandlers(p, ignorelist); + } +} + + +string DVIToSVG::getSVGFilename (unsigned pageno) const { + return _out.filename(pageno, numberOfPages()); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h new file mode 100644 index 00000000000..9e3f5d659ca --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.h @@ -0,0 +1,63 @@ +/************************************************************************* +** DVIToSVG.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DVITOSVG_H +#define DVISVGM_DVITOSVG_H + +#include +#include +#include +#include "DVIReader.h" +#include "SpecialManager.h" +#include "SVGTree.h" + +class Matrix; +struct SVGOutputBase; + +class DVIToSVG : public DVIReader +{ + public: + DVIToSVG (std::istream &is, SVGOutputBase &out); + ~DVIToSVG (); + void convert (const std::string &range, std::pair *pageinfo=0); + void setPageSize (const std::string &name) {_bboxString = name;} + void setPageTransformation (const std::string &cmds) {_transCmds = cmds;} + void getPageTransformation (Matrix &matrix) const; + std::string getSVGFilename (unsigned pageno) const; + static void setProcessSpecials (const char *ignorelist=0, bool pswarning=false); + + public: + static char TRACE_MODE; + + protected: + DVIToSVG (const DVIToSVG &); + void convert (unsigned firstPage, unsigned lastPage, std::pair *pageinfo=0); + void beginPage (unsigned pageno, Int32 *c); + void endPage (unsigned pageno); + void embedFonts (XMLElementNode *svgElement); + + private: + SVGTree _svg; + SVGOutputBase &_out; + std::string _bboxString; + std::string _transCmds; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp new file mode 100644 index 00000000000..9553a9d7846 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -0,0 +1,368 @@ +/************************************************************************* +** DVIToSVGActions.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "BoundingBox.h" +#include "DVIToSVG.h" +#include "DVIToSVGActions.h" +#include "Font.h" +#include "FontManager.h" +#include "GlyphTracerMessages.h" +#include "SpecialManager.h" +#include "System.h" +#include "XMLNode.h" +#include "XMLString.h" + + +using namespace std; + + +DVIToSVGActions::DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg) + : _svg(svg), _dvireader(&dvisvg), _pageMatrix(0), _bgcolor(Color::TRANSPARENT), _boxes(0) +{ + _currentFontNum = -1; + _pageCount = 0; +} + + +DVIToSVGActions::~DVIToSVGActions () { + delete _pageMatrix; + delete _boxes; +} + + +void DVIToSVGActions::reset() { + _usedChars.clear(); + _usedFonts.clear(); + _bbox = BoundingBox(); + _currentFontNum = -1; + _bgcolor = Color::TRANSPARENT; +} + + +void DVIToSVGActions::setPageMatrix (const Matrix &matrix) { + delete _pageMatrix; + _pageMatrix = new Matrix(matrix); +} + + +void DVIToSVGActions::moveToX (double x) { + SpecialManager::instance().notifyPositionChange(getX(), getY()); + _svg.setX(x); +} + + +void DVIToSVGActions::moveToY (double y) { + SpecialManager::instance().notifyPositionChange(getX(), getY()); + _svg.setY(y); +} + + +string DVIToSVGActions::getSVGFilename (unsigned pageno) const { + if (DVIToSVG *dvi2svg = dynamic_cast(_dvireader)) + return dvi2svg->getSVGFilename(pageno); + return ""; +} + + +/** This method is called when a "set char" command was found in the DVI file. + * It draws a character of the current font. + * @param[in] x horizontal position of left bounding box edge + * @param[in] y vertical position of the character's baseline + * @param[in] c character code relative to the current font + * @param[in] vertical true if we're in vertical mode + * @param[in] font font to be used */ +void DVIToSVGActions::setChar (double x, double y, unsigned c, bool vertical, const Font *font) { + // If we use SVG fonts there is no need to record all font name/char/size combinations + // because the SVG font mechanism handles this automatically. It's sufficient to + // record font names and chars. The various font sizes can be ignored here. + // For a given font object, Font::uniqueFont() returns the same unique font object for + // all fonts with the same name. + _usedChars[SVGTree::USE_FONTS ? font->uniqueFont() : font].insert(c); + + // However, we record all required fonts + _usedFonts.insert(font); + _svg.appendChar(c, x, y, *font); + + static string fontname; + GlyphTracerMessages callback(fontname != font->name(), false); + fontname = font->name(); + + BoundingBox charbox; + GlyphMetrics metrics; + font->getGlyphMetrics(c, vertical, metrics); + const PhysicalFont* pf = dynamic_cast(font); + if (PhysicalFont::EXACT_BBOX && pf) { + GlyphMetrics exact_metrics; + pf->getExactGlyphBox(c, exact_metrics, vertical, &callback); + if (vertical) { + // move top of bbox to upper margin of glyph (just an approximation yet) + y += (metrics.d-exact_metrics.h-exact_metrics.d)/2; + } + metrics = exact_metrics; + } + BoundingBox bbox(x-metrics.wl, y-metrics.h, x+metrics.wr, y+metrics.d); + + // update bounding box + if (!getMatrix().isIdentity()) + bbox.transform(getMatrix()); + embed(bbox); +#if 0 + XMLElementNode *rect = new XMLElementNode("rect"); + rect->addAttribute("x", x-metrics.wl); + rect->addAttribute("y", y-metrics.h); + rect->addAttribute("width", metrics.wl+metrics.wr); + rect->addAttribute("height", metrics.h+metrics.d); + rect->addAttribute("fill", "none"); + rect->addAttribute("stroke", "red"); + rect->addAttribute("stroke-width", "0.5"); + _svg.appendToPage(rect); + if (metrics.d > 0) { + XMLElementNode *line = new XMLElementNode("line"); + line->addAttribute("x1", x-metrics.wl); + line->addAttribute("y1", y); + line->addAttribute("x2", x+metrics.wr); + line->addAttribute("y2", y); + line->addAttribute("stroke", "blue"); + line->addAttribute("stroke-width", "0.5"); + _svg.appendToPage(line); + } + if (metrics.wl > 0) { + XMLElementNode *line = new XMLElementNode("line"); + line->addAttribute("x1", x); + line->addAttribute("y1", y-metrics.h); + line->addAttribute("x2", x); + line->addAttribute("y2", y+metrics.d); + line->addAttribute("stroke", "blue"); + line->addAttribute("stroke-width", "0.5"); + _svg.appendToPage(line); + } +#endif +} + + +/** This method is called when a "set rule" or "put rule" command was found in the + * DVI file. It draws a solid unrotated rectangle. + * @param[in] x horizontal position of left edge + * @param[in] y vertical position of bottom(!) edge + * @param[in] height length of the vertical edges + * @param[in] width length of the horizontal edges */ +void DVIToSVGActions::setRule (double x, double y, double height, double width) { + // (x,y) is the lower left corner of the rectangle + XMLElementNode *rect = new XMLElementNode("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().getSVG()); + if (getColor() != Color::BLACK) + rect->addAttribute("fill", _svg.getColor().svgColorString()); + _svg.appendToPage(rect); + + // update bounding box + BoundingBox bb(x, y-height, x+width, y); + if (!getMatrix().isIdentity()) + bb.transform(getMatrix()); + embed(bb); +} + + +/** This method is called when a "set font" command was found in the DVI file. The + * font must be previously defined. + * @param[in] num unique number of the font in the DVI file (not necessarily equal to the DVI font number) + * @param[in] font pointer to the font object (always represents a physical font and never a virtual font) */ +void DVIToSVGActions::setFont (int num, const Font *font) { + _currentFontNum = num; + _svg.setFont(num, font); +} + + +/** This method is called when a "special" command was found in the DVI file. + * @param[in] spc the special expression + * @param[in] dvi2bp factor to scale DVI units to PS points + * @param[in] preprocessing if true, the DVI file is being pre-processed */ +void DVIToSVGActions::special (const string &spc, double dvi2bp, bool preprocessing) { + try { + if (preprocessing) + SpecialManager::instance().preprocess(spc, this); + else + SpecialManager::instance().process(spc, dvi2bp, this); + // @@ output message in case of unsupported specials? + } + catch (const SpecialException &e) { + Message::estream(true) << "error in special: " << e.what() << '\n'; + } +} + + +/** This method is called when the DVI preamble was read + * @param[in] cmt preamble comment text. */ +void DVIToSVGActions::preamble (const string &cmt) { +} + + +void DVIToSVGActions::postamble () { +} + + +/** This method is called when a "begin of page (bop)" command was found in the DVI file. + * @param[in] pageno physical page number + * @param[in] c array with 10 components representing \\count0 ... \\count9. c[0] contains the + * current (printed) page number (may differ from page count) */ +void DVIToSVGActions::beginPage (unsigned pageno, Int32 *c) { + _svg.newPage(++_pageCount); + _bbox = BoundingBox(); // clear bounding box + if (_boxes) + _boxes->clear(); +} + + +/** This method is called when an "end of page (eop)" command was found in the DVI file. */ +void DVIToSVGActions::endPage (unsigned pageno) { + _svg.transformPage(_pageMatrix); + if (_bgcolor != Color::TRANSPARENT) { + // create a rectangle filled with the background color + XMLElementNode *r = new XMLElementNode("rect"); + r->addAttribute("x", _bbox.minX()); + r->addAttribute("y", _bbox.minY()); + r->addAttribute("width", _bbox.width()); + r->addAttribute("height", _bbox.height()); + r->addAttribute("fill", _bgcolor.svgColorString()); + _svg.prependToPage(r); + } +} + + +void DVIToSVGActions::setBgColor (const Color &color) { + _bgcolor = color; +} + + +void DVIToSVGActions::embed(const BoundingBox& bbox) { + _bbox.embed(bbox); + if (_boxes) { + FORALL(*_boxes, BoxMap::iterator, it) + it->second.embed(bbox); + } +} + + +void DVIToSVGActions::embed(const DPair& p, double r) { + if (r == 0) + _bbox.embed(p); + else + _bbox.embed(p, r); + if (_boxes) + FORALL(*_boxes, BoxMap::iterator, it) + it->second.embed(p, r); +} + + +BoundingBox& DVIToSVGActions::bbox(const string& name, bool reset) { + if (!_boxes) + _boxes = new BoxMap; + BoundingBox &box = (*_boxes)[name]; + if (reset) + box = BoundingBox(); + return box; +} + + +/** This method is called by subprocesses like the PS handler when + * a computation step has finished. Since the total number of steps + * can't be determined in advance, we don't show a percent value but + * a rotating dash. */ +void DVIToSVGActions::progress (const char *id) { + if (PROGRESSBAR_DELAY < 1000) { + static double time=0; + // slow down updating of the progress indicator to prevent flickering + if (System::time() - time > 0.1) { + progress(0, 0, id); + time = System::time(); + } + } +} + + +/** Returns the number of digits of a given integer. */ +static int digits (int n) { + if (n == 0) + return 1; + if (n > 0) + return int(log10(double(n))+1); + return int(log10(double(-n))+2); +} + + +/** Draws a simple progress indicator. + * @param[in] current current iteration step (of 'total' steps) + * @param[in] total total number of iteration steps + * @param[in] id ID of the subprocess providing the information */ +void DVIToSVGActions::progress (size_t current, size_t total, const char *id) { + static double time=0; + static bool draw=false; // show progress indicator? + static const char *prev_id=0; + if (current == 0 && total > 0) { + time = System::time(); + draw = false; + Message::mstream() << '\n'; + } + // don't show the progress indicator before the given time has elapsed + if (!draw && System::time()-time > PROGRESSBAR_DELAY) { + draw = true; + Terminal::cursor(false); + } + if (draw && (System::time() - time > 0.1 || (total > 0 && current == total) || prev_id != id)) { + static int step = -1; // >=0: rotating dash + static size_t prev_current=0, prev_total=1; + const char *tips = "-\\|/"; + if (total == 0) { + current = prev_current; + total = prev_total; + step = (step+1) % 4; + } + else { + prev_current = current; + prev_total = total; + step = -1; + } + // adapt length of progress indicator to terminal width + int cols = Terminal::columns(); + int width = (cols == 0 || cols > 60) ? 50 : 49-60+cols; + double factor = double(current)/double(total); + int length = int(width*factor); + Message::mstream(false, Message::MC_PROGRESS) + << '[' << string(length, '=') + << (factor < 1.0 ? (step < 0 ? ' ' : tips[step]) : '=') + << string(width-length, ' ') + << "] " << string(3-digits(int(100*factor)), ' ') << int(100*factor) + << "%\r"; + // overprint indicator when finished + if (factor == 1.0) { + Message::estream().clearline(); + Terminal::cursor(true); + } + time = System::time(); + prev_id = id; + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h new file mode 100644 index 00000000000..873f104550a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.h @@ -0,0 +1,105 @@ +/************************************************************************* +** DVIToSVGActions.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DVITOSVGACTIONS_H +#define DVISVGM_DVITOSVGACTIONS_H + +#include +#include +#include "BoundingBox.h" +#include "DVIActions.h" +#include "Matrix.h" +#include "SpecialActions.h" +#include "SpecialManager.h" +#include "SVGTree.h" +#include "DVIReader.h" + + +class DVIToSVG; +struct FileFinder; +struct Font; +struct XMLNode; + +class DVIToSVGActions : public DVIActions, public SpecialActions +{ + typedef std::map > CharMap; + typedef std::set FontSet; + typedef std::map BoxMap; + + public: + DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg); + ~DVIToSVGActions (); + void reset (); + void setChar (double x, double y, unsigned c, bool vertical, const Font *f); + void setRule (double x, double y, double height, double width); + void setBgColor (const Color &color); + void setColor (const Color &color) {_svg.setColor(color);} + void setMatrix (const Matrix &m) {_svg.setMatrix(m);} + const Matrix& getMatrix () const {return _svg.getMatrix();} + void getPageTransform (Matrix &matrix) const {_dvireader->getPageTransformation(matrix);} + Color getColor () const {return _svg.getColor();} + int getDVIStackDepth() const {return _dvireader->getStackDepth();} + unsigned getCurrentPageNumber() const {return _dvireader->getCurrentPageNumber();} + void appendToPage (XMLNode *node) {_svg.appendToPage(node);} + void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} + void prependToPage (XMLNode *node) {_svg.prependToPage(node);} + void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} + void popContextElement () {_svg.popContextElement();} + void setTextOrientation(bool vertical) {_svg.setVertical(vertical);} + void moveToX (double x); + void moveToY (double y); + void setFont (int num, const Font *font); + void special (const std::string &spc, double dvi2bp, bool preprocessing=false); + void preamble (const std::string &cmt); + void postamble (); + void beginPage (unsigned pageno, Int32 *c); + void endPage (unsigned pageno); + void progress (size_t current, size_t total, const char *id=0); + void progress (const char *id); + CharMap& getUsedChars () const {return _usedChars;} + const FontSet& getUsedFonts () const {return _usedFonts;} + void setDVIReader (BasicDVIReader &r) {_dvireader = &r;} + void setPageMatrix (const Matrix &tm); + double getX() const {return _dvireader->getXPos();} + double getY() const {return _dvireader->getYPos();} + void setX (double x) {_dvireader->translateToX(x); _svg.setX(x);} + void setY (double y) {_dvireader->translateToY(y); _svg.setY(y);} + void finishLine () {_dvireader->finishLine();} + BoundingBox& bbox () {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false); + void embed (const BoundingBox &bbox); + void embed (const DPair &p, double r=0); + std::string getSVGFilename (unsigned pageno) const; + + private: + SVGTree &_svg; + BasicDVIReader *_dvireader; + BoundingBox _bbox; + int _pageCount; + int _currentFontNum; + mutable CharMap _usedChars; + FontSet _usedFonts; + Matrix *_pageMatrix; // transformation of whole page + Color _bgcolor; + BoxMap *_boxes; +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h new file mode 100644 index 00000000000..e00a68ffbd1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DependencyGraph.h @@ -0,0 +1,122 @@ +/************************************************************************* +** DependencyGraph.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + + +#ifndef DEPENDENCYGRAPH_H +#define DEPENDENCYGRAPH_H + +#include +#include + +template +class DependencyGraph +{ + struct GraphNode { + typedef typename std::vector Dependees; + typedef typename Dependees::iterator Iterator; + + GraphNode (const T &k) : key(k), dependent(0) {} + + void addDependee (GraphNode *node) { + if (node) { + node->dependent = this; + dependees.push_back(node); + } + } + + void deleteDependentsAndSelf () { + if (dependent) + dependent->deleteDependentsAndSelf(); + for (typename Dependees::iterator it = dependees.begin(); it != dependees.end(); ++it) + (*it)->dependent = 0; + delete this; + } + + T key; + GraphNode *dependent; + Dependees dependees; + }; + + typedef std::map NodeMap; + + public: + ~DependencyGraph() { + for (typename NodeMap::iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) + delete it->second; + } + + void insert (const T &key) { + if (!contains(key)) + _nodeMap[key] = new GraphNode(key); + } + + void insert (const T &depKey, const T &key) { + if (contains(key)) + return; + typename NodeMap::iterator it = _nodeMap.find(depKey); + if (it != _nodeMap.end()) { + GraphNode *node = new GraphNode(key); + it->second->addDependee(node); + _nodeMap[key] = node; + } + } + + void removeDependencyPath (const T &key) { + typename NodeMap::iterator it = _nodeMap.find(key); + if (it != _nodeMap.end()) { + GraphNode *startNode = it->second; + for (GraphNode *node=startNode; node; node=node->dependent) + _nodeMap.erase(node->key); + startNode->deleteDependentsAndSelf(); + } + } + + void getKeys (std::vector &keys) const { + for (typename NodeMap::const_iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) + keys.push_back(it->first); + } + + bool contains (const T &value) const { + return _nodeMap.find(value) != _nodeMap.end(); + } + + bool empty () const { + return _nodeMap.empty(); + } + +#if 0 + void writeDOT (std::ostream &os) const { + os << "digraph {\n"; + for (typename NodeMap::const_iterator it=_nodeMap.begin(); it != _nodeMap.end(); ++it) { + GraphNode *node = it->second; + if (node->dependent) + os << (node->key) << " -> " << (node->dependent->key) << ";\n"; + else if (node->dependees.empty()) + os << (node->key) << ";\n"; + } + os << "}\n"; + } +#endif + + private: + NodeMap _nodeMap; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp new file mode 100644 index 00000000000..0bc3c555e45 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.cpp @@ -0,0 +1,129 @@ +/************************************************************************* +** Directory.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "Directory.h" + +using namespace std; + +#ifdef __WIN32__ + #include +#else + #include + #include +#endif + + +Directory::Directory () { +#if __WIN32__ + handle = INVALID_HANDLE_VALUE; + firstread = true; + memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); +#else + dir = 0; + dirent = 0; +#endif +} + + +Directory::Directory (string dirname) { +#if __WIN32__ + handle = INVALID_HANDLE_VALUE; + firstread = true; + memset(&fileData, 0, sizeof(WIN32_FIND_DATA)); +#else + dir = 0; + dirent = 0; +#endif + open(dirname); +} + + +Directory::~Directory () { + close(); +} + + +bool Directory::open (string dname) { + _dirname = dname; +#ifdef __WIN32__ + firstread = true; + if (dname[dname.length()-1] == '/' || dname[dname.length()-1] == '\\') + dname = dname.substr(0, dname.length()-1); + dname += "\\*"; + handle = FindFirstFile(dname.c_str(), &fileData); + return handle != INVALID_HANDLE_VALUE; +#else + dir = opendir(_dirname.c_str()); + return dir; +#endif +} + + +void Directory::close () { +#ifdef __WIN32__ + FindClose(handle); +#else + closedir(dir); +#endif +} + + +/** Reads first/next directory entry. + * @param[in] type type of entry to return (a: file or dir, f: file, d: dir) + * @return name of entry */ +const char* Directory::read (EntryType type) { +#ifdef __WIN32__ + if (handle == INVALID_HANDLE_VALUE) + return 0; + while (firstread || FindNextFile(handle, &fileData)) { + firstread = false; + if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if (type == ET_FILE_OR_DIR || type == ET_DIR) + return fileData.cFileName; + } + else if (type == ET_FILE_OR_DIR || type == ET_FILE) + return fileData.cFileName; + } + FindClose(handle); + handle = INVALID_HANDLE_VALUE; + return 0; +#else + if (!dir) + return 0; + while ((dirent = readdir(dir))) { + string path = string(_dirname) + "/" + dirent->d_name; + struct stat stats; + if (stat(path.c_str(), &stats) == 0) { + if (S_ISDIR(stats.st_mode)) { + if (type == ET_FILE_OR_DIR || type == ET_DIR) + return dirent->d_name; + } + else if (type == ET_FILE_OR_DIR || type == ET_FILE) + return dirent->d_name; + } + } + closedir(dir); + dir = 0; + return 0; +#endif +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h new file mode 100644 index 00000000000..17bd10f507d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Directory.h @@ -0,0 +1,56 @@ +/************************************************************************* +** Directory.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DIRECTORY_H +#define DVISVGM_DIRECTORY_H + +#include +#ifdef __WIN32__ + #include +#else + #include +#endif + +class Directory +{ + public: + enum EntryType {ET_FILE, ET_DIR, ET_FILE_OR_DIR}; + + public: + Directory (); + Directory (std::string path); + ~Directory (); + bool open (std::string path); + void close (); + const char* read (EntryType type=ET_FILE_OR_DIR); + + private: + std::string _dirname; +#ifdef __WIN32__ + bool firstread; + HANDLE handle; + WIN32_FIND_DATA fileData; +#else + DIR *dir; + struct dirent *dirent; +#endif +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp new file mode 100644 index 00000000000..0d97120a2cf --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.cpp @@ -0,0 +1,354 @@ +/************************************************************************* +** DvisvgmSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "DvisvgmSpecialHandler.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "SpecialActions.h" +#include "XMLNode.h" +#include "XMLString.h" + +using namespace std; + + +DvisvgmSpecialHandler::DvisvgmSpecialHandler () + : _currentMacro(_macros.end()), _nestingLevel(0) +{ +} + + +void DvisvgmSpecialHandler::preprocess (const char*, istream &is, SpecialActions*) { + struct Command { + const char *name; + void (DvisvgmSpecialHandler::*handler)(InputReader&); + } commands[] = { + {"raw", &DvisvgmSpecialHandler::preprocessRaw}, + {"rawdef", &DvisvgmSpecialHandler::preprocessRawDef}, + {"rawset", &DvisvgmSpecialHandler::preprocessRawSet}, + {"endrawset", &DvisvgmSpecialHandler::preprocessEndRawSet}, + {"rawput", &DvisvgmSpecialHandler::preprocessRawPut}, + }; + + StreamInputReader ir(is); + string cmd = ir.getWord(); + for (size_t i=0; i < sizeof(commands)/sizeof(Command); i++) { + if (commands[i].name == cmd) { + ir.skipSpace(); + (this->*commands[i].handler)(ir); + return; + } + } +} + + +void DvisvgmSpecialHandler::preprocessRawSet (InputReader &ir) { + _nestingLevel++; + string id = ir.getString(); + if (id.empty()) + throw SpecialException("definition of unnamed SVG fragment"); + if (_nestingLevel > 1) + throw SpecialException("nested definition of SVG fragment '" + id + "'"); + + _currentMacro = _macros.find(id); + if (_currentMacro != _macros.end()) { + _currentMacro = _macros.end(); + throw SpecialException("redefinition of SVG fragment '" + id + "'"); + } + pair entry(id, StringVector()); + pair state = _macros.insert(entry); + _currentMacro = state.first; +} + + +void DvisvgmSpecialHandler::preprocessEndRawSet (InputReader&) { + if (_nestingLevel > 0 && --_nestingLevel == 0) + _currentMacro = _macros.end(); +} + + +void DvisvgmSpecialHandler::preprocessRaw (InputReader &ir) { + if (_currentMacro == _macros.end()) + return; + string str = ir.getLine(); + if (!str.empty()) + _currentMacro->second.push_back(string("P")+str); +} + + +void DvisvgmSpecialHandler::preprocessRawDef (InputReader &ir) { + if (_currentMacro == _macros.end()) + return; + string str = ir.getLine(); + if (!str.empty()) + _currentMacro->second.push_back(string("D")+str); +} + + +void DvisvgmSpecialHandler::preprocessRawPut (InputReader &ir) { + if (_currentMacro != _macros.end()) + throw SpecialException("dvisvgm:rawput not allowed inside rawset/endrawset"); +} + + +/** Evaluates and executes a dvisvgm special statement. + * @param[in] prefix special prefix read by the SpecialManager + * @param[in] is the special statement is read from this stream + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +bool DvisvgmSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + if (!actions) + return true; + + struct Command { + const char *name; + void (DvisvgmSpecialHandler::*handler)(InputReader&, SpecialActions*); + } commands[] = { + {"raw", &DvisvgmSpecialHandler::processRaw}, + {"rawdef", &DvisvgmSpecialHandler::processRawDef}, + {"rawset", &DvisvgmSpecialHandler::processRawSet}, + {"endrawset", &DvisvgmSpecialHandler::processEndRawSet}, + {"rawput", &DvisvgmSpecialHandler::processRawPut}, + {"bbox", &DvisvgmSpecialHandler::processBBox}, + {"img", &DvisvgmSpecialHandler::processImg}, + }; + StreamInputReader ir(is); + string cmd = ir.getWord(); + for (size_t i=0; i < sizeof(commands)/sizeof(Command); i++) { + if (commands[i].name == cmd) { + ir.skipSpace(); + (this->*commands[i].handler)(ir, actions); + return true; + } + } + return true; +} + + +/** Replaces constants of the form {?name} by their corresponding value. + * @param[in,out] str text to expand + * @param[in] actions interfcae to the world outside the special handler */ +static void expand_constants (string &str, SpecialActions *actions) { + struct Constant { + const char *name; + string val; + } + constants[] = { + {"x", XMLString(actions->getX())}, + {"y", XMLString(actions->getY())}, + {"color", actions->getColor().svgColorString()}, + {"nl", "\n"}, + {0, ""} + }; + bool repl_bbox = true; + while (repl_bbox) { + size_t pos = str.find(string("{?bbox ")); + if (pos == string::npos) + repl_bbox = false; + else { + size_t endpos = pos+7; + while (endpos < str.length() && isalnum(str[endpos])) + ++endpos; + if (str[endpos] == '}') { + BoundingBox &box=actions->bbox(str.substr(pos+7, endpos-pos-7)); + str.replace(pos, endpos-pos+1, box.toSVGViewBox()); + } + else + repl_bbox = false; + } + } + for (const Constant *p=constants; p->name; p++) { + const string pattern = string("{?")+p->name+"}"; + size_t pos = str.find(pattern); + while (pos != string::npos) { + str.replace(pos, strlen(p->name)+3, p->val); + pos = str.find(pattern, pos+p->val.length()); // look for further matches + } + } +} + + +void DvisvgmSpecialHandler::processRaw (InputReader &ir, SpecialActions *actions) { + if (_nestingLevel == 0) { + string str = ir.getLine(); + if (!str.empty()) { + expand_constants(str, actions); + actions->appendToPage(new XMLTextNode(str)); + } + } +} + + +void DvisvgmSpecialHandler::processRawDef (InputReader &ir, SpecialActions *actions) { + if (_nestingLevel == 0) { + string str = ir.getLine(); + if (!str.empty()) { + expand_constants(str, actions); + actions->appendToDefs(new XMLTextNode(str)); + } + } +} + + +void DvisvgmSpecialHandler::processRawSet (InputReader&, SpecialActions*) { + _nestingLevel++; +} + + +void DvisvgmSpecialHandler::processEndRawSet (InputReader&, SpecialActions*) { + if (_nestingLevel > 0) + _nestingLevel--; +} + + +void DvisvgmSpecialHandler::processRawPut (InputReader &ir, SpecialActions *actions) { + if (_nestingLevel > 0) + return; + string id = ir.getString(); + MacroMap::iterator it = _macros.find(id); + if (it == _macros.end()) + throw SpecialException("undefined SVG fragment '" + id + "' referenced"); + + StringVector &defs = it->second; + for (StringVector::iterator defs_it=defs.begin(); defs_it != defs.end(); ++defs_it) { + char &type = defs_it->at(0); + string def = defs_it->substr(1); + if ((type == 'P' || type == 'D') && !def.empty()) { + expand_constants(def, actions); + if (type == 'P') + actions->appendToPage(new XMLTextNode(def)); + else { // type == 'D' + actions->appendToDefs(new XMLTextNode(def)); + type = 'L'; // locked + } + } + } +} + + +/** Embeds the virtual rectangle (x, y ,w , h) into the current bounding box, + * where (x,y) is the lower left vertex composed of the current DVI position. + * @param[in] w width of the rectangle in PS point units + * @param[in] h height of the rectangle in PS point units + * @param[in] d depth of the rectangle in PS point units + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +static void update_bbox (double w, double h, double d, SpecialActions *actions) { + double x = actions->getX(); + double y = actions->getY(); + actions->embed(BoundingBox(x, y, x+w, y-h)); + actions->embed(BoundingBox(x, y, x+w, y+d)); +} + + +/** Evaluates the special dvisvgm:bbox. + * variant 1: dvisvgm:bbox [r[el]] [] + * variant 2: dvisvgm:bbox a[bs] + * variant 3: dvisvgm:bbox f[ix] + * variant 4: dvisvgm:bbox n[ew] */ +void DvisvgmSpecialHandler::processBBox (InputReader &ir, SpecialActions *actions) { + const double pt2bp = 72/72.27; + ir.skipSpace(); + int c = ir.peek(); + if (isalpha(c)) { + while (!isspace(ir.peek())) // skip trailing characters + ir.get(); + if (c == 'n') { + ir.skipSpace(); + string name; + while (isalnum(ir.peek())) + name += char(ir.get()); + ir.skipSpace(); + if (!name.empty() && ir.eof()) + actions->bbox(name, true); // create new user box + } + else if (c == 'a' || c == 'f') { + double p[4]; + for (int i=0; i < 4; i++) + p[i] = ir.getDouble()*pt2bp; + BoundingBox b(p[0], p[1], p[2], p[3]); + if (c == 'a') + actions->embed(b); + else { + actions->bbox() = b; + actions->bbox().lock(); + } + } + } + else + c = 'r'; // no mode specifier => relative box parameters + + if (c == 'r') { + double w = ir.getDouble()*pt2bp; + double h = ir.getDouble()*pt2bp; + double d = ir.getDouble()*pt2bp; + update_bbox(w, h, d, actions); + } +} + + +void DvisvgmSpecialHandler::processImg (InputReader &ir, SpecialActions *actions) { + if (actions) { + const double pt2bp = 72/72.27; + double w = ir.getDouble()*pt2bp; + double h = ir.getDouble()*pt2bp; + string f = ir.getString(); + update_bbox(w, h, 0, actions); + XMLElementNode *img = new XMLElementNode("image"); + img->addAttribute("x", actions->getX()); + img->addAttribute("y", actions->getY()); + img->addAttribute("width", w); + img->addAttribute("height", h); + img->addAttribute("xlink:href", f); + if (!actions->getMatrix().isIdentity()) + img->addAttribute("transform", actions->getMatrix().getSVG()); + actions->appendToPage(img); + } +} + + +void DvisvgmSpecialHandler::dviPreprocessingFinished () { + string id; + if (_currentMacro != _macros.end()) + id = _currentMacro->first; + // ensure all pattern definitions are closed after pre-processing the whole DVI file + _currentMacro = _macros.end(); + _nestingLevel = 0; + if (!id.empty()) + throw SpecialException("missing dvisvgm:endrawset for SVG fragment '" + id + "'"); +} + + +void DvisvgmSpecialHandler::dviEndPage (unsigned) { + for (MacroMap::iterator map_it=_macros.begin(); map_it != _macros.end(); ++map_it) { + StringVector &vec = map_it->second; + for (StringVector::iterator str_it=vec.begin(); str_it != vec.end(); ++str_it) { + // activate locked parts of a pattern again + if (str_it->at(0) == 'L') + str_it->at(0) = 'D'; + } + } +} + + +const char** DvisvgmSpecialHandler::prefixes () const { + static const char *pfx[] = {"dvisvgm:", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h new file mode 100644 index 00000000000..fb3a0c754aa --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DvisvgmSpecialHandler.h @@ -0,0 +1,67 @@ +/************************************************************************* +** DvisvgmSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_DVISVGMSPECIALHANDLER_H +#define DVISVGM_DVISVGMSPECIALHANDLER_H + +#include +#include +#include +#include "SpecialHandler.h" + +class InputReader; +struct SpecialActions; + +class DvisvgmSpecialHandler : public SpecialHandler, public DVIPreprocessingListener, public DVIEndPageListener +{ + typedef std::vector StringVector; + typedef std::map MacroMap; + + public: + DvisvgmSpecialHandler (); + const char* name () const {return "dvisvgm";} + const char* info () const {return "special set for embedding raw SVG snippets";} + const char** prefixes () const; + void preprocess (const char *prefix, std::istream &is, SpecialActions *actions); + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + + protected: + void preprocessRaw (InputReader &ir); + void preprocessRawDef (InputReader &ir); + void preprocessRawSet (InputReader &ir); + void preprocessEndRawSet (InputReader &ir); + void preprocessRawPut (InputReader &ir); + void processRaw (InputReader &ir, SpecialActions *actions); + void processRawDef (InputReader &ir, SpecialActions *actions); + void processRawSet (InputReader &ir, SpecialActions *actions); + void processEndRawSet (InputReader &ir, SpecialActions *actions); + void processRawPut (InputReader &ir, SpecialActions *actions); + void processBBox (InputReader &ir, SpecialActions *actions); + void processImg (InputReader &ir, SpecialActions *actions); + void dviPreprocessingFinished (); + void dviEndPage (unsigned pageno); + + private: + MacroMap _macros; + MacroMap::iterator _currentMacro; + int _nestingLevel; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp new file mode 100644 index 00000000000..3b8632599a3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.cpp @@ -0,0 +1,115 @@ +/************************************************************************* +** EPSFile.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "EPSFile.h" +#include "InputBuffer.h" +#include "InputReader.h" + +using namespace std; + + +/** Reads a little-endian 32-bit integer from the given input stream. */ +static UInt32 getUInt32 (istream &is) { + UInt32 value=0; + char buf[4]; + is.read(buf, 4); + for (int i=0; i < 4; i++) + value |= ((buf[i] & 255) << (8*i)); + return value; +} + + +static size_t getline (istream &is, char *line, size_t n) { + char buf[512]; + is.get(buf, min(n, (size_t)512)-1); + n = is.gcount(); + size_t linelen=0; + for (size_t i=0; i < n; i++) + if (isprint(buf[i])) + line[linelen++] = buf[i]; + line[linelen] = 0; + if (is.peek() == '\n') + is.get(); + else + is.ignore(numeric_limits::max(), '\n'); + return linelen; +} + + +EPSFile::EPSFile (const std::string& fname) : _ifs(fname.c_str(), ios::binary), _headerValid(false), _offset(0), _pslength(0) +{ + if (_ifs) { + if (getUInt32(_ifs) != 0xC6D3D0C5) // no binary header present? + _ifs.seekg(0); // go back to the first byte + else { + _offset = getUInt32(_ifs); // stream offset where PS part of the file begins + _pslength = getUInt32(_ifs); // length of PS section in bytes + _ifs.seekg(_offset); // continue reading at the beginning of the PS section + } + string str; + str += _ifs.get(); + str += _ifs.get(); + _headerValid = (str == "%!"); + _ifs.seekg(0); + } +} + + +/** Returns an input stream for the EPS file. The stream pointer is automatically moved + * to the beginning of the ASCII (PostScript) part of the file. */ +istream& EPSFile::istream () const { + _ifs.clear(); + _ifs.seekg(_offset); + return _ifs; +} + + +/** Extracts the bounding box information from the DSC header/footer (if present) + * @param[out] box the extracted bounding box + * @return true if %%BoundingBox data could be read successfully */ +bool EPSFile::bbox (BoundingBox &box) const { + std::istream &is = EPSFile::istream(); + if (is) { + char buf[64]; + while (is) { + size_t linelen = getline(is, buf, 64); + if (strncmp(buf, "%%BoundingBox:", 14) == 0) { + CharInputBuffer ib(buf, linelen); + BufferInputReader ir(ib); + ir.skip(14); + ir.skipSpace(); + if (!ir.check("(atend)", true)) { + int val[4]; + for (int i=0; i < 4; i++) { + ir.skipSpace(); + ir.parseInt(val[i]); + } + box = BoundingBox(val[0], val[1], val[2], val[3]); + return true; + } + } + } + } + return false; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h new file mode 100644 index 00000000000..24871103327 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSFile.h @@ -0,0 +1,46 @@ +/************************************************************************* +** EPSFile.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_EPSFILE_H +#define DVISVGM_EPSFILE_H + +#include +#include +#include "BoundingBox.h" +#include "types.h" + +class EPSFile +{ + public: + EPSFile (const std::string &fname); + std::istream& istream () const; + bool hasValidHeader () const {return _headerValid;} + bool bbox (BoundingBox &box) const; + UInt32 pslength () const {return _pslength;} + + private: + mutable std::ifstream _ifs; + bool _headerValid; ///< true if file has a valid header + UInt32 _offset; ///< stream offset where ASCII part of the file begins + UInt32 _pslength; ///< length of PS section (in bytes) +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp new file mode 100644 index 00000000000..555e3549760 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.cpp @@ -0,0 +1,108 @@ +/************************************************************************* +** EPSToSVG.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "EPSFile.h" +#include "EPSToSVG.h" +#include "Message.h" +#include "MessageException.h" +#include "PsSpecialHandler.h" +#include "SVGOutput.h" +#include "System.h" + + +using namespace std; + + +void EPSToSVG::convert () { +#ifndef HAVE_LIBGS + if (!Ghostscript().available()) + throw MessageException("Ghostscript is required to process the EPS file"); +#endif + EPSFile epsfile(_fname); + if (!epsfile.hasValidHeader()) + throw PSException("invalid EPS file"); + + BoundingBox bbox; + epsfile.bbox(bbox); + if (bbox.width() == 0 || bbox.height() == 0) + Message::wstream(true) << "bounding box of file " << _fname << " is empty\n"; + Message::mstream(false, Message::MC_PAGE_NUMBER) << "processing file " << _fname << '\n'; + Message::mstream().indent(1); + _svg.newPage(1); + // create a psfile special and forward it to the PsSpecialHandler + stringstream ss; + ss << "\"" << _fname << "\" " + "llx=" << bbox.minX() << " " + "lly=" << bbox.minY() << " " + "urx=" << bbox.maxX() << " " + "ury=" << bbox.maxY(); + PsSpecialHandler pshandler; + pshandler.process("psfile=", ss, this); + progress(0); + // output SVG file + _svg.setBBox(_bbox); + _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); + _svg.write(_out.getPageStream(1, 1)); + string svgfname = _out.filename(1, 1); + const double bp2pt = 72.27/72; + const double bp2mm = 25.4/72; + Message::mstream(false, Message::MC_PAGE_SIZE) << "graphic size: " << XMLString(bbox.width()*bp2pt) << "pt" + " x " << XMLString(bbox.height()*bp2pt) << "pt" + " (" << XMLString(bbox.width()*bp2mm) << "mm" + " x " << XMLString(bbox.height()*bp2mm) << "mm)\n"; + Message::mstream(false, Message::MC_PAGE_WRITTEN) << "graphic written to " << (svgfname.empty() ? "" : svgfname) << '\n'; +} + + +string EPSToSVG::getSVGFilename (unsigned pageno) const { + if (pageno == 1) + return _out.filename(1, 1); + return ""; +} + + +void EPSToSVG::progress (const char *id) { + static double time=0; + static bool draw=false; // show progress indicator? + static size_t count=0; + count++; + // don't show the progress indicator before the given time has elapsed + if (!draw && System::time()-time > PROGRESSBAR_DELAY) { + draw = true; + Terminal::cursor(false); + Message::mstream(false) << "\n"; + } + if (draw && ((System::time() - time > 0.05) || id == 0)) { + const size_t DIGITS=6; + Message::mstream(false, Message::MC_PROGRESS) + << string(DIGITS-min(DIGITS, static_cast(log10(count))), ' ') + << count << " PostScript instructions processed\r"; + // overprint indicator when finished + if (id == 0) { + Message::estream().clearline(); + Terminal::cursor(true); + } + time = System::time(); + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h new file mode 100644 index 00000000000..841ffe5d0a9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EPSToSVG.h @@ -0,0 +1,72 @@ +/************************************************************************* +** EPSToSVG.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_EPSTOSVG_H +#define DVISVGM_EPSTOSVG_H + +#include +#include "SpecialActions.h" +#include "SVGTree.h" + +struct SVGOutputBase; + +class EPSToSVG : protected SpecialActions +{ + public: + EPSToSVG (const std::string &fname, SVGOutputBase &out) : _fname(fname), _out(out), _x(0), _y(0) {} + void convert (); + void setTransformation (const Matrix &m); + void setPageSize (const std::string &name); + + protected: + // implement abstract base class SpecialActions + double getX () const {return _x;} + double getY () const {return _y;} + void setX (double x) {_x = x; _svg.setX(x);} + void setY (double y) {_y = y; _svg.setY(y);} + void finishLine () {} + void setColor (const Color &color) {_svg.setColor(color);} + Color getColor () const {return _svg.getColor();} + void setMatrix (const Matrix &m) {_svg.setMatrix(m);} + const Matrix& getMatrix () const {return _svg.getMatrix();} + void getPageTransform (Matrix &matrix) const {} + void setBgColor (const Color &color) {} + void appendToPage (XMLNode *node) {_svg.appendToPage(node);} + void appendToDefs (XMLNode *node) {_svg.appendToDefs(node);} + void prependToPage (XMLNode *node) {_svg.prependToPage(node);} + void pushContextElement (XMLElementNode *node) {_svg.pushContextElement(node);} + void popContextElement () {_svg.popContextElement();} + void embed (const BoundingBox &bbox) {_bbox.embed(bbox);} + void embed (const DPair &p, double r=0) {if (r==0) _bbox.embed(p); else _bbox.embed(p, r);} + void progress (const char *id); + unsigned getCurrentPageNumber() const {return 0;} + BoundingBox& bbox () {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} + std::string getSVGFilename (unsigned pageno) const; + + private: + std::string _fname; ///< name of EPS file + SVGTree _svg; + SVGOutputBase &_out; + double _x, _y; + BoundingBox _bbox; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp new file mode 100644 index 00000000000..20293b204bc --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.cpp @@ -0,0 +1,233 @@ +/************************************************************************* +** EmSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "EmSpecialHandler.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "SpecialActions.h" +#include "XMLNode.h" +#include "XMLString.h" + +using namespace std; + + +EmSpecialHandler::EmSpecialHandler () : _linewidth(0.4*72/72.27), _actions(0) { +} + + +/** Computes the "cut vector" that is used to compute the line shape. + * Because each line has a width > 0 the actual shape of the line is a tetragon. + * The 4 vertices can be influenced by the cut parameter c that specifies + * a horizontal, vertical or orthogonal cut of a line end. Depending on c and the + * line's slope a cut vector v can be computed that, relatively to endpoint p, denotes + * the 2 vertices of that line end: v1=p+v and v2=p-v. + * @param[in] c cut direction ('h', 'v' or 'p') + * @param[in] v direction vector of line to be drawn + * @param[in] lw width of line to be drawn + * @return the "cut vector" */ +static DPair cut_vector (char c, const DPair &v, double lw) { + if (c == 'p') + return v.ortho()/v.length() * (lw/2); + DPair cut; + if (c == 'v' && v.x() != 0) { + double slope = v.y()/v.x(); + double h = sqrt(lw*lw*(1+slope*slope)); + cut.y(0.5*h); + } + else if (v.y() != 0) { // c == 'h' + double slope = v.x()/v.y(); + double h = sqrt(lw*lw*(1+slope*slope)); + double sgn = slope < 0 ? 1.0 : -1.0; + cut.x(0.5*h*sgn); + } + return cut; +} + + +/** Creates the SVG element that will a the line. + * @param[in] p1 first endpoint in PS point units + * @param[in] p2 second endpoint in PS point units + * @param[in] c1 cut method of first endpoint ('h', 'v' or 'p') + * @param[in] c2 cut method of second endpoint ('h', 'v' or 'p') + * @param[in] lw line width in PS point units + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, double lw, SpecialActions *actions) { + XMLElementNode *node=0; + DPair dir = p2-p1; + if (dir.x() == 0 || dir.y() == 0 || (c1 == 'p' && c2 == 'p')) { + // draw regular line + node = new XMLElementNode("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()); + // update bounding box + actions->embed(p1); + actions->embed(p2); + } + else { + // draw polygon + 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; + node = new XMLElementNode("polygon"); + 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->addAttribute("points", oss.str()); + if (actions->getColor() != Color::BLACK) + node->addAttribute("fill", actions->getColor().svgColorString()); + // update bounding box + actions->embed(q11); + actions->embed(q12); + actions->embed(q21); + actions->embed(q22); + } + actions->appendToPage(node); +} + + +static double read_length (InputReader &in) { + struct Unit { + const char *name; + double factor; + } + units[] = { + {"pt", 1.0}, + {"pc", 12.0}, + {"in", 72.27}, + {"bp", 72.27/72}, + {"cm", 72.27/2.54}, + {"mm", 72.27/25.4}, + {"dd", 1238.0/1157}, + {"cc", 1238.0/1157*12}, + {"sp", 1.0/65536}, + {0, 0} + }; + double len = in.getDouble(); + in.skipSpace(); + for (Unit *p=units; p->name; p++) + if (in.check(p->name)) { + len *= p->factor; + break; + } + return len*72/72.27; +} + + +bool EmSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + // em:moveto => move graphic cursor to dvi cursor + // em:lineto => draw line from graphic cursor to dvi cursor, move graphic cursor to dvi cursor + // em:linewidth => set line width to + // em:point [,[,]] => defines point as (,); if and/or is missing, + // the corresponding dvi cursor coordinate is inserted + // and are lengths + // em:line [h|v|p], [h|v|p] [,] => draws line of width from point # to point # + // point number suffixes: + // h: cut line horizontally + // v: cut line vertically + // p: cut line orthogonally to line direction (default) + // if is omitted, the global line width is used + // + // supported length units: pt, pc, in, bp, cm, mm, dd, cc, sp + // default line width: 0.4pt + + if (actions) { + _actions = actions; // save pointer to SpecialActions for later use in endPage + StreamInputBuffer ib(is, 128); + BufferInputReader in(ib); + string cmd = in.getWord(); + if (cmd == "moveto") + _pos = DPair(actions->getX(), actions->getY()); + else if (cmd == "lineto") { + DPair p(actions->getX(), actions->getY()); + create_line(_pos, p, 'p', 'p', _linewidth, actions); + _pos = p; + } + else if (cmd == "linewidth") + _linewidth = read_length(in); + else if (cmd == "point") { + DPair p(actions->getX(), actions->getY()); + int n = in.getInt(); + if (in.getPunct() == ',') { + p.x(in.getDouble()); + if (in.getPunct() == ',') + p.y(in.getDouble()); + } + _points[n] = p; + } + else if (cmd == "line") { + int n1 = in.getInt(); + int c1 = 'p'; + if (isalpha(in.peek())) + c1 = in.get(); + in.getPunct(); + int n2 = in.getInt(); + int c2 = 'p'; + if (isalpha(in.peek())) + c2 = in.get(); + double lw = _linewidth; + if (in.getPunct() == ',') + lw = read_length(in); + map::iterator it1=_points.find(n1); + map::iterator it2=_points.find(n2); + if (it1 != _points.end() && it2 != _points.end()) + create_line(it1->second, it2->second, char(c1), char(c2), lw, actions); + else { + // Line endpoints havn't necessarily to be defined before + // a line definition. If a point wasn't defined yet we push the line + // in a wait list and process the lines at the end of the page. + _lines.push_back(Line(n1, n2, char(c1), char(c2), lw)); + } + } + } + return true; +} + + +/** This method is called at the end of a DVI page. Here we have to draw all pending + * lines that are still in the line list. All line endpoints must be defined until here. */ +void EmSpecialHandler::dviEndPage (unsigned pageno) { + if (_actions) { + FORALL(_lines, list::iterator, it) { + map::iterator pit1=_points.find(it->p1); + map::iterator pit2=_points.find(it->p2); + if (pit1 != _points.end() && pit2 != _points.end()) + create_line(pit1->second, pit2->second, it->c1, it->c2, it->width, _actions); + // all lines with still undefined points are ignored + } + } + // line and point definitions are local to a page + _lines.clear(); + _points.clear(); +} + + +const char** EmSpecialHandler::prefixes () const { + static const char *pfx[] = {"em:", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h new file mode 100644 index 00000000000..7b3c78b6b24 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EmSpecialHandler.h @@ -0,0 +1,57 @@ +/************************************************************************* +** EmSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_EMSPECIALHANDLER_H +#define DVISVGM_EMSPECIALHANDLER_H + +#include +#include +#include "Pair.h" +#include "SpecialHandler.h" + + +class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener +{ + struct Line { + Line (int pp1, int pp2, char cc1, char cc2, double w) : p1(pp1), p2(pp2), c1(cc1), c2(cc2), width(w) {} + int p1, p2; ///< point numbers of line ends + char c1, c2; ///< cut type of line ends (h, v or p) + double width; ///< line width + }; + + public: + EmSpecialHandler (); + const char* name () const {return "em";} + const char* info () const {return "line drawing statements of the emTeX special set";} + const char** prefixes () const; + bool process (const char *prefix, std::istream &in, SpecialActions *actions); + + protected: + void dviEndPage (unsigned pageno); + + private: + std::map _points; ///< points defined by special em:point + std::list _lines; ///< list of lines with undefined end points + double _linewidth; ///< global line width + DPair _pos; ///< current position of "graphic cursor" + SpecialActions *_actions; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp new file mode 100644 index 00000000000..cc1b8151e14 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.cpp @@ -0,0 +1,134 @@ +/************************************************************************* +** EncFile.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "Font.h" +#include "EncFile.h" +#include "FontMap.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "FileFinder.h" +#include "Message.h" + +using namespace std; + +static string read_entry (InputReader &in); +static bool valid_name_char (int c); + + +EncFile::EncFile (const string &encname) : _encname(encname) +{ + read(); +} + + +const char* EncFile::path () const { + return FileFinder::lookup(_encname+".enc", false); +} + + +/** Search for suitable enc-file and read its encoding information. + * The file contents must be a valid PostScript vector with 256 entries. */ +void EncFile::read () { + if (const char *p = path()) { + ifstream ifs(p); + read(ifs); + } + else + Message::wstream(true) << "encoding file '" << _encname << ".enc' not found\n"; +} + + +/** Read encoding information from stream. */ +void EncFile::read (istream &is) { + StreamInputBuffer ib(is, 256); + BufferInputReader in(ib); + _table.resize(256); + + // find beginning of vector + while (!in.eof()) { + in.skipSpace(); + if (in.peek() == '%') + in.skipUntil("\n"); + else + if (in.get() == '[') + break; + } + + // read vector entries + int n=0; + while (!in.eof()) { + in.skipSpace(); + if (in.peek() == '%') + in.skipUntil("\n"); + else if (in.peek() == ']') { + in.get(); + break; + } + else { + string entry = read_entry(in); + if (entry == ".notdef") + entry.clear(); + if (n < 256) + _table[n++] = entry; + } + } + // remove trailing .notdef names + for (n--; n > 0 && _table[n].empty(); n--); + _table.resize(n+1); +} + + +static string read_entry (InputReader &in) { + string entry; + bool accept_slashes=true; + while (!in.eof() && ((in.peek() == '/' && accept_slashes) || valid_name_char(in.peek()))) { + if (in.peek() != '/') + accept_slashes = false; + entry += in.get(); + } + if (entry.length() > 1) { + // strip leading slashes + // According to the PostScript specification, a single slash without further + // following characters is a valid name. + size_t n=0; + while (n < entry.length() && entry[n] == '/') + n++; + entry = entry.substr(n); + } + return entry; +} + + +static bool valid_name_char (int c) { + const char *delimiters = "<>(){}[]/~%"; + return isprint(c) && !isspace(c) && !strchr(delimiters, c); +} + + +/** Returns an entry of the encoding table. + * @param[in] c character code + * @return character name assigned to character code c*/ +const char* EncFile::charName (UInt32 c) const { + if (c < _table.size()) + return !_table[c].empty() ? _table[c].c_str() : 0; + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h new file mode 100644 index 00000000000..249db961054 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/EncFile.h @@ -0,0 +1,50 @@ +/************************************************************************* +** EncFile.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_ENCFILE_H +#define DVISVGM_ENCFILE_H + +#include +#include +#include +#include +#include "FontEncoding.h" +#include "types.h" + + +class EncFile : public NamedFontEncoding +{ + public: + EncFile (const std::string &name); + void read (); + void read (std::istream &is); + int size () const {return _table.size();} + const char* name () const {return _encname.c_str();} + const char* charName (UInt32 c) const; + Character decode (UInt32 c) const {return Character(charName(c));} + bool mapsToCharIndex () const {return false;} + const char* path () const; + + private: + std::string _encname; + std::vector _table; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp new file mode 100644 index 00000000000..2418c8fb786 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.cpp @@ -0,0 +1,278 @@ +/************************************************************************* +** FileFinder.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include + +#ifdef MIKTEX + #include "MessageException.h" + #include "MiKTeXCom.h" + static MiKTeXCom *miktex=0; +#else + #ifdef KPSE_CXX_UNSAFE + extern "C" { + #endif + #include + #ifdef KPSE_CXX_UNSAFE + } + #endif +#endif + +#include +#include +#include +#include +#include "FileFinder.h" +#include "FileSystem.h" +#include "FontMap.h" +#include "Message.h" +#include "Process.h" + +// --------------------------------------------------- + +static bool _initialized = false; +static bool _mktex_enabled = false; + +// --------------------------------------------------- + +static const char* find_file (const std::string &fname, const char *ftype); +static const char* find_mapped_file (std::string fname); +static const char* mktex (const std::string &fname); + + +/** Initializes the file finder. This function must be called before any other + * FileFinder function. + * @param[in] argv0 argv[0] of main() function + * @param[in] progname name of application using the FileFinder + * @param[in] enable_mktexmf if true, tfm and mf file generation is activated */ +void FileFinder::init (const char *argv0, const char *progname, bool enable_mktexmf) { + if (_initialized) + return; + + _mktex_enabled = enable_mktexmf; +#ifdef MIKTEX + miktex = new MiKTeXCom; +#else + kpse_set_program_name(argv0, progname); + // enable tfm and mf generation (actually invoked by calls of kpse_make_tex) + kpse_set_program_enabled(kpse_tfm_format, 1, kpse_src_env); + kpse_set_program_enabled(kpse_mf_format, 1, kpse_src_env); + kpse_make_tex_discard_errors = true; // suppress messages from mktexFOO tools +#ifdef TEXLIVEWIN32 + texlive_gs_init(); +#endif +#endif + _initialized = true; +} + + +/** Cleans up the FileFinder. This function must be called before leaving the + * application's main() function. */ +void FileFinder::finish () { +#ifdef MIKTEX + if (miktex) { + delete miktex; + miktex = 0; + } +#endif + _initialized = false; +} + + +/** Returns the version string of the underlying file searching library (kpathsea, MiKTeX) */ +std::string FileFinder::version () { +#ifdef MIKTEX + bool autoinit=false; + try { + if (!_initialized) { + init("", "", false); + autoinit = true; + } + std::string ret = miktex->getVersion(); + if (autoinit) + finish(); + return ret; + } + catch (MessageException &e) { + if (autoinit) + finish(); + } +#else + if (const char *v = strrchr(KPSEVERSION, ' ')) + return v+1; +#endif + return "unknown"; +} + + +/** Determines filetype by the filename extension and calls kpse_find_file + * to actually look up the file. + * @param[in] fname name of file to look up + * @param[in] ftype expected file format of file fname; if 0, it's derived from the filename suffix + * @return file path on success, 0 otherwise */ +static const char* find_file (const std::string &fname, const char *ftype) { + if (!_initialized || fname.empty()) + return 0; + + std::string ext; + if (ftype) + ext = ftype; + else { + size_t pos = fname.rfind('.'); + if (pos == std::string::npos) + return 0; // no extension and no file type => no search + ext = fname.substr(pos+1); + } + + static std::string buf; +#ifdef MIKTEX + if (ext == "dll" || ext == "exe") { + // lookup dll and exe files in the MiKTeX bin directory first + buf = miktex->getBinDir() + "/" + fname; + if (FileSystem::exists(buf.c_str())) + return buf.c_str(); + } + else if (ext == "cmap") { + // The MiKTeX SDK doesn't support the lookup of files without suffix (yet), thus + // it's not possible to find cmap files which usually don't have a suffix. In order + // to work around this, we try to lookup the files by calling kpsewhich. + Process process("kpsewhich", std::string("-format=cmap ")+fname); + process.run(&buf); + return buf.empty() ? 0 : buf.c_str(); + } + try { + return miktex->findFile(fname.c_str()); + } + catch (const MessageException &e) { + return 0; + } +#else +#ifdef TEXLIVEWIN32 + if (ext == "exe") { + // lookup exe files in directory where dvisvgm is located + if (const char *path = kpse_var_value("SELFAUTOLOC")) { + buf = std::string(path) + "/" + fname; + return FileSystem::exists(buf.c_str()) ? buf.c_str() : 0; + } + return 0; + } +#endif + static std::map types; + if (types.empty()) { + types["tfm"] = kpse_tfm_format; + types["pfb"] = kpse_type1_format; + types["vf"] = kpse_vf_format; + types["mf"] = kpse_mf_format; + types["ttc"] = kpse_truetype_format; + types["ttf"] = kpse_truetype_format; + types["otf"] = kpse_opentype_format; + types["map"] = kpse_fontmap_format; + types["cmap"] = kpse_cmap_format; + types["sty"] = kpse_tex_format; + types["enc"] = kpse_enc_format; + types["pro"] = kpse_tex_ps_header_format; + types["sfd"] = kpse_sfd_format; + } + std::map::iterator it = types.find(ext.c_str()); + if (it == types.end()) + return 0; + + if (char *path = kpse_find_file(fname.c_str(), it->second, 0)) { + // In the current version of libkpathsea, each call of kpse_find_file produces + // a memory leak since the path buffer is not freed. I don't think we can do + // anything against it here... + buf = path; + std::free(path); + return buf.c_str(); + } + return 0; +#endif +} + + +/** Checks whether the given file is mapped to a different name and if the + * file can be found under this name. + * @param[in] fname name of file to look up + * @return file path on success, 0 otherwise */ +static const char* find_mapped_file (std::string fname) { + size_t pos = fname.rfind('.'); + if (pos == std::string::npos) + return 0; + const std::string ext = fname.substr(pos+1); // file extension + const std::string base = fname.substr(0, pos); + if (const FontMap::Entry *entry = FontMap::instance().lookup(base)) { + const char *path=0; + if (entry->fontname.find('.') != std::string::npos) // does the mapped filename has an extension? + path = find_file(entry->fontname, 0); // look for that file + else { // otherwise, use extension of unmapped file + fname = entry->fontname + "." + ext; + (path = find_file(fname, 0)) || (path = mktex(fname)); + } + return path; + } + return 0; +} + + +/** Runs external mktexFOO tool to create missing tfm or mf file. + * @param[in] fname name of file to build + * @return file path on success, 0 otherwise */ +static const char* mktex (const std::string &fname) { + if (!_initialized) + return 0; + + size_t pos = fname.rfind('.'); + if (!_mktex_enabled || pos == std::string::npos) + return 0; + + std::string ext = fname.substr(pos+1); // file extension + if (ext != "tfm" && ext != "mf") + return 0; + + const char *path = 0; +#ifdef MIKTEX + // maketfm and makemf are located in miktex/bin which is in the search PATH + std::string toolname = (ext == "tfm" ? "miktex-maketfm" : "miktex-makemf"); + system((toolname+".exe "+fname).c_str()); + path = find_file(fname, 0); +#else + kpse_file_format_type type = (ext == "tfm" ? kpse_tfm_format : kpse_mf_format); + path = kpse_make_tex(type, fname.c_str()); +#endif + return path; +} + + +/** Searches a file in the TeX directory tree. + * If the file doesn't exist, maximal two further steps are applied + * (if "extended" is true): + * - checks whether the filename is mapped to a different name and returns + * the path to that name + * - in case of tfm or mf files: invokes the external mktextfm/mktexmf tool + * to create the missing file + * @param[in] fname name of file to look up + * @param[in] ftype type/format of file to look up + * @param[in] extended if true, use fontmap lookup and mktexFOO calls + * @return path to file on success, 0 otherwise */ +const char* FileFinder::lookup (const std::string &fname, const char *ftype, bool extended) { + const char *path; + if ((path = find_file(fname, ftype)) || (extended && ((path = find_mapped_file(fname)) || (path = mktex(fname))))) + return path; + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h new file mode 100644 index 00000000000..6727bd3e81d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileFinder.h @@ -0,0 +1,35 @@ +/************************************************************************* +** FileFinder.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_KPSFILEFINDER_H +#define DVISVGM_KPSFILEFINDER_H + +#include + +struct FileFinder +{ + static void init (const char *argv0, const char *progname, bool enable_mktexmf); + static void finish (); + static std::string version (); + static const char* lookup (const std::string &fname, const char *ftype, bool extended=true); + static const char* lookup (const std::string &fname, bool extended=true) {return lookup(fname, 0, extended);} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp new file mode 100644 index 00000000000..fc8430145f5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.cpp @@ -0,0 +1,258 @@ +/************************************************************************* +** FilePath.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "FilePath.h" +#include "FileSystem.h" +#include "MessageException.h" +#include "macros.h" + +using namespace std; + + +/** Removes redundant slashes from a given path. */ +static string& single_slashes (string &str) { + size_t pos=0; + while ((pos = str.find("//", pos)) != string::npos) + str.replace(pos, 2, "/"); + return str; +} + + +#ifdef __WIN32__ +static char strip_drive_letter (string &path) { + char letter = 0; + if (path.length() >= 2 && path[1] == ':' && isalpha(path[0])) { + letter = tolower(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) + ":").c_str())) { + path.insert(0, FileSystem::getcwd()+"/"); + strip_drive_letter(path); + } + else + throw MessageException("drive " + string(1, target_drive) + ": not accessible"); + } + } + } + return target_drive; +} + + +static void tolower (string &str) { + for (size_t i=0; i < str.length(); ++i) + str[i] = tolower(str[i]); +} +#endif + + +/** Constructs a FilePath object from a given path. Relative paths are + * relative to the current working directory. + * @param[in] path absolute or relative path to a file or directory */ +FilePath::FilePath (const string &path) { + init(path, !FileSystem::isDirectory(path.c_str()), FileSystem::getcwd()); +} + + +/** Constructs a FilePath object. + * @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 + * @param[in] current_dir if 'path' is a relative path expression it will be related to 'current_dir' */ +FilePath::FilePath (const string &path, bool isfile, string current_dir) { + init(path, isfile, current_dir); +} + + +/** Initializes a FilePath object. This method should be called by the constructors only. + * @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 + * @param[in] current_dir if 'path' is a relative path expression it will be related to 'current_dir' */ +void FilePath::init (string path, bool isfile, string current_dir) { + single_slashes(path); + single_slashes(current_dir); +#ifdef __WIN32__ + tolower(path); + path = FileSystem::adaptPathSeperators(path); + _drive = strip_drive_letter(path); +#endif + if (isfile) { + size_t pos = path.rfind('/'); + _fname = path.substr((pos == string::npos) ? 0 : pos+1); + if (pos != string::npos) + path.erase(pos); + else + path.clear(); + } + if (current_dir.empty()) + current_dir = FileSystem::getcwd(); +#ifdef __WIN32__ + tolower(current_dir); + _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 + "/"); + string elem; + FORALL (path, string::const_iterator, it) { + if (*it == '/') { + add(elem); + elem.clear(); + } + else + elem += *it; + } + add(elem); +} + + +/** Adds a location step to the current path. */ +void FilePath::add (const string &dir) { + if (dir == ".." && !_dirs.empty()) + _dirs.pop_back(); + else if (dir.length() > 0 && dir != ".") + _dirs.push_back(dir); +} + + +/** Returns the suffix of the filename. If FilePath represents the + * location of a directory (and not of a file) an empty string + * is returned. */ +string FilePath::suffix () const { + size_t start = 0; + // ignore leading dots + while (start < _fname.length() && _fname[start] == '.') + start++; + string sub = _fname.substr(start); + size_t pos = sub.rfind('.'); + if (pos != string::npos && pos < sub.length()-1) + return sub.substr(pos+1); + return ""; +} + + +/** Changes the suffix of the filename. If FilePath represents the + * location of a directory (and not of a file) nothing happens. + * @param[in] s new suffix */ +void FilePath::suffix (const string &s) { + if (!_fname.empty()) { + string current_suffix = suffix(); + if (!current_suffix.empty()) + _fname.erase(_fname.length()-current_suffix.length()-1); + _fname += "."+s; + } +} + + +/** Returns the filename without suffix. + * Example: FilePath("/a/b/c.def", true) == "c" */ +string FilePath::basename () const { + if (!_fname.empty()) { + size_t len = suffix().length(); + if (len > 0) + len++; // strip dot too + return _fname.substr(0, _fname.length()-len); + } + return ""; +} + + +/** Returns the absolute path string of this FilePath. + * @param[in] with_filename if false, the filename is omitted + * @return the absolute path string */ +string FilePath::absolute (bool with_filename) const { + string path; + FORALL (_dirs, ConstIterator, it) { + path += "/" + *it; + } + 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); +} + + +/** Returns a path string of this FilePath relative to reldir. If we wanted to + * navigate from /a/b/c/d to /a/b/e/f using the shell command "cd", we could do that + * with the relative path argument: "cd ../../e/f". This function returns such a relative + * path. Example: FilePath("/a/b/e/f").relative("/a/b/c/d") => "../../e/f". + * @param[in] reldir absolute path to a directory + * @param[in] with_filename if false, the filename is omitted + * @return the relative path string */ +string FilePath::relative (string reldir, bool with_filename) const { + if (reldir.empty()) + reldir = FileSystem::getcwd(); +#ifdef __WIN32__ + adapt_current_path(reldir, _drive); +#endif + if (reldir[0] != '/') + return absolute(); + FilePath rel(reldir, false); + string path; +#ifdef __WIN32__ + if (rel._drive && _drive && rel._drive != _drive) + path += string(1, _drive) + ":"; +#endif + ConstIterator i = _dirs.begin(); + ConstIterator j = rel._dirs.begin(); + while (i != _dirs.end() && j != rel._dirs.end() && *i == *j) + ++i, ++j; + for (; j != rel._dirs.end(); ++j) + path += "../"; + for (; i != _dirs.end(); ++i) + path += *i + "/"; + if (!path.empty()) + path.erase(path.length()-1, 1); // remove trailing slash + if (with_filename && !_fname.empty()) { + if (!path.empty() && path != "/") + path += "/"; + path += _fname; + } + if (path.empty()) + path = "."; + return single_slashes(path); +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h new file mode 100644 index 00000000000..005d9ecc66e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.h @@ -0,0 +1,59 @@ +/************************************************************************* +** FilePath.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FILEPATH_H +#define DVISVGM_FILEPATH_H + +#include +#include + +class FilePath +{ + typedef std::vector Directories; + typedef Directories::iterator Iterator; + typedef Directories::const_iterator ConstIterator; + public: + FilePath (const std::string &path); + FilePath (const std::string &path, bool isfile, std::string current_dir=""); + std::string absolute (bool with_filename=true) const; + std::string relative (std::string reldir="", bool with_filename=true) const; + std::string basename () const; + std::string suffix () const; + void suffix (const std::string &s); + size_t depth () const {return _dirs.size();} + bool isFile () const {return !_fname.empty();} + bool empty () const {return _dirs.empty() && _fname.empty();} + const std::string& filename () const {return _fname;} + void filename (const std::string &fname) {_fname = fname;} + + protected: + void init (std::string path, bool isfile, std::string current_dir); + void add (const std::string &elem); + + private: + Directories _dirs; + std::string _fname; +#ifdef __WIN32__ + char _drive; +#endif +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp new file mode 100644 index 00000000000..a0c93177ac8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp @@ -0,0 +1,330 @@ +/************************************************************************* +** FileSystem.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "FileSystem.h" +#include "macros.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + + +using namespace std; + +#ifdef __WIN32__ + #include + #include + const char *FileSystem::DEVNULL = "nul"; + const char FileSystem::PATHSEP = '\\'; + #define unlink _unlink +#else + #include + #include + #include + #include + const char *FileSystem::DEVNULL = "/dev/null"; + const char FileSystem::PATHSEP = '/'; +#endif + + +bool FileSystem::remove (const string &fname) { + return unlink(fname.c_str()) == 0; +} + + +/** Copies a file. + * @param[in] src path of file to copy + * @param[in] dest path of target file + * @param[in] remove_src remove file 'src' if true + * @return true on success */ +bool FileSystem::copy (const string &src, const string &dest, bool remove_src) { + ifstream ifs(src.c_str(), ios::in|ios::binary); + ofstream ofs(dest.c_str(), ios::out|ios::binary); + if (ifs && ofs) { + ofs << ifs.rdbuf(); + if (!ifs.fail() && !ofs.fail() && remove_src) { + ofs.close(); + ifs.close(); + return remove(src); + } + else + return !remove_src; + } + return false; +} + + +bool FileSystem::rename (const string &oldname, const string &newname) { + return ::rename(oldname.c_str(), newname.c_str()) == 0; +} + + +UInt64 FileSystem::filesize (const string &fname) { +#ifdef __WIN32__ + // unfortunately, stat doesn't work properly under Windows + // so we have to use this freaky code + WIN32_FILE_ATTRIBUTE_DATA attr; + GetFileAttributesExA(fname.c_str(), GetFileExInfoStandard, &attr); + return (static_cast(attr.nFileSizeHigh) << (8*sizeof(attr.nFileSizeLow))) | attr.nFileSizeLow; +#else + struct stat attr; + return (stat(fname.c_str(), &attr) == 0) ? attr.st_size : 0; +#endif +} + + +string FileSystem::adaptPathSeperators (string path) { + for (size_t i=0; i < path.length(); i++) + if (path[i] == PATHSEP) + path[i] = '/'; + return path; +} + + +string FileSystem::getcwd () { + char buf[1024]; +#ifdef __WIN32__ + return adaptPathSeperators(_getcwd(buf, 1024)); +#else + return ::getcwd(buf, 1024); +#endif +} + + +/** Changes the work directory. + * @param[in] dir path to new work directory + * @return true on success */ +bool FileSystem::chdir (const char *dir) { + bool success = false; + if (dir) { +#ifdef __WIN32__ + success = (_chdir(dir) == 0); +#else + success = (chdir(dir) == 0); +#endif + } + return success; +} + + +/** Returns the user's home directory. */ +const char* FileSystem::userdir () { +#ifdef __WIN32__ + const char *drive=getenv("HOMEDRIVE"); + const char *path=getenv("HOMEPATH"); + if (drive && path) { + static string ret = string(drive)+path; + if (!ret.empty()) + return ret.c_str(); + } + return 0; +#else + const char *dir=getenv("HOME"); + if (!dir) { + if (const char *user=getenv("USER")) { + if (struct passwd *pw=getpwnam(user)) + dir = pw->pw_dir; + } + } + return dir; +#endif +} + + +/** Private wrapper function for mkdir: creates a single folder. + * @param[in] dir folder name + * @return true on success */ +static bool s_mkdir (const char *dir) { + bool success = true; + if (!FileSystem::exists(dir)) { +#ifdef __WIN32__ + success = (_mkdir(dir) == 0); +#else + success = (mkdir(dir, 0776) == 0); +#endif + } + return success; +} + + +static bool inline s_rmdir (const char *dir) { +#ifdef __WIN32__ + return (_rmdir(dir) == 0); +#else + return (rmdir(dir) == 0); +#endif +} + + +/** Removes leading and trailing whitespace from a string. */ +static string trim (const string &str) { + int first=0, last=str.length()-1; + while (isspace(str[first])) + first++; + while (isspace(str[last])) + last--; + return str.substr(first, last-first+1); +} + + +/** Creates a new folder relative to the current work directory. If necessary, + * the parent folders are also created. + * @param[in] dir single folder name or path to folder + * @return true if folder(s) could be created */ +bool FileSystem::mkdir (const char *dir) { + bool success = false; + if (dir) { + success = true; + const string dirstr = adaptPathSeperators(trim(dir)); + for (size_t pos=1; success && (pos = dirstr.find('/', pos)) != string::npos; pos++) + success &= s_mkdir(dirstr.substr(0, pos).c_str()); + success &= s_mkdir(dirstr.c_str()); + } + return success; +} + + +/** Removes a directory and its contents. + * @param[in] dirname path to directory + * @return true on success */ +bool FileSystem::rmdir (const char *dirname) { + bool ok = false; + if (dirname && isDirectory(dirname)) { + ok = true; +#ifdef __WIN32__ + string pattern = string(dirname) + "/*"; + WIN32_FIND_DATA data; + HANDLE h = FindFirstFile(pattern.c_str(), &data); + bool ready = (h == INVALID_HANDLE_VALUE); + while (!ready && ok) { + const char *fname = data.cFileName; + string path = string(dirname) + "/" + fname; + if (isDirectory(path.c_str())) { + if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) + ok = rmdir(path.c_str()) && s_rmdir(path.c_str()); + } + else if (isFile(path.c_str())) + ok = remove(path); + else + ok = false; + ready = !FindNextFile(h, &data); + } + FindClose(h); +#else + if (DIR *dir = opendir(dirname)) { + struct dirent *ent; + while ((ent = readdir(dir)) && ok) { + const char *fname = ent->d_name; + string path = string(fname) + "/" + fname; + if (isDirectory(path.c_str())) { + if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) + ok = rmdir(path.c_str()) && s_rmdir(path.c_str()); + } + else if (isFile(path.c_str())) + ok = remove(path); + else + ok = false; + } + closedir(dir); + } +#endif + ok = s_rmdir(dirname); + } + return ok; +} + + +/** Checks if a file or directory exits. */ +bool FileSystem::exists (const char *fname) { + if (!fname) + return false; +#ifdef __WIN32__ + return GetFileAttributes(fname) != INVALID_FILE_ATTRIBUTES; +#else + struct stat attr; + return stat(fname, &attr) == 0; +#endif +} + + +/** Returns true if 'fname' references a directory. */ +bool FileSystem::isDirectory (const char *fname) { + if (!fname) + return false; +#ifdef __WIN32__ + return GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY; +#else + struct stat attr; + return stat(fname, &attr) == 0 && S_ISDIR(attr.st_mode); +#endif +} + + +/** Returns true if 'fname' references a file. */ +bool FileSystem::isFile (const char *fname) { + if (!fname) + return false; +#ifdef __WIN32__ + ifstream ifs(fname); + return (bool)ifs; +#else + struct stat attr; + return stat(fname, &attr) == 0 && S_ISREG(attr.st_mode); +#endif +} + + +int FileSystem::collect (const char *dirname, vector &entries) { + entries.clear(); +#ifdef __WIN32__ + string pattern = string(dirname) + "/*"; + WIN32_FIND_DATA data; + HANDLE h = FindFirstFile(pattern.c_str(), &data); + bool ready = (h == INVALID_HANDLE_VALUE); + while (!ready) { + string fname = data.cFileName; + string path = string(dirname)+"/"+fname; + string typechar = isFile(path.c_str()) ? "f" : isDirectory(path.c_str()) ? "d" : "?"; + if (fname != "." && fname != "..") + entries.push_back(typechar+fname); + ready = !FindNextFile(h, &data); + } + FindClose(h); +#else + if (DIR *dir = opendir(dirname)) { + struct dirent *ent; + while ((ent = readdir(dir))) { + string fname = ent->d_name; + string path = string(dirname)+"/"+fname; + string typechar = isFile(path.c_str()) ? "f" : isDirectory(path.c_str()) ? "d" : "?"; + if (fname != "." && fname != "..") + entries.push_back(typechar+fname); + } + closedir(dir); + } +#endif + return entries.size(); +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h new file mode 100644 index 00000000000..d14454262ac --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.h @@ -0,0 +1,48 @@ +/************************************************************************* +** FileSystem.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FILESYSTEM_H +#define DVISVGM_FILESYSTEM_H + +#include +#include +#include "types.h" + +struct FileSystem +{ + static bool remove (const std::string &fname); + static bool rename (const std::string &oldname, const std::string &newname); + static bool copy (const std::string &src, const std::string &dest, bool remove_src=false); + static UInt64 filesize (const std::string &fname); + static std::string adaptPathSeperators (std::string path); + static std::string getcwd (); + static bool chdir (const char *dir); + static bool exists (const char *file); + static bool mkdir (const char *dir); + static bool rmdir (const char *fname); + static int collect (const char *dirname, std::vector &entries); + static bool isDirectory (const char *fname); + static bool isFile (const char *fname); + static const char* userdir (); + static const char* DEVNULL; + static const char PATHSEP; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp new file mode 100644 index 00000000000..d09f3c7d334 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.cpp @@ -0,0 +1,664 @@ +/************************************************************************* +** Font.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "CMap.h" +#include "FileFinder.h" +#include "FileSystem.h" +#include "Font.h" +#include "FontEncoding.h" +#include "FontEngine.h" +#include "GFGlyphTracer.h" +#include "Glyph.h" +#include "Message.h" +#include "MetafontWrapper.h" +#include "TFM.h" +#include "VFReader.h" +#include "SignalHandler.h" +#include "Subfont.h" +#include "SVGTree.h" +#include "Unicode.h" +#include "macros.h" + + +using namespace std; + + +UInt32 Font::unicode (UInt32 c) const { + return Unicode::charToCodepoint(c); +} + + +/** Returns the encoding object of this font which is asigned in a map file. + * If there's no encoding assigned, the function returns 0. */ +const FontEncoding* Font::encoding () const { + if (const FontMap::Entry *entry = fontMapEntry()) + return FontEncoding::encoding(entry->encname); + return 0; +} + + +const FontMap::Entry* Font::fontMapEntry () const { + string fontname = name(); + size_t pos = fontname.rfind('.'); + if (pos != string::npos) + fontname = fontname.substr(0, pos); // strip extension + return FontMap::instance().lookup(fontname); +} + + +/** Compute the extents of a given glyph. + * @param[in] c character code of glyph + * @param[in] vertical true if is glyph is part of vertical aligned text + * @param[out] metrics the resulting extents */ +void Font::getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const { + double s = scaleFactor(); + if (vertical) { // get metrics for vertical text flow? + if (verticalLayout()) { // is the font designed for vertical texts? + metrics.wl = s*charDepth(c); + metrics.wr = s*charHeight(c); + metrics.h = 0; + metrics.d = s*charWidth(c); + } + else { // rotate box by 90 degrees for alphabetic text + metrics.wl = s*charDepth(c); + metrics.wr = s*charHeight(c); + metrics.h = 0; + metrics.d = s*(charWidth(c)+italicCorr(c)); + } + } + else { + metrics.wl = 0; + metrics.wr = s*(charWidth(c)+italicCorr(c)); + metrics.h = s*charHeight(c); + metrics.d = s*charDepth(c); + } +} + + +const char* Font::filename () const { + const char *fname = strrchr(path(), '/'); + if (fname) + return fname+1; + return path(); +} + +/////////////////////////////////////////////////////////////////////////////////////// + +TFMFont::TFMFont (string name, UInt32 cs, double ds, double ss) + : _metrics(0), _fontname(name), _checksum(cs), _dsize(ds), _ssize(ss) +{ +} + + +TFMFont::~TFMFont () { + delete _metrics; +} + + +/** Returns a font metrics object for the current font. + * @throw FontException if TFM file can't be found */ +const FontMetrics* TFMFont::getMetrics () const { + if (!_metrics) { + try { + _metrics = FontMetrics::read(_fontname.c_str()); + if (!_metrics) { + _metrics = new NullFontMetric; + Message::wstream(true) << "can't find "+_fontname+".tfm\n"; + } + } + catch (FontMetricException &e) { + _metrics = new NullFontMetric; + Message::wstream(true) << e.what() << " in " << _fontname << ".tfm\n"; + } + } + return _metrics; +} + + +double TFMFont::charWidth (int c) const { + double w = getMetrics() ? getMetrics()->getCharWidth(c) : 0; + if (style()) { + w *= style()->extend; + w += fabs(style()->slant*charHeight(c)); // slant := tan(phi) = dx/height + } + return w; +} + + +double TFMFont::italicCorr (int c) const { + double w = getMetrics() ? getMetrics()->getItalicCorr(c) : 0; + if (style()) + w *= style()->extend; + return w; +} + + +double TFMFont::charDepth (int c) const {return getMetrics() ? getMetrics()->getCharDepth(c) : 0;} +double TFMFont::charHeight (int c) const {return getMetrics() ? getMetrics()->getCharHeight(c) : 0;} + + +/** Tests if the checksum of the font matches that of the corresponding TFM file. */ +bool TFMFont::verifyChecksums () const { + if (_checksum != 0 && getMetrics() && getMetrics()->getChecksum() != 0) + return _checksum == getMetrics()->getChecksum(); + return true; +} + +////////////////////////////////////////////////////////////////////////////// + +// static class variables +bool PhysicalFont::EXACT_BBOX = false; +bool PhysicalFont::KEEP_TEMP_FILES = false; +const char *PhysicalFont::CACHE_PATH = 0; +double PhysicalFont::METAFONT_MAG = 4; +FontCache PhysicalFont::_cache; + + +Font* PhysicalFont::create (string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type) { + return new PhysicalFontImpl(name, 0, checksum, dsize, ssize, type); +} + + +Font* PhysicalFont::create (string name, int fontindex, UInt32 checksum, double dsize, double ssize) { + return new PhysicalFontImpl(name, fontindex, checksum, dsize, ssize, PhysicalFont::TTC); +} + + +const char* PhysicalFont::path () const { + const char *ext=0; + switch (type()) { + case OTF: ext = "otf"; break; + case PFB: ext = "pfb"; break; + case TTC: ext = "ttc"; break; + case TTF: ext = "ttf"; break; + case MF : ext = "mf"; break; + default : ext = 0; + } + if (ext) + return FileFinder::lookup(name()+"."+ext); + return FileFinder::lookup(name()); +} + + +/** Returns true if this font is CID-based. */ +bool PhysicalFont::isCIDFont () const { + if (type() == MF) + return false; + FontEngine::instance().setFont(*this); + return FontEngine::instance().isCIDFont(); +} + + +/** Retrieve the IDs of all charachter maps available in the font file. + * @param[out] charMapIDs IDs of the found character maps + * @return number of found character maps */ +int PhysicalFont::collectCharMapIDs (std::vector &charMapIDs) const { + if (type() == MF) + return 0; + FontEngine::instance().setFont(*this); + return FontEngine::instance().getCharMapIDs(charMapIDs); +} + + +/** Decodes a character code used in the DVI file to the code required to + * address the correct character in the font. + * @param[in] c DVI character to decode + * @return target character code or name */ +Character PhysicalFont::decodeChar (UInt32 c) const { + if (const FontEncoding *enc = encoding()) + return enc->decode(c); + return Character(Character::CHRCODE, c); +} + + +/** Returns the number of units per EM. The EM square is the virtual area a glyph is designed on. + * All coordinates used to specify portions of the glyph are relative to the origin (0,0) at the + * lower left corner of this square, while the upper right corner is located at (m,m), where m + * is an integer value defined with the font, and returned by this function. */ +int PhysicalFont::unitsPerEm() const { + if (type() == MF) + return 1000; + FontEngine::instance().setFont(*this); + return FontEngine::instance().getUnitsPerEM(); +} + + +int PhysicalFont::hAdvance () const { + if (type() == MF) + return 0; + FontEngine::instance().setFont(*this); + return FontEngine::instance().getHAdvance(); +} + + +double PhysicalFont::hAdvance (int c) const { + if (type() == MF) + return unitsPerEm()*charWidth(c)/designSize(); + FontEngine::instance().setFont(*this); + if (const FontMap::Entry *entry = fontMapEntry()) + if (Subfont *sf = entry->subfont) + c = sf->decode(c); + return FontEngine::instance().getHAdvance(decodeChar(c)); +} + + +double PhysicalFont::vAdvance (int c) const { + if (type() == MF) + return unitsPerEm()*charWidth(c)/designSize(); + FontEngine::instance().setFont(*this); + if (const FontMap::Entry *entry = fontMapEntry()) + if (Subfont *sf = entry->subfont) + c = sf->decode(c); + return FontEngine::instance().getVAdvance(decodeChar(c)); +} + + +string PhysicalFont::glyphName (int c) const { + if (type() == MF) + return ""; + FontEngine::instance().setFont(*this); + if (const FontMap::Entry *entry = fontMapEntry()) + if (Subfont *sf = entry->subfont) + c = sf->decode(c); + return FontEngine::instance().getGlyphName(decodeChar(c)); +} + + +double PhysicalFont::scaledAscent() const { + return ascent()*scaledSize()/unitsPerEm(); +} + + +int PhysicalFont::ascent () const { + if (type() == MF) + return 0; + FontEngine::instance().setFont(*this); + return FontEngine::instance().getAscender(); +} + + +int PhysicalFont::descent () const { + if (type() == MF) + return 0; + FontEngine::instance().setFont(*this); + return FontEngine::instance().getDescender(); +} + + +/** Extracts the glyph outlines of a given character. + * @param[in] c character code of requested glyph + * @param[out] glyph path segments of the glyph outline + * @param[in] cb optional callback object for tracer class + * @return true if outline could be computed */ +bool PhysicalFont::getGlyph (int c, GraphicPath &glyph, GFGlyphTracer::Callback *cb) const { + if (type() == MF) { + const Glyph *cached_glyph=0; + if (CACHE_PATH) { + _cache.write(CACHE_PATH); + _cache.read(name().c_str(), CACHE_PATH); + cached_glyph = _cache.getGlyph(c); + } + if (cached_glyph) { + glyph = *cached_glyph; + return true; + } + else { + string gfname; + if (createGF(gfname)) { + try { + double ds = getMetrics() ? getMetrics()->getDesignSize() : 1; + GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb); + tracer.setGlyph(glyph); + tracer.executeChar(c); + glyph.closeOpenSubPaths(); + if (CACHE_PATH) + _cache.setGlyph(c, glyph); + return true; + } + catch (GFException &e) { + // @@ print error message + } + } + else { + Message::wstream(true) << "failed creating " << name() << ".gf\n"; + } + } + } + else { // vector fonts (OTF, PFB, TTF, TTC) + bool ok=true; + FontEngine::instance().setFont(*this); + if (const FontMap::Entry *entry = fontMapEntry()) + if (Subfont *sf = entry->subfont) + c = sf->decode(c); + ok = FontEngine::instance().traceOutline(decodeChar(c), glyph, false); + glyph.closeOpenSubPaths(); + return ok; + } + return false; +} + + +/** Creates a GF file for this font object. + * @param[out] gfname name of GF font file + * @return true on success */ +bool PhysicalFont::createGF (string &gfname) const { + SignalHandler::instance().check(); + gfname = name()+".gf"; + MetafontWrapper mf(name()); + bool ok = mf.make("ljfour", METAFONT_MAG); // call Metafont if necessary + return ok && mf.success() && getMetrics(); +} + + +/** Traces all glyphs of the current font and stores them in the cache. If caching is disabled, nothing happens. + * @param[in] includeCached if true, glyphs already cached are traced again + * @param[in] cb optional callback methods called by the tracer + * @return number of glyphs traced */ +int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const { + int count = 0; + if (type() == MF && CACHE_PATH) { + if (const FontMetrics *metrics = getMetrics()) { + int fchar = metrics->firstChar(); + int lchar = metrics->lastChar(); + string gfname; + Glyph glyph; + if (createGF(gfname)) { + _cache.read(name().c_str(), CACHE_PATH); + double ds = getMetrics() ? getMetrics()->getDesignSize() : 1; + GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb); + tracer.setGlyph(glyph); + for (int i=fchar; i <= lchar; i++) { + if (includeCached || !_cache.getGlyph(i)) { + glyph.clear(); + tracer.executeChar(i); + glyph.closeOpenSubPaths(); + _cache.setGlyph(i, glyph); + ++count; + } + } + _cache.write(CACHE_PATH); + } + } + } + return count; +} + + +/** Computes the exact bounding box of a glyph. + * @param[in] c character code of the glyph + * @param[out] bbox the computed bounding box + * @param[in] cb optional calback object forwarded to the tracer + * @return true if the box could be computed successfully */ +bool PhysicalFont::getExactGlyphBox(int c, BoundingBox& bbox, GFGlyphTracer::Callback* cb) const { + Glyph glyph; + if (getGlyph(c, glyph, cb)) { + glyph.computeBBox(bbox); + double s = scaledSize()/unitsPerEm(); + bbox.scale(s, s); + return true; + } + return false; +} + + +bool PhysicalFont::getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb) const { + BoundingBox charbox; + if (!getExactGlyphBox(c, charbox, cb)) + return false; + if ((metrics.wl = -charbox.minX()) < 0) metrics.wl=0; + if ((metrics.wr = charbox.maxX()) < 0) metrics.wr=0; + if ((metrics.h = charbox.maxY()) < 0) metrics.h=0; + if ((metrics.d = -charbox.minY()) < 0) metrics.d=0; + if (vertical) { // vertical text orientation + if (verticalLayout()) { // font designed for vertical layout? + metrics.wl = metrics.wr = (metrics.wl+metrics.wr)/2; + metrics.d += metrics.h; + metrics.h = 0; + } + else { + double depth = metrics.d; + metrics.d = metrics.wr; + metrics.wr = metrics.h; + metrics.h = metrics.wl; + metrics.wl = depth; + } + } + return true; +} + + +Font* VirtualFont::create (string name, UInt32 checksum, double dsize, double ssize) { + return new VirtualFontImpl(name, checksum, dsize, ssize); +} + + +////////////////////////////////////////////////////////////////////////////// + + +PhysicalFontImpl::PhysicalFontImpl (string name, int fontindex, UInt32 cs, double ds, double ss, PhysicalFont::Type type) + : TFMFont(name, cs, ds, ss), + _filetype(type), _fontIndex(fontindex), _fontMapEntry(Font::fontMapEntry()), _encodingPair(Font::encoding()), _localCharMap(0) +{ +} + + +PhysicalFontImpl::~PhysicalFontImpl () { + if (CACHE_PATH) + _cache.write(CACHE_PATH); + if (!KEEP_TEMP_FILES) + tidy(); + delete _localCharMap; +} + + +const FontEncoding* PhysicalFontImpl::encoding () const { + if (!_encodingPair.enc1()) + return 0; + return &_encodingPair; +} + + +bool PhysicalFontImpl::findAndAssignBaseFontMap () { + const FontEncoding *enc = encoding(); + if (enc && enc->mapsToCharIndex()) { + // try to find a base font map that maps from character indexes to a suitable + // target encoding supported by the font file + if (const FontEncoding *bfmap = enc->findCompatibleBaseFontMap(this, _charmapID)) + _encodingPair.assign(bfmap); + else + return false; + } + else if (type() != MF) { + FontEngine::instance().setFont(*this); + if ((_localCharMap = FontEngine::instance().createCustomToUnicodeMap()) != 0) + _charmapID = FontEngine::instance().setCustomCharMap(); + else + _charmapID = FontEngine::instance().setUnicodeCharMap(); + } + return true; +} + + +/** Returns the Unicode point for a given DVI character. */ +UInt32 PhysicalFontImpl::unicode (UInt32 c) const { + if (type() == MF) + return Font::unicode(c); + Character chr = decodeChar(c); + if (type() == PFB) { + // try to get the Unicode point from the character name + string glyphname = glyphName(c); + UInt32 codepoint; + if (!glyphname.empty() && (codepoint = Unicode::psNameToCodepoint(glyphname)) != 0) + return codepoint; + if (c <= 0x1900) // does character code c fit into Private Use Zone U+E000? + return 0xe000+c; +// Message::wstream() << "can't properly map PS character '" << glyphname << "' (0x" << hex << c << ") to Unicode\n"; + // If we get here, there is no easy mapping. As for now, we use the character code as Unicode point. + // Although quite unlikely, it might collide with properly mapped characters. + return Unicode::charToCodepoint(c); + } + if (chr.type() == Character::NAME || chr.number() == 0) + return Unicode::charToCodepoint(chr.number()); + + if (_localCharMap) { + if (UInt32 mapped_char = _localCharMap->valueAt(chr.number())) + return mapped_char; + } + // No Unicode equivalent found in the font file. + // Now we should look for a smart alternative but at the moment + // it's sufficient to simply choose a valid unused codepoint. + return Unicode::charToCodepoint(chr.number()); +} + + +/** Delete all temporary font files created by Metafont. */ +void PhysicalFontImpl::tidy () const { + if (type() == MF) { + const char *ext[] = {"gf", "tfm", "log", 0}; + for (const char **p=ext; *p; ++p) { + if (FileSystem::exists((name()+"."+(*p)).c_str())) + FileSystem::remove(name()+"."+(*p)); + } + } +} + +////////////////////////////////////////////////////////////////////////////// + +string NativeFont::uniqueName (const string &path, const FontStyle &style) { + static map ids; + ostringstream oss; + oss << path << "b" << style.bold << "e" << style.extend << "s" << style.slant; + map::iterator it = ids.find(oss.str()); + int id = ids.size(); + if (it == ids.end()) + ids[oss.str()] = id; + else + id = it->second; + oss.str(""); + oss << "nf" << id; + return oss.str(); +} + + +string NativeFont::name () const { + return uniqueName(path(), _style); +} + + +PhysicalFont::Type NativeFont::type () const { + if (const char *filepath = path()) { + if (const char *p =strrchr(filepath, '.')) { + string ext = p+1; + if (ext == "otf") + return PhysicalFont::OTF; + if (ext == "ttf") + return PhysicalFont::TTF; + if (ext == "pfb") + return PhysicalFont::PFB; + } + } + return PhysicalFont::UNKNOWN; +} + + +double NativeFont::charWidth (int c) const { + FontEngine::instance().setFont(*this); + int upem = FontEngine::instance().getUnitsPerEM(); + double w = upem ? (scaledSize()*FontEngine::instance().getAdvance(c)/upem*_style.extend) : 0; + w += fabs(_style.slant*charHeight(c)); + return w; +} + + +double NativeFont::charHeight (int c) const { + FontEngine::instance().setFont(*this); + int upem = FontEngine::instance().getUnitsPerEM(); + return upem ? (scaledSize()*FontEngine::instance().getAscender()/upem) : 0; +} + + +double NativeFont::charDepth (int c) const { + FontEngine::instance().setFont(*this); + int upem = FontEngine::instance().getUnitsPerEM(); + return upem ? (-scaledSize()*FontEngine::instance().getDescender()/upem) : 0; +} + + +bool NativeFontImpl::findAndAssignBaseFontMap () { + FontEngine &fe = FontEngine::instance(); + fe.setFont(*this); + fe.setUnicodeCharMap(); + fe.buildCharMap(_toUnicodeMap); + if (!_toUnicodeMap.addMissingMappings(fe.getNumGlyphs())) + Message::wstream(true) << "incomplete Unicode mapping for native font " << name() << " (" << filename() << ")\n"; + return true; +} + + +Character NativeFontImpl::decodeChar (UInt32 c) const { + return Character(Character::INDEX, c); +} + + +UInt32 NativeFontImpl::unicode (UInt32 c) const { + UInt32 ucode = _toUnicodeMap.valueAt(c); + return Unicode::charToCodepoint(ucode); +} + +////////////////////////////////////////////////////////////////////////////// + +VirtualFontImpl::VirtualFontImpl (string name, UInt32 cs, double ds, double ss) + : TFMFont(name, cs, ds, ss) +{ +} + + +VirtualFontImpl::~VirtualFontImpl () { + // delete dvi vectors received by VFReaderAction + for (map::iterator i=_charDefs.begin(); i != _charDefs.end(); ++i) + delete i->second; +} + + +const char* VirtualFontImpl::path () const { + return FileFinder::lookup(name()+".vf"); +} + + +void VirtualFontImpl::assignChar (UInt32 c, DVIVector *dvi) { + if (dvi) { + if (_charDefs.find(c) == _charDefs.end()) + _charDefs[c] = dvi; + else + delete dvi; + } +} + + +const vector* VirtualFontImpl::getDVI (int c) const { + map::const_iterator it = _charDefs.find(c); + return (it == _charDefs.end() ? 0 : it->second); +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h new file mode 100644 index 00000000000..e1959f202e1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.h @@ -0,0 +1,392 @@ +/************************************************************************* +** Font.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONT_H +#define DVISVGM_FONT_H + +#include +#include +#include +#include "Character.h" +#include "CharMapID.h" +#include "Color.h" +#include "FontCache.h" +#include "FontEncoding.h" +#include "FontMap.h" +#include "FontMetrics.h" +#include "GFGlyphTracer.h" +#include "Glyph.h" +#include "GraphicPath.h" +#include "MessageException.h" +#include "RangeMap.h" +#include "ToUnicodeMap.h" +#include "VFActions.h" +#include "VFReader.h" +#include "types.h" + + +struct FontStyle; + + +struct GlyphMetrics +{ + GlyphMetrics () : wl(0), wr(0), h(0), d(0) {} + GlyphMetrics (double wwl, double wwr, double hh, double dd) : wl(wwl), wr(wwr), h(hh), d(dd) {} + double wl, wr, h, d; +}; + + +/** Abstract base for all font classes. */ +struct Font { + virtual ~Font () {} + virtual Font* clone (double ds, double sc) const =0; + virtual const Font* uniqueFont () const =0; + virtual std::string name () const =0; + virtual double designSize () const =0; + virtual double scaledSize () const =0; + virtual double scaleFactor () const {return scaledSize()/designSize();} + virtual double charWidth (int c) const =0; + virtual double charDepth (int c) const =0; + virtual double charHeight (int c) const =0; + virtual double italicCorr (int c) const =0; + virtual const FontMetrics* getMetrics () const =0; + 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 *cb=0) const =0; + virtual void getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const; + virtual UInt32 unicode (UInt32 c) const; + virtual void tidy () const {} + virtual bool findAndAssignBaseFontMap () {return true;} + virtual bool verticalLayout () const {return getMetrics() ? getMetrics()->verticalLayout() : false;} + virtual bool verifyChecksums () const {return true;} + virtual int fontIndex () const {return 0;} + virtual const FontStyle* style () const {return 0;} + virtual Color color () const {return Color::BLACK;} + virtual const FontMap::Entry* fontMapEntry () const; +}; + + +/** Empty font without any glyphs. Instances of this class are used + * if no physical or virtual font file can be found. + * The metric values returned by the member functions are based on cmr10. */ +struct EmptyFont : public Font +{ + public: + EmptyFont (std::string name) : _fontname(name) {} + Font* clone (double ds, double sc) const {return new EmptyFont(*this);} + const Font* uniqueFont () const {return this;} + std::string name () const {return _fontname;} + double designSize () const {return 10;} // cmr10 design size in pt + double scaledSize () const {return 10;} // cmr10 scaled size in pt + double charWidth (int c) const {return 9.164;} // width of cmr10's 'M' in pt + double charHeight (int c) const {return 6.833;} // height of cmr10's 'M' in pt + double charDepth (int c) const {return 0;} + double italicCorr (int c) const {return 0;} + const FontMetrics* getMetrics () const {return 0;} + const char* path () const {return 0;} + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} + + private: + std::string _fontname; +}; + + +/** Interface for all physical fonts. */ +class PhysicalFont : public virtual Font +{ + public: + enum Type {MF, OTF, PFB, TTC, TTF, UNKNOWN}; + + static Font* create (std::string name, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); + static Font* create (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize); + virtual Type type () const =0; + virtual bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const; + virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb=0) const; + virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb=0) const; + virtual bool isCIDFont () const; + virtual int hAdvance () const; + virtual double hAdvance (int c) const; + virtual double vAdvance (int c) const; + std::string glyphName (int c) const; + virtual int unitsPerEm () const; + virtual double scaledAscent () const; + virtual int ascent () const; + virtual int descent () const; + virtual int traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb=0) const; + virtual int collectCharMapIDs (std::vector &charmapIDs) const; + virtual CharMapID getCharMapID () const =0; + virtual void setCharMapID (const CharMapID &id) {} + virtual Character decodeChar (UInt32 c) const; + const char* path () const; + + protected: + bool createGF (std::string &gfname) const; + + public: + static bool EXACT_BBOX; + static bool KEEP_TEMP_FILES; + static const char *CACHE_PATH; ///< path to cache directory (0 if caching is disabled) + static double METAFONT_MAG; ///< magnification factor for Metafont calls + + protected: + static FontCache _cache; +}; + + +/** Interface for all virtual fonts. */ +class VirtualFont : public virtual Font +{ + friend class FontManager; + public: + typedef std::vector DVIVector; + + public: + static Font* create (std::string name, UInt32 checksum, double dsize, double ssize); + virtual const DVIVector* getDVI (int c) const =0; + bool getGlyph (int c, Glyph &glyph, GFGlyphTracer::Callback *cb=0) const {return false;} + + protected: + virtual void assignChar (UInt32 c, DVIVector *dvi) =0; +}; + + +class TFMFont : public virtual Font +{ + public: + TFMFont (std::string name, UInt32 checksum, double dsize, double ssize); + ~TFMFont (); + const FontMetrics* getMetrics () const; + std::string name () const {return _fontname;} + double designSize () const {return _dsize;} + double scaledSize () const {return _ssize;} + double charWidth (int c) const; + double charDepth (int c) const; + double charHeight (int c) const; + double italicCorr (int c) const; + bool verifyChecksums () const; + + private: + mutable FontMetrics *_metrics; + std::string _fontname; + UInt32 _checksum; ///< cheksum to be compared with TFM checksum + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class PhysicalFontProxy : public PhysicalFont +{ + friend class PhysicalFontImpl; + public: + Font* clone (double ds, double sc) const {return new PhysicalFontProxy(*this, ds, sc);} + const Font* uniqueFont () const {return _pf;} + std::string name () const {return _pf->name();} + double designSize () const {return _dsize;} + double scaledSize () const {return _ssize;} + double charWidth (int c) const {return _pf->charWidth(c);} + double charDepth (int c) const {return _pf->charDepth(c);} + double charHeight (int c) const {return _pf->charHeight(c);} + double italicCorr (int c) const {return _pf->italicCorr(c);} + const FontMetrics* getMetrics () const {return _pf->getMetrics();} + Type type () const {return _pf->type();} + UInt32 unicode (UInt32 c) const {return _pf->unicode(c);} + int fontIndex () const {return _pf->fontIndex();} + const FontStyle* style () const {return _pf->style();} + const FontMap::Entry* fontMapEntry () const {return _pf->fontMapEntry();} + const FontEncoding* encoding () const {return _pf->encoding();} + CharMapID getCharMapID () const {return _pf->getCharMapID();} + int collectCharMapIDs (std::vector &charmapIDs) const {return _pf->collectCharMapIDs(charmapIDs);} + + protected: + PhysicalFontProxy (const PhysicalFont *font, double ds, double ss) : _pf(font), _dsize(ds), _ssize(ss) {} + PhysicalFontProxy (const PhysicalFontProxy &proxy, double ds, double ss) : _pf(proxy._pf), _dsize(ds), _ssize(ss) {} + + private: + const PhysicalFont *_pf; + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class PhysicalFontImpl : public PhysicalFont, public TFMFont +{ + friend class PhysicalFont; + public: + ~PhysicalFontImpl(); + Font* clone (double ds, double ss) const {return new PhysicalFontProxy(this, ds, ss);} + const Font* uniqueFont () const {return this;} + Type type () const {return _filetype;} + int fontIndex() const {return _fontIndex;} + const FontStyle* style () const {return _fontMapEntry ? &_fontMapEntry->style : 0;} + const FontMap::Entry* fontMapEntry () const {return _fontMapEntry;} + const FontEncoding* encoding () const; + UInt32 unicode (UInt32 c) const; + bool findAndAssignBaseFontMap (); + void tidy () const; + CharMapID getCharMapID () const {return _charmapID;} + + protected: + PhysicalFontImpl (std::string name, int fontindex, UInt32 checksum, double dsize, double ssize, PhysicalFont::Type type); + + private: + Type _filetype; + int _fontIndex; + const FontMap::Entry *_fontMapEntry; + FontEncodingPair _encodingPair; + CharMapID _charmapID; ///< ID of the font's charmap to use + const RangeMap *_localCharMap; +}; + + +class NativeFont : public PhysicalFont +{ + public: + virtual NativeFont* clone (double ptsize, const FontStyle &style, Color color) const =0; + virtual Font* clone (double ds, double sc) const =0; + std::string name () const; + Type type () const; + double designSize () const {return _ptsize;} + double scaledSize () const {return _ptsize;} + double charWidth (int c) const; + double charDepth (int c) const; + double charHeight (int c) const; + double italicCorr (int c) const {return 0;} + const FontMetrics* getMetrics () const {return 0;} + const FontStyle* style () const {return &_style;} + Color color () const {return _color;} + const FontMap::Entry* fontMapEntry () const {return 0;} + static std::string uniqueName (const std::string &path, const FontStyle &style); + + protected: + NativeFont (double ptsize, const FontStyle &style, Color color) : _ptsize(ptsize), _style(style), _color(color) {} + + private: + double _ptsize; ///< font size in PS point units + FontStyle _style; + Color _color; +}; + + +class NativeFontProxy : public NativeFont +{ + friend class NativeFontImpl; + public: + NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { + return new NativeFontProxy(this, ptsize, style, color); + } + + Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} + const Font* uniqueFont () const {return _nfont;} + const char* path () const {return _nfont->path();} + int fontIndex () const {return _nfont->fontIndex();} + Character decodeChar (UInt32 c) const {return _nfont->decodeChar(c);} + UInt32 unicode (UInt32 c) const {return _nfont->unicode(c);} + CharMapID getCharMapID () const {return _nfont->getCharMapID();} + + protected: + NativeFontProxy (const NativeFont *nfont, double ptsize, const FontStyle &style, Color color) + : NativeFont(ptsize, style, color), _nfont(nfont) {} + + private: + const NativeFont *_nfont; +}; + + +class NativeFontImpl : public NativeFont +{ + public: + NativeFontImpl (const std::string &fname, int fontIndex, double ptsize, const FontStyle &style, Color color) + : NativeFont(ptsize, style, color), _path(fname), _fontIndex(fontIndex) {} + + NativeFont* clone (double ptsize, const FontStyle &style, Color color) const { + return new NativeFontProxy(this, ptsize, style, color); + } + + Font* clone (double ds, double sc) const {return new NativeFontProxy(this , sc, *style(), color());} + const Font* uniqueFont () const {return this;} + const char* path () const {return _path.c_str();} + int fontIndex() const {return _fontIndex;} + bool findAndAssignBaseFontMap (); + CharMapID getCharMapID () const {return CharMapID::NONE;} + Character decodeChar (UInt32 c) const; + UInt32 unicode (UInt32 c) const; + + private: + std::string _path; + int _fontIndex; + ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points +}; + + +class VirtualFontProxy : public VirtualFont +{ + friend class VirtualFontImpl; + public: + Font* clone (double ds, double ss) const {return new VirtualFontProxy(*this, ds, ss);} + const Font* uniqueFont () const {return _vf;} + std::string name () const {return _vf->name();} + const DVIVector* getDVI (int c) const {return _vf->getDVI(c);} + double designSize () const {return _dsize;} + double scaledSize () const {return _ssize;} + double charWidth (int c) const {return _vf->charWidth(c);} + double charDepth (int c) const {return _vf->charDepth(c);} + double charHeight (int c) const {return _vf->charHeight(c);} + double italicCorr (int c) const {return _vf->italicCorr(c);} + const FontMetrics* getMetrics () const {return _vf->getMetrics();} + const char* path () const {return _vf->path();} + + protected: + VirtualFontProxy (const VirtualFont *font, double ds, double ss) : _vf(font), _dsize(ds), _ssize(ss) {} + VirtualFontProxy (const VirtualFontProxy &proxy, double ds, double ss) : _vf(proxy._vf), _dsize(ds), _ssize(ss) {} + void assignChar (UInt32 c, DVIVector *dvi) {delete dvi;} + + private: + const VirtualFont *_vf; + double _dsize; ///< design size in PS point units + double _ssize; ///< scaled size in PS point units +}; + + +class VirtualFontImpl : public VirtualFont, public TFMFont +{ + friend class VirtualFont; + public: + ~VirtualFontImpl (); + Font* clone (double ds, double ss) const {return new VirtualFontProxy(this, ds, ss);} + const Font* uniqueFont () const {return this;} + const DVIVector* getDVI (int c) const; + const char* path () const; + + protected: + VirtualFontImpl (std::string name, UInt32 checksum, double dsize, double ssize); + void assignChar (UInt32 c, DVIVector *dvi); + + private: + std::map _charDefs; ///< dvi subroutines defining the characters +}; + + +struct FontException : public MessageException +{ + FontException (std::string msg) : MessageException(msg) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp new file mode 100644 index 00000000000..df638715785 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.cpp @@ -0,0 +1,390 @@ +/************************************************************************* +** FontCache.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include "CRC32.h" +#include "FileSystem.h" +#include "FontCache.h" +#include "Glyph.h" +#include "Pair.h" +#include "StreamReader.h" +#include "StreamWriter.h" +#include "types.h" + +using namespace std; + +const UInt8 FontCache::FORMAT_VERSION = 5; + + +static Pair32 read_pair (int bytes, StreamReader &sr) { + Int32 x = sr.readSigned(bytes); + Int32 y = sr.readSigned(bytes); + return Pair32(x, y); +} + + +FontCache::FontCache () : _changed(false) +{ +} + + +FontCache::~FontCache () { + clear(); +} + + +/** Removes all data from the cache. This does not affect the cache files. */ +void FontCache::clear () { + _glyphs.clear(); + _fontname.clear(); +} + + +/** Assigns glyph data to a character and adds it to the cache. + * @param[in] c character code + * @param[in] glyph font glyph data */ +void FontCache::setGlyph (int c, const Glyph &glyph) { + _glyphs[c] = glyph; + _changed = true; +} + + +/** Returns the corresponding glyph data of a given character of the current font. + * @param[in] c character code + * @return font glyph data (0 if no matching data was found) */ +const Glyph* FontCache::getGlyph (int c) const { + GlyphMap::const_iterator it = _glyphs.find(c); + return (it != _glyphs.end()) ? &it->second : 0; +} + + +/** Writes the current cache data to a file (only if anything changed after + * the last call of read()). + * @param[in] fontname name of current font + * @param[in] dir directory where the cache file should go + * @return true if writing was successful */ +bool FontCache::write (const char *fontname, const char *dir) const { + if (!_changed) + return true; + + if (fontname && strlen(fontname) > 0) { + string dirstr = (dir == 0 || strlen(dir) == 0) ? FileSystem::getcwd() : dir; + ostringstream oss; + oss << dirstr << '/' << fontname << ".fgd"; + ofstream ofs(oss.str().c_str(), ios::binary); + return write(fontname, ofs); + } + return false; +} + + +bool FontCache::write (const char* dir) const { + return _fontname.empty() ? false : write(_fontname.c_str(), dir); +} + + +/** Returns the minimal number of bytes needed to store the given value. */ +static int max_int_size (Int32 value) { + Int32 limit = 0x7f; + for (int i=1; i <= 4; i++) { + if ((value < 0 && -value <= limit+1) || (value >= 0 && value <= limit)) + return i; + limit = (limit << 8) | 0xff; + } + return 4; +} + + +/** Returns the minimal number of bytes needed to store the biggest + * pair component of the given vector. */ +static int max_int_size (const Pair *pairs, size_t n) { + int ret=0; + for (size_t i=0; i < n; i++) { + ret = max(ret, max_int_size(pairs[i].x())); + ret = max(ret, max_int_size(pairs[i].y())); + } + return ret; +} + + +/** Writes the current cache data to a stream (only if anything changed after + * the last call of read()). + * @param[in] fontname name of current font + * @param[in] os output stream + * @return true if writing was successful */ +bool FontCache::write (const char *fontname, ostream &os) const { + if (!_changed) + return true; + if (!os) + return false; + + StreamWriter sw(os); + CRC32 crc32; + + struct WriteActions : Glyph::Actions { + WriteActions (StreamWriter &sw, CRC32 &crc32) : _sw(sw), _crc32(crc32) {} + + void draw (char cmd, const Glyph::Point *points, int n) { + int bytes = max_int_size(points, n); + int cmdchar = (bytes << 5) | (cmd - 'A'); + _sw.writeUnsigned(cmdchar, 1, _crc32); + for (int i=0; i < n; i++) { + _sw.writeSigned(points[i].x(), bytes, _crc32); + _sw.writeSigned(points[i].y(), bytes, _crc32); + } + } + StreamWriter &_sw; + CRC32 &_crc32; + } actions(sw, crc32); + + sw.writeUnsigned(FORMAT_VERSION, 1, crc32); + sw.writeUnsigned(0, 4); // space for checksum + sw.writeString(fontname, crc32, true); + sw.writeUnsigned(_glyphs.size(), 4, crc32); + FORALL(_glyphs, GlyphMap::const_iterator, it) { + const Glyph &glyph = it->second; + sw.writeUnsigned(it->first, 4, crc32); + sw.writeUnsigned(glyph.size(), 2, crc32); + glyph.iterate(actions, false); + } + os.seekp(1); + sw.writeUnsigned(crc32.get(), 4); // insert CRC32 checksum + os.seekp(0, ios::end); + return true; +} + + +/** Reads font glyph information from a file. + * @param[in] fontname name of font data to read + * @param[in] dir directory where the cache files are located + * @return true if reading was successful */ +bool FontCache::read (const char *fontname, const char *dir) { + if (!fontname || strlen(fontname) == 0) + return false; + if (_fontname == fontname) + return true; + clear(); + string dirstr = (dir == 0 || strlen(dir) == 0) ? FileSystem::getcwd() : dir; + ostringstream oss; + oss << dirstr << '/' << fontname << ".fgd"; + ifstream ifs(oss.str().c_str(), ios::binary); + return read(fontname, ifs); +} + + +/** Reads font glyph information from a stream. + * @param[in] fontname name of font data to read + * @param[in] is input stream to read the glyph data from + * @return true if reading was successful */ +bool FontCache::read (const char *fontname, istream &is) { + if (_fontname == fontname) + return true; + clear(); + _fontname = fontname; + if (!is) + return false; + + StreamReader sr(is); + CRC32 crc32; + if (sr.readUnsigned(1, crc32) != FORMAT_VERSION) + return false; + + UInt32 crc32_cmp = sr.readUnsigned(4); + crc32.update(is); + if (crc32.get() != crc32_cmp) + return false; + + is.clear(); + is.seekg(5); // continue reading after checksum + + string fname = sr.readString(); + if (fname != fontname) + return false; + + UInt32 num_glyphs = sr.readUnsigned(4); + while (num_glyphs-- > 0) { + UInt32 c = sr.readUnsigned(4); // character code + UInt16 s = sr.readUnsigned(2); // number of path commands + Glyph &glyph = _glyphs[c]; + while (s-- > 0) { + UInt8 cmdval = sr.readUnsigned(1); + UInt8 cmdchar = (cmdval & 0x1f) + 'A'; + int bytes = cmdval >> 5; + switch (cmdchar) { + case 'C': { + Pair32 p1 = read_pair(bytes, sr); + Pair32 p2 = read_pair(bytes, sr); + Pair32 p3 = read_pair(bytes, sr); + glyph.cubicto(p1, p2, p3); + break; + } + case 'L': + glyph.lineto(read_pair(bytes, sr)); + break; + case 'M': + glyph.moveto(read_pair(bytes, sr)); + break; + case 'Q': { + Pair32 p1 = read_pair(bytes, sr); + Pair32 p2 = read_pair(bytes, sr); + glyph.conicto(p1, p2); + break; + } + case 'Z': + glyph.closepath(); + } + } + } + _changed = false; + return true; +} + + +/** Collects font cache information. + * @param[in] dirname path to font cache directory + * @param[out] infos the collected font information + * @param[out] invalid names of outdated/corrupted cache files + * @return true on success */ +bool FontCache::fontinfo (const char *dirname, vector &infos, vector &invalid) { + infos.clear(); + invalid.clear(); + if (dirname) { + vector fnames; + FileSystem::collect(dirname, fnames); + FORALL(fnames, vector::iterator, it) { + if ((*it)[0] == 'f' && it->length() > 5 && it->substr(it->length()-4) == ".fgd") { + FontInfo info; + string path = string(dirname)+"/"+(it->substr(1)); + ifstream ifs(path.c_str(), ios::binary); + if (fontinfo(ifs, info)) + infos.push_back(info); + else + invalid.push_back(it->substr(1)); + } + } + } + return !infos.empty(); +} + + +/** Collects font cache information of a single font. + * @param[in] is input stream of the cache file + * @param[out] info the collected data + * @return true if data could be read, false if cache file is unavailable, outdated, or corrupted */ +bool FontCache::fontinfo (std::istream &is, FontInfo &info) { + info.name.clear(); + info.numchars = info.numbytes = info.numcmds = 0; + if (is) { + is.clear(); + is.seekg(0); + try { + StreamReader sr(is); + CRC32 crc32; + if ((info.version = sr.readUnsigned(1, crc32)) != FORMAT_VERSION) + return false; + + info.checksum = sr.readUnsigned(4); + crc32.update(is); + if (crc32.get() != info.checksum) + return false; + + is.clear(); + is.seekg(5); // continue reading after checksum + + info.name = sr.readString(); + info.numchars = sr.readUnsigned(4); + for (UInt32 i=0; i < info.numchars; i++) { + sr.readUnsigned(4); // character code + UInt16 s = sr.readUnsigned(2); // number of path commands + while (s-- > 0) { + UInt8 cmdval = sr.readUnsigned(1); + UInt8 cmdchar = (cmdval & 0x1f) + 'A'; + int bytes = cmdval >> 5; + int bc = 0; + switch (cmdchar) { + case 'C': bc = 6*bytes; break; + case 'H': + case 'L': + case 'M': + case 'T': + case 'V': bc = 2*bytes; break; + case 'Q': + case 'S': bc = 4*bytes; break; + case 'Z': break; + default : return false; + } + info.numbytes += bc+1; // command length + command + info.numcmds++; + is.seekg(bc, ios::cur); + } + info.numbytes += 6; // number of path commands + char code + } + info.numbytes += 6+info.name.length(); // version + 0-byte + fontname + number of chars + } + catch (StreamReaderException &e) { + return false; + } + } + return true; +} + + +/** Collects font cache information and write it to a stream. + * @param[in] dirname path to font cache directory + * @param[in] os output is written to this stream + * @param[in] purge if true, outdated and corrupted cache files are removed */ +void FontCache::fontinfo (const char *dirname, ostream &os, bool purge) { + if (dirname) { + ios::fmtflags osflags(os.flags()); + vector infos; + vector invalid_files; + if (fontinfo(dirname, infos, invalid_files)) { + os << "cache format version " << infos[0].version << endl; + typedef map SortMap; + SortMap sortmap; + FORALL(infos, vector::iterator, it) + sortmap[it->name] = &(*it); + + FORALL(sortmap, SortMap::iterator, it) { + os << dec << setfill(' ') << left + << setw(10) << left << it->second->name + << setw(5) << right << it->second->numchars << " glyph" << (it->second->numchars == 1 ? ' ':'s') + << setw(10) << right << it->second->numcmds << " cmd" << (it->second->numcmds == 1 ? ' ':'s') + << setw(12) << right << it->second->numbytes << " byte" << (it->second->numbytes == 1 ? ' ':'s') + << setw(6) << "crc:" << setw(8) << hex << right << setfill('0') << it->second->checksum + << endl; + } + } + else + os << "cache is empty\n"; + FORALL(invalid_files, vector::iterator, it) { + string path=string(dirname)+"/"+(*it); + if (FileSystem::remove(path)) + os << "invalid cache file " << (*it) << " removed\n"; + } + os.flags(osflags); // restore format flags + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h new file mode 100644 index 00000000000..49efb455495 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontCache.h @@ -0,0 +1,70 @@ +/************************************************************************* +** FontCache.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTCACHE_H +#define DVISVGM_FONTCACHE_H + +#include +#include +#include +#include "types.h" +#include "Glyph.h" + + +class FontCache +{ + typedef std::map GlyphMap; + + public: + struct FontInfo + { + std::string name; // fontname + UInt16 version; // file format version + UInt32 checksum; // CRC32 checksum of file data + UInt32 numchars; // number of characters + UInt32 numbytes; // number of bytes + UInt32 numcmds; // number of path commands + }; + + public: + FontCache (); + ~FontCache (); + bool read (const char *fontname, const char *dir); + bool read (const char *fontname, std::istream &is); + bool write (const char *dir) const; + bool write (const char *fontname, const char *dir) const; + bool write (const char *fontname, std::ostream &os) const; + const Glyph* getGlyph (int c) const; + void setGlyph (int c, const Glyph &glyph); + void clear (); + const std::string& fontname () const {return _fontname;} + + static bool fontinfo (const char *dirname, std::vector &infos, std::vector &invalid); + static bool fontinfo (std::istream &is, FontInfo &info); + static void fontinfo (const char *dirname, std::ostream &os, bool purge=false); + + private: + static const UInt8 FORMAT_VERSION; + std::string _fontname; + GlyphMap _glyphs; + bool _changed; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp new file mode 100644 index 00000000000..d2dbfd8da50 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.cpp @@ -0,0 +1,98 @@ +/************************************************************************* +** FontEncoding.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "CMap.h" +#include "CMapManager.h" +#include "EncFile.h" +#include "FileFinder.h" +#include "FontEncoding.h" + +using namespace std; + + +struct EncodingMap : public map +{ + ~EncodingMap () { + for (EncodingMap::iterator it=begin(); it != end(); ++it) + delete it->second; + } +}; + + +/** Returns the encoding object for a given encoding name. + * @param[in] encname name of the encoding to lookup + * @return pointer to encoding object, or 0 if there is no encoding defined */ +FontEncoding* FontEncoding::encoding (const string &encname) { + if (encname.empty()) + return 0; + // initially, try to find an .enc file with the given name + static EncodingMap encmap; + EncodingMap::const_iterator it = encmap.find(encname); + if (it != encmap.end()) + return it->second; + if (FileFinder::lookup(encname + ".enc", false)) { + EncFile *enc = new EncFile(encname); + encmap[encname] = enc; + return enc; + } + // no .enc file found => try to find a CMap + if (CMap *cmap = CMapManager::instance().lookup(encname)) + return cmap; + return 0; +} + +///////////////////////////////////////////////////////////////////////// + +Character FontEncodingPair::decode (UInt32 c) const { + if (_enc1) { + Character chr = _enc1->decode(c); + if (_enc2 && chr.type() != Character::NAME) + chr = _enc2->decode(chr.number()); + return chr; + } + return Character(Character::INDEX, 0); +} + + +bool FontEncodingPair::mapsToCharIndex () const { + if (_enc2) + return _enc2->mapsToCharIndex(); + if (_enc1) + return _enc1->mapsToCharIndex(); + return false; +} + + +const FontEncoding* FontEncodingPair::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { + if (_enc2) + return _enc2->findCompatibleBaseFontMap(font, charmapID); + if (_enc1) + return _enc1->findCompatibleBaseFontMap(font, charmapID); + return 0; +} + + +void FontEncodingPair::assign (const FontEncoding *enc) { + if (!_enc1) + _enc1 = enc; + else + _enc2 = enc; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h new file mode 100644 index 00000000000..e36eb899bac --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEncoding.h @@ -0,0 +1,65 @@ +/************************************************************************* +** FontEncoding.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTENCODING_H +#define DVISVGM_FONTENCODING_H + +#include +#include "Character.h" +#include "types.h" + + +struct CharMapID; +class PhysicalFont; + +struct FontEncoding +{ + virtual ~FontEncoding () {} + virtual Character decode (UInt32 c) const =0; + virtual bool mapsToCharIndex () const =0; + virtual const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const {return 0;} + static FontEncoding* encoding (const std::string &encname); +}; + + +struct NamedFontEncoding : public FontEncoding +{ + virtual const char* name () const =0; + virtual const char* path () const =0; +}; + + +class FontEncodingPair : public FontEncoding +{ + public: + FontEncodingPair (const FontEncoding *enc1) : _enc1(enc1), _enc2(0) {} + FontEncodingPair (const FontEncoding *enc1, const FontEncoding *enc2) : _enc1(enc1), _enc2(enc2) {} + Character decode (UInt32 c) const; + bool mapsToCharIndex () const; + const FontEncoding* findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const; + const FontEncoding* enc1 () const {return _enc1;} + const FontEncoding* enc2 () const {return _enc2;} + void assign (const FontEncoding *enc); + + private: + const FontEncoding *_enc1, *_enc2; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp new file mode 100644 index 00000000000..bc3ad6a2a65 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.cpp @@ -0,0 +1,416 @@ +/************************************************************************* +** FontEngine.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include FT_ADVANCES_H +#include FT_GLYPH_H +#include FT_OUTLINE_H +#include FT_TRUETYPE_TABLES_H +#include FT_TYPES_H +#include "Font.h" +#include "FontEngine.h" +#include "FontStyle.h" +#include "Message.h" + +using namespace std; + + +/** Converts a floating point value to a 16.16 fixed point value. */ +static inline FT_Fixed to_16dot16 (double val) { + return static_cast(val*65536.0 + 0.5); +} + + +/** Converts an integer to a 16.16 fixed point value. */ +static inline FT_Fixed to_16dot16 (int val) { + return static_cast(val) << 16; +} + + +/////////////////////////////////////////////////////////////////////////// + + +FontEngine::FontEngine () : _currentFace(0), _currentFont(0) +{ + _currentChar = _currentGlyphIndex = 0; + _horDeviceRes = _vertDeviceRes = 300; + if (FT_Init_FreeType(&_library)) + Message::estream(true) << "FontEngine: error initializing FreeType library\n"; +} + + +FontEngine::~FontEngine () { + if (_currentFace && FT_Done_Face(_currentFace)) + Message::estream(true) << "FontEngine: error removing glyph\n"; + if (FT_Done_FreeType(_library)) + Message::estream(true) << "FontEngine: error removing FreeType library\n"; +} + + +/** Returns the singleton instance of this class. */ +FontEngine& FontEngine::instance () { + static FontEngine engine; + return engine; +} + + +string FontEngine::version () { + FT_Int major, minor, patch; + FT_Library &lib = instance()._library; + FT_Library_Version(lib, &major, &minor, &patch); + ostringstream oss; + oss << major << '.' << minor << '.' << patch; + return oss.str(); +} + + +void FontEngine::setDeviceResolution (int x, int y) { + _horDeviceRes = x; + _vertDeviceRes = y; +} + + +/** Sets the font to be used. + * @param[in] fname path to font file + * @param[in] fontindex index of font in font collection (multi-font files, like TTC) + * @return true on success */ +bool FontEngine::setFont (const string &fname, int fontindex, const CharMapID &charMapID) { + if (_currentFace && FT_Done_Face(_currentFace)) + Message::estream(true) << "FontEngine: error removing font\n"; + if (FT_New_Face(_library, fname.c_str(), fontindex, &_currentFace)) { + Message::estream(true) << "FontEngine: error reading file " << fname << '\n'; + return false; + } + if (charMapID.valid()) + setCharMap(charMapID); + return true; +} + + +bool FontEngine::setFont (const Font &font) { + if (!_currentFont || _currentFont->name() != font.name()) { + const PhysicalFont *pf = dynamic_cast(&font); + _currentFont = &font; + return setFont(font.path(), font.fontIndex(), pf ? pf->getCharMapID() : CharMapID()); + } + return true; +} + + +bool FontEngine::isCIDFont() const { + FT_Bool cid_keyed; + return FT_Get_CID_Is_Internally_CID_Keyed(_currentFace, &cid_keyed) == 0 && cid_keyed; +} + + +bool FontEngine::setCharMap (const CharMapID &charMapID) { + for (int i=0; i < _currentFace->num_charmaps; i++) { + FT_CharMap ft_cmap = _currentFace->charmaps[i]; + if (ft_cmap->platform_id == charMapID.platform_id && ft_cmap->encoding_id == charMapID.encoding_id) { + FT_Set_Charmap(_currentFace, ft_cmap); + return true; + } + } + return false; +} + + +/** Returns a character map that maps from character indexes to character codes + * of the current encoding. + * @param[out] charmap the resulting charmap */ +void FontEngine::buildCharMap (RangeMap &charmap) { + charmap.clear(); + FT_UInt glyph_index; + UInt32 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); + } +} + + +/** Creates a charmap that maps from the custom character encoding to unicode. + * @return pointer to charmap if it could be created, 0 otherwise */ +const RangeMap* FontEngine::createCustomToUnicodeMap () { + FT_CharMap ftcharmap = _currentFace->charmap; + if (FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) != 0) + return 0; + RangeMap index_to_source_chrcode; + buildCharMap(index_to_source_chrcode); + if (FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) != 0) + return 0; + RangeMap *charmap = new RangeMap; + FT_UInt glyph_index; + UInt32 unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); + while (glyph_index) { + UInt32 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_Set_Charmap(_currentFace, ftcharmap); + return charmap; +} + + +const char* FontEngine::getFamilyName () const { + return _currentFace ? _currentFace->family_name : 0; +} + + +const char* FontEngine::getStyleName () const { + return _currentFace ? _currentFace->style_name : 0; +} + + +int FontEngine::getUnitsPerEM () const { + return _currentFace ? _currentFace->units_per_EM : 0; +} + + +/** Returns the ascender of the current font in font units. */ +int FontEngine::getAscender () const { + return _currentFace ? _currentFace->ascender : 0; +} + + +/** Returns the descender of the current font in font units. */ +int FontEngine::getDescender () const { + return _currentFace ? _currentFace->descender : 0; +} + + +int FontEngine::getAdvance (int c) const { + if (_currentFace) { + FT_Fixed adv=0; + FT_Get_Advance(_currentFace, c, FT_LOAD_NO_SCALE, &adv); + return adv; + } + return 0; +} + + +int FontEngine::getHAdvance () const { + if (_currentFace) { + TT_OS2 *table = static_cast(FT_Get_Sfnt_Table(_currentFace, ft_sfnt_os2)); + return table ? table->xAvgCharWidth : 0; + } + return 0; +} + + +int FontEngine::getHAdvance (const Character &c) const { + if (_currentFace) { + FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); + return _currentFace->glyph->metrics.horiAdvance; + } + return 0; +} + + +int FontEngine::getVAdvance (const Character &c) const { + if (_currentFace) { + FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE); + if (FT_HAS_VERTICAL(_currentFace)) + return _currentFace->glyph->metrics.vertAdvance; + return _currentFace->glyph->metrics.horiAdvance; + } + return 0; +} + + +int FontEngine::charIndex (const Character &c) const { + if (!_currentFace || !_currentFace->charmap) + return c.type() == Character::NAME ? 0 : c.number(); + switch (c.type()) { + case Character::CHRCODE: + return FT_Get_Char_Index(_currentFace, (FT_ULong)c.number()); + case Character::NAME: + return FT_Get_Name_Index(_currentFace, (FT_String*)c.name()); + default: + return c.number(); + } +} + + +/** Get first available character of the current font face. */ +int FontEngine::getFirstChar () const { + if (_currentFace) + return _currentChar = FT_Get_First_Char(_currentFace, &_currentGlyphIndex); + return 0; +} + + +/** Get the next available character of the current font face. */ +int FontEngine::getNextChar () const { + if (_currentFace && _currentGlyphIndex) + return _currentChar = FT_Get_Next_Char(_currentFace, _currentChar, &_currentGlyphIndex); + return getFirstChar(); +} + + +/** Returns the number of glyphs present in the current font face. */ +int FontEngine::getNumGlyphs () const { + return _currentFace ? _currentFace->num_glyphs : 0; +} + + +/** Returns the glyph name for a given charater code. + * @param[in] c char code + * @return glyph name */ +string FontEngine::getGlyphName (const Character &c) const { + if (c.type() == Character::NAME) + return c.name(); + + if (_currentFace && FT_HAS_GLYPH_NAMES(_currentFace)) { + char buf[256]; + FT_Get_Glyph_Name(_currentFace, charIndex(c), buf, 256); + return string(buf); + } + return ""; +} + + +vector FontEngine::getPanose () const { + vector panose(10); + if (_currentFace) { + TT_OS2 *table = static_cast(FT_Get_Sfnt_Table(_currentFace, ft_sfnt_os2)); + if (table) + for (int i=0; i < 10; i++) + panose[i] = table->panose[i]; + } + return panose; +} + + +int FontEngine::getCharMapIDs (vector &charmapIDs) const { + charmapIDs.clear(); + if (_currentFace) { + for (int i=0; i < _currentFace->num_charmaps; i++) { + FT_CharMap charmap = _currentFace->charmaps[i]; + charmapIDs.push_back(CharMapID(charmap->platform_id, charmap->encoding_id)); + } + } + return charmapIDs.size(); +} + + +CharMapID FontEngine::setUnicodeCharMap () { + if (_currentFace && FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) == 0) + return CharMapID(_currentFace->charmap->platform_id, _currentFace->charmap->encoding_id); + return CharMapID(); +} + + +CharMapID FontEngine::setCustomCharMap () { + if (_currentFace && FT_Select_Charmap(_currentFace, FT_ENCODING_ADOBE_CUSTOM) == 0) + return CharMapID(_currentFace->charmap->platform_id, _currentFace->charmap->encoding_id); + return CharMapID(); +} + + +// handle API change in freetype version 2.2.1 +#if FREETYPE_MAJOR > 2 || (FREETYPE_MAJOR == 2 && (FREETYPE_MINOR > 2 || (FREETYPE_MINOR == 2 && FREETYPE_PATCH >= 1))) + typedef const FT_Vector *FTVectorPtr; +#else + typedef FT_Vector *FTVectorPtr; +#endif + + +// Callback functions used by trace_outline/FT_Outline_Decompose +static int moveto (FTVectorPtr to, void *user) { + Glyph *glyph = static_cast(user); + glyph->moveto(to->x, to->y); + return 0; +} + + +static int lineto (FTVectorPtr to, void *user) { + Glyph *glyph = static_cast(user); + glyph->lineto(to->x, to->y); + return 0; +} + + +static int conicto (FTVectorPtr control, FTVectorPtr to, void *user) { + Glyph *glyph = static_cast(user); + glyph->conicto(control->x, control->y, to->x, to->y); + return 0; +} + + +static int cubicto (FTVectorPtr control1, FTVectorPtr control2, FTVectorPtr to, void *user) { + Glyph *glyph = static_cast(user); + glyph->cubicto(control1->x, control1->y, control2->x, control2->y, to->x, to->y); + return 0; +} + + +/** Traces the outline of a glyph by calling the corresponding "drawing" functions. + * Each glyph is composed of straight lines, quadratic (conic) or cubic B�zier curves. + * This function creates a Glyph object representing these graphics segments. + * @param[in] face FreeType object representing the font to scan + * @param[in] font corresponding Font object providing additional data + * @param[in] index index of the glyph to be traced + * @param[out] glyph resulting Glyph object containing the graphics segments + * @param[in] scale if true the current pt size will be considered otherwise the plain TrueType units are used. + * @return false on errors */ +static bool trace_outline (FT_Face face, const Font *font, int index, Glyph &glyph, bool scale) { + if (face) { + if (FT_Load_Glyph(face, index, scale ? FT_LOAD_DEFAULT : FT_LOAD_NO_SCALE)) { + Message::estream(true) << "can't load glyph " << int(index) << '\n'; + return false; + } + if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) { + Message::estream(true) << "no outlines found in glyph " << int(index) << '\n'; + return false; + } + FT_Outline outline = face->glyph->outline; + // apply style parameters if set + if (const FontStyle *style = font->style()) { + FT_Matrix matrix = {to_16dot16(style->extend), to_16dot16(style->slant), 0, to_16dot16(1)}; + FT_Outline_Transform(&outline, &matrix); + if (style->bold != 0) + FT_Outline_Embolden(&outline, style->bold/font->scaledSize()*face->units_per_EM); + } + const FT_Outline_Funcs funcs = {moveto, lineto, conicto, cubicto, 0, 0}; + FT_Outline_Decompose(&outline, &funcs, &glyph); + return true; + } + Message::wstream(true) << "FontEngine: can't trace outline, no font face selected\n"; + return false; +} + + +/** Traces the outline of a glyph by calling the corresponding "drawing" functions. + * Each glyph is composed of straight lines, quadratic (conic) or cubic B�zier curves. + * This function creates a Glyph object representing these graphics segments. + * @param[in] c the glyph of this character will be traced + * @param[out] glyph resulting Glyph object containing the graphics segments + * @param[in] scale if true the current pt size will be considered otherwise the plain TrueType units are used. + * @return false on errors */ +bool FontEngine::traceOutline (const Character &c, Glyph &glyph, bool scale) const { + if (_currentFace) + return trace_outline(_currentFace, _currentFont, charIndex(c), glyph, scale); + Message::wstream(true) << "FontEngine: can't trace outline, no font face selected\n"; + return false; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h new file mode 100644 index 00000000000..33a4cf7a63b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontEngine.h @@ -0,0 +1,85 @@ +/************************************************************************* +** FontEngine.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTENGINE_H +#define DVISVGM_FONTENGINE_H + +#include +#include FT_FREETYPE_H +#include FT_CID_H +#include +#include +#include +#include "Character.h" +#include "CharMapID.h" +#include "Font.h" +#include "Glyph.h" +#include "RangeMap.h" +#include "types.h" + + +/** This class provides methods to handle font files and font data. + * It's a wrapper for the Freetype font library. */ +class FontEngine +{ + public: + ~FontEngine (); + static FontEngine& instance (); + static std::string version (); + void setDeviceResolution (int x, int y); + bool setFont (const Font &font); + bool isCIDFont() const; + bool traceOutline (const Character &c, Glyph &glyph, bool scale=true) const; + const char* getFamilyName () const; + const char* getStyleName () const; + int getUnitsPerEM () const; + int getAscender () const; + int getDescender () const; + int getAdvance (int c) const; + int getHAdvance () const; + int getHAdvance (const Character &c) const; + int getVAdvance (const Character &c) const; + int getFirstChar () const; + int getNextChar () const; + int getCharMapIDs (std::vector &charmapIDs) const; + int getNumGlyphs () const; + CharMapID setUnicodeCharMap (); + CharMapID setCustomCharMap (); + std::vector getPanose () const; + std::string getGlyphName (const Character &c) const; + int getCharByGlyphName (const char *name) const; + bool setCharMap (const CharMapID &charMapID); + void buildCharMap (RangeMap &charmap); + const RangeMap* createCustomToUnicodeMap (); + + protected: + FontEngine (); + bool setFont (const std::string &fname, int fontindex, const CharMapID &charmapID); + int charIndex (const Character &c) const; + + private: + int _horDeviceRes, _vertDeviceRes; + mutable unsigned int _currentChar, _currentGlyphIndex; + FT_Face _currentFace; + FT_Library _library; + const Font *_currentFont; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp new file mode 100644 index 00000000000..4561d5c0ca7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.cpp @@ -0,0 +1,347 @@ +/************************************************************************* +** FontManager.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "CMap.h" +#include "Font.h" +#include "FontManager.h" +#include "FontMap.h" +#include "FileFinder.h" +#include "FileSystem.h" +#include "Message.h" +#include "macros.h" + +using namespace std; + + +FontManager::~FontManager () { + FORALL(_fonts, vector::iterator, i) + delete *i; +} + + +/** Returns the singleton instance */ +FontManager& FontManager::instance () { + static FontManager fm; + return fm; +} + + +/** Returns a unique ID that identifies the font. + * @param[in] n local font number, as used in DVI and VF files + * @return non-negative font ID if font was found, -1 otherwise */ +int FontManager::fontID (int n) const { + if (_vfStack.empty()) { + Num2IdMap::const_iterator it = _num2id.find(n); + return (it == _num2id.end()) ? -1 : it->second; + } + VfNum2IdMap::const_iterator vit = _vfnum2id.find(_vfStack.top()); + if (vit == _vfnum2id.end()) + return -1; + const Num2IdMap &num2id = vit->second; + Num2IdMap::const_iterator it = num2id.find(n); + return (it == num2id.end()) ? -1 : it->second; +} + + +/** Returns a unique ID that identifies the font. Not the font object but the + * font pointer is looked up to get the ID. Thus, two different pointers + * referencing different objects of the same font are mapped to different IDs. + * @param[in] font pointer to font object to be identified + * @return non-negative font ID if font was found, -1 otherwise */ +int FontManager::fontID (const Font *font) const { + for (size_t i=0; i < _fonts.size(); i++) + if (_fonts[i] == font) + return i; + return -1; +} + + +/** Returns a unique ID that identifies the font. + * @param[in] name name of font to be identified, e.g. cmr10 + * @return non-negative font ID if font was found, -1 otherwise */ +int FontManager::fontID (const string &name) const { + map::const_iterator it = _name2id.find(name); + if (it == _name2id.end()) + return -1; + return it->second; +} + + +int FontManager::fontnum (int id) const { + if (id < 0 || size_t(id) > _fonts.size()) + return -1; + if (_vfStack.empty()) { + FORALL(_num2id, Num2IdMap::const_iterator, i) + if (i->second == id) + return i->first; + } + else { + VfNum2IdMap::const_iterator it = _vfnum2id.find(_vfStack.top()); + if (it == _vfnum2id.end()) + return -1; + const Num2IdMap &num2id = it->second; + FORALL(num2id, Num2IdMap::const_iterator, i) + if (i->second == id) + return i->first; + } + return -1; +} + + +int FontManager::vfFirstFontNum (VirtualFont *vf) const { + VfFirstFontMap::const_iterator it = _vfFirstFontMap.find(vf); + return (it == _vfFirstFontMap.end()) ? -1 : (int) it->second; +} + + +/** Returns a previously registered font. + * @param[in] n local font number, as used in DVI and VF files + * @return pointer to font if font was found, 0 otherwise */ +Font* FontManager::getFont (int n) const { + int id = fontID(n); + return (id < 0) ? 0 : _fonts[id]; +} + + +Font* FontManager::getFont (const string &name) const { + int id = fontID(name); + if (id < 0) + return 0; + return _fonts[id]; +} + + +Font* FontManager::getFontById (int id) const { + if (id < 0 || size_t(id) >= _fonts.size()) + return 0; + return _fonts[id]; +} + + +/** Returns the current active virtual font. */ +VirtualFont* FontManager::getVF () const { + return _vfStack.empty() ? 0 : _vfStack.top(); +} + + +static Font* create_font (const string &filename, const string &fontname, int fontindex, UInt32 checksum, double dsize, double ssize) { + string ext; + if (const char *dot = strrchr(filename.c_str(), '.')) + ext = dot+1; + if (!ext.empty() && FileFinder::lookup(filename)) { + if (ext == "pfb") + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::PFB); + if (ext == "otf") + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::OTF); + if (ext == "ttf") + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::TTF); + if (ext == "ttc") + return PhysicalFont::create(fontname, fontindex, checksum, dsize, ssize); + if (ext == "vf") + return VirtualFont::create(fontname, checksum, dsize, ssize); + if (ext == "mf") + return PhysicalFont::create(fontname, checksum, dsize, ssize, PhysicalFont::MF); + } + return 0; +} + + +/** Registers a new font to be managed by the FontManager. If there is + * already a registered font assigned to number n, nothing happens. + * @param[in] fontnum local font number, as used in DVI and VF files + * @param[in] name TFM fontname given in DVI file, e.g. cmr10 + * @param[in] checksum checksum to be compared with TFM checksum + * @param[in] dsize design size in PS point units + * @param[in] ssize scaled size in PS point units + * @return id of registered font */ +int FontManager::registerFont (UInt32 fontnum, string name, UInt32 checksum, double dsize, double ssize) { + int id = fontID(fontnum); + if (id >= 0) + return id; + + Font *newfont = 0; + const int newid = _fonts.size(); // the new font gets this ID + Name2IdMap::iterator it = _name2id.find(name); + if (it != _name2id.end()) { // font with same name already registered? + Font *font = _fonts[it->second]; + newfont = font->clone(dsize, ssize); + } + else { + string filename = name; + int fontindex = 0; + const FontMap::Entry *map_entry = FontMap::instance().lookup(name); + if (map_entry) { + filename = map_entry->fontname; + fontindex = map_entry->fontindex; + } + // try to find font file with the exact given name + if (filename.rfind(".") != string::npos) + newfont = create_font(filename, name, fontindex, checksum, dsize, ssize); + else { + // try various font file formats if the given file has no extension + const char *exts[] = {"pfb", "otf", "ttc", "ttf", "vf", "mf", 0}; + for (const char **p = exts; *p && !newfont; ++p) + newfont = create_font(filename+"."+*p, name, fontindex, checksum, dsize, ssize); + } + if (newfont) { + if (!newfont->findAndAssignBaseFontMap()) + Message::wstream(true) << "no suitable encoding table found for font " << filename << "\n"; + if (!newfont->verifyChecksums()) + Message::wstream(true) << "checksum mismatch in font " << name << '\n'; + } + else { + // create dummy font as a placeholder if the proper font is not available + newfont = new EmptyFont(name); + if (filename.rfind(".") == string::npos) + filename += ".mf"; + // print warning message about missing font file (only once for each filename) + static set missing_fonts; + if (missing_fonts.find(filename) == missing_fonts.end()) { + Message::wstream(true) << "font file '" << filename << "' not found\n"; + missing_fonts.insert(filename); + } + } + _name2id[name] = newid; + } + _fonts.push_back(newfont); + if (_vfStack.empty()) // register font referenced in dvi file? + _num2id[fontnum] = newid; + else { // register font referenced in vf file + VirtualFont *vf = const_cast(_vfStack.top()); + _vfnum2id[vf][fontnum] = newid; + if (_vfFirstFontMap.find(vf) == _vfFirstFontMap.end()) // first fontdef of VF? + _vfFirstFontMap[vf] = fontnum; + } + return newid; +} + + +int FontManager::registerFont (UInt32 fontnum, string filename, double ptsize, const FontStyle &style, Color color) { + return registerFont(fontnum, filename, 0, ptsize, style, color); +} + + +int FontManager::registerFont (UInt32 fontnum, string filename, int fontIndex, double ptsize, const FontStyle &style, Color color) { + int id = fontID(fontnum); + if (id >= 0) + return id; + + if (!filename.empty() && filename[0] == '[' && filename[filename.size()-1] == ']') + filename = filename.substr(1, filename.size()-2); + string fontname = NativeFont::uniqueName(filename, style); + const char *path = filename.c_str(); + Font *newfont=0; + const int newid = _fonts.size(); // the new font gets this ID + Name2IdMap::iterator it = _name2id.find(fontname); + if (it != _name2id.end()) { // font with same name already registered? + if (NativeFont *font = dynamic_cast(_fonts[it->second])) + newfont = font->clone(ptsize, style, color); + } + else { + if (!FileSystem::exists(path)) + path = FileFinder::lookup(filename, false); + if (path) { + newfont = new NativeFontImpl(path, fontIndex, ptsize, style, color); + newfont->findAndAssignBaseFontMap(); + } + if (!newfont) { + // create dummy font as a placeholder if the proper font is not available + newfont = new EmptyFont(filename); + // print warning message about missing font file (only once for each filename) + static set missing_fonts; + if (missing_fonts.find(filename) == missing_fonts.end()) { + Message::wstream(true) << "font file '" << filename << "' not found\n"; + missing_fonts.insert(filename); + } + } + _name2id[fontname] = newid; + } + _fonts.push_back(newfont); + _num2id[fontnum] = newid; + return newid; +} + + +/** Enters a new virtual font frame. + * This method must be called before processing a VF character. + * @param[in] vf virtual font */ +void FontManager::enterVF (VirtualFont *vf) { + if (vf) + _vfStack.push(vf); +} + + +/** Leaves a previously entered virtual font frame. */ +void FontManager::leaveVF () { + if (!_vfStack.empty()) + _vfStack.pop(); +} + + +/** Assigns a sequence of DVI commands to a char code. + * @param[in] c character code + * @param[in] dvi points to vector with DVI commands */ +void FontManager::assignVfChar (int c, vector *dvi) { + if (!_vfStack.empty() && dvi) + _vfStack.top()->assignChar(c, dvi); +} + + +ostream& FontManager::write (ostream &os, Font *font, int level) { +#if 0 + if (font) { + int id = -1; + for (int i=0; i < fonts.size() && id < 0; i++) + if (fonts[i] == font) + id = i; + + VirtualFont *vf = dynamic_cast(font); + for (int j=0; j < level+1; j++) + os << " "; + os << "id " << id + << " fontnum " << fontnum(id) << " " + << (vf ? "VF" : "PF") << " " + << font->name() + << endl; + + if (vf) { + enterVF(vf); + const Num2IdMap &num2id = vfnum2id.find(vf)->second; + FORALL(num2id, Num2IdMap::const_iterator, i) { + Font *font = fonts[i->second]; + write(os, font, level+1); + } + leaveVF(); + } + } + else { + for (int i=0; i < fonts.size(); i++) + write(os, fonts[i], level); + os << endl; + } +#endif + return os; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h new file mode 100644 index 00000000000..f856eb656a1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontManager.h @@ -0,0 +1,85 @@ +/************************************************************************* +** FontManager.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTMANAGER_H +#define DVISVGM_FONTMANAGER_H + +#include +#include +#include +#include +#include +#include +#include "Color.h" +#include "FontStyle.h" +#include "types.h" + + +struct FileFinder; +struct Font; +class VirtualFont; + +/** This class provides methods for easy DVI font handling. + * DVI and VF files use local font numbers to reference fonts. For SVG output + * we need a single list with unique IDs of all physical fonts. Characters of + * virtual fonts are completely replaced by their DVI description so they don't + * appear anywhere in the output. */ +class FontManager +{ + typedef std::map Num2IdMap; + typedef std::map Name2IdMap; + typedef std::map VfNum2IdMap; + typedef std::map VfFirstFontMap; + typedef std::stack VfStack; + + public: + ~FontManager (); + static FontManager& instance (); + int registerFont (UInt32 fontnum, std::string fontname, UInt32 checksum, double dsize, double scale); + int registerFont (UInt32 fontnum, std::string fname, double ptsize, const FontStyle &style, Color color); + int registerFont (UInt32 fontnum, std::string fname, int fontIndex, double ptsize, const FontStyle &style, Color color); + Font* getFont (int n) const; + Font* getFont (const std::string &name) const; + Font* getFontById (int id) const; + VirtualFont* getVF () const; + int fontID (int n) const; + int fontID (const Font *font) const; + int fontID (const std::string &name) const; + int fontnum (int id) const; + int vfFirstFontNum (VirtualFont *vf) const; + void enterVF (VirtualFont *vf); + void leaveVF (); + void assignVfChar (int c, std::vector *dvi); + const std::vector& getFonts () const {return _fonts;} + std::ostream& write (std::ostream &os, Font *font=0, int level=0); + + protected: + FontManager () {} + + private: + std::vector _fonts; ///< all registered Fonts + Num2IdMap _num2id; ///< DVI font number -> fontID + Name2IdMap _name2id; ///< fontname -> fontID + VfNum2IdMap _vfnum2id; + VfStack _vfStack; ///< stack of currently processed virtual fonts + VfFirstFontMap _vfFirstFontMap; ///< VF -> local font number of first font defined in VF +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp new file mode 100644 index 00000000000..e6179c8115e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.cpp @@ -0,0 +1,305 @@ +/************************************************************************* +** FontMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "CMap.h" +#include "Directory.h" +#include "FileFinder.h" +#include "FontManager.h" +#include "FontMap.h" +#include "MapLine.h" +#include "Message.h" +#include "Subfont.h" + +using namespace std; + + +FontMap::~FontMap () { + for (Iterator it=_entries.begin(); it != _entries.end(); ++it) + delete it->second; +} + + +/** Returns the singleton instance. */ +FontMap& FontMap::instance() { + static FontMap fontmap; + return fontmap; +} + + +/** Reads and evaluates a single font map file. + * @param[in] fname name of map file to read + * @param[in] mode selects how to integrate the map file entries into the global map tree + * @return true if file could be opened */ +bool FontMap::read (const string &fname, FontMap::Mode mode) { + ifstream ifs(fname.c_str()); + if (!ifs) + return false; + + int line_number = 1; + while (ifs) { + int c = ifs.peek(); + if (c < 0 || strchr("\n&#%;*", c)) // comment or empty line? + ifs.ignore(numeric_limits::max(), '\n'); + else { + try { + MapLine mapline(ifs); + apply(mapline, mode); + } + catch (const MapLineException &e) { + Message::wstream(true) << fname << ", line " << line_number << ": " << e.what() << '\n'; + } + catch (const SubfontException &e) { + Message::wstream(true) << e.filename(); + if (e.lineno() > 0) + Message::wstream(false) << ", line " << e.lineno(); + Message::wstream(false) << e.what() << '\n'; + } + } + line_number++; + } + return true; +} + + +bool FontMap::read (const string &fname, char modechar) { + Mode mode; + switch (modechar) { + case '=': mode = FM_REPLACE; break; + case '-': mode = FM_REMOVE; break; + default : mode = FM_APPEND; + } + return read(fname, mode); +} + + +/** Applies a mapline according to the given mode (append, remove, replace). + * @param[in] mapline the mapline to be applied + * @param[in] mode mode to use + * @return true in case of success */ +bool FontMap::apply (const MapLine& mapline, FontMap::Mode mode) { + switch (mode) { + case FM_APPEND: + return append(mapline); + case FM_REMOVE: + return remove(mapline); + default: + return replace(mapline); + } +} + + +/** Applies a mapline according to the given mode (append, remove, replace). + * @param[in] mapline the mapline to be applied + * @param[in] modechar character that denotes the mode (+, -, or =) + * @return true in case of success */ +bool FontMap::apply (const MapLine& mapline, char modechar) { + Mode mode; + switch (modechar) { + case '=': mode = FM_REPLACE; break; + case '-': mode = FM_REMOVE; break; + default : mode = FM_APPEND; + } + return apply(mapline, mode); +} + + +/** Reads and evaluates a sequence of map files. Each map file is looked up in the local + * directory and the TeX file tree. + * @param[in] fname_seq comma-separated list of map file names + * @return true if at least one of the given map files was found */ +bool FontMap::read (const string &fname_seq) { + bool found = false; + size_t left=0; + while (left < fname_seq.length()) { + const char modechar = fname_seq[left]; + if (strchr("+-=", modechar)) + left++; + string fname; + size_t right = fname_seq.find(',', left); + if (right != string::npos) + fname = fname_seq.substr(left, right-left); + else { + fname = fname_seq.substr(left); + right = fname_seq.length(); + } + if (!fname.empty()) { + if (!read(fname, modechar)) { + if (const char *path = FileFinder::lookup(fname, false)) + found = found || read(path, modechar); + else + Message::wstream(true) << "map file " << fname << " not found\n"; + } + } + left = right+1; + } + return found; +} + + +/** Appends given map line data to the font map if there is no entry for the corresponding + * font in the map yet. + * @param[in] mapline parsed font data + * @return true if data has been appended */ +bool FontMap::append (const MapLine &mapline) { + bool ret = false; + if (!mapline.texname().empty()) { + if (!mapline.fontfname().empty() || !mapline.encname().empty()) { + vector subfonts; + if (mapline.sfd()) + mapline.sfd()->subfonts(subfonts); + else + subfonts.push_back(0); + for (size_t i=0; i < subfonts.size(); i++) { + string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); + Iterator it = _entries.find(fontname); + if (it == _entries.end()) { + _entries[fontname] = new Entry(mapline, subfonts[i]); + ret = true; + } + } + } + } + return ret; +} + + +/** Replaces the map data of the given font. + * If the font is locked (because it's already in use) nothing happens. + * @param[in] mapline parsed font data + * @return true if data has been replaced */ +bool FontMap::replace (const MapLine &mapline) { + if (mapline.texname().empty()) + return false; + if (mapline.fontfname().empty() && mapline.encname().empty()) + return remove(mapline); + + vector subfonts; + if (mapline.sfd()) + mapline.sfd()->subfonts(subfonts); + else + subfonts.push_back(0); + for (size_t i=0; i < subfonts.size(); i++) { + string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); + Iterator it = _entries.find(fontname); + if (it == _entries.end()) + _entries[fontname] = new Entry(mapline, subfonts[i]); + else if (!it->second->locked) + *it->second = Entry(mapline, subfonts[i]); + } + return true; +} + + +/** Removes the map entry of the given font. + * If the font is locked (because it's already in use) nothing happens. + * @param[in] mapline parsed font data + * @return true if entry has been removed */ +bool FontMap::remove (const MapLine &mapline) { + bool ret = false; + if (!mapline.texname().empty()) { + vector subfonts; + if (mapline.sfd()) + mapline.sfd()->subfonts(subfonts); + else + subfonts.push_back(0); + for (size_t i=0; i < subfonts.size(); i++) { + string fontname = mapline.texname()+(subfonts[i] ? subfonts[i]->id() : ""); + Iterator it = _entries.find(fontname); + if (it != _entries.end() && !it->second->locked) { + _entries.erase(it); + ret = true; + } + } + } + return ret; +} + + +ostream& FontMap::write (ostream &os) const { + for (ConstIterator it=_entries.begin(); it != _entries.end(); ++it) + os << it->first << " -> " << it->second->fontname << " [" << it->second->encname << "]\n"; + return os; +} + + +/** Reads and evaluates all map files in the given directory. + * @param[in] dirname path to directory containing the map files to be read */ +void FontMap::readdir (const string &dirname) { + Directory dir(dirname); + while (const char *fname = dir.read(Directory::ET_FILE)) { + if (strlen(fname) >= 4 && strcmp(fname+strlen(fname)-4, ".map") == 0) { + string path = dirname + "/" + fname; + read(path.c_str()); + } + } +} + + +/** Returns name of font that is mapped to a given font. + * @param[in] fontname name of font whose mapped name is retrieved + * @returns name of mapped font */ +const FontMap::Entry* FontMap::lookup (const string &fontname) const { + ConstIterator it = _entries.find(fontname); + if (it == _entries.end()) + return 0; + return it->second; +} + + +/** Sets the lock flag for the given font in order to avoid changing the map data of this font. + * @param[in] fontname name of font to be locked */ +void FontMap::lockFont (const string& fontname) { + Iterator it = _entries.find(fontname); + if (it != _entries.end()) + it->second->locked = true; +} + + +/** Removes all (unlocked) entries from the font map. + * @param[in] unlocked_only if true, only unlocked entries are removed */ +void FontMap::clear (bool unlocked_only) { + if (!unlocked_only) + _entries.clear(); + else { + Iterator it=_entries.begin(); + while (it != _entries.end()) { + if (it->second->locked) + ++it; + else { + delete it->second; + _entries.erase(it++); + } + } + } +} + +///////////////////////////////////////////////// + +FontMap::Entry::Entry (const MapLine &mapline, Subfont *sf) + : fontname(mapline.fontfname()), encname(mapline.encname()), subfont(sf), fontindex(mapline.fontindex()), + locked(false), style(mapline.bold(), mapline.extend(), mapline.slant()) +{ +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h new file mode 100644 index 00000000000..0360a67d3df --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMap.h @@ -0,0 +1,78 @@ +/************************************************************************* +** FontMap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTMAP_H +#define DVISVGM_FONTMAP_H + +#include +#include +#include +#include "FontStyle.h" + + +struct FontEncoding; +class MapLine; +class Subfont; + +class FontMap +{ + public: + struct Entry + { + Entry (const MapLine &mapline, Subfont *subfont=0); + std::string fontname; ///< target font name + std::string encname; ///< name of font encoding + Subfont *subfont; + int fontindex; ///< index of font in multi-font file + bool locked; + FontStyle style; + }; + + protected: + typedef std::map::iterator Iterator; + typedef std::map::const_iterator ConstIterator; + + public: + enum Mode {FM_APPEND, FM_REMOVE, FM_REPLACE}; + + ~FontMap (); + static FontMap& instance (); + bool read (const std::string &fname, Mode mode); + bool read (const std::string &fname, char modechar); + bool read (const std::string &fname_seq); + void readdir (const std::string &dirname); + bool apply (const MapLine &mapline, Mode mode); + bool apply (const MapLine &mapline, char modechar); + bool append (const MapLine &mapline); + bool replace (const MapLine &mapline); + bool remove (const MapLine &mapline); + void lockFont (const std::string &fontname); + void clear (bool unlocked_only=false); + std::ostream& write (std::ostream &os) const; + const Entry* lookup(const std::string &fontname) const; + + protected: + FontMap () {} + + private: + std::map _entries; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp new file mode 100644 index 00000000000..5792e8abbd5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.cpp @@ -0,0 +1,41 @@ +/************************************************************************* +** FontMetrics.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "FileFinder.h" +#include "FontMetrics.h" +#include "JFM.h" +#include "TFM.h" + +using namespace std; + + +FontMetrics* FontMetrics::read (const char *fontname) { + const char *path = FileFinder::lookup(string(fontname) + ".tfm"); + ifstream ifs(path, ios::binary); + if (!ifs) + return 0; + UInt16 id = 256*ifs.get(); + id += ifs.get(); + if (id == 9 || id == 11) // Japanese font metric file? + return new JFM(ifs); + return new TFM(ifs); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h new file mode 100644 index 00000000000..7e7a9d3e12a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontMetrics.h @@ -0,0 +1,64 @@ +/************************************************************************* +** FontMetrics.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_FONTMETRICS_H +#define DVISVGM_FONTMETRICS_H + +#include +#include "MessageException.h" +#include "types.h" + +struct FontMetrics +{ + virtual ~FontMetrics () {} + virtual double getDesignSize () const =0; + virtual double getCharWidth (int c) const =0; + virtual double getCharHeight (int c) const =0; + virtual double getCharDepth (int c) const =0; + virtual double getItalicCorr (int c) const =0; + virtual bool verticalLayout () const =0; + virtual UInt32 getChecksum () const =0; + virtual UInt16 firstChar () const =0; + virtual UInt16 lastChar () const =0; + static FontMetrics* read (const char *fontname); +}; + + +struct NullFontMetric : public FontMetrics +{ + double getDesignSize () const {return 1;} + double getCharWidth (int c) const {return 0;} + double getCharHeight (int c) const {return 0;} + double getCharDepth (int c) const {return 0;} + double getItalicCorr (int c) const {return 0;} + bool verticalLayout () const {return false;} + UInt32 getChecksum () const {return 0;} + UInt16 firstChar () const {return 0;} + UInt16 lastChar () const {return 0;} +}; + + +struct FontMetricException : public MessageException +{ + FontMetricException (const std::string &msg) : MessageException(msg) {} +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h new file mode 100644 index 00000000000..932c09291cc --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h @@ -0,0 +1,12 @@ +#ifndef FONTSTYLE +#define FONTSTYLE + +struct FontStyle { + FontStyle () : bold(0), extend(1), slant(0) {} + FontStyle (float b, float e, float s) : bold(b), extend(e), slant(s) {} + double bold; ///< stroke width in pt used to draw the glyph outlines + double extend; ///< factor to strech/shrink the glyphs horizontally + double slant; ///< horizontal slanting/skewing value (= tan(phi)) +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp new file mode 100644 index 00000000000..19d9e0bb533 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.cpp @@ -0,0 +1,93 @@ +/************************************************************************* +** GFGlyphTracer.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "GFGlyphTracer.h" +#include "Pair.h" + +using namespace std; + +GFGlyphTracer::GFGlyphTracer () : GFTracer(_ifs, 0), _glyph(0), _callback(0) +{ +} + +/** 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) + : GFTracer(_ifs, upp), _glyph(0), _callback(cb) +{ + if (_callback) + _callback->setFont(fname); + _ifs.open(fname.c_str(), ios::binary); +} + + +void GFGlyphTracer::reset (string &fname, double upp) { + if (_callback) + _callback->setFont(fname); + if (_ifs.is_open()) + _ifs.close(); + unitsPerPoint(upp); + _ifs.open(fname.c_str(), ios::binary); +} + + +bool GFGlyphTracer::executeChar (UInt8 c) { + if (!_glyph) + return false; + + if (_callback) + _callback->beginChar(c); + bool ok = GFTracer::executeChar(c); + if (_callback) { + if (ok) + _callback->endChar(c); + else + _callback->emptyChar(c); + } + return ok; +} + + +void GFGlyphTracer::moveTo (double x, double y) { + _glyph->moveto(int(x), int(y)); +} + + +void GFGlyphTracer::lineTo (double x, double y) { + _glyph->lineto(int(x), int(y)); +} + + +void GFGlyphTracer::curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) { + _glyph->cubicto(int(c1x), int(c1y), int(c2x), int(c2y), int(x), int(y)); +} + + +void GFGlyphTracer::closePath () { + _glyph->closepath(); +} + + +void GFGlyphTracer::endChar (UInt32 c) { + _glyph->clear(); + GFTracer::endChar(c); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h new file mode 100644 index 00000000000..1449657465f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFGlyphTracer.h @@ -0,0 +1,60 @@ +/************************************************************************* +** GFGlyphTracer.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GFGLYPHTRACER_H +#define DVISVGM_GFGLYPHTRACER_H + +#include +#include +#include "GFTracer.h" +#include "Glyph.h" + +class GFGlyphTracer : public GFTracer +{ + public: + struct Callback { + virtual ~Callback () {} + virtual void setFont (const std::string &fontname) {} + virtual void beginChar (UInt8 c) {} + virtual void endChar (UInt8 c) {} + virtual void emptyChar (UInt8 c) {} + }; + + public: + GFGlyphTracer (); + GFGlyphTracer (std::string &fname, double upp, Callback *cb=0); + void reset (std::string &fname, double upp); + void setCallback (Callback *cb) {_callback = cb;} + bool executeChar (UInt8 c); + void moveTo (double x, double y); + void lineTo (double x, double y); + void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y); + void closePath (); + void endChar (UInt32 c); + void setGlyph (Glyph &glyph) {_glyph = &glyph;} + const Glyph& getGlyph () const {return *_glyph;} + + private: + std::ifstream _ifs; + Glyph *_glyph; + Callback *_callback; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp new file mode 100644 index 00000000000..8e10c21373f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.cpp @@ -0,0 +1,368 @@ +/************************************************************************* +** GFReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "GFReader.h" +#include "macros.h" +#include "SignalHandler.h" + +using namespace std; + +struct GFCommand +{ + void (GFReader::*method)(int); + int numBytes; +}; + + +/** Converts a fix point length to double (PS point units) */ +static inline double fix2double (Int32 fix) { + return double(fix)/(1 << 20)*72/72.27; +} + + +static inline double scaled2double (Int32 scaled) { + return double(scaled)/(1 << 16); +} + + +GFReader::GFReader (istream &is) : _in(is), _penDown(false) +{ + _minX = _maxX = _minY = _maxY = _x = _y = 0; + _currentChar = 0; + _designSize = 0; + _hppp = _vppp = 0; + _checksum = 0; +} + + +UInt32 GFReader::readUnsigned (int bytes) { + UInt32 ret = 0; + for (int i=bytes-1; i >= 0 && !_in.eof(); i--) { + UInt32 b = _in.get(); + ret |= b << (8*i); + } + return ret; +} + + +Int32 GFReader::readSigned (int bytes) { + Int32 ret = _in.get(); + if (ret & 128) // negative value? + ret |= 0xffffff00; + for (int i=bytes-2; i >= 0 && !_in.eof(); i--) + ret = (ret << 8) | _in.get(); + return ret; +} + + +string GFReader::readString (int bytes) { + vector buf(bytes+1); + if (bytes > 0) + _in.get(&buf[0], bytes+1); // reads 'bytes' bytes (pos. bytes+1 is set to 0) + else + buf[0] = 0; + return &buf[0]; +} + + +/** Reads a single GF command from the current position of the input stream and calls the + * corresponding cmdFOO method. + * @return opcode of the executed command */ +int GFReader::executeCommand () { + SignalHandler::instance().check(); + /* Each cmdFOO command reads the necessary number of bytes from the stream so executeCommand + doesn't need to know the exact GF command format. Some cmdFOO methods are used for multiple + GF commands because they only differ in the size of their parameters. */ + static const GFCommand commands[] = { + {&GFReader::cmdPaint, 1}, {&GFReader::cmdPaint, 2}, {&GFReader::cmdPaint, 3}, // 64-66 + {&GFReader::cmdBoc, 0}, {&GFReader::cmdBoc1, 0}, // 67-68 + {&GFReader::cmdEoc, 0}, // 69 + {&GFReader::cmdSkip, 0}, {&GFReader::cmdSkip, 1}, {&GFReader::cmdSkip, 2},{&GFReader::cmdSkip, 3}, // 70-73 + {&GFReader::cmdXXX, 1}, {&GFReader::cmdXXX, 2}, {&GFReader::cmdXXX, 3}, {&GFReader::cmdXXX, 4}, // 239-242 + {&GFReader::cmdYYY, 0}, // 243 + {&GFReader::cmdNop, 0}, // 244 + {&GFReader::cmdCharLoc, 0}, {&GFReader::cmdCharLoc0, 0}, // 245-246 + {&GFReader::cmdPre, 0}, {&GFReader::cmdPost, 0}, {&GFReader::cmdPostPost, 0} // 247-249 + }; + + int opcode = _in.get(); + if (opcode < 0) // at end of file? + throw GFException("unexpected end of file"); + + if (opcode >= 0 && opcode <= 63) + cmdPaint0(opcode); + else if (opcode >= 74 && opcode <= 238) + cmdNewRow(opcode-74); + else if (opcode >= 250) { + ostringstream oss; + oss << "undefined GF command (opcode " << opcode << ")"; + throw GFException(oss.str()); + } + else { + int offset = opcode <= 73 ? 64 : 239-(73-64+1); + const GFCommand &cmd = commands[opcode-offset]; + if (cmd.method) + (this->*cmd.method)(cmd.numBytes); + } + return opcode; +} + + +bool GFReader::executeChar (UInt8 c) { + _in.clear(); + if (_charInfoMap.empty()) + executePostamble(); // read character info + _in.clear(); + Iterator it = _charInfoMap.find(c); + if (_in && it != _charInfoMap.end()) { + _in.seekg(it->second.location); + while (executeCommand() != 69); // execute all commands until eoc is reached + return true; + } + return false; +} + + +bool GFReader::executeAllChars () { + _in.clear(); + if (_charInfoMap.empty()) + executePostamble(); // read character info + _in.clear(); + if (_in) { + _in.seekg(0); + while (executeCommand() != 248); // execute all commands until postamble is reached + return true; + } + return false; +} + + +bool GFReader::executePreamble () { + _in.clear(); + if (!_in) + return false; + _in.seekg(0); + executeCommand(); + return true; +} + + +bool GFReader::executePostamble () { + _in.clear(); + if (!_in) + return false; + _in.seekg(-1, ios::end); + while (_in.peek() == 223) // skip fill bytes + _in.seekg(-1, ios::cur); + _in.seekg(-4, ios::cur); + UInt32 q = readUnsigned(4); // pointer to begin of postamble + _in.seekg(q); // now on begin of postamble + while (executeCommand() != 249); // execute all commands until postpost is reached + return true; +} + + +/** Returns the design size of this font in PS point units. */ +double GFReader::getDesignSize () const { + return fix2double(_designSize); +} + +/** Returns the number of horizontal pixels per point. */ +double GFReader::getHPixelsPerPoint () const { + return scaled2double(_hppp)*72/72.27; +} + +/** Returns the number of vertical pixels per point. */ +double GFReader::getVPixelsPerPoint () const { + return scaled2double(_vppp)*72/72.27; +} + +/** Returns the width of character c in PS point units */ +double GFReader::getCharWidth (UInt32 c) const { + ConstIterator it = _charInfoMap.find(c%256); + return it == _charInfoMap.end() ? 0 : it->second.width*getDesignSize()/(1<<24); +} + +/////////////////////// + + +/** Reads the preamble. */ +void GFReader::cmdPre (int) { + UInt32 i = readUnsigned(1); + if (i == 131) { + UInt32 k = readUnsigned(1); + string s = readString(k); + preamble(s); + } + else + throw GFException("invalid identification number in GF preamble"); +} + + +/** Reads the postamble. */ +void GFReader::cmdPost (int) { + readUnsigned(4); // pointer to byte after final eoc + _designSize = readUnsigned(4); // design size of font in points + _checksum = readUnsigned(4); // checksum + _hppp = readUnsigned(4); // horizontal pixels per point (scaled int) + _vppp = readUnsigned(4); // vertical pixels per point (scaled int) + _in.seekg(16, ios::cur); // skip x and y bounds + postamble(); +} + + +/** Reads trailing bytes at end of stream. */ +void GFReader::cmdPostPost (int) { + readUnsigned(4); // pointer to begin of postamble + UInt32 i = readUnsigned(1); + if (i == 131) + while (readUnsigned(1) == 223); // skip fill bytes + else + throw GFException("invalid identification number in GF preamble"); +} + + +/** Inverts "paint color" (black to white or vice versa) of n pixels + * and advances the cursor by n. + * @param[in] n number of pixels to be inverted */ +void GFReader::cmdPaint0 (int n) { + if (_penDown) // set pixels? + _bitmap.setBits(_y, _x, n); + _x += n; + _penDown = !_penDown; // inverse pen state +} + + +/** Inverts "paint color" (black to white or vice versa) of n pixels + * and advances the cursor by n. The number n of pixels is read from + * the input stream. + * @param[in] len size of n in bytes */ +void GFReader::cmdPaint (int len) { + UInt32 pixels = readUnsigned(len); + cmdPaint0(pixels); +} + + +/** Beginning of character (generic format). */ +void GFReader::cmdBoc (int) { + _currentChar = readSigned(4); + readSigned(4); // pointer to previous boc with same c mod 256 + _minX = readSigned(4); + _maxX = readSigned(4); + _minY = readSigned(4); + _maxY = readSigned(4); + _x = _minX; + _y = _maxY; + _penDown = false; + _bitmap.resize(_minX, _maxX, _minY, _maxY); + beginChar(_currentChar); +} + + +/** Beginning of character (compact format). */ +void GFReader::cmdBoc1 (int) { + _currentChar = readUnsigned(1); + UInt32 dx = readUnsigned(1); + _maxX = readUnsigned(1); + _minX = _maxX - dx; + UInt32 dy = readUnsigned(1); + _maxY = readUnsigned(1); + _minY = _maxY - dy; + _x = _minX; + _y = _maxY; + _penDown = false; + _bitmap.resize(_minX, _maxX, _minY, _maxY); + beginChar(_currentChar); +} + + +/** End of character. */ +void GFReader::cmdEoc (int) { + endChar(_currentChar); +} + + +/** Moves cursor to the beginning of a following row and sets + * paint color to white. + * @param[in] len if 0: move to next row, otherwise: number of bytes to read. + * The read value denotes the number of rows to be skipped. */ +void GFReader::cmdSkip (int len) { + if (len == 0) + _y--; + else + _y -= readUnsigned(len)+1; + _x = _minX; + _penDown = false; +} + + +/** Moves cursor to pixel number 'col' in the next row and sets + * the paint color to black. + * @param[in] col pixel/column number */ +void GFReader::cmdNewRow (int col) { + _x = _minX + col ; + _y--; + _penDown = true; +} + + +void GFReader::cmdXXX (int len) { + UInt32 n = readUnsigned(len); + string str = readString(n); + special(str); +} + + +void GFReader::cmdYYY (int) { + Int32 y = readSigned(4); + numspecial(y); +} + + +/** Does nothing. */ +void GFReader::cmdNop (int) { +} + + +/** Reads character locator (part of postamble) */ +void GFReader::cmdCharLoc0 (int) { + UInt8 c = readUnsigned(1); // character code mod 256 + UInt8 dm = readUnsigned(1); // + Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize + Int32 p = readSigned(4); // pointer to begin of (last) character data + Int32 dx = 65536*dm; + Int32 dy = 0; + _charInfoMap[c] = CharInfo(dx, dy, w, p); +} + + +/** Reads character locator (part of postamble) */ +void GFReader::cmdCharLoc (int) { + UInt32 c = readUnsigned(1); // character code mod 256 + Int32 dx = readSigned(4); // horizontal escapement (scaled pixel units) + Int32 dy = readSigned(4); // vertical escapement (scaled pixel units) + Int32 w = readSigned(4); // (1<<24)*characterWidth/designSize + Int32 p = readSigned(4); // pointer to begin of (last) character data + _charInfoMap[c] = CharInfo(dx, dy, w, p); +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h new file mode 100644 index 00000000000..a644fce901c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFReader.h @@ -0,0 +1,111 @@ +/************************************************************************* +** GFReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GFREADER_H +#define DVISVGM_GFREADER_H + +#include +#include +#include +#include "Bitmap.h" +#include "MessageException.h" +#include "types.h" + + +class CharInfo; + + +struct GFException : public MessageException +{ + GFException (const std::string &msg) : MessageException(msg) {} +}; + + +class GFReader +{ + struct CharInfo + { + CharInfo () : dx(0), dy(0), width(0), location(0) {} + CharInfo (Int32 dxx, Int32 dyy, Int32 w, UInt32 p) : dx(dxx), dy(dyy), width(w), location(p) {} + + Int32 dx, dy; + Int32 width; // 2^24 * (true width)/(design size) + UInt32 location; + }; + + typedef std::map::iterator Iterator; + typedef std::map::const_iterator ConstIterator; + public: + GFReader (std::istream &is); + virtual ~GFReader () {} + bool executeChar (UInt8 c); + bool executeAllChars (); + bool executePreamble (); + bool executePostamble (); + virtual void preamble (const std::string &str) {} + virtual void postamble () {} + virtual void beginChar (UInt32 c) {} + virtual void endChar (UInt32 c) {} + virtual void special (std::string str) {} + virtual void numspecial (Int32 y) {} + const Bitmap& getBitmap () const {return _bitmap;} + double getDesignSize () const; + double getHPixelsPerPoint () const; + double getVPixelsPerPoint () const; + double getCharWidth (UInt32 c) const; + UInt32 getChecksum () const {return _checksum;} + + protected: + Int32 readSigned (int bytes); + UInt32 readUnsigned (int bytes); + std::string readString (int len); + int executeCommand (); + std::istream& getInputStream () const {return _in;} + + void cmdPre (int); + void cmdPost (int); + void cmdPostPost (int); + void cmdPaint0 (int pixels); + void cmdPaint (int len); + void cmdBoc (int); + void cmdBoc1 (int); + void cmdEoc (int); + void cmdSkip (int len); + void cmdNewRow (int col); + void cmdXXX (int len); + void cmdYYY (int); + void cmdNop (int); + void cmdCharLoc0 (int); + void cmdCharLoc (int); + + private: + std::istream &_in; + Int32 _minX, _maxX, _minY, _maxY; + Int32 _x, _y; // current pen location (pixel units) + Int32 _currentChar; + Bitmap _bitmap; // bitmap of current char + FixWord _designSize; // designSize + ScaledInt _hppp, _vppp; // horizontal and vertical pixel per point + UInt32 _checksum; + std::map _charInfoMap; + bool _penDown; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp new file mode 100644 index 00000000000..e071e93e1f6 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.cpp @@ -0,0 +1,103 @@ +/************************************************************************* +** GFTracer.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "GFTracer.h" +#include "Glyph.h" +#include "Message.h" + +#ifdef __MSVC__ +#include +#else +extern "C" { +#include +} +#endif + +using namespace std; + + +GFTracer::GFTracer (istream &is) + : GFReader(is), _unitsPerPoint(0.0) +{ +} + + +/** Constructs a new GFTracer. + * @param[in] is GF file is read from this stream + * @param[in] upp target units per PS point */ +GFTracer::GFTracer (istream &is, double upp) + : GFReader(is), _unitsPerPoint(upp) +{ +} + + +void GFTracer::beginChar (UInt32 c) { +} + + +void GFTracer::endChar (UInt32 c) { + const Bitmap &bitmap = getBitmap(); + if (bitmap.empty()) + return; + + // prepare potrace's bitmap structure + vector buffer; + potrace_bitmap_t pobitmap; + pobitmap.w = bitmap.width(); + pobitmap.h = bitmap.height(); + pobitmap.dy = bitmap.copy(buffer); + pobitmap.map = &buffer[0]; + potrace_param_t *param = potrace_param_default(); + potrace_state_t *state = potrace_trace(param, &pobitmap); + potrace_param_free(param); + + if (!state || state->status == POTRACE_STATUS_INCOMPLETE) + Message::wstream(true) << "error while tracing character\n"; + else { + double hsf=1.0, vsf=1.0; // horizontal a d vertical scale factor + if (_unitsPerPoint != 0.0) { + hsf = _unitsPerPoint/getHPixelsPerPoint(); // horizontal scale factor + vsf = _unitsPerPoint/getVPixelsPerPoint(); // vertical scale factor + } + for (potrace_path_t *path = state->plist; path; path = path->next) { + potrace_dpoint_t &p = path->curve.c[path->curve.n-1][2]; // start/end point + moveTo(hsf*(p.x+bitmap.xshift()), vsf*(p.y+bitmap.yshift())); + for (int i=0; i < path->curve.n; i++) { + if (path->curve.tag[i] == POTRACE_CURVETO) { + curveTo(hsf*(path->curve.c[i][0].x+bitmap.xshift()), vsf*(path->curve.c[i][0].y+bitmap.yshift()), + hsf*(path->curve.c[i][1].x+bitmap.xshift()), vsf*(path->curve.c[i][1].y+bitmap.yshift()), + hsf*(path->curve.c[i][2].x+bitmap.xshift()), vsf*(path->curve.c[i][2].y+bitmap.yshift())); + } + else { + lineTo(hsf*(path->curve.c[i][1].x+bitmap.xshift()), vsf*(path->curve.c[i][1].y+bitmap.yshift())); + if (i == path->curve.n-1) + closePath(); + else + lineTo(hsf*(path->curve.c[i][2].x+bitmap.xshift()), vsf*(path->curve.c[i][2].y+bitmap.yshift())); + } + } + } + } + potrace_state_free(state); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h new file mode 100644 index 00000000000..a288284f3ab --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GFTracer.h @@ -0,0 +1,47 @@ +/************************************************************************* +** GFTracer.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GFTRACER_H +#define DVISVGM_GFTRACER_H + +#include +#include "GFReader.h" + +class GFTracer : public GFReader +{ + public: + GFTracer (std::istream &is); + GFTracer (std::istream &is, double upp); + virtual ~GFTracer () {} + virtual void moveTo (double x, double y) =0; + virtual void lineTo (double x, double y) =0; + virtual void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) =0; + virtual void closePath () =0; + void beginChar (UInt32 c); + void endChar (UInt32 c); + + protected: + void unitsPerPoint(double upp) {_unitsPerPoint = upp;} + + private: + double _unitsPerPoint; ///< target units per PS point +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp new file mode 100644 index 00000000000..6a58ba0c6b5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.cpp @@ -0,0 +1,353 @@ +/************************************************************************* +** Ghostscript.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "Ghostscript.h" +#if !defined(DISABLE_GS) +#include +#include +#include +#if defined(HAVE_LIBGS) + #include +#else + #include "ierrors.h" + #include "FileFinder.h" +#endif + +using namespace std; + +// name of Ghostscript shared library set by the user +string Ghostscript::LIBGS_NAME; + +#ifndef HAVE_LIBGS + +#ifdef __WIN32__ +/** Looks up the path of the Ghostscript DLL in the Windows registry and returns it. + * If there is no proper registry entry, the returned string is empty. */ +static string get_path_from_registry () { +#ifdef RRF_RT_REG_SZ // RegGetValueA and RRF_RT_REG_SZ may not be defined for some oldish MinGW + REGSAM mode = KEY_READ|KEY_QUERY_VALUE; +#ifdef KEY_WOW64_64KEY +#ifdef __WIN64__ + mode |= KEY_WOW64_64KEY; +#else + mode |= KEY_WOW64_32KEY; +#endif +#endif + static const char *gs_companies[] = {"GPL", "GNU", "AFPL", "Aladdin"}; + for (size_t i=0; i < sizeof(gs_companies)/sizeof(char*); i++) { + const string reg_path = string("SOFTWARE\\") + gs_companies[i] + " Ghostscript"; + static HKEY reg_roots[] = {HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE}; + for (size_t j=0; j < sizeof(reg_roots)/sizeof(HKEY); j++) { + HKEY hkey; + if (RegOpenKeyExA(reg_roots[j], reg_path.c_str(), 0, mode, &hkey) == ERROR_SUCCESS) { + char subkey[16]; + for (int k=0; RegEnumKeyA(hkey, k, subkey, 16) == ERROR_SUCCESS; k++) { + istringstream iss(subkey); + int major_version; + iss >> major_version; + if (major_version >= 7) { + char dll_path[256]; // path to Ghostscript DLL stored in the registry + DWORD length; + if (RegGetValueA(hkey, subkey, "GS_DLL", RRF_RT_REG_SZ, 0, dll_path, &length) == ERROR_SUCCESS) { + RegCloseKey(hkey); + return dll_path; + } + } + } + RegCloseKey(hkey); + } + } + } +#endif // RRF_RT_REG_SZ + return ""; +} +#endif // __WIN32__ + + +/** Try to detect name of the Ghostscript shared library depending on the user settings. + * @param[in] fname path/filename given by the user + * @return name of Ghostscript shared library */ +static string get_libgs (const string &fname) { + if (!fname.empty()) + return fname; +#ifdef MIKTEX +#if defined(__WIN64__) + const char *gsdll = "mgsdll64.dll"; +#else + const char *gsdll = "mgsdll32.dll"; +#endif + // try to look up the Ghostscript DLL coming with MiKTeX + if (const char *gsdll_path = FileFinder::lookup(gsdll)) + return gsdll_path; +#endif // MIKTEX +#if defined(__WIN32__) + // try to look up the path of the Ghostscript DLL in the Windows registry + string gsdll_path = get_path_from_registry(); + if (!gsdll_path.empty()) + return gsdll_path; +#endif +#if defined(__WIN64__) + return "gsdll64.dll"; +#elif defined(__WIN32__) + return "gsdll32.dll"; +#else + // try to find libgs.so.X on the user's system + const int abi_min=7, abi_max=9; // supported libgs ABI versions + for (int i=abi_max; i >= abi_min; i--) { + ostringstream oss; +#if defined(__CYGWIN__) + oss << "cyggs-" << i << ".dll"; +#else + oss << "libgs.so." << i; +#endif + DLLoader loader(oss.str().c_str()); + if (loader.loaded()) + return oss.str(); + } +#endif + // no appropriate library found + return ""; +} +#endif // !HAVE_LIBGS + + +/** Loads the Ghostscript library but does not create an instance. This + * constructor should only be used to call available() and revision(). */ +Ghostscript::Ghostscript () +#if !defined(HAVE_LIBGS) + : DLLoader(get_libgs(LIBGS_NAME).c_str()) +#endif +{ + _inst = 0; +} + + +/** Tries to load the shared library and to initialize Ghostscript. + * @param[in] argc number of parameters in array argv + * @param[in] argv parameters passed to Ghostscript + * @param[in] caller this parameter is passed to all callback functions */ +Ghostscript::Ghostscript (int argc, const char **argv, void *caller) +#if !defined(HAVE_LIBGS) + : DLLoader(get_libgs(LIBGS_NAME).c_str()) +#endif +{ + _inst = 0; + init(argc, argv, caller); +} + + +/** Exits Ghostscript and unloads the dynamic library. */ +Ghostscript::~Ghostscript () { + if (_inst) { + this->exit(); + delete_instance(); + } +} + + +bool Ghostscript::init (int argc, const char **argv, void *caller) { + if (!_inst) { + int status = new_instance(&_inst, caller); + if (status < 0) + _inst = 0; + else { + init_with_args(argc, (char**)argv); + } + } + return _inst != 0; +} + + +/** Returns true if Ghostscript library was found and can be loaded. */ +bool Ghostscript::available () { +#if defined(HAVE_LIBGS) + return true; +#else + gsapi_revision_t rev; + return loaded() && revision(&rev); +#endif +} + + +/** 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) { +#if defined(HAVE_LIBGS) + return (gsapi_revision(r, sizeof(gsapi_revision_t)) == 0); +#else + if (PFN_gsapi_revision fn = (PFN_gsapi_revision)loadSymbol("gsapi_revision")) + return (fn(r, sizeof(gsapi_revision_t)) == 0); + return false; +#endif +} + + +/** Returns product name and revision number of the GS library. + * @param[in] revonly if true, only the revision number is returned */ +string Ghostscript::revision (bool revonly) { + gsapi_revision_t r; + if (revision(&r)) { + ostringstream oss; + if (!revonly) + oss << r.product << ' '; + oss << (r.revision/100) << '.' << setfill('0') << setw(2) << (r.revision%100); + return oss.str(); + } + return ""; +} + + +/** Creates a new instance of Ghostscript. This method is called by the constructor and + * should not be used elsewhere. + * @param[out] psinst handle of newly created instance (or 0 on error) + * @param[in] caller pointer forwarded to callback functions */ +int Ghostscript::new_instance (void **psinst, void *caller) { +#if defined(HAVE_LIBGS) + return gsapi_new_instance(psinst, caller); +#else + if (PFN_gsapi_new_instance fn = (PFN_gsapi_new_instance)loadSymbol("gsapi_new_instance")) + return fn(psinst, caller); + *psinst = 0; + return 0; +#endif +} + + +/** Destroys the current instance of Ghostscript. This method is called by the destructor + * and should not be used elsewhere. */ +void Ghostscript::delete_instance () { +#if defined(HAVE_LIBGS) + gsapi_delete_instance(_inst); +#else + if (PFN_gsapi_delete_instance fn = (PFN_gsapi_delete_instance)loadSymbol("gsapi_delete_instance")) + fn(_inst); +#endif +} + + +/** Exits the interpreter. Must be called before destroying the GS instance. */ +int Ghostscript::exit () { +#if defined(HAVE_LIBGS) + return gsapi_exit(_inst); +#else + if (PFN_gsapi_exit fn = (PFN_gsapi_exit)loadSymbol("gsapi_exit")) + return fn(_inst); + return 0; +#endif +} + + +/** Sets the I/O callback functions. + * @param[in] in pointer to stdin handler + * @param[in] out pointer to stdout handler + * @param[in] err pointer to stderr handler */ +int Ghostscript::set_stdio (Stdin in, Stdout out, Stderr err) { +#if defined(HAVE_LIBGS) + return gsapi_set_stdio(_inst, in, out, err); +#else + if (PFN_gsapi_set_stdio fn = (PFN_gsapi_set_stdio)loadSymbol("gsapi_set_stdio")) + return fn(_inst, in, out, err); + return 0; +#endif +} + + +/** Initializes Ghostscript with a set of optional parameters. This + * method is called by the constructor and should not be used elsewhere. + * @param[in] argc number of paramters + * @param[in] argv parameters passed to Ghostscript */ +int Ghostscript::init_with_args (int argc, char **argv) { +#if defined(HAVE_LIBGS) + return gsapi_init_with_args(_inst, argc, argv); +#else + if (PFN_gsapi_init_with_args fn = (PFN_gsapi_init_with_args)loadSymbol("gsapi_init_with_args")) + return fn(_inst, argc, argv); + return 0; +#endif +} + + +/** Tells Ghostscript that several calls of run_string_continue will follow. */ +int Ghostscript::run_string_begin (int user_errors, int *pexit_code) { +#if defined(HAVE_LIBGS) + return gsapi_run_string_begin(_inst, user_errors, pexit_code); +#else + if (PFN_gsapi_run_string_begin fn = (PFN_gsapi_run_string_begin)loadSymbol("gsapi_run_string_begin")) + return fn(_inst, user_errors, pexit_code); + *pexit_code = 0; + return 0; +#endif +} + + +/** Executes a chunk of PostScript commands given by a buffer of characters. The size of + * this buffer must not exceed 64KB. Longer programs can be split into arbitrary smaller chunks + * and passed to Ghostscript by successive calls of run_string_continue. + * @param[in] str buffer containing the PostScript code + * @param[in] length number of characters in buffer + * @param[in] user_errors if non-negative, the default PS error values will be generated, otherwise this value is returned + * @param[out] pexit_code takes the PS error code */ +int Ghostscript::run_string_continue (const char *str, unsigned length, int user_errors, int *pexit_code) { +#if defined(HAVE_LIBGS) + return gsapi_run_string_continue(_inst, str, length, user_errors, pexit_code); +#else + if (PFN_gsapi_run_string_continue fn = (PFN_gsapi_run_string_continue)loadSymbol("gsapi_run_string_continue")) + return fn(_inst, str, length, user_errors, pexit_code); + *pexit_code = 0; + return 0; +#endif +} + + +/** Terminates the successive code feeding. Must be called after the last call of run_string_continue. */ +int Ghostscript::run_string_end (int user_errors, int *pexit_code) { +#if defined(HAVE_LIBGS) + return gsapi_run_string_end(_inst, user_errors, pexit_code); +#else + if (PFN_gsapi_run_string_end fn = (PFN_gsapi_run_string_end)loadSymbol("gsapi_run_string_end")) + return fn(_inst, user_errors, pexit_code); + *pexit_code = 0; + return 0; +#endif +} + + +const char* Ghostscript::error_name (int code) { + if (code < 0) + code = -code; + const char *error_names[] = { ERROR_NAMES }; + if (code == 0 || (size_t)code > sizeof(error_names)/sizeof(error_names[0])) + return 0; +#if defined(HAVE_LIBGS) + // use array defined in libgs to avoid linking the error strings into the binary + return gs_error_names[code-1]; +#elif defined(__WIN32__) + // gs_error_names is private in the Ghostscript DLL so we can't access it here + return error_names[code-1]; +#else + if (const char **error_names = (const char**)loadSymbol("gs_error_names")) + return error_names[code-1]; + return 0; +#endif +} + +#endif // !DISABLE_GS diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h new file mode 100644 index 00000000000..c20c847dfbe --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Ghostscript.h @@ -0,0 +1,103 @@ +/************************************************************************* +** Ghostscript.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GHOSTSCRIPT_H +#define DVISVGM_GHOSTSCRIPT_H + +#include +#include + +#if defined(DISABLE_GS) + #include "iapi.h" +#elif defined(HAVE_LIBGS) + #include +#else + #include "DLLoader.h" + #include "iapi.h" +#endif + +#if defined(__WIN32__) && !defined(_Windows) + #define _Windows +#endif + +#if defined(DISABLE_GS) +struct Ghostscript +{ + typedef int (GSDLLCALLPTR Stdin) (void *caller, char *buf, int len); + typedef int (GSDLLCALLPTR Stdout) (void *caller, const char *str, int len); + typedef int (GSDLLCALLPTR Stderr) (void *caller, const char *str, int len); + + Ghostscript () {} + Ghostscript (int argc, const char **argv, void *caller=0) {} + bool init (int argc, const char **argv, void *caller=0) {return false;} + bool available () {return false;} + bool revision (gsapi_revision_t *r) {return false;} + std::string revision (bool revonly=false) {return "";} + int set_stdio (Stdin in, Stdout out, Stderr err) {return 0;} + int run_string_begin (int user_errors, int *pexit_code) {return 0;} + int run_string_continue (const char *str, unsigned int length, int user_errors, int *pexit_code) {return 0;} + int run_string_end (int user_errors, int *pexit_code) {return 0;} + int exit () {return 0;} + const char* error_name (int code) {return 0;} +}; + +#else + +/** Wrapper class of (a subset of) the Ghostscript API. */ +class Ghostscript +#if !defined(HAVE_LIBGS) +: public DLLoader +#endif +{ + public: + typedef int (GSDLLCALLPTR Stdin) (void *caller, char *buf, int len); + typedef int (GSDLLCALLPTR Stdout) (void *caller, const char *str, int len); + typedef int (GSDLLCALLPTR Stderr) (void *caller, const char *str, int len); + + public: + Ghostscript (); + Ghostscript (int argc, const char **argv, void *caller=0); + ~Ghostscript (); + bool init (int argc, const char **argv, void *caller=0); + bool available (); + bool revision (gsapi_revision_t *r); + std::string revision (bool revonly=false); + int set_stdio (Stdin in, Stdout out, Stderr err); + int run_string_begin (int user_errors, int *pexit_code); + int run_string_continue (const char *str, unsigned int length, int user_errors, int *pexit_code); + int run_string_end (int user_errors, int *pexit_code); + int exit (); + const char* error_name (int code); + + static std::string LIBGS_NAME; + + protected: + Ghostscript (const Ghostscript &gs) : _inst(0) {} + int init_with_args (int argc, char **argv); + int new_instance (void **psinst, void *caller); + void delete_instance (); + + private: + void *_inst; ///< Ghostscript handle needed to call the gsapi_foo functions +}; + +#endif // DISABLE_GS + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h new file mode 100644 index 00000000000..d19f130ceaf --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Glyph.h @@ -0,0 +1,28 @@ +/************************************************************************* +** Glyph.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GLYPH_H +#define DVISVGM_GLYPH_H + +#include "GraphicPath.h" + +typedef GraphicPath Glyph; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h new file mode 100644 index 00000000000..c6190730ecf --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GlyphTracerMessages.h @@ -0,0 +1,74 @@ +/************************************************************************* +** GlyphTracerMessages.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GLYPHTRACERMESSAGES_H +#define DVISVGM_GLYPHTRACERMESSAGES_H + +#include +#include "GFGlyphTracer.h" +#include "Message.h" +#include "types.h" + +class GlyphTracerMessages : public GFGlyphTracer::Callback +{ + public: + GlyphTracerMessages (bool sfmsg=true, bool autonl=true) : _sfmsg(sfmsg), _autonl(autonl), _traced(false) {} + + ~GlyphTracerMessages () { + if (_autonl) + Message::mstream() << '\n'; + } + + void beginChar (UInt8 c) { + if (!_traced) { + if (!_fname.empty()) + Message::mstream() << '\n'; + Message::mstream(false, Message::MC_STATE) + << "tracing glyphs of " << _fname.substr(0, _fname.length()-3) << '\n'; + _traced = true; + } + } + + void endChar (UInt8 c) { + std::ostringstream oss; + oss << '['; + if (isprint(c)) + oss << c; + else + oss << '#' << unsigned(c); + oss << ']'; + Message::mstream(false, Message::MC_TRACING) << oss.str(); + } + + void setFont (const std::string &fname) { + if (_sfmsg && fname != _fname) { + _fname = fname; + _traced = false; + } + } + + private: + std::string _fname; + bool _sfmsg, _autonl; + bool _traced; ///< true if a glyph of the current font has already been traced? +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h new file mode 100644 index 00000000000..6d377eb8a59 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicPath.h @@ -0,0 +1,395 @@ +/************************************************************************* +** GraphicPath.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_GRAPHICPATH_H +#define DVISVGM_GRAPHICPATH_H + +#include +#include +#include +#include +#include "BoundingBox.h" +#include "Matrix.h" +#include "Pair.h" +#include "XMLString.h" + + +template +class GraphicPath +{ + friend class PathClipper; + public: + enum WindingRule {WR_EVEN_ODD, WR_NON_ZERO}; + typedef Pair Point; + + struct Command { + enum Type {MOVETO, LINETO, CONICTO, CUBICTO, CLOSEPATH}; + + Command (Type t) : type(t) {} + + Command (Type t, const Point &p) : type(t) { + params[0] = p; + } + + Command (Type t, const Point &p1, const Point &p2) : type(t) { + params[0] = p1; + params[1] = p2; + } + + Command (Type t, const Point &p1, const Point &p2, const Point &p3) : type(t) { + params[0] = p1; + params[1] = p2; + params[2] = p3; + } + + int numParams () const { + switch (type) { + case CLOSEPATH : return 0; + case MOVETO : + case LINETO : return 1; + case CONICTO : return 2; + case CUBICTO : return 3; + } + return 0; + } + + void transform (const Matrix &matrix) { + for (int i=0; i < numParams(); i++) + params[i] = matrix * params[i]; + } + + Type type; + Point params[3]; + }; + + struct Actions + { + virtual ~Actions () {} + virtual void moveto (const Point &p) {} + virtual void lineto (const Point &p) {} + virtual void hlineto (const T &y) {} + virtual void vlineto (const T &x) {} + virtual void sconicto (const Point &p) {} + virtual void conicto (const Point &p1, const Point &p2) {} + virtual void scubicto (const Point &p1, const Point &p2) {} + virtual void cubicto (const Point &p1, const Point &p2, const Point &p3) {} + virtual void closepath () {} + virtual void draw (char cmd, const Point *points, int n) {} + virtual bool quit () {return false;} + virtual void finished () {} + }; + + typedef typename std::vector::iterator Iterator; + typedef typename std::vector::const_iterator ConstIterator; + typedef typename std::vector::const_reverse_iterator ConstRevIterator; + + public: + GraphicPath (WindingRule wr=WR_NON_ZERO) : _windingRule(wr) {} + + void setWindingRule (WindingRule wr) {_windingRule = wr;} + WindingRule windingRule () const {return _windingRule;} + + void clear () { + _commands.clear(); + } + + /// Returns true if the path is empty, i.e. there is nothing to draw + bool empty () const { + return _commands.empty(); + } + + /// Returns the number of path commands used to describe the path. + size_t size () const { + return _commands.size(); + } + + /// Insert another path at the beginning of this one. + void prepend (const GraphicPath &path) { + _commands.insert(_commands.begin(), path._commands.begin(), path._commands.end()); + } + + void moveto (const T &x, const T &y) { + moveto(Point(x, y)); + } + + void moveto (const Point &p) { + // avoid sequences of several MOVETOs; always use latest + if (_commands.empty() || _commands.back().type != Command::MOVETO) + _commands.push_back(Command(Command::MOVETO, p)); + else + _commands.back().params[0] = p; + } + + void lineto (const T &x, const T &y) { + lineto(Point(x, y)); + } + + void lineto (const Point &p) { + _commands.push_back(Command(Command::LINETO, p)); + } + + void conicto (const T &x1, const T &y1, const T &x2, const T &y2) { + conicto(Point(x1, y1), Point(x2, y2)); + } + + void conicto (const Point &p1, const Point &p2) { + _commands.push_back(Command(Command::CONICTO, p1, p2)); + } + + void cubicto (const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3) { + cubicto(Point(x1, y1), Point(x2, y2), Point(x3, y3)); + } + + void cubicto (const Point &p1, const Point &p2, const Point &p3) { + _commands.push_back(Command(Command::CUBICTO, p1, p2, p3)); + } + + void closepath () { + _commands.push_back(Command(Command::CLOSEPATH)); + } + + + const std::vector& commands () const { + return _commands; + } + + + /** Detects all open subpaths and closes them by adding a closePath command. + * Most font formats only support closed outline paths so there are no explicit closePath statements + * in the glyph's outline description. All open paths are automatically closed by the renderer. + * This method detects all open paths and adds the missing closePath statement. */ + void closeOpenSubPaths () { + Command *prevCommand = 0; + FORALL(_commands, Iterator, it) { + if (it->type == Command::MOVETO && prevCommand && prevCommand->type != Command::CLOSEPATH) { + prevCommand = &(*it); + it = _commands.insert(it, Command(Command::CLOSEPATH))+1; +// ++it; // skip inserted closePath command in next iteration step + } + else + prevCommand = &(*it); + } + if (!_commands.empty() && _commands.back().type != Command::CLOSEPATH) + closepath(); + } + + + /** Writes the path data as SVG path drawing command to a given output stream. + * @param[in] os output stream used to write the SVG commands to + * @param[in] relative if true, create relative rather than absolute coordinate values + * @param[in] sx horizontal scale factor + * @param[in] sy vertical scale factor + * @param[in] dx horizontal translation in PS point units + * @param[in] dy vertical translation in PS point units */ + void writeSVG (std::ostream &os, bool relative, double sx=1.0, double sy=1.0, double dx=0.0, double dy=0.0) const { + struct WriteActions : Actions { + WriteActions (std::ostream &os, bool relative, double sx, double sy, double dx, double dy) + : _os(os), _relative(relative), _sx(sx), _sy(sy), _dx(dx), _dy(dy) {} + + void draw (char cmd, const Point *points, int n) { + if (_relative) + cmd = tolower(cmd); + _os << cmd; + switch (cmd) { + case 'h': _os << XMLString(_sx*(points->x()-_currentPoint.x())+_dx); break; + case 'v': _os << XMLString(_sy*(points->y()-_currentPoint.y())+_dy); break; + case 'z': _currentPoint = _startPoint; break; + case 'H': _os << XMLString(_sx*points->x()+_dx); break; + case 'V': _os << XMLString(_sy*points->y()+_dy); break; + default : + for (int i=0; i < n; i++) { + if (i > 0) + _os << ' '; + Point p = points[i]; + if (_relative) + p -= _currentPoint; + _os << XMLString(_sx*p.x()+_dx) << ' ' << XMLString(_sy*p.y()+_dy); + } + } + if (cmd == 'm') + _startPoint = points[0]; + if (islower(cmd) && n > 0) + _currentPoint = points[n-1]; + } + std::ostream &_os; + bool _relative; + double _sx, _sy, _dx, _dy; + Point _startPoint, _currentPoint; + } actions(os, relative, sx, sy, dx, dy); + iterate(actions, true); + } + +#if 0 + void writePS (std::ostream &os, double sx=1.0, double sy=1.0, double dx=0.0, double dy=0.0) const { + struct WriteActions : Actions { + WriteActions (std::ostream &os, double sx, double sy, double dx, double dy) + : _os(os), _sx(sx), _sy(sy), _dx(dx), _dy(dy) {} + void draw (char cmd, const Point *points, int n) { + for (int i=0; i < n; i++) + _os << _sx*points[i].x()+_dx << ' ' << _sy*points[i].y()+_dy << ' '; + switch (cmd) { + case 'M': _os << "moveto"; break; + case 'L': _os << "lineto"; break; + case 'C': _os << "curveto"; break; + case 'Z': _os << "closepath"; break; + default: ; + } + _os << '\n'; + } + std::ostream &_os; + bool _relative; + double _sx, _sy, _dx, _dy; + } actions(os, sx, sy, dx, dy); + iterate(actions, false); + } +#endif + + + /** Computes the bounding box of the current path. + * @param[out] bbox the computed bounding box */ + void computeBBox (BoundingBox &bbox) const { + struct BBoxActions : Actions { + BBoxActions (BoundingBox &bb) : bbox(bb) {} + void moveto (const Point &p) {bbox.embed(p);} + void lineto (const Point &p) {bbox.embed(p);} + void conicto (const Point &p1, const Point &p2) {bbox.embed(p1); bbox.embed(p2);} + void cubicto (const Point &p1, const Point &p2, const Point &p3) {bbox.embed(p1); bbox.embed(p2); bbox.embed(p3);} + BoundingBox &bbox; + } actions(bbox); + iterate(actions, false); + } + + + /** Checks whether the current path describes a dot/point only (with no extent). + * @param[out] p coordinates of the point if path describes a dot + * @return true if path is a dot/point */ + bool isDot (Point &p) const { + struct DotActions : Actions { + DotActions () : differs(false) {} + void moveto (const Point &p) {point = p;} + void lineto (const Point &p) {differs = (p != point);} + void conicto (const Point &p1, const Point &p2) {differs = (point != p1 || point != p2);} + void cubicto (const Point &p1, const Point &p2, const Point &p3) {differs = (point != p1 || point != p2 || point != p3);} + bool quit () {return differs;} + Point point; + bool differs; + } actions; + iterate(actions, false); + p = actions.point; + return !actions.differs; + } + + + /** Transforms the path according to a given Matrix. + * @param[in] matrix Matrix describing the affine transformation */ + void transform (const Matrix &matrix) { + FORALL(_commands, Iterator, it) + it->transform(matrix); + } + + void iterate (Actions &actions, bool optimize) const; + + private: + std::vector _commands; + WindingRule _windingRule; +}; + + +/** Iterates over all commands defining this path and calls the corresponding template methods. + * In the case of successive bezier curve sequences, control points or tangent slopes are often + * identical so that the path description contains redundant information. SVG provides shorthand + * curve commands that require less parameters. If 'optimize' is true, this method detects such + * command sequences. + * @param[in] actions template methods called by each iteration step + * @param[in] optimize if true, shorthand drawing commands (sconicto, scubicto,...) are considered */ +template +void GraphicPath::iterate (Actions &actions, bool optimize) const { + ConstIterator prev = _commands.end(); // pointer to preceding command + Point fp; // first point of current path + Point cp; // current point + Point pstore[2]; + for (ConstIterator it=_commands.begin(); it != _commands.end() && !actions.quit(); ++it) { + const Point *params = it->params; + switch (it->type) { + case Command::MOVETO: + actions.moveto(params[0]); + actions.draw('M', params, 1); + fp = params[0]; + break; + case Command::LINETO: + if (optimize) { + if (cp.x() == params[0].x()) { + actions.vlineto(params[0].y()); + actions.draw('V', params, 1); + } + else if (cp.y() == params[0].y()) { + actions.hlineto(params[0].x()); + actions.draw('H', params, 1); + } + else { + actions.lineto(params[0]); + actions.draw('L', params, 1); + } + } + else { + actions.lineto(params[0]); + actions.draw('L', params, 1); + } + break; + case Command::CONICTO: + if (optimize && prev != _commands.end() && prev->type == Command::CONICTO && params[0] == pstore[1]*T(2)-pstore[0]) { + actions.sconicto(params[1]); + actions.draw('T', params+1, 1); + } + else { + actions.conicto(params[0], params[1]); + actions.draw('Q', params, 2); + } + pstore[0] = params[0]; // store control point and + pstore[1] = params[1]; // curve endpoint + break; + case Command::CUBICTO: + // is first control point reflection of preceding second control point? + if (optimize && prev != _commands.end() && prev->type == Command::CUBICTO && params[0] == pstore[1]*T(2)-pstore[0]) { + actions.scubicto(params[1], params[2]); + actions.draw('S', params+1, 2); + } + else { + actions.cubicto(params[0], params[1], params[2]); + actions.draw('C', params, 3); + } + pstore[0] = params[1]; // store second control point and + pstore[1] = params[2]; // curve endpoint + break; + case Command::CLOSEPATH: + actions.closepath(); + actions.draw('Z', params, 0); + cp = fp; + } + // update current point + const int np = it->numParams(); + if (np > 0) + cp = it->params[np-1]; + prev = it; + } + actions.finished(); +} + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp new file mode 100644 index 00000000000..d8e0c8f30f6 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.cpp @@ -0,0 +1,306 @@ +/************************************************************************* +** HtmlSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "HtmlSpecialHandler.h" +#include "InputReader.h" +#include "Message.h" +#include "SVGTree.h" +#include "XMLNode.h" + +using namespace std; + +// variable to select the link marker variant (none, underlined, boxed, or colored background) +HtmlSpecialHandler::MarkerType HtmlSpecialHandler::MARKER_TYPE = HtmlSpecialHandler::MT_LINE; +Color HtmlSpecialHandler::LINK_BGCOLOR; +Color HtmlSpecialHandler::LINK_LINECOLOR; +bool HtmlSpecialHandler::USE_LINECOLOR = false; + + +void HtmlSpecialHandler::preprocess (const char *prefix, istream &is, SpecialActions *actions) { + if (!actions) + return; + _actions = actions; + StreamInputReader ir(is); + ir.skipSpace(); + // collect page number and ID of named anchors + map attribs; + if (ir.check(" 0) { + map::iterator it; + if ((it = attribs.find("name")) != attribs.end()) + preprocessNameAnchor(it->second); + else if ((it = attribs.find("href")) != attribs.end()) + preprocessHrefAnchor(it->second); + } +} + + +void HtmlSpecialHandler::preprocessNameAnchor (const string &name) { + NamedAnchors::iterator it = _namedAnchors.find(name); + if (it == _namedAnchors.end()) { // anchor completely undefined? + int id = _namedAnchors.size()+1; + _namedAnchors[name] = NamedAnchor(_actions->getCurrentPageNumber(), id, 0); + } + else if (it->second.id < 0) { // anchor referenced but not defined yet? + it->second.id *= -1; + it->second.pageno = _actions->getCurrentPageNumber(); + } + else + Message::wstream(true) << "named hyperref anchor '" << name << "' redefined\n"; +} + + +void HtmlSpecialHandler::preprocessHrefAnchor (const string &uri) { + if (uri[0] != '#') + return; + string name = uri.substr(1); + NamedAnchors::iterator it = _namedAnchors.find(name); + if (it != _namedAnchors.end()) // anchor already defined? + it->second.referenced = true; + else { + int id = _namedAnchors.size()+1; + _namedAnchors[name] = NamedAnchor(0, -id, 0, true); + } +} + + +bool HtmlSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + if (!actions) + return true; + _actions = actions; + StreamInputReader ir(is); + ir.skipSpace(); + map attribs; + map::iterator it; + if (ir.check(" 0) { + if ((it = attribs.find("href")) != attribs.end()) // + processHrefAnchor(it->second); + else if ((it = attribs.find("name")) != attribs.end()) // + processNameAnchor(it->second); + else + return false; // none or only invalid attributes + } + else if (ir.check("")) + closeAnchor(); + else if (ir.check(" 0 && (it = attribs.find("href")) != attribs.end()) + _base = it->second; + return true; +} + + +/** Handles anchors with href attribute: ... + * @param uri value of href attribute */ +void HtmlSpecialHandler::processHrefAnchor (string uri) { + closeAnchor(); + string name; + if (uri[0] == '#') { // reference to named anchor? + name = uri.substr(1); + NamedAnchors::iterator it = _namedAnchors.find(name); + if (it == _namedAnchors.end() || it->second.id < 0) + Message::wstream(true) << "reference to undefined anchor '" << name << "'\n"; + else { + int id = it->second.id; + uri = "#loc"+XMLString(id); + if (_actions->getCurrentPageNumber() != it->second.pageno) { + ostringstream oss; + oss << _actions->getSVGFilename(it->second.pageno) << uri; + uri = oss.str(); + } + } + } + if (!_base.empty() && uri.find("://") != string::npos) { + if (*_base.rbegin() != '/' && uri[0] != '/' && uri[0] != '#') + uri = "/" + uri; + uri = _base + uri; + } + XMLElementNode *anchor = new XMLElementNode("a"); + anchor->addAttribute("xlink:href", uri); + anchor->addAttribute("xlink:title", XMLString(name.empty() ? uri : name, false)); + _actions->pushContextElement(anchor); + _actions->bbox("{anchor}", true); // start computing the bounding box of the linked area + _depthThreshold = _actions->getDVIStackDepth(); + _anchorType = AT_HREF; +} + + +/** Handles anchors with name attribute: ... + * @param name value of name attribute */ +void HtmlSpecialHandler::processNameAnchor (const string &name) { + closeAnchor(); + NamedAnchors::iterator it = _namedAnchors.find(name); + assert(it != _namedAnchors.end()); + it->second.pos = _actions->getY(); + _anchorType = AT_NAME; +} + + +/** Handles the closing tag ( of the current anchor element. */ +void HtmlSpecialHandler::closeAnchor () { + if (_anchorType == AT_HREF) { + markLinkedBox(); + _actions->popContextElement(); + _depthThreshold = 0; + } + _anchorType = AT_NONE; +} + + +/** Marks a single rectangular area of the linked part of the document with a line or + * a box so that it's noticeable by the user. Additionally, an invisible rectangle is + * placed over this area in order to avoid flickering of the mouse cursor when moving + * it over the hyperlinked area. */ +void HtmlSpecialHandler::markLinkedBox () { + const BoundingBox &bbox = _actions->bbox("{anchor}"); + if (bbox.width() > 0 && bbox.height() > 0) { // does the bounding box extend in both dimensions? + if (MARKER_TYPE != MT_NONE) { + const double linewidth = min(0.5, bbox.height()/15); + XMLElementNode *rect = new XMLElementNode("rect"); + double x = bbox.minX(); + double y = bbox.maxY()+linewidth; + double w = bbox.width(); + double h = linewidth; + const Color &linecolor = USE_LINECOLOR ? LINK_LINECOLOR : _actions->getColor(); + if (MARKER_TYPE == MT_LINE) + rect->addAttribute("fill", linecolor.svgColorString()); + else { + x -= linewidth; + y = bbox.minY()-linewidth; + w += 2*linewidth; + h += bbox.height()+linewidth; + if (MARKER_TYPE == MT_BGCOLOR) { + rect->addAttribute("fill", LINK_BGCOLOR.svgColorString()); + if (USE_LINECOLOR) { + rect->addAttribute("stroke", linecolor.svgColorString()); + rect->addAttribute("stroke-width", linewidth); + } + } + else { // LM_BOX + rect->addAttribute("fill", "none"); + rect->addAttribute("stroke", linecolor.svgColorString()); + rect->addAttribute("stroke-width", linewidth); + } + } + rect->addAttribute("x", x); + rect->addAttribute("y", y); + rect->addAttribute("width", w); + rect->addAttribute("height", h); + _actions->prependToPage(rect); + if (MARKER_TYPE == MT_BOX || MARKER_TYPE == MT_BGCOLOR) { + // slightly enlarge the boxed area + x -= linewidth; + y -= linewidth; + w += 2*linewidth; + h += 2*linewidth; + } + _actions->embed(BoundingBox(x, y, x+w, y+h)); + } + // 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) { + XMLElementNode *rect = new XMLElementNode("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); + _actions->appendToPage(rect); + } + } +} + + +/** This method is called every time the DVI position changes. */ +void HtmlSpecialHandler::dviMovedTo (double x, double y) { + if (_actions && _anchorType != AT_NONE) { + // Start a new box if the current depth of the DVI stack underruns + // the initial threshold which indicates a line break. + if (_actions->getDVIStackDepth() < _depthThreshold) { + markLinkedBox(); + _depthThreshold = _actions->getDVIStackDepth(); + _actions->bbox("{anchor}", true); // start a new box on the new line + } + } +} + + +void HtmlSpecialHandler::dviEndPage (unsigned pageno) { + if (_actions) { + // create views for all collected named anchors defined on the recent page + const BoundingBox &pagebox = _actions->bbox(); + for (NamedAnchors::iterator it=_namedAnchors.begin(); it != _namedAnchors.end(); ++it) { + if (it->second.pageno == pageno && it->second.referenced) { // current anchor referenced? + ostringstream oss; + oss << pagebox.minX() << ' ' << it->second.pos << ' ' + << pagebox.width() << ' ' << pagebox.height(); + XMLElementNode *view = new XMLElementNode("view"); + view->addAttribute("id", "loc"+XMLString(it->second.id)); + view->addAttribute("viewBox", oss.str()); + _actions->appendToDefs(view); + } + } + closeAnchor(); + _actions = 0; + } +} + + +/** Sets the appearance of the link markers. + * @param[in] marker string specifying the marker (format: type[:linecolor]) + * @return true on success */ +bool HtmlSpecialHandler::setLinkMarker (const string &marker) { + string type; // "none", "box", "line", or a background color specifier + string color; // optional line color specifier + size_t seppos = marker.find(":"); + if (seppos == string::npos) + type = marker; + else { + type = marker.substr(0, seppos); + color = marker.substr(seppos+1); + } + if (type.empty() || type == "none") + MARKER_TYPE = MT_NONE; + else if (type == "line") + MARKER_TYPE = MT_LINE; + else if (type == "box") + MARKER_TYPE = MT_BOX; + else { + if (!LINK_BGCOLOR.setPSName(type, false)) + return false; + MARKER_TYPE = MT_BGCOLOR; + } + USE_LINECOLOR = false; + if (MARKER_TYPE != MT_NONE && !color.empty()) { + if (!LINK_LINECOLOR.setPSName(color, false)) + return false; + USE_LINECOLOR = true; + } + return true; +} + + +const char** HtmlSpecialHandler::prefixes () const { + static const char *pfx[] = {"html:", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h new file mode 100644 index 00000000000..4c5893c0306 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HtmlSpecialHandler.h @@ -0,0 +1,79 @@ +/************************************************************************* +** HtmlSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_HTMLSPECIALHANDLER_H +#define DVISVGM_HTMLSPECIALHANDLER_H + +#include +#include +#include "Color.h" +#include "SpecialHandler.h" + +struct SpecialActions; + +class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, public DVIPositionListener +{ + struct NamedAnchor { + NamedAnchor () : pageno(0), id(0), pos(0), referenced(false) {} + NamedAnchor (unsigned pn, int i, double p, bool r=false) : pageno(pn), id(i), pos(p), referenced(r) {} + unsigned pageno; ///< page number where the anchor is located + int id; ///< unique numerical ID (< 0 if anchor is undefined yet) + double pos; ///< vertical position of named anchor (in PS point units) + bool referenced; ///< true if a reference to this anchor exists + }; + + enum AnchorType {AT_NONE, AT_HREF, AT_NAME}; + typedef std::map NamedAnchors; + + public: + HtmlSpecialHandler () : _actions(0), _anchorType(AT_NONE), _depthThreshold(0) {} + void preprocess(const char *prefix, std::istream &is, SpecialActions *actions); + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + const char* name () const {return "html";} + const char* info () const {return "hyperref specials";} + const char** prefixes () const; + + static bool setLinkMarker (const std::string &marker); + + protected: + void preprocessHrefAnchor (const std::string &uri); + void preprocessNameAnchor (const std::string &name); + void processHrefAnchor (std::string uri); + void processNameAnchor (const std::string &name); + void dviEndPage (unsigned pageno); + void dviMovedTo (double x, double y); + void closeAnchor (); + void markLinkedBox (); + + enum MarkerType {MT_NONE, MT_LINE, MT_BOX, MT_BGCOLOR}; + static MarkerType MARKER_TYPE; ///< selects how to mark linked areas + static Color LINK_BGCOLOR; ///< background color if linkmark type == LT_BGCOLOR + static Color LINK_LINECOLOR; ///< line color if linkmark type is LM_LINE or LM_BOX + static bool USE_LINECOLOR; ///< if true, LINK_LINECOLOR is applied + + private: + SpecialActions *_actions; + AnchorType _anchorType; ///< type of active anchor + int _depthThreshold; ///< break anchor box if the DVI stack depth underruns this threshold + std::string _base; ///< base URL that is prepended to all relative targets + NamedAnchors _namedAnchors; ///< information about all named anchors processed +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp new file mode 100644 index 00000000000..acf19e2f1c2 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.cpp @@ -0,0 +1,138 @@ +/************************************************************************* +** InputBuffer.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "InputBuffer.h" + +using namespace std; + + +StreamInputBuffer::StreamInputBuffer (istream &is, size_t bufsize) + : _is(is), _bufsize(bufsize), _buf1(new UInt8[_bufsize]), _buf2(new UInt8[_bufsize]), _bufptr(_buf1) +{ + _size1 = fillBuffer(_buf1); + _size2 = fillBuffer(_buf2); +} + + +StreamInputBuffer::~StreamInputBuffer () { + delete [] _buf1; + delete [] _buf2; +} + + +int StreamInputBuffer::get () { + if (pos() == _size1) { + if (_size2 == 0) + return -1; + swap(_buf1, _buf2); + _size1 = _size2; + _bufptr = _buf1; + _size2 = fillBuffer(_buf2); + } + UInt8 c = *_bufptr++; + return c; +} + + +/** Returns the next character to be read without skipping it. + * Same as peek(0). */ +int StreamInputBuffer::peek () const { + if (pos() < _size1) + return *_bufptr; + return _size2 > 0 ? *_buf2 : -1; +} + + +/** Returns the n-th next character without skipping it. */ +int StreamInputBuffer::peek (size_t n) const { + if (pos()+n < _size1) + return *(_bufptr+n); + if (pos()+n < _size1+_size2) + return *(_buf2 + pos()+n-_size1); + return -1; +} + + +/** Fills the buffer by reading a sequence of characters from the assigned + * input stream. + * @param[in] buf pointer to character buffer to be filled + * @return number of characters read */ +int StreamInputBuffer::fillBuffer (UInt8 *buf) { + if (_is && !_is.eof()) { + _is.read((char*)buf, _bufsize); + return _is.gcount(); + } + return 0; +} + +/////////////////////////////////////////////// + +SplittedCharInputBuffer::SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2) { + _buf[0] = buf1; + _buf[1] = buf2; + _size[0] = buf1 ? s1 : 0; + _size[1] = buf2 ? s2 : 0; + _index = _size[0] ? 0 : 1; +} + + +int SplittedCharInputBuffer::get () { + if (_size[_index] == 0) + return -1; + int ret = *_buf[_index]++; + _size[_index]--; + if (_index == 0 && _size[0] == 0) + _index++; + return ret; +} + + +int SplittedCharInputBuffer::peek () const { + return _size[_index] ? *_buf[_index] : -1; +} + + +int SplittedCharInputBuffer::peek (size_t n) const { + if (n < _size[_index]) + return _buf[_index][n]; + n -= _size[_index]; + if (_index == 0 && n < _size[1]) + return _buf[1][n]; + return -1; +} + +/////////////////////////////////////////////// + + +int TextStreamInputBuffer::get () { + int c = StreamInputBuffer::get(); + if (c == '\n') { + _line++; + _col = 1; + } + else + _col++; + return c; +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h new file mode 100644 index 00000000000..35ea9401a6e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.h @@ -0,0 +1,145 @@ +/************************************************************************* +** InputBuffer.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_INPUTBUFFER_H +#define DVISVGM_INPUTBUFFER_H + +#include +#include +#include +#include +#include +#include "types.h" + +struct InputBuffer +{ + virtual ~InputBuffer () {} + virtual int get () =0; + virtual int peek () const =0; + virtual int peek (size_t n) const =0; + virtual bool eof () const =0; + virtual void invalidate () =0; +}; + + +class StreamInputBuffer : public InputBuffer +{ + public: + StreamInputBuffer (std::istream &is, size_t bufsize=1024); + ~StreamInputBuffer (); + int get (); + int peek () const; + int peek (size_t n) const; + bool eof () const {return pos() == _size1 && _size2 == 0;} + void invalidate () {_bufptr = _buf1+_size1; _size2 = 0;} + + protected: + int fillBuffer (UInt8 *buf); + size_t pos () const {return _bufptr-_buf1;} + + private: + std::istream &_is; + const size_t _bufsize; ///< maximal number of bytes each buffer can hold + UInt8 *_buf1; ///< pointer to first buffer + UInt8 *_buf2; ///< pointer to second buffer + size_t _size1; ///< number of bytes in buffer 1 + size_t _size2; ///< number of bytes in buffer 2 + UInt8 *_bufptr; ///< pointer to next byte to read +}; + + +class StringInputBuffer : public InputBuffer +{ + public: + StringInputBuffer (const std::string &str) : _str(str), _pos(0) {} + int get () {return _pos < _str.length() ? _str[_pos++] : -1;} + int peek () const {return _pos < _str.length() ? _str[_pos] : -1;} + int peek (size_t n) const {return _pos+n < _str.length() ? _str[_pos+n] : -1;} + bool eof () const {return _pos >= _str.length();} + void invalidate () {_pos = _str.length();} + + private: + const std::string &_str; + size_t _pos; +}; + + +class CharInputBuffer : public InputBuffer +{ + public: + CharInputBuffer (const char *buf, size_t size) : _pos(buf), _size(buf ? size : 0) {} + + int get () { + if (_size == 0) + return -1; + else { + _size--; + return *_pos++; + } + } + + + void assign (const char *buf, size_t size) { + _pos = buf; + _size = size; + } + + void assign (const char *buf) {assign(buf, std::strlen(buf));} + int peek () const {return _size > 0 ? *_pos : -1;} + int peek (size_t n) const {return _size >= n ? _pos[n] : -1;} + bool eof () const {return _size == 0;} + void invalidate () {_size = 0;} + + private: + const char *_pos; + size_t _size; +}; + + +class SplittedCharInputBuffer : public InputBuffer +{ + public: + SplittedCharInputBuffer (const char *buf1, size_t s1, const char *buf2, size_t s2); + int get (); + int peek () const; + int peek (size_t n) const; + bool eof () const {return _size[_index] == 0;} + void invalidate () {_size[_index] = 0;} + + private: + const char *_buf[2]; + size_t _size[2]; + int _index; +}; + + +class TextStreamInputBuffer : public StreamInputBuffer +{ + public: + TextStreamInputBuffer (std::istream &is) : StreamInputBuffer(is), _line(1), _col(1) {} + int get (); + int line () const {return _line;} + int col () const {return _col;} + + private: + int _line, _col; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp new file mode 100644 index 00000000000..cfe46f9d87f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.cpp @@ -0,0 +1,349 @@ +/************************************************************************* +** InputReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "InputReader.h" + +using namespace std; + + +/** Skips n characters. */ +void InputReader::skip (size_t n) { + while (n-- > 0) + get(); +} + + +/** Moves the buffer pointer to the next non-space character. A following call + * of get() returns this character. */ +void InputReader::skipSpace () { + while (isspace(peek())) + get(); +} + + +/** Tries to find a given string and skips all characters preceding that string. + * @param[in] s string to look for (must not be longer than the maximal buffer size) + * @param[in] consume if true, the buffer pointer is moved to the first character following string s + * @return true if s was found */ +bool InputReader::skipUntil (const char *s, bool consume) { + bool found = false; + while (!eof() && !(found = check(s, consume))) + get(); + return found; +} + + +/** Looks for the first occurrence of a given character. + * @param[in] c character to lookup + * @return position of character relative to current location, -1 if character was not found */ +int InputReader::find (char c) const { + int pos = 0; + int cc; + while ((cc = peek(pos)) >= 0 && cc != c) + pos++; + return cc < 0 ? -1 : pos; +} + + +/** Checks if the next characters to be read match a given string. + * @param[in] s string to be matched + * @param[in] consume if true, the characters of the matched string are skipped + * @return true if s matches */ +bool InputReader::check (const char *s, bool consume) { + size_t count = 0; + for (const char *p=s; *p; p++) { + if (peek(count++) != *p) + return false; + } + if (consume) + skip(count); + return true; +} + + +int InputReader::compare (const char *s, bool consume) { + size_t count = 0; + for (const char *p=s; *p; p++) { + int c = peek(count++); + if (c != *p) + return c < *p ? -1 : 1; + } + int c = peek(count); + if (c < 0 || !isspace(c)) + return 1; + if (consume) + skip(count); + return 0; +} + + +/** Reads an integer from the buffer. All characters that are part of + * the read integer constant are skipped. If this function returns false, + * the buffer pointer points to the same position as before the function call. + * @param[out] val contains the read integer value on success + * @param[in] accept_sign if false, only positive integers (without sign) are accepted + * @return true if integer could be read */ +bool InputReader::parseInt (int &val, bool accept_sign) { + val = 0; + int fac=1; + char sign; // explicitly given sign + if (accept_sign && ((sign = peek()) == '+' || sign == '-')) { + if (isdigit(peek(1))) { + get(); // skip sign + if (sign == '-') + fac = -1; + } + else + return false; + } + else if (!isdigit(peek())) + return false; + + while (isdigit(peek())) + val = val*10 + (get()-'0'); + val *= fac; + return true; +} + + +bool InputReader::parseUInt (unsigned &val) { + val = 0; + if (!isdigit(peek())) + return false; + while (isdigit(peek())) + val = val*10 + (get()-'0'); + return true; +} + + +bool InputReader::parseInt (int base, int &val) { + if (base < 2 || base > 32) + return false; + + const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; + const char maxdigit = digits[base-1]; + char c; + if (!isalnum(c = tolower(peek())) || c > maxdigit) + return false; + + val = 0; + while (isalnum(c = tolower(peek())) && c <= maxdigit) { + get(); + int digit = c - (c <= '9' ? '0' : 'a'-10); + val = val*base + digit; + } + return true; +} + + +/** Reads a double from the buffer. All characters that are part of + * the read double constant are skipped. If this function returns false, + * the buffer pointer points to the same position as before the function call. + * @param[out] val contains the read double value on success + * @return number details: 0=no number, 'i'=integer, 'f'=floating point number */ +char InputReader::parseDouble (double &val) { + int fac=1; + int int_part=0; + bool is_float = false; + skipSpace(); + char sign = peek(); + if (parseInt(int_part)) { // match [+-]?[0-9]+\.? + if (peek() == '.') { + get(); + is_float = true; + } + if (int_part < 0 || sign == '-') { + fac = -1; + int_part = -int_part; + } + } + else { // match [+-]?\. + char sign; // explicitly given sign + if ((sign = peek()) == '+' || sign == '-') { // match [+-]?\.[0-9] + if (peek(1) != '.' || !isdigit(peek(2))) + return 0; + if (sign == '-') + fac = -1; + skip(2); // skip sign and dot + } + else if (peek() == '.' && isdigit(peek(1))) + get(); + else + return 0; + is_float = true; + } + // parse fractional part + double frac_part=0.0; + for (double u=10; isdigit(peek()); u*=10) + frac_part += (get()-'0')/u; + val = (int_part + frac_part) * fac; + // parse exponent + char c; + if (tolower(peek()) == 'e' && (isdigit(c=peek(1)) || ((c == '+' || c == '-') && isdigit(peek(2))))) { + get(); // skip 'e' + int exp; + parseInt(exp); + val *= pow(10.0, exp); + is_float = true; + } + return is_float ? 'f' : 'i'; +} + + +/** Reads an integer value from the buffer. If no valid integer constant + * could be found at the current position 0 is returned. */ +int InputReader::getInt () { + skipSpace(); + int val; + return parseInt(val) ? val : 0; +} + + +/** Reads an double value from the buffer. If no valid double constant + * could be found at the current position 0 is returned. */ +double InputReader::getDouble () { + skipSpace(); + double val; + return parseDouble(val) ? val : 0.0; +} + + +/** Reads a string that consists of alphabetic letters only. Reading stops as + * soon as a non-alphabetic character is found or EOF is reached. */ +string InputReader::getWord () { + string ret; + skipSpace(); + while (isalpha(peek())) + ret += get(); + return ret; +} + + +/** Reads a single punctuation character. + * @return the read character or 0 if there's no punctuation character at the current position */ +char InputReader::getPunct () { + skipSpace(); + if (ispunct(peek())) + return get(); + return 0; +} + + +/** Reads a string delimited by a given quotation character. + * Before reading the string, all leading whitespace is skipped. Then, the function checks + * for the given quotation character. If it is found, all characters until the second + * appearance of the quotation char are appended to the result. Otherwise, an empty string + * is returned. If the quotation character is 0, the behavior of this function is identical to + * a call of getString(). + * @param[in] quotechar the quotation character bounding the string to be read + * @return the string read */ +string InputReader::getQuotedString (char quotechar) { + if (quotechar == 0) + return getString(); + + string ret; + skipSpace(); + if (peek() == quotechar) { + get(); + while (!eof() && peek() != quotechar) + ret += get(); + get(); + } + return ret; +} + + +/** Reads a string delimited by whitespace and/or invisible characters. + * Before reading the string, all leading whitespace is skipped. Then, the function adds + * all printable characters to the result until a whitespace, an unprintable character, or + * EOF is found. + * @return the string read */ +string InputReader::getString () { + string ret; + skipSpace(); + while (!eof() && !isspace(peek()) && isprint(peek())) + ret += get(); + return ret; +} + + +/** Reads a given number of characters and returns the resulting string. + * @param n number of character to read + * @return the string read */ +string InputReader::getString (size_t n) { + string ret; + while (n-- > 0) + ret += get(); + return ret; +} + + +string InputReader::getLine () { + string ret; + skipSpace(); + while (!eof() && peek() > 0 && peek() != '\n') + ret += get(); + // trim trailing whitespace + ret.erase(std::find_if(ret.rbegin(), ret.rend(), not1(ptr_fun(isspace))).base(), ret.end()); + return ret; +} + + +/** Parses a sequence of key-value pairs of the form KEY=VALUE or KEY="VALUE" + * @param[out] attr the scanned atributes + * @param[in] quotechar quote character used to enclose the attribute values + * @return number of attributes scanned */ +int InputReader::parseAttributes (map &attr, char quotechar) { + bool ready=false; + while (!eof() && !ready) { + string key; + skipSpace(); + while (isalnum(peek())) + key += get(); + skipSpace(); + if (peek() == '=') { + get(); + skipSpace(); + string val = getQuotedString(quotechar); + attr[key] = val; + } + else + ready = true; + } + return attr.size(); +} + +////////////////////////////////////////// + + +int StreamInputReader::peek (size_t n) const { + if (n == 0) + return peek(); + vector chars(n); + _is.read(&chars[0], n); + int ret = peek(); + for (int i=n-1; i >= 0; i--) + _is.putback(chars[i]); + return ret; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h new file mode 100644 index 00000000000..5cf43b6142d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputReader.h @@ -0,0 +1,90 @@ +/************************************************************************* +** InputReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_INPUTREADER_H +#define DVISVGM_INPUTREADER_H + +#include +#include +#include +#include "InputBuffer.h" + + +class InputReader +{ + public: + virtual ~InputReader() {} + virtual int get () =0; + virtual int peek () const =0; + virtual int peek (size_t n) const =0; + virtual bool eof () const =0; + virtual bool check (char c) const {return peek() == c;} + virtual bool check (const char *s, bool consume=true); + virtual int compare (const char *s, bool consume=true); + virtual void skip (size_t n); + virtual bool skipUntil (const char *s, bool consume=true); + virtual int find (char c) const; + virtual void skipSpace (); + virtual int getInt (); + virtual bool parseInt (int &val, bool accept_sign=true); + virtual bool parseInt (int base, int &val); + virtual bool parseUInt (unsigned &val); + virtual char parseDouble (double &val); + virtual double getDouble (); + virtual std::string getWord (); + virtual char getPunct (); + virtual std::string getQuotedString (char quotechar); + virtual std::string getString (); + virtual std::string getString (size_t n); + virtual std::string getLine (); + virtual int parseAttributes (std::map &attr, char quotechar=0); + virtual operator bool () const {return !eof();} +}; + + +class StreamInputReader : public InputReader +{ + public: + StreamInputReader (std::istream &is) : _is(is) {} + int get () {return _is.get();} + int peek () const {return _is.peek();} + int peek (size_t n) const; + bool eof () const {return !_is || _is.eof();} + + private: + std::istream &_is; +}; + + +class BufferInputReader : public InputReader +{ + public: + BufferInputReader (InputBuffer &ib) : _ib(&ib) {} + void assign (InputBuffer &ib) {_ib = &ib;} + int get () {return _ib->get();} + int peek () const {return _ib->peek();} + int peek (size_t n) const {return _ib->peek(n);} + bool eof () const {return _ib->eof();} + + private: + InputBuffer *_ib; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp new file mode 100644 index 00000000000..fb93b716d01 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -0,0 +1,99 @@ +/************************************************************************* +** JFM.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "JFM.h" +#include "StreamReader.h" + +using namespace std; + + +JFM::JFM (istream &is) { + is.seekg(0); + StreamReader sr(is); + UInt16 id = UInt16(sr.readUnsigned(2)); // JFM ID (9 or 11) + if (id != 9 && id != 11) { + ostringstream oss; + oss << "invalid JFM identifier " << id << " (9 or 11 expected)"; + throw FontMetricException(oss.str()); + } + _vertical = (id == 9); + UInt16 nt = UInt16(sr.readUnsigned(2)); // length of character type table + UInt16 lf = UInt16(sr.readUnsigned(2)); // length of entire file in 4 byte words + UInt16 lh = UInt16(sr.readUnsigned(2)); // length of header in 4 byte words + UInt16 bc = UInt16(sr.readUnsigned(2)); // smallest character code in font + UInt16 ec = UInt16(sr.readUnsigned(2)); // largest character code in font + UInt16 nw = UInt16(sr.readUnsigned(2)); // number of words in width table + UInt16 nh = UInt16(sr.readUnsigned(2)); // number of words in height table + UInt16 nd = UInt16(sr.readUnsigned(2)); // number of words in depth table + UInt16 ni = UInt16(sr.readUnsigned(2)); // number of words in italic corr. table + UInt16 nl = UInt16(sr.readUnsigned(2)); // number of words in glue/kern table + UInt16 nk = UInt16(sr.readUnsigned(2)); // number of words in kern table + UInt16 ng = UInt16(sr.readUnsigned(2)); // number of words in glue table + UInt16 np = UInt16(sr.readUnsigned(2)); // number of font parameter words + + if (7+nt+lh+(ec-bc+1)+nw+nh+nd+ni+nl+nk+ng+np != lf) + throw FontMetricException("inconsistent length values"); + + setCharRange(bc, ec); + readHeader(sr); + is.seekg(28+lh*4); + readTables(sr, nt, nw, nh, nd, ni); +} + + +void JFM::readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni) { + // determine smallest charcode with chartype > 0 + UInt16 minchar=0xFFFF, maxchar=0; + for (int i=0; i < nt; i++) { + UInt16 c = (UInt16)sr.readUnsigned(2); + UInt16 t = (UInt16)sr.readUnsigned(2); + if (t > 0) { + minchar = min(minchar, c); + maxchar = max(maxchar, c); + } + } + // build charcode to chartype map + if (minchar <= maxchar) { + _minchar = minchar; + _charTypeTable.resize(maxchar-minchar+1); + memset(&_charTypeTable[0], 0, nt*sizeof(UInt16)); + sr.seek(-nt*4, ios::cur); + for (int i=0; i < nt; i++) { + UInt16 c = (UInt16)sr.readUnsigned(2); + UInt16 t = (UInt16)sr.readUnsigned(2); + if (c >= minchar) + _charTypeTable[c-minchar] = t; + } + } + TFM::readTables(sr, nw, nh, nd, ni); +} + + +int JFM::charIndex (int c) const { + UInt16 chartype = 0; + if (!_charTypeTable.empty() && c >= _minchar && size_t(c) < _minchar+_charTypeTable.size()) + chartype = _charTypeTable[c-_minchar]; + return TFM::charIndex(chartype); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h new file mode 100644 index 00000000000..e3a98e8e94c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.h @@ -0,0 +1,44 @@ +/************************************************************************* +** JFM.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_JFM_H +#define DVISVGM_JFM_H + +#include +#include "TFM.h" + + +class JFM : public TFM +{ + public: + JFM (std::istream &is); + bool verticalLayout () const {return _vertical;} + + protected: + void readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni); + int charIndex (int c) const; + + private: + UInt16 _minchar; ///< character code of first entry in character type table + bool _vertical; ///< true if metrics refer to vertical text layout + std::vector _charTypeTable; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp new file mode 100644 index 00000000000..7ed0a4d1dfe --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.cpp @@ -0,0 +1,85 @@ +/************************************************************************* +** Length.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "InputReader.h" +#include "Length.h" + +#define UNIT(c1,c2) ((c1 << 8)|c2) + +using namespace std; + + +void Length::set (const string &len) { + switch (len.length()) { + case 0: + _pt = 0; + break; + case 1: + if (isdigit(len[0])) + _pt = len[0] - '0'; + else + throw UnitException("invalid length: "+len); + break; + default: + istringstream iss(len); + StreamInputReader ir(iss); + double val; + if (!ir.parseDouble(val)) + throw UnitException("invalid length: "+len); + string unit = ir.getWord(); + set(val, unit); + } +} + + +void Length::set (double val, Unit unit) { + switch (unit) { + case PT: _pt = val; break; + case BP: _pt = val*72.27/72; break; + case IN: _pt = val*72.27; break; + case CM: _pt = val/2.54*72.27; break; + case MM: _pt = val/25.4*72.27; break; + case PC: _pt = val/12*72.27; break; + } +} + + +void Length::set (double val, string unitstr) { + if (unitstr.empty()) + unitstr = "pt"; + else if (unitstr.length() != 2) + throw UnitException("invalid length unit: "+unitstr); + + Unit unit; + switch (UNIT(unitstr[0], unitstr[1])) { + case UNIT('p','t'): unit = PT; break; + case UNIT('b','p'): unit = BP; break; + case UNIT('i','n'): unit = IN; break; + case UNIT('c','m'): unit = CM; break; + case UNIT('m','m'): unit = MM; break; + case UNIT('p','c'): unit = PC; break; + default: + throw UnitException("invalid length unit: "+unitstr); + } + set(val, unit); +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h new file mode 100644 index 00000000000..b4782cb8b23 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Length.h @@ -0,0 +1,62 @@ +/************************************************************************* +** Length.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_LENGTH_H +#define DVISVGM_LENGTH_H + +#include +#include "MessageException.h" + +#ifdef IN +#undef IN +#endif + +struct UnitException : MessageException +{ + UnitException (const std::string &msg) : MessageException(msg) {} +}; + + +class Length +{ + public: + enum Unit {PT, BP, CM, MM, IN, PC}; + + public: + Length () : _pt(0) {} + Length (double val, Unit unit=PT) {set(val, unit);} + Length (double val, const std::string &unit) {set(val, unit);} + Length (const std::string &len) {set(len);} + void set (double val, Unit unit); + void set (double val, std::string unit); + void set (const std::string &len); + + double pt () const {return _pt;} + double in () const {return _pt/72.27;} + double bp () const {return in()*72;} + double cm () const {return in()*2.54;} + double mm () const {return cm()*10;} + double pc () const {return in()*12;} + + private: + double _pt; // length in TeX point units +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am new file mode 100644 index 00000000000..837dd0cd633 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -0,0 +1,233 @@ +:## This file is part of dvisvgm +## Copyright (C) 2005-2015 Martin Gieseking +## +## Process this file with automake. + +bin_PROGRAMS = dvisvgm +noinst_LIBRARIES = libdvisvgm.a + +dvisvgm_SOURCES = gzstream.h \ + dvisvgm.cpp gzstream.cpp + +dvisvgm_LDADD = \ + $(noinst_LIBRARIES) \ + ../clipper/libclipper.a \ + ../xxHash/libxxhash.a \ + $(FREETYPE_LIBS) \ + $(ZLIB_LIBS) + +dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) + +libdvisvgm_a_SOURCES = \ + BasicDVIReader.cpp \ + BasicDVIReader.h \ + Bezier.cpp \ + Bezier.h \ + BgColorSpecialHandler.cpp \ + BgColorSpecialHandler.h \ + Bitmap.cpp \ + Bitmap.h \ + BoundingBox.cpp \ + BoundingBox.h \ + Calculator.cpp \ + Calculator.h \ + Character.h \ + CharMapID.cpp \ + CharMapID.h \ + CMap.cpp \ + CMap.h \ + CMapManager.cpp \ + CMapManager.h \ + CMapReader.cpp \ + CMapReader.h \ + CmdLineParserBase.cpp \ + CmdLineParserBase.h \ + Color.cpp \ + Color.h \ + ColorSpecialHandler.cpp \ + ColorSpecialHandler.h \ + CommandLine.cpp \ + CommandLine.h \ + CRC32.cpp \ + CRC32.h \ + DependencyGraph.h \ + Directory.cpp \ + Directory.h \ + DLLoader.cpp \ + DLLoader.h \ + DVIActions.h \ + DVIReader.cpp \ + DVIReader.h \ + DvisvgmSpecialHandler.cpp \ + DvisvgmSpecialHandler.h \ + DVIToSVG.cpp \ + DVIToSVG.h \ + DVIToSVGActions.cpp \ + DVIToSVGActions.h \ + EmSpecialHandler.cpp \ + EmSpecialHandler.h \ + EncFile.cpp \ + EncFile.h \ + EPSFile.cpp \ + EPSFile.h \ + EPSToSVG.cpp \ + EPSToSVG.h \ + FileFinder.cpp \ + FileFinder.h \ + FilePath.cpp \ + FilePath.h \ + FileSystem.cpp \ + FileSystem.h \ + Font.cpp \ + Font.h \ + FontCache.cpp \ + FontCache.h \ + FontEncoding.cpp \ + FontEncoding.h \ + FontEngine.cpp \ + FontEngine.h \ + FontManager.cpp \ + FontManager.h \ + FontMap.cpp \ + FontMap.h \ + FontMetrics.cpp \ + FontMetrics.h \ + FontStyle.h \ + GFGlyphTracer.cpp \ + GFGlyphTracer.h \ + GFReader.cpp \ + GFReader.h \ + GFTracer.cpp \ + GFTracer.h \ + Ghostscript.cpp \ + Ghostscript.h \ + Glyph.h \ + GlyphTracerMessages.h \ + GraphicPath.h \ + HtmlSpecialHandler.cpp \ + HtmlSpecialHandler.h \ + InputBuffer.cpp \ + InputBuffer.h \ + InputReader.cpp \ + InputReader.h \ + JFM.cpp \ + JFM.h \ + Length.cpp \ + Length.h \ + macros.h \ + MapLine.cpp \ + MapLine.h \ + Matrix.cpp \ + Matrix.h \ + Message.cpp \ + Message.h \ + MessageException.h \ + MetafontWrapper.cpp \ + MetafontWrapper.h \ + NoPsSpecialHandler.cpp \ + NoPsSpecialHandler.h \ + NumericRanges.h \ + PageRanges.cpp \ + PageRanges.h \ + PageSize.cpp \ + PageSize.h \ + Pair.h \ + PathClipper.cpp \ + PathClipper.h \ + PdfSpecialHandler.cpp \ + PdfSpecialHandler.h \ + PreScanDVIReader.cpp \ + PreScanDVIReader.h \ + Process.cpp \ + Process.h \ + psdefs.cpp \ + PSFilter.h \ + PSInterpreter.cpp \ + PSInterpreter.h \ + PSPattern.cpp \ + PSPattern.h \ + PSPreviewFilter.cpp \ + PSPreviewFilter.h \ + PsSpecialHandler.cpp \ + PsSpecialHandler.h \ + RangeMap.cpp \ + RangeMap.h \ + ShadingPatch.cpp \ + ShadingPatch.h \ + SignalHandler.cpp \ + SignalHandler.h \ + SpecialActions.h \ + SpecialHandler.h \ + SpecialManager.cpp \ + SpecialManager.h \ + StreamReader.cpp \ + StreamReader.h \ + StreamWriter.cpp \ + StreamWriter.h \ + Subfont.cpp \ + Subfont.h \ + SVGOutput.cpp \ + SVGOutput.h \ + SVGTree.cpp \ + SVGTree.h \ + System.cpp \ + System.h \ + TensorProductPatch.cpp \ + TensorProductPatch.h \ + Terminal.cpp \ + Terminal.h \ + TFM.cpp \ + TFM.h \ + ToUnicodeMap.cpp \ + ToUnicodeMap.h \ + TpicSpecialHandler.cpp \ + TpicSpecialHandler.h \ + TriangularPatch.cpp \ + TriangularPatch.h \ + types.h \ + Unicode.cpp \ + Unicode.h \ + VectorIterator.h \ + VectorStream.h \ + VFActions.h \ + VFReader.cpp \ + VFReader.h \ + XMLDocument.cpp \ + XMLDocument.h \ + XMLNode.cpp \ + XMLNode.h \ + XMLString.cpp \ + XMLString.h + +EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.h MiKTeXCom.cpp + +AM_CXXFLAGS = -Wall -Wnon-virtual-dtor \ + -I$(top_srcdir)/clipper \ + -I$(top_srcdir)/xxHash \ + $(FREETYPE_CFLAGS) \ + $(ZLIB_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) + +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + +# the command-line parser is generated from options.xml by opt2cpp +$(srcdir)/CommandLine.cpp: options.xml + if test -f opt2cpp.xsl; then \ + rm -f $@ $*.h; \ + xsltproc opt2cpp.xsl $<; \ + elif test -f $(srcdir)/opt2cpp.py; then \ + rm -f $@ $*.h; \ + python2 $(srcdir)/opt2cpp.py $< $@ $*.h; \ + fi + +# Create a C string definition containing the PostScript routines psdefs.ps needed by class PSInterpreter +$(srcdir)/psdefs.cpp: psdefs.ps + if test -f $<; then \ + ps2c PSInterpreter::PSDEFS $< >$@; \ + fi + +psdefs.ps: ; + +@CODE_COVERAGE_RULES@ + +CLEANFILES = *.gcda *.gcno diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp new file mode 100644 index 00000000000..d65649a4c34 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.cpp @@ -0,0 +1,276 @@ +/************************************************************************* +** MapLine.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "InputBuffer.h" +#include "InputReader.h" +#include "MapLine.h" +#include "Subfont.h" + +using namespace std; + + +/** Constructs a MapLine object by parsing a single mapline from the given stream. */ +MapLine::MapLine (istream &is) + : _sfd(0), _fontindex(0), _slant(0), _bold(0), _extend(1) +{ + char buf[256]; + is.getline(buf, 256); + parse(buf); +} + + +// Some of the following functions have been derived from the dvipdfmx source file fontmap.c: +// http://cvs.ktug.or.kr/viewcvs/dvipdfmx/src/fontmap.c?revision=1.43&view=markup + + +/** Returns true if the given string is in dvips mapline format, and false if it's in dvipdfm format. + @param[in] line string to check */ +bool MapLine::isDVIPSFormat (const char *line) const { + if (strchr(line, '"') || strchr(line, '<')) // these chars are only present in dvips maps + return true; + char prevchar = ' '; + int entry_count=0; + for (const char *p=line; *p; ++p) { + if (isspace(prevchar)) { + if (*p == '-') // options starting with '-' are only present in dvipdfm map files + return false; + if (!isspace(*p)) + entry_count++; + } + prevchar = *p; + } + // tfm_name and ps_name only => dvips map + return entry_count == 2; +} + + +/** Separates main font name and subfont definition name from a given combined name. + * Example: "basename@sfdname@10" => {"basename10", "sfdname"} + * @param[in,out] fontname complete fontname; after separation: main fontname only + * @param[out] sfdname name of subfont definition + * @return true on success */ +static bool split_fontname (string &fontname, string &sfdname) { + size_t pos1; // index of first '@' + if ((pos1 = fontname.find('@')) != string::npos && pos1 > 0) { + size_t pos2; // index of second '@' + if ((pos2 = fontname.find('@', pos1+1)) != string::npos && pos2 > pos1+1) { + sfdname = fontname.substr(pos1+1, pos2-pos1-1); + fontname = fontname.substr(0, pos1) + fontname.substr(pos2+1); + return true; + } + } + return false; +} + + +/** Parses a single mapline and stores the scanned data in member variables. + * The line may either be given in dvips or dvipdfmx mapfile format. + * @param[in] line the mapline */ +void MapLine::parse (const char *line) { + CharInputBuffer ib(line, strlen(line)); + BufferInputReader ir(ib); + _texname = ir.getString(); + string sfdname; + split_fontname(_texname, sfdname); + if (!sfdname.empty()) + _sfd = SubfontDefinition::lookup(sfdname); + if (isDVIPSFormat(line)) + parseDVIPSLine(ir); + else + parseDVIPDFMLine(ir); +} + + +/** Parses a single line in dvips mapfile format. + * @param[in] ir the input stream must be assigned to this reader */ +void MapLine::parseDVIPSLine (InputReader &ir) { + ir.skipSpace(); + if (ir.peek() != '<' && ir.peek() != '"') + _psname = ir.getString(); + ir.skipSpace(); + while (ir.peek() == '<' || ir.peek() == '"') { + if (ir.peek() == '<') { + ir.get(); + if (ir.peek() == '[') + ir.get(); + string name = ir.getString(); + if (name.length() > 4 && name.substr(name.length()-4) == ".enc") + _encname = name.substr(0, name.length()-4); + else + _fontfname = name; + } + else { // ir.peek() == '"' => list of PS font operators + string options = ir.getQuotedString('"'); + StringInputBuffer sib(options); + BufferInputReader sir(sib); + while (!sir.eof()) { + double number; + if (sir.parseDouble(number)) { + // operator with preceding numeric parameter (value opstr) + string opstr = sir.getString(); + if (opstr == "SlantFont") + _slant = number; + else if (opstr == "ExtendFont") + _extend = number; + } + else { + // operator without parameter => skip for now + sir.getString(); + } + } + } + ir.skipSpace(); + } +} + + +static void throw_number_expected (char opt, bool integer_only=false) { + ostringstream oss; + oss << "option -" << opt << ": " << (integer_only ? "integer" : "floating point") << " value expected"; + throw MapLineException(oss.str()); +} + + +/** Parses a single line in dvipdfmx mapfile format. + * @param[in] ir the input stream must be assigned to this reader */ +void MapLine::parseDVIPDFMLine (InputReader &ir) { + ir.skipSpace(); + if (ir.peek() != '-') { + _encname = ir.getString(); + if (_encname == "default" || _encname == "none") + _encname.clear(); + } + ir.skipSpace(); + if (ir.peek() != '-') + _fontfname = ir.getString(); + if (!_fontfname.empty()) { + parseFilenameOptions(_fontfname); + } + ir.skipSpace(); + while (ir.peek() == '-') { + ir.get(); + char option = ir.get(); + if (!isprint(option)) + throw MapLineException("option character expected"); + ir.skipSpace(); + switch (option) { + case 's': // slant + if (!ir.parseDouble(_slant)) + throw_number_expected('s'); + break; + case 'e': // extend + if (!ir.parseDouble(_extend)) + throw_number_expected('e'); + break; + case 'b': // bold + if (!ir.parseDouble(_bold)) + throw_number_expected('b'); + break; + case 'r': //remap (deprecated) + break; + case 'i': // ttc index + if (!ir.parseInt(_fontindex, false)) + throw_number_expected('i', true); + break; + case 'p': // UCS plane + int dummy; + if (!ir.parseInt(dummy, false)) + throw_number_expected('p', true); + break; + case 'u': // to unicode + ir.getString(); + break; + case 'v': // stemV + int stemv; + if (!ir.parseInt(stemv, true)) + throw_number_expected('v', true); + break; + case 'm': // map single chars + ir.skipUntil("-"); + break; + case 'w': // writing mode (horizontal=0, vertical=1) + int vertical; + if (!ir.parseInt(vertical, false)) + throw_number_expected('w', true); + break; + default: + ostringstream oss; + oss << "invalid option: -" << option; + throw MapLineException(oss.str()); + } + ir.skipSpace(); + } +} + + +/** [:INDEX:][!]FONTNAME[/CSI][,VARIANT] */ +void MapLine::parseFilenameOptions (string fname) { + _fontfname = fname; + StringInputBuffer ib(fname); + BufferInputReader ir(ib); + if (ir.peek() == ':' && isdigit(ir.peek(1))) { // index given? + ir.get(); + _fontindex = ir.getInt(); // font index of file with multiple fonts + if (ir.peek() == ':') + ir.get(); + else + _fontindex = 0; + } + if (ir.peek() == '!') // no embedding + ir.get(); + + bool csi_given=false, style_given=false; + int pos; + if ((pos = ir.find('/')) >= 0) { // csi delimiter + csi_given = true; + _fontfname = ir.getString(pos); + } + else if ((pos = ir.find(',')) >= 0) { + style_given = true; + _fontfname = ir.getString(pos); + } + else + _fontfname = ir.getString(); + + if (csi_given) { + if ((pos = ir.find(',')) >= 0) { + style_given = true; + ir.getString(pos); // charcoll + } + else if (ir.eof()) + throw MapLineException("CSI specifier expected"); + else + ir.getString(); // charcoll + } + if (style_given) { + ir.get(); // skip ',' + if (ir.check("BoldItalic")) { + } + else if (ir.check("Bold")) { + } + else if (ir.check("Italic")) { + } + if (!ir.eof()) + throw MapLineException("invalid style given"); + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h new file mode 100644 index 00000000000..ea3f92e526e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.h @@ -0,0 +1,72 @@ +/************************************************************************* +** MapLine.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MAPLINE_H +#define DVISVGM_MAPLINE_H + +#include +#include +#include "MessageException.h" + + +class InputReader; +class SubfontDefinition; + + +struct MapLineException : MessageException +{ + MapLineException (const std::string &msg) : MessageException(msg) {} +}; + + +class MapLine +{ + public: + MapLine (std::istream &is); + const std::string& texname () const {return _texname;} + const std::string& psname () const {return _psname;} + const std::string& fontfname () const {return _fontfname;} + const std::string& encname () const {return _encname;} + int fontindex () const {return _fontindex;} + double bold () const {return _bold;} + double slant () const {return _slant;} + double extend () const {return _extend;} + SubfontDefinition* sfd () const {return _sfd;} + + protected: + void init (); + bool isDVIPSFormat (const char *line) const; + void parse (const char *line); + void parseDVIPSLine (InputReader &ir); + void parseDVIPDFMLine (InputReader &ir); + void parseFilenameOptions (std::string opt); + + private: + std::string _texname; ///< TeX font name + std::string _psname; ///< PS font name + std::string _fontfname; ///< name of fontfile + std::string _encname; ///< name of encoding (without file suffix ".enc") + SubfontDefinition *_sfd; ///< subfont definition to be used + int _fontindex; ///< font index of file with multiple fonts (e.g. ttc files) + double _slant, _bold, _extend; +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp new file mode 100644 index 00000000000..06537689c3f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -0,0 +1,491 @@ +/************************************************************************* +** Matrix.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#define _USE_MATH_DEFINES +#include +#include +#include +#include +#include +#include "Calculator.h" +#include "Matrix.h" +#include "XMLString.h" + +using namespace std; + + + +/** Computes the determinant of a given matrix */ +double det (const Matrix &m) { + double sum=0; + for (int i=0; i < 3; ++i) { + sum += m._values[0][i] * m._values[1][(i+1)%3] * m._values[2][(i+2)%3] + - m._values[0][2-i] * m._values[1][(4-i)%3] * m._values[2][(3-i)%3]; + } + return sum; +} + + +/** Computes the determinant of the 2x2 submatrix of m where a given + * row and column were removed. + * @param[in] m base matrix + * @param[in] row row to remove + * @param[in] col column to remove */ +double det (const Matrix &m, int row, int col) { + int c1 = (col+1)%3, c2 = (col+2)%3; + int r1 = (row+1)%3, r2 = (row+2)%3; + if (c1 > c2) + swap(c1, c2); + if (r1 > r2) + swap(r1, r2); + return m._values[r1][c1] * m._values[r2][c2] + - m._values[r1][c2] * m._values[r2][c1]; +} + + +static inline double deg2rad (double deg) { + return M_PI*deg/180.0; +} + + +/** Creates a diagonal matrix ((d,0,0),(0,d,0),(0,0,d)). + * @param[in] d value of diagonal elements */ +Matrix::Matrix (double d) { + set(d); +} + + +/** Creates the matrix ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). + * Expects that array v consists of 'size' elements. If size is less than 9, the + * remaining matrix components will be set to those of the identity matrix. + * @param[in] v array containing the matrix components + * @param[in] size size of array v */ +Matrix::Matrix (double v[], unsigned size) { + set(v, size); +} + + +/** Creates the matrix ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). + * If vector v has less than 9 elements, the remaining matrix components will be set to + * those of the identity matrix. + * @param[in] v array containing the matrix components + * @param[in] start use vector components start,...,start+8 */ +Matrix::Matrix (const std::vector &v, int start) { + set(v, start); +} + + +Matrix::Matrix (const string &cmds, Calculator &calc) { + parse(cmds, calc); +} + + +Matrix& Matrix::set (double d) { + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + _values[i][j] = (i==j ? d : 0); + return *this; +} + + +Matrix& Matrix::set (double v[], unsigned size) { + size = min(size, 9u); + for (unsigned i=0; i < size; i++) + _values[i/3][i%3] = v[i]; + for (unsigned i=size; i < 9; i++) + _values[i/3][i%3] = (i%4 ? 0 : 1); + return *this; +} + + +/** Set matrix values ((v0,v1,v2),(v3,v4,v5),(v6,v7,v8)). + * If vector v has less than 9 elements, the remaining matrix components will be set to + * those of the identity matrix. + * @param[in] v array containing the matrix components + * @param[in] start use vector components start,...,start+8 */ +Matrix& Matrix::set (const vector &v, int start) { + unsigned size = min((unsigned)v.size()-start, 9u); + for (unsigned i=0; i < size; i++) + _values[i/3][i%3] = v[i+start]; + for (unsigned i=size; i < 9; i++) + _values[i/3][i%3] = (i%4 ? 0 : 1); + return *this; +} + + +Matrix& Matrix::set(const string &cmds, Calculator &calc) { + parse(cmds, calc); + return *this; +} + + +Matrix& Matrix::translate (double tx, double ty) { + if (tx != 0 || ty != 0) { + TranslationMatrix t(tx, ty); + rmultiply(t); + } + return *this; +} + + +Matrix& Matrix::scale (double sx, double sy) { + if (sx != 1 || sy != 1) { + ScalingMatrix s(sx, sy); + rmultiply(s); + } + return *this; +} + + +/** Multiplies this matrix by ((cos d, -sin d, 0), (sin d, cos d, 0), (0,0,1)) that + * describes an anti-clockwise rotation by d degrees. + * @param[in] deg rotation angle in degrees */ +Matrix& Matrix::rotate (double deg) { + RotationMatrix r(deg); + rmultiply(r); + return *this; +} + + +Matrix& Matrix::xskewByAngle (double deg) { + if (fmod(fabs(deg)-90, 180) != 0) + return xskewByRatio(tan(deg2rad(deg))); + return *this; +} + + +Matrix& Matrix::xskewByRatio (double xyratio) { + if (xyratio != 0) { + double v[] = {1, xyratio}; + Matrix t(v, 2); + rmultiply(t); + } + return *this; +} + + +Matrix& Matrix::yskewByAngle (double deg) { + if (fmod(fabs(deg)-90, 180) != 0) + return yskewByRatio(tan(deg2rad(deg))); + return *this; +} + + +Matrix& Matrix::yskewByRatio (double xyratio) { + if (xyratio != 0) { + double v[] = {1, 0, 0, xyratio}; + Matrix t(v, 4); + rmultiply(t); + } + return *this; +} + + +Matrix& Matrix::flip (bool haxis, double a) { + double s = 1; + if (haxis) // mirror at horizontal axis? + s = -1; + double v[] = {-s, 0, (haxis ? 0 : 2*a), 0, s, (haxis ? 2*a : 0), 0, 0, 1}; + Matrix t(v); + rmultiply(t); + return *this; +} + + +/** Swaps rows and columns of the matrix. */ +Matrix& Matrix::transpose () { + for (int i=0; i < 3; i++) + for (int j=i+1; j < 3; j++) + swap(_values[i][j], _values[j][i]); + return *this; +} + + +/** Multiplies this matrix M with matrix tm (tm is the factor on the left side): M := tm * M */ +Matrix& Matrix::lmultiply (const Matrix &tm) { + Matrix ret; + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + for (int k=0; k < 3; k++) + ret._values[i][j] += _values[i][k] * tm._values[k][j]; + return *this = ret; +} + + +/** Multiplies this matrix M with matrix tm (tm is the factor on the right side): M := M * tm */ +Matrix& Matrix::rmultiply (const Matrix &tm) { + Matrix ret; + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + for (int k=0; k < 3; k++) + ret._values[i][j] += tm._values[i][k] * _values[k][j]; + return *this = ret; +} + + +Matrix& Matrix::invert () { + Matrix ret; + if (double denom = det(*this)) { + for (int i=0; i < 3; ++i) { + for (int j=0; j < 3; ++j) { + ret._values[i][j] = det(*this, i, j)/denom; + if ((i+j)%2 != 0) + ret._values[i][j] *= -1; + } + } + return *this = ret; + } + throw exception(); +} + + +Matrix& Matrix::operator *= (double c) { + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + _values[i][j] *= c; + return *this; +} + + +DPair Matrix::operator * (const DPair &p) const { + double pp[] = {p.x(), p.y(), 1}; + double ret[]= {0, 0}; + for (int i=0; i < 2; i++) + for (int j=0; j < 3; j++) + ret[i] += _values[i][j] * pp[j]; + return DPair(ret[0], ret[1]); +} + + +/** Returns true if this matrix equals. Checks equality by comparing the matrix components. */ +bool Matrix::operator == (const Matrix &m) const { + for (int i=0; i < 2; i++) + for (int j=0; j < 3; j++) + if (_values[i][j] != m._values[i][j]) + return false; + return true; +} + + +/** Returns true if this matrix doesn't equal m. Checks inequality by comparing the matrix components. */ +bool Matrix::operator != (const Matrix &m) const { + for (int i=0; i < 2; i++) + for (int j=0; j < 3; j++) + if (_values[i][j] != m._values[i][j]) + return true; + return false; +} + + +/** Returns true if this matrix is the identity matrix ((1,0,0),(0,1,0),(0,0,1)). */ +bool Matrix::isIdentity() const { + for (int i=0; i < 2; i++) + for (int j=0; j < 3; j++) { + const double &v = _values[i][j]; + if ((i == j && v != 1) || (i != j && v != 0)) + return false; + } + return true; +} + + +/** Checks whether this matrix describes a plain translation (without any other transformations). + * If so, the parameters tx and ty are filled with the translation components. + * @param[out] tx horizontal translation + * @param[out] ty vertical translation + * @return true if matrix describes a pure translation */ +bool Matrix::isTranslation (double &tx, double &ty) const { + tx = _values[0][2]; + ty = _values[1][2]; + for (int i=0; i < 3; i++) + for (int j=0; j < 2; j++) { + const double &v = _values[i][j]; + if ((i == j && v != 1) || (i != j && v != 0)) + return false; + } + return _values[2][2] == 1; +} + + +/** Gets a parameter for the transformation command. + * @param[in] is parameter chars are read from this stream + * @param[in] calc parameters can be arithmetic expressions, so we need a calculator to evaluate them + * @param[in] def default value if parameter is optional + * @param[in] optional true if parameter is optional + * @param[in] leadingComma true if first non-blank must be a comma + * @return value of argument */ +static double getArgument (istream &is, Calculator &calc, double def, bool optional, bool leadingComma) { + while (isspace(is.peek())) + is.get(); + if (!optional && leadingComma && is.peek() != ',') + throw ParserException("',' expected"); + if (is.peek() == ',') { + is.get(); // skip comma + optional = false; // now we expect a parameter + } + string expr; + while (is && !isupper(is.peek()) && is.peek() != ',') + expr += (char)is.get(); + if (expr.length() == 0) { + if (optional) + return def; + else + throw ParserException("parameter expected"); + } + return calc.eval(expr); +} + + +Matrix& Matrix::parse (istream &is, Calculator &calc) { + *this = Matrix(1); + while (is) { + while (isspace(is.peek())) + is.get(); + int cmd = is.get(); + switch (cmd) { + case 'T': { + double tx = getArgument(is, calc, 0, false, false); + double ty = getArgument(is, calc, 0, true, true); + translate(tx, ty); + break; + } + case 'S': { + double sx = getArgument(is, calc, 1, false, false); + double sy = getArgument(is, calc, sx, true, true ); + scale(sx, sy); + break; + } + case 'R': { + double a = getArgument(is, calc, 0, false, false); + double x = getArgument(is, calc, calc.getVariable("ux")+calc.getVariable("w")/2, true, true); + double y = getArgument(is, calc, calc.getVariable("uy")+calc.getVariable("h")/2, true, true); + translate(-x, -y); + rotate(a); + translate(x, y); + break; + } + case 'F': { + int c = is.get(); + if (c != 'H' && c != 'V') + throw ParserException("'H' or 'V' expected"); + double a = getArgument(is, calc, 0, false, false); + flip(c == 'H', a); + break; + } + case 'K': { + int c = is.get(); + if (c != 'X' && c != 'Y') + throw ParserException("transformation command 'K' must be followed by 'X' or 'Y'"); + double a = getArgument(is, calc, 0, false, false); + if (fabs(cos(deg2rad(a))) <= numeric_limits::epsilon()) { + ostringstream oss; + oss << "illegal skewing angle: " << a << " degrees"; + throw ParserException(oss.str()); + } + if (c == 'X') + xskewByAngle(a); + else + yskewByAngle(a); + break; + } + case 'M': { + double v[9]; + for (int i=0; i < 6; i++) + v[i] = getArgument(is, calc, i%4 ? 0 : 1, i!=0, i!=0); + // third row (0, 0, 1) + v[6] = v[7] = 0; + v[8] = 1; + Matrix tm(v); + rmultiply(tm); + break; + } + default: + ostringstream oss; + oss << "transformation command expected (found '" << cmd << "' instead)"; + throw ParserException(oss.str()); + } + } + return *this; +} + + +Matrix& Matrix::parse (const string &cmds, Calculator &calc) { + istringstream iss; + iss.str(cmds); + return parse(iss, calc); +} + + +/** Returns an SVG matrix expression that can be used in transform attributes. + * ((a,b,c),(d,e,f),(0,0,1)) => matrix(a d b e c f) */ +string Matrix::getSVG () const { + ostringstream oss; + oss << "matrix("; + for (int i=0; i < 3; i++) { + for (int j=0; j < 2; j++) { + if (i > 0 || j > 0) + oss << ' '; + oss << XMLString(_values[j][i]); + } + } + oss << ')'; + return oss.str(); +} + + +ostream& Matrix::write (ostream &os) const { + os << '('; + for (int i=0; i < 3; i++) { + os << '(' << _values[i][0]; + for (int j=1; j < 3; j++) + os << ',' << _values[i][j]; + os << ')'; + if (i < 2) + os << ','; + } + os << ')'; + return os; +} + + +////////////////////////////////////////////////////////////////// + + +TranslationMatrix::TranslationMatrix (double tx, double ty) { + double v[] = {1, 0, tx, 0, 1, ty}; + set(v, 6); +} + + +ScalingMatrix::ScalingMatrix (double sx, double sy) { + double v[] = {sx, 0, 0, 0, sy}; + set(v, 5); +} + + +RotationMatrix::RotationMatrix (double deg) { + double rad = deg2rad(deg); + double c = cos(rad); + double s = sin(rad); + double v[] = {c, -s, 0, s, c}; + set(v, 5); +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h new file mode 100644 index 00000000000..02b94299fd5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.h @@ -0,0 +1,108 @@ +/************************************************************************* +** Matrix.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MATRIX_H +#define DVISVGM_MATRIX_H + +#include +#include +#include +#include "MessageException.h" +#include "Pair.h" + + +struct ParserException : public MessageException +{ + ParserException (const std::string &msg) : MessageException(msg) {} +}; + +class Calculator; + +class Matrix +{ + friend double det (const Matrix &m); + friend double det (const Matrix &m, int row, int col); + + public: + Matrix (const std::string &cmds, Calculator &calc); + Matrix (double d=0); + Matrix (double v[], unsigned size=9); + Matrix (const std::vector &v, int start=0); + Matrix& set (double d); + Matrix& set (double v[], unsigned size); + Matrix& set (const std::vector &v, int start=0); + Matrix& set (const std::string &cmds, Calculator &calc); + double get (int row, int col) const {return _values[row][col];} + Matrix& transpose (); + Matrix& invert (); + Matrix& parse (std::istream &is, Calculator &c); + Matrix& parse (const std::string &cmds, Calculator &c); + Matrix& lmultiply (const Matrix &tm); + Matrix& rmultiply (const Matrix &tm); + Matrix& translate (double tx, double ty); + Matrix& scale (double sx, double sy); + Matrix& rotate (double deg); + Matrix& xskewByAngle (double deg); + Matrix& yskewByAngle (double deg); + Matrix& xskewByRatio (double xyratio); + Matrix& yskewByRatio (double xyratio); + Matrix& flip (bool h, double a); + Matrix& operator *= (double c); + DPair operator * (const DPair &p) const; + bool operator == (const Matrix &m) const; + bool operator != (const Matrix &m) const; + bool isIdentity() const; + bool isTranslation (double &tx, double &ty) const; + std::string getSVG () const; + std::ostream& write (std::ostream &os) const; + + private: + double _values[3][3]; // row x col +}; + + +struct TranslationMatrix : public Matrix +{ + TranslationMatrix (double tx, double ty); +}; + + +struct ScalingMatrix : public Matrix +{ + ScalingMatrix (double sx, double sy); +}; + + +struct RotationMatrix : public Matrix +{ + RotationMatrix (double deg); +}; + + +inline std::ostream& operator << (std::ostream &os, const Matrix &m) { + return m.write(os); +} + + +double det (const Matrix &m); +double det (const Matrix &m, int row, int col); + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp new file mode 100644 index 00000000000..17b9b526f9e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.cpp @@ -0,0 +1,274 @@ +/************************************************************************* +** Message.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "Message.h" +#include "Terminal.h" + +using namespace std; + +MessageStream::MessageStream () : _os(0), _nl(false), _col(1), _indent(0) { +} + + +MessageStream::MessageStream (std::ostream &os) + : _os(&os), _nl(true), _col(1), _indent(0) +{ + Terminal::init(os); +} + + +MessageStream::~MessageStream () { + if (_os && Message::COLORIZE) + Terminal::finish(*_os); +} + + +void MessageStream::putChar (const char c, ostream &os) { + switch (c) { + case '\r': + os << '\r'; + _nl = true; + _col = 1; + return; + case '\n': + if (!_nl) { + _col = 1; + _nl = true; + os << '\n'; + } + return; + default: + if (_nl) { + os << string(_indent, ' '); + _col += _indent; + } + else { + const int cols = Terminal::columns(); + if (cols > 0 && _col >= cols) { +#ifndef __WIN32__ + // move cursor to next line explicitly (not necessary in Windows/DOS terminal) + os << '\n'; +#endif + os << string(_indent, ' '); + _col = _indent+1; + } + else + _col++; + } + _nl = false; + if (!_nl || c != '\n') + os << c; + } +} + + +MessageStream& MessageStream::operator << (const char *str) { + if (_os && str) { + const char *first = str; + while (*first) { + const char *last = strchr(first, '\n'); + if (!last) + last = first+strlen(first)-1; +#ifndef __WIN32__ + // move cursor to next line explicitly (not necessary in Windows/DOS terminal) + const int cols = Terminal::columns(); + int len = last-first+1; + if (cols > 0 && _col+len > cols && _indent+len <= cols) + putChar('\n', *_os); +#endif + while (first <= last) + putChar(*first++, *_os); + first = last+1; + } + } + return *this; +} + + +MessageStream& MessageStream::operator << (const char &c) { + if (_os) + putChar(c, *_os); + return *this; +} + + +void MessageStream::indent (bool reset) { + if (reset) + _indent = 0; + _indent += 2; +} + + +void MessageStream::outdent (bool all) { + if (all) + _indent = 0; + else if (_indent > 0) + _indent -= 2; +} + + +void MessageStream::clearline () { + if (_os) { + int cols = Terminal::columns(); + *_os << '\r' << string(cols ? cols-1 : 79, ' ') << '\r'; + _nl = true; + _col = 1; + } +} + +static MessageStream nullStream; +static MessageStream messageStream(cerr); + + +////////////////////////////// + +// maximal verbosity +int Message::LEVEL = Message::MESSAGES | Message::WARNINGS | Message::ERRORS; +bool Message::COLORIZE = false; +bool Message::_initialized = false; +Message::Color Message::_classColors[9]; + + +/** Returns the stream for usual messages. */ +MessageStream& Message::mstream (bool prefix, MessageClass mclass) { + init(); + MessageStream *ms = (LEVEL & MESSAGES) ? &messageStream : &nullStream; + if (COLORIZE && ms && ms->os()) { + Terminal::fgcolor(_classColors[mclass].foreground, *ms->os()); + Terminal::bgcolor(_classColors[mclass].background, *ms->os()); + } + if (prefix) + *ms << "\nMESSAGE: "; + return *ms; +} + + +/** Returns the stream for warning messages. */ +MessageStream& Message::wstream (bool prefix) { + init(); + MessageStream *ms = (LEVEL & WARNINGS) ? &messageStream : &nullStream; + if (COLORIZE && ms && ms->os()) { + Terminal::fgcolor(_classColors[MC_WARNING].foreground, *ms->os()); + Terminal::bgcolor(_classColors[MC_WARNING].background, *ms->os()); + } + if (prefix) + *ms << "\nWARNING: "; + return *ms; +} + + +/** Returns the stream for error messages. */ +MessageStream& Message::estream (bool prefix) { + init(); + MessageStream *ms = (LEVEL & ERRORS) ? &messageStream : &nullStream; + if (COLORIZE && ms && ms->os()) { + Terminal::fgcolor(_classColors[MC_ERROR].foreground, *ms->os()); + Terminal::bgcolor(_classColors[MC_ERROR].background, *ms->os()); + } + if (prefix) + *ms << "\nERROR: "; + return *ms; +} + + +static bool colorchar2int (char colorchar, int *val) { + colorchar = tolower(colorchar); + if (colorchar >= '0' && colorchar <= '9') + *val = int(colorchar-'0'); + else if (colorchar >= 'a' && colorchar <= 'f') + *val = int(colorchar-'a'+10); + else if (colorchar == '*') + *val = -1; + else + return false; + return true; +} + + +/** Initializes the Message class. Sets the colors for each message set. + * The colors can be changed via environment variable DVISVGM_COLORS. Its + * value must be a sequence of color entries of the form gg:BF where the + * two-letter ID gg specifies a message set, B the hex digit of the + * background, and F the hex digit of the foreground/text color. + * Color codes: + * - 1: red, 2: green, 4: blue + * - 0-7: dark colors + * - 8-F: light colors + * - *: default color + * Example: num:01 sets page number messages to red on black background */ +void Message::init () { + if (_initialized || !Message::COLORIZE) + return; + + // set default message colors + _classColors[MC_ERROR] = Color(Terminal::RED, true); + _classColors[MC_WARNING] = Color(Terminal::YELLOW); + _classColors[MC_PAGE_NUMBER] = Color(Terminal::BLUE, true); + _classColors[MC_PAGE_SIZE] = Color(Terminal::MAGENTA); + _classColors[MC_PAGE_WRITTEN] = Color(Terminal::GREEN); + _classColors[MC_STATE] = Color(Terminal::CYAN); + _classColors[MC_TRACING] = Color(Terminal::BLUE); + _classColors[MC_PROGRESS] = Color(Terminal::MAGENTA); + + if (const char *color_str = getenv("DVISVGM_COLORS")) { + map classes; + classes["er"] = MC_ERROR; + classes["wn"] = MC_WARNING; + classes["pn"] = MC_PAGE_NUMBER; + classes["ps"] = MC_PAGE_SIZE; + classes["fw"] = MC_PAGE_WRITTEN; + classes["sm"] = MC_STATE; + classes["tr"] = MC_TRACING; + classes["pi"] = MC_PROGRESS; + const char *p=color_str; + + // skip leading whitespace + while (isspace(*p)) + ++p; + + // iterate over color assignments + while (strlen(p) >= 5) { + map::iterator it = classes.find(string(p, 2)); + if (it != classes.end() && p[2] == '=') { + int bgcolor, fgcolor; + if (colorchar2int(p[3], &bgcolor) && colorchar2int(p[4], &fgcolor)) { + _classColors[it->second].background = bgcolor; + _classColors[it->second].foreground = fgcolor; + } + } + p += 5; + + // skip trailing characters in a malformed entry + while (!isspace(*p) && *p != ':' && *p != ';') + ++p; + // skip separation characters + while (isspace(*p) || *p == ':' || *p == ';') + ++p; + } + } + _initialized = true; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h new file mode 100644 index 00000000000..e9ab6bf116b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Message.h @@ -0,0 +1,114 @@ +/************************************************************************* +** Message.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MESSAGE_H +#define DVISVGM_MESSAGE_H + +#include +#include +#include +#include +#include "Terminal.h" +#include "types.h" + + +class Message; + +class MessageStream +{ + friend class Message; + + public: + MessageStream (); + MessageStream (std::ostream &os); + ~MessageStream (); + + template + MessageStream& operator << (const T &obj) { + std::ostringstream oss; + oss << obj; + (*this) << oss.str(); + return *this; + } + + MessageStream& operator << (const char *str); + MessageStream& operator << (const char &c); + MessageStream& operator << (const std::string &str) {return (*this) << str.c_str();} + + void indent (int level) {_indent = std::max(0, level*2);} + void indent (bool reset=false); + void outdent (bool all=false); + void clearline (); + + protected: + void putChar (const char c, std::ostream &os); + std::ostream* os () {return _os;} + + private: + std::ostream *_os; + bool _nl; ///< true if previous character was a newline + int _col; ///< current terminal column + int _indent; ///< indentation width (number of columns/characters) +}; + + +class Message +{ + struct Color { + Color () : foreground(-1), background(-1) {} + Color (Int8 fgcolor) : foreground(fgcolor), background(-1) {} + Color (Int8 fgcolor, bool light) : foreground(fgcolor + (light ? 8 : 0)), background(-1) {} + Color (Int8 fgcolor, Int8 bgcolor) : foreground(fgcolor), background(bgcolor) {} + Int8 foreground; + Int8 background; + }; + + public: + enum MessageClass { + MC_ERROR, + MC_WARNING, + MC_MESSAGE, + MC_PAGE_NUMBER, + MC_PAGE_SIZE, + MC_PAGE_WRITTEN, + MC_STATE, + MC_TRACING, + MC_PROGRESS, + }; + + public: + static MessageStream& mstream (bool prefix=false, MessageClass mclass=MC_MESSAGE); + static MessageStream& estream (bool prefix=false); + static MessageStream& wstream (bool prefix=false); + + enum {ERRORS=1, WARNINGS=2, MESSAGES=4}; + static int LEVEL; + static bool COLORIZE; + + protected: + static void init (); + + + private: + static Color _classColors[]; + static bool _initialized; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h new file mode 100644 index 00000000000..c7a84b4b13c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MessageException.h @@ -0,0 +1,39 @@ +/************************************************************************* +** MessageException.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MESSAGEEXCEPTION_H +#define DVISVGM_MESSAGEEXCEPTION_H + +#include +#include + + +class MessageException : public std::exception +{ + public: + MessageException (const std::string &msg) : _message(msg) {} + virtual ~MessageException () throw() {} + const char* what () const throw() {return _message.c_str();} + + private: + std::string _message; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp new file mode 100644 index 00000000000..42fcaa266b0 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.cpp @@ -0,0 +1,134 @@ +/************************************************************************* +** MetafontWrapper.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "FileSystem.h" +#include "FileFinder.h" +#include "Message.h" +#include "MetafontWrapper.h" +#include "Process.h" +#include "SignalHandler.h" +#include "macros.h" + +using namespace std; + + +MetafontWrapper::MetafontWrapper (const string &fname) : _fontname(fname) +{ +} + + +/** Calls Metafont and evaluates the logfile. If a gf file was successfully + * generated the dpi value is stripped from the filename + * (e.g. cmr10.600gf => cmr10.gf). This makes life easier... + * @param[in] mode Metafont mode, e.g. "ljfour" + * @param[in] mag magnification factor + * @return true on success */ +bool MetafontWrapper::call (const string &mode, double mag) { + if (!FileFinder::lookup(_fontname+".mf")) + return false; // mf file not available => no need to call the "slow" Metafont + FileSystem::remove(_fontname+".gf"); + +#ifdef __WIN32__ +#ifdef TEXLIVEWIN32 + const char *mfname = "mf-nowin.exe"; +#else + const char *mfname = "mf.exe"; +#endif + const char *cmd = FileFinder::lookup(mfname, false); + if (!cmd) { + Message::estream(true) << "can't run Metafont (" << mfname << " not found)\n"; + return false; + } +#else + const char *cmd = "mf"; +#endif + ostringstream oss; + oss << "\"\\mode=" << mode << ";" + "mag:=" << mag << ";" + "batchmode;" + "input " << _fontname << "\""; + Message::mstream(false, Message::MC_STATE) << "\nrunning Metafont for " << _fontname << '\n'; + Process mf_process(cmd, oss.str().c_str()); + mf_process.run(); + + // try to read Metafont's logfile and get name of created GF file + ifstream ifs((_fontname+".log").c_str()); + if (ifs) { + char buf[128]; + while (ifs) { + ifs.getline(buf, 128); + string line = buf; + if (line.substr(0, 15) == "! Interruption.") + SignalHandler::instance().trigger(true); + if (line.substr(0, 17) == "Output written on") { + size_t pos = line.find("gf ", 18+_fontname.length()); + if (pos != string::npos) { + string gfname = line.substr(18, pos-16); // GF filename found + FileSystem::rename(gfname, _fontname+".gf"); + } + break; + } + } + } + ifstream gf((_fontname+".gf").c_str()); + return (bool)gf; +} + + +/** Calls Metafont if output files (tfm and gf) don't already exist. + * @param[in] mode Metafont mode to be used (e.g. 'ljfour') + * @param[in] mag magnification factor + * @return true on success */ +bool MetafontWrapper::make (const string &mode, double mag) { + ifstream tfm((_fontname+".tfm").c_str()); + ifstream gf((_fontname+".gf").c_str()); + if (gf && tfm) // @@ distinguish between gf and tfm + return true; + return call(mode, mag); +} + + +bool MetafontWrapper::success () const { + ifstream tfm((_fontname+".tfm").c_str()); + ifstream gf((_fontname+".gf").c_str()); + return tfm && gf; +} + + +/** Remove all files created by a Metafont call (tfm, gf, log). + * @param[in] keepGF if true, GF files won't be removed */ +void MetafontWrapper::removeOutputFiles (bool keepGF) { + removeOutputFiles(_fontname, keepGF); +} + + +/** Remove all files created by a Metafont call for a given font (tfm, gf, log). + * @param[in] fontname name of font whose temporary files should be removed + * @param[in] keepGF if true, GF files will be kept */ +void MetafontWrapper::removeOutputFiles (const string &fontname, bool keepGF) { + const char *ext[] = {"gf", "tfm", "log", 0}; + for (const char **p = keepGF ? ext+2 : ext; *p; ++p) + FileSystem::remove(fontname + "." + *p); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h new file mode 100644 index 00000000000..93266c5122e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MetafontWrapper.h @@ -0,0 +1,43 @@ +/************************************************************************* +** MetafontWrapper.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_METAFONTWRAPPER_H +#define DVISVGM_METAFONTWRAPPER_H + +#include + + +struct FileFinder; + +class MetafontWrapper +{ + public: + MetafontWrapper (const std::string &fontname); + bool call (const std::string &mode, double mag); + bool make (const std::string &mode, double mag); + bool success () const; + void removeOutputFiles (bool keepGF=false); + static void removeOutputFiles (const std::string &fontname, bool keepGF=false); + + private: + std::string _fontname; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp new file mode 100644 index 00000000000..bf43c038035 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp @@ -0,0 +1,114 @@ +/************************************************************************* +** MiKTeXCom.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "MessageException.h" +#include "MiKTeXCom.h" +#include "macros.h" + +using namespace std; + + +/** Constructs a COM object representing a MiKTeX session. */ +MiKTeXCom::MiKTeXCom () : _session(0) { + if (FAILED(CoInitialize(0))) + throw MessageException("COM library could not be initialized\n"); + // try to initialize the MiKTeX session object +#ifdef _MSC_VER + HRESULT hres = _session.CreateInstance(L"MiKTeX.Session"); +#elif defined(__WIN64__) + HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_LOCAL_SERVER, IID_ISession2, (void**)&_session); +#else + HRESULT hres = CoCreateInstance(CLSID_MiKTeXSession2_9, 0, CLSCTX_INPROC_SERVER, IID_ISession2, (void**)&_session); +#endif + if (FAILED(hres)) { + CoUninitialize(); + throw MessageException("MiKTeX session could not be initialized"); + } +} + + +MiKTeXCom::~MiKTeXCom () { + if (_session) { +#ifdef _MSC_VER + _session.Release(); +#else + _session->Release(); +#endif + _session = 0; // prevent automatic call of Release() after CoUninitialize() + } + CoUninitialize(); +} + + +/** Returns the MiKTeX version number. */ +string MiKTeXCom::getVersion () { +#ifdef _MSC_VER + MiKTeXSetupInfo info = _session->GetMiKTeXSetupInfo(); +#else + MiKTeXSetupInfo info; + _session->GetMiKTeXSetupInfo(&info); +#endif + _bstr_t version = info.version; + return string(version); +} + + +/** Returns the path of the directory where the MiKTeX binaries are located. */ +string MiKTeXCom::getBinDir () { +#ifdef _MSC_VER + MiKTeXSetupInfo info = _session->GetMiKTeXSetupInfo(); +#else + MiKTeXSetupInfo info; + _session->GetMiKTeXSetupInfo(&info); +#endif + _bstr_t bindir = info.binDirectory; + return string(bindir); +} + + +/** Try to lookup a given file in the MiKTeX directory tree. + * @param[in] fname name of file to lookup + * @return path of the file or 0 if it can't be found */ +const char* MiKTeXCom::findFile (const char *fname) { + try { + _bstr_t path; + static string ret; +#ifdef _MSC_VER + HRESULT hres = _session->FindFile(fname, path.GetAddress()); + bool found = (hres != 0); +#else + VARIANT_BOOL found_var; + _session->FindFile(_bstr_t(fname), path.GetAddress(), &found_var); + bool found = (found_var == VARIANT_TRUE); +#endif + if (found) { + ret = _bstr_t(path); + return ret.c_str(); + } + return 0; + } + catch (_com_error &e) { + throw MessageException((const char*)e.Description()); + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h new file mode 100644 index 00000000000..c278840c9c8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.h @@ -0,0 +1,52 @@ +/************************************************************************* +** MiKTeXCom.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MIKTEXCOM_H +#define DVISVGM_MIKTEXCOM_H + +#include + +#ifdef _MSC_VER +#import +using namespace MiKTeXSession2_9; +#else +#include "miktex209-session.h" +#endif + + +class MiKTeXCom +{ + public: + MiKTeXCom (); + ~MiKTeXCom (); + std::string getBinDir (); + std::string getVersion (); + const char* findFile (const char* fname); + + private: +#ifdef _MSC_VER + ISession2Ptr _session; +#else + ISession2 *_session; +#endif +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp new file mode 100644 index 00000000000..659cd81818b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.cpp @@ -0,0 +1,46 @@ +/************************************************************************* +** NoPsSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "Message.h" +#include "NoPsSpecialHandler.h" + +using namespace std; + + +bool NoPsSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + _count++; + return true; +} + + +void NoPsSpecialHandler::dviEndPage (unsigned pageno) { + if (_count > 0) { + string suffix = (_count > 1 ? "s" : ""); + Message::wstream(true) << _count << " PostScript special" << suffix << " ignored. The resulting SVG might look wrong.\n"; + _count = 0; + } +} + + +const char** NoPsSpecialHandler::prefixes () const { + static const char *pfx[] = {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h new file mode 100644 index 00000000000..5176d87a2a4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NoPsSpecialHandler.h @@ -0,0 +1,42 @@ +/************************************************************************* +** NoPsSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_NOPSSPECIALHANDLER_H +#define DVISVGM_NOPSSPECIALHANDLER_H + +#include "SpecialHandler.h" + +class NoPsSpecialHandler : public SpecialHandler, public DVIEndPageListener +{ + public: + NoPsSpecialHandler () : _count(0) {} + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + const char* name () const {return 0;} + const char* info () const {return 0;} + const char** prefixes () const; + + protected: + void dviEndPage (unsigned pageno); + + private: + unsigned _count; // number of PS specials skipped +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h new file mode 100644 index 00000000000..34be8486fb2 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/NumericRanges.h @@ -0,0 +1,110 @@ +/************************************************************************* +** NumericRanges.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_NUMERICRANGES_H +#define DVISVGM_NUMERICRANGES_H + +#include +#include +#include + +template +class NumericRanges +{ + public: + typedef std::pair Range; + typedef std::list Container; + typedef typename Container::iterator Iterator; + typedef typename Container::const_iterator ConstIterator; + + public: + void addRange (T value) {addRange(value, value);} + void addRange (T first, T last); + bool valueExists (T value) const; + size_t size () const {return _ranges.size();} + ConstIterator begin () const {return _ranges.begin();} + ConstIterator end () const {return _ranges.end();} + const Container& ranges () const {return _ranges;} + + protected: + static bool isLess (const Range &r1, const Range &r2) {return r1.first < r2.first;} + + private: + Container _ranges; +}; + + +/** Adds a numeric range to the collection. + * @param[in] first left bound of new range + * @param[in] last right bound of new range */ +template +void NumericRanges::addRange (T first, T last) { + if (first > last) + std::swap(first, last); + typename Container::iterator it = _ranges.begin(); + while (it != _ranges.end() && first > it->first+1 && first > it->second+1) + ++it; + if (it == _ranges.end() || last < it->first-1 || first > it->second+1) + it = _ranges.insert(it, Range(first, last)); + else if ((first < it->first && last >= it->first-1) || (first <= it->second+1 && last > it->second)) { + it->first = std::min(it->first, first); + it->second = std::max(it->second, last); + } + // merge adjacent ranges + if (it != _ranges.end()) { + typename Container::iterator l = it; + typename Container::iterator r = it; + if (l == _ranges.begin()) + l = _ranges.end(); + else + --l; + ++r; + bool l_modified = false; + bool r_modified = false; + if (l != _ranges.end() && l->second >= it->first-1) { + l->first = std::min(l->first, it->first); + l->second = std::max(l->second, it->second); + l_modified = true; + } + if (r != _ranges.end() && r->first <= it->second+1) { + r->first = std::min(r->first, it->first); + r->second = std::max(r->second, it->second); + r_modified = true; + } + if (l_modified || r_modified) { + _ranges.erase(it); + if (l_modified && r_modified && l->second >= r->first-1) { + l->first = std::min(l->first, r->first); + l->second = std::max(l->second, r->second); + _ranges.erase(r); + } + } + } +} + + +template +bool NumericRanges::valueExists (T value) const { + ConstIterator it = std::lower_bound(_ranges.begin(), _ranges.end(), Range(value, 0), &isLess); + return (it != _ranges.end() && it->first <= value && it->second >= value); +} + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h new file mode 100644 index 00000000000..3b2a9391250 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSFilter.h @@ -0,0 +1,41 @@ +/************************************************************************* +** PSFilter.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PSFILTER_H +#define DVISVGM_PSFILTER_H + +class PSInterpreter; + +class PSFilter +{ + public: + PSFilter (PSInterpreter &psi) : _psi(psi) {} + virtual ~PSFilter () {} + virtual void execute (const char *code, size_t len) =0; + virtual bool active () const =0; + + protected: + PSInterpreter& psInterpreter () {return _psi;} + + private: + PSInterpreter &_psi; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp new file mode 100644 index 00000000000..a297bd2bb9b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.cpp @@ -0,0 +1,359 @@ +/************************************************************************* +** PSInterpreter.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "FileFinder.h" +#include "InputReader.h" +#include "Message.h" +#include "PSFilter.h" +#include "PSInterpreter.h" +#include "SignalHandler.h" + +using namespace std; + + +const char *PSInterpreter::GSARGS[] = { + "gs", // dummy name + "-q", // be quiet, suppress gs banner + "-dSAFER", // disallow writing of files + "-dNODISPLAY", // we don't need a display device + "-dNOPAUSE", // keep going + "-dWRITESYSTEMDICT", // leave systemdict writable as some operators must be replaced + "-dNOPROMPT", +// "-dNOBIND", +}; + + +/** Constructs a new PSInterpreter object. + * @param[in] actions template methods to be executed after recognizing the corresponding PS operator. */ +PSInterpreter::PSInterpreter (PSActions *actions) + : _mode(PS_NONE), _actions(actions), _filter(0), _bytesToRead(0), _inError(false), _initialized(false) +{ +} + + +void PSInterpreter::init () { + if (!_initialized) { + _gs.init(sizeof(GSARGS)/sizeof(char*), GSARGS, this); + _gs.set_stdio(input, output, error); + _initialized = true; + // Before executing any random PS code redefine some operators and run + // initializing PS code. This cannot be done in the constructor because we + // need the completely initialized PSInterpreter object here. + execute(PSDEFS); + } +} + + +PSActions* PSInterpreter::setActions (PSActions *actions) { + PSActions *old_actions = _actions; + _actions = actions; + return old_actions; +} + + +/** Checks if the given status value returned by Ghostscript indicates an error. + * @param[in] status status value returned by Ghostscript after the execution of a PS snippet + * @throw PSException if the status value indicates a PostScript error */ +void PSInterpreter::checkStatus (int status) { + if (status < 0) { + _mode = PS_QUIT; + if (status < -100) + throw PSException("fatal error"); + if (_errorMessage.empty()) + throw PSException(_gs.error_name(status)); + throw PSException(_errorMessage); + } +} + + +/** Executes a chunk of PostScript code. + * @param[in] str buffer containing the code + * @param[in] len number of characters in buffer + * @param[in] flush If true, a final 'flush' is sent which forces the output buffer to be written immediately. + * @return true if the assigned number of bytes have been read */ +bool PSInterpreter::execute (const char *str, size_t len, bool flush) { + init(); + if (_mode == PS_QUIT) + return false; + + int status=0; + if (_mode == PS_NONE) { + _gs.run_string_begin(0, &status); + _mode = PS_RUNNING; + } + checkStatus(status); + + bool complete=false; + if (_bytesToRead > 0 && len >= _bytesToRead) { + len = _bytesToRead; + complete = true; + } + + if (_filter && _filter->active()) { + PSFilter *filter = _filter; + _filter = 0; // prevent recursion when filter calls execute() + filter->execute(str, len); + if (filter->active()) // filter still active after execution? + _filter = filter; + return complete; + } + + // 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) { + SignalHandler::instance().check(); + size_t chunksize = min(len, (size_t)0xffff); + _gs.run_string_continue(p, chunksize, 0, &status); + p += chunksize; + len -= chunksize; + if (_bytesToRead > 0) + _bytesToRead -= chunksize; + if (status == -101) // e_Quit + _mode = PS_QUIT; + else + checkStatus(status); + } + if (flush) { + // force writing contents of output buffer + _gs.run_string_continue("\nflush ", 7, 0, &status); + } + return complete; +} + + +/** Executes a chunk of PostScript code read from a stream. The method returns on EOF. + * @param[in] is the input stream + * @param[in] flush If true, a final 'flush' is sent which forces the output buffer to be written immediately. + * @return true if the assigned number of bytes have been read */ +bool PSInterpreter::execute (istream &is, bool flush) { + char buf[4096]; + bool finished = false; + while (is && !is.eof() && !finished) { + is.read(buf, 4096); + finished = execute(buf, is.gcount(), false); + } + execute("\n", 1, flush); + return finished; +} + + +bool PSInterpreter::executeRaw (const string &str, int n) { + _rawData.clear(); + ostringstream oss; + oss << str << ' ' << n << " (raw) prcmd\n"; + execute(oss.str()); + return !_rawData.empty(); +} + + +/** This callback function handles input from stdin to Ghostscript. Currently not needed. + * @param[in] inst pointer to calling instance of PSInterpreter + * @param[in] buf takes the read characters + * @param[in] len size of buffer buf + * @return number of characters read */ +int GSDLLCALL PSInterpreter::input (void *inst, char *buf, int len) { + return 0; +} + + +/** This callback function handles output from Ghostscript to stdout. It looks for + * emitted commands staring with "dvi." and executes them by calling method callActions. + * Ghostscript sends the text in chunks by several calls of this function. + * Unfortunately, the PostScript specification wants error messages also to be sent to stdout + * instead of stderr. Thus, we must collect and concatenate the chunks until an evaluable text + * snippet is completely received. Furthermore, error messages have to be recognized and to be + * filtered out. + * @param[in] inst pointer to calling instance of PSInterpreter + * @param[in] buf contains the characters to be output + * @param[in] len number of characters in buf + * @return number of processed characters (equals 'len') */ +int GSDLLCALL PSInterpreter::output (void *inst, const char *buf, int len) { + PSInterpreter *self = static_cast(inst); + if (self && self->_actions) { + const size_t MAXLEN = 512; // maximal line length (longer lines are of no interest) + const char *end = buf+len-1; // last position of buf + for (const char *first=buf, *last=buf; first <= end; last++, first=last) { + // move first and last to begin and end of the next line, respectively + while (last < end && *last != '\n') + last++; + size_t linelength = last-first+1; + if (linelength > MAXLEN) // skip long lines since they don't contain any relevant information + continue; + + vector &linebuf = self->_linebuf; // just a shorter name... + if ((*last == '\n' || !self->active()) || self->_inError) { + if (linelength + linebuf.size() > 1) { // prefix "dvi." plus final newline + SplittedCharInputBuffer ib(linebuf.empty() ? 0 : &linebuf[0], linebuf.size(), first, linelength); + BufferInputReader in(ib); + if (self->_inError) + self->_errorMessage += string(first, linelength); + else { + in.skipSpace(); + if (in.check("Unrecoverable error: ")) { + self->_errorMessage.clear(); + while (!in.eof()) + self->_errorMessage += in.get(); + self->_inError = true; + } + else if (in.check("dvi.")) + self->callActions(in); + } + } + linebuf.clear(); + } + else { // no line end found => + // save remaining characters and prepend them to the next incoming chunk of characters + if (linebuf.size() + linelength > MAXLEN) + linebuf.clear(); // don't care for long lines + else { + size_t currsize = linebuf.size(); + linebuf.resize(currsize+linelength); + memcpy(&linebuf[currsize], first, linelength); + } + } + } + } + return len; +} + + +/** Converts a vector of strings to a vector of doubles. + * @param[in] str the strings to be converted + * @param[out] d the resulting doubles */ +static void str2double (const vector &str, vector &d) { + for (size_t i=0; i < str.size(); i++) { + istringstream iss(str[i]); + iss >> d[i]; + } +} + + +/** Evaluates a command emitted by Ghostscript and invokes the corresponding + * method of interface class PSActions. + * @param[in] in reader pointing to the next command */ +void PSInterpreter::callActions (InputReader &in) { + // array of currently supported operators (must be ascendingly sorted) + static const struct Operator { + const char *name; // name of operator + int pcount; // number of parameters (< 0 : variable number of parameters) + void (PSActions::*op)(vector &p); // operation handler + } operators [] = { + {"applyscalevals", 3, &PSActions::applyscalevals}, + {"clip", 0, &PSActions::clip}, + {"clippath", 0, &PSActions::clippath}, + {"closepath", 0, &PSActions::closepath}, + {"curveto", 6, &PSActions::curveto}, + {"eoclip", 0, &PSActions::eoclip}, + {"eofill", 0, &PSActions::eofill}, + {"fill", 0, &PSActions::fill}, + {"grestore", 0, &PSActions::grestore}, + {"grestoreall", 0, &PSActions::grestoreall}, + {"gsave", 0, &PSActions::gsave}, + {"initclip", 0, &PSActions::initclip}, + {"lineto", 2, &PSActions::lineto}, + {"makepattern", -1, &PSActions::makepattern}, + {"moveto", 2, &PSActions::moveto}, + {"newpath", 1, &PSActions::newpath}, + {"querypos", 2, &PSActions::querypos}, + {"raw", -1, 0}, + {"restore", 1, &PSActions::restore}, + {"rotate", 1, &PSActions::rotate}, + {"save", 1, &PSActions::save}, + {"scale", 2, &PSActions::scale}, + {"setcmykcolor", 4, &PSActions::setcmykcolor}, + {"setdash", -1, &PSActions::setdash}, + {"setgray", 1, &PSActions::setgray}, + {"sethsbcolor", 3, &PSActions::sethsbcolor}, + {"setlinecap", 1, &PSActions::setlinecap}, + {"setlinejoin", 1, &PSActions::setlinejoin}, + {"setlinewidth", 1, &PSActions::setlinewidth}, + {"setmatrix", 6, &PSActions::setmatrix}, + {"setmiterlimit", 1, &PSActions::setmiterlimit}, + {"setopacityalpha", 1, &PSActions::setopacityalpha}, + {"setpattern", -1, &PSActions::setpattern}, + {"setrgbcolor", 3, &PSActions::setrgbcolor}, + {"shfill", -1, &PSActions::shfill}, + {"stroke", 0, &PSActions::stroke}, + {"translate", 2, &PSActions::translate}, + }; + if (_actions) { + in.skipSpace(); + // binary search + int first=0, last=sizeof(operators)/sizeof(Operator)-1; + while (first <= last) { + int mid = first+(last-first)/2; + int cmp = in.compare(operators[mid].name); + if (cmp < 0) + last = mid-1; + else if (cmp > 0) + first = mid+1; + else { + if (!operators[mid].op) { // raw string data received + _rawData.clear(); + in.skipSpace(); + while (!in.eof()) { + _rawData.push_back(in.getString()); + in.skipSpace(); + } + } + else { + // collect parameters and call handler + vector params; + int pcount = operators[mid].pcount; + if (pcount < 0) { // variable number of parameters? + in.skipSpace(); + while (!in.eof()) { // read all available parameters + params.push_back(in.getString()); + in.skipSpace(); + } + } + else { // fix number of parameters + for (int i=0; i < pcount; i++) { + in.skipSpace(); + params.push_back(in.getString()); + } + } + vector v(params.size()); + str2double(params, v); + (_actions->*operators[mid].op)(v); + _actions->executed(); + } + break; + } + } + } +} + + +/** This callback function handles output from Ghostscript to stderr. + * @param[in] inst pointer to calling instance of PSInterpreter + * @param[in] buf contains the characters to be output + * @param[in] len number of chars in buf + * @return number of processed characters */ +int GSDLLCALL PSInterpreter::error (void *inst, const char *buf, int len) { + return len; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h new file mode 100644 index 00000000000..528e95ca83c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSInterpreter.h @@ -0,0 +1,129 @@ +/************************************************************************* +** PSInterpreter.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PSINTERPRETER_H +#define DVISVGM_PSINTERPRETER_H + +#include +#include +#include +#include +#include "Ghostscript.h" +#include "InputReader.h" +#include "MessageException.h" + + +struct PSException : public MessageException +{ + PSException (const std::string &msg) : MessageException(msg) {} +}; + + +/** This interface provides the template methods called by PSInterpreter when executing a PS snippet. + * Each method corresponds to a PostScript operator of the same name. */ +struct PSActions +{ + virtual ~PSActions () {} + virtual void applyscalevals (std::vector &p) =0; + virtual void clip (std::vector &p) =0; + virtual void clippath (std::vector &p) =0; + virtual void closepath (std::vector &p) =0; + virtual void curveto (std::vector &p) =0; + virtual void eoclip (std::vector &p) =0; + virtual void eofill (std::vector &p) =0; + virtual void fill (std::vector &p) =0; + virtual void gsave (std::vector &p) =0; + virtual void grestore (std::vector &p) =0; + virtual void grestoreall (std::vector &p) =0; + virtual void initclip (std::vector &p) =0; + virtual void lineto (std::vector &p) =0; + virtual void makepattern (std::vector &p) =0; + virtual void moveto (std::vector &p) =0; + virtual void newpath (std::vector &p) =0; + virtual void querypos (std::vector &p) =0; + virtual void restore (std::vector &p) =0; + virtual void rotate (std::vector &p) =0; + virtual void save (std::vector &p) =0; + virtual void scale (std::vector &p) =0; + virtual void setcmykcolor (std::vector &cmyk) =0; + virtual void setdash (std::vector &p) =0; + virtual void setgray (std::vector &p) =0; + virtual void sethsbcolor (std::vector &hsb) =0; + virtual void setlinecap (std::vector &p) =0; + virtual void setlinejoin (std::vector &p) =0; + virtual void setlinewidth (std::vector &p) =0; + virtual void setmatrix (std::vector &p) =0; + virtual void setmiterlimit (std::vector &p) =0; + virtual void setopacityalpha (std::vector &p) =0; + virtual void setpattern (std::vector &p) =0; + virtual void setrgbcolor (std::vector &rgb) =0; + virtual void shfill (std::vector &rgb) =0; + virtual void stroke (std::vector &p) =0; + virtual void translate (std::vector &p) =0; + virtual void executed () {} // triggered if one of the above PS operators has been executed +}; + +class PSFilter; + +/** This class provides methods to execute chunks of PostScript code and calls + * several template methods on invocation of selected PS operators (see PSActions). */ +class PSInterpreter +{ + enum Mode {PS_NONE, PS_RUNNING, PS_QUIT}; + + public: + PSInterpreter (PSActions *actions=0); + bool execute (const char *str, size_t len, bool flush=true); + bool execute (const char *str, bool flush=true) {return execute(str, std::strlen(str), flush);} + bool execute (const std::string &str, bool flush=true) {return execute(str.c_str(), flush);} + bool execute (std::istream &is, bool flush=true); + bool executeRaw (const std::string &str, int n); + bool active () const {return _mode != PS_QUIT;} + void limit (size_t max_bytes) {_bytesToRead = max_bytes;} + void setFilter (PSFilter *filter) {_filter = filter;} + PSActions* setActions (PSActions *actions); + const std::vector& rawData () const {return _rawData;} + + protected: + void init (); + // callback functions + static int GSDLLCALL input (void *inst, char *buf, int len); + static int GSDLLCALL output (void *inst, const char *buf, int len); + static int GSDLLCALL error (void *inst, const char *buf, int len); + + void checkStatus (int status); + void callActions (InputReader &cib); + + private: + Ghostscript _gs; + Mode _mode; ///< current execution mode + PSActions *_actions; ///< actions to be performed + PSFilter *_filter; ///< active filter used to process PS code + size_t _bytesToRead; ///< if > 0, maximal number of bytes to be processed by following calls of execute() + std::vector _linebuf; + std::string _errorMessage; ///< text of error message + bool _inError; ///< true if scanning error message + bool _initialized; ///< true if PSInterpreter has been completely initialized + std::vector _rawData; ///< raw data received + static const char *GSARGS[]; ///< parameters passed to Ghostscript + static const char *PSDEFS; ///< initial PostScript definitions +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp new file mode 100644 index 00000000000..8465df01469 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.cpp @@ -0,0 +1,175 @@ +/************************************************************************* +** PSPattern.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "BoundingBox.h" +#include "PSPattern.h" +#include "SpecialActions.h" +#include "SVGTree.h" +#include "XMLNode.h" + +using namespace std; + + +string PSPattern::svgID () const { + return XMLString("pat")+XMLString(_id); +} + + +/** Appends the definition of this pattern to the "def" section of the SVG tree. */ +void PSPattern::apply (SpecialActions *actions) { + if (XMLElementNode *pattern = createPatternNode()) + actions->appendToDefs(pattern); +} + + +///////////////////////////////////////////////////////////////////////////// + +PSTilingPattern::PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) + : PSPattern(id), _bbox(bbox), _matrix(matrix), _xstep(xstep), _ystep(ystep), _groupNode(0) +{ + _groupNode = PSTilingPattern::createGroupNode(); +} + + +PSTilingPattern::~PSTilingPattern () { + delete _groupNode; +} + + +/** Creates a new pattern element representing the pattern defined in the PS code. */ +XMLElementNode* PSTilingPattern::createPatternNode () const { + if (!_groupNode) + return 0; + BoundingBox box(_bbox.minX(), _bbox.minY(), _bbox.minX()+_xstep, _bbox.minY()+_ystep); + XMLElementNode *pattern = new XMLElementNode("pattern"); + pattern->addAttribute("id", svgID()); + pattern->addAttribute("x", box.minX()); + pattern->addAttribute("y", box.minY()); + pattern->addAttribute("width", box.width()); + pattern->addAttribute("height", box.height()); + pattern->addAttribute("viewBox", box.toSVGViewBox()); + pattern->addAttribute("patternUnits", "userSpaceOnUse"); + if (!_matrix.isIdentity()) + pattern->addAttribute("patternTransform", _matrix.getSVG()); + if (_xstep < _bbox.width() || _ystep < _bbox.height()) { // overlapping tiles? + // disable clipping at the tile borders => tiles become "transparent" + pattern->addAttribute("overflow", "visible"); + } + if (XMLElementNode *clip=createClipNode()) + pattern->append(clip); + pattern->append(_groupNode); + return pattern; +} + + +/** Creates a new clip element restricting the drawing area to the + * dimensions given in the definition of the pattern. */ +XMLElementNode* PSTilingPattern::createClipNode() const { + XMLElementNode *clip = new XMLElementNode("clipPath"); + clip->addAttribute("id", "pc"+XMLString(psID())); + XMLElementNode *rect = new XMLElementNode("rect"); + rect->addAttribute("x", _bbox.minX()); + rect->addAttribute("y", _bbox.minY()); + rect->addAttribute("width", _bbox.width()); + rect->addAttribute("height", _bbox.height()); + clip->append(rect); + return clip; +} + + +/** Creates a new group element that contains all "drawing" elements that + * define the pattern graphic. */ +XMLElementNode* PSTilingPattern::createGroupNode () const { + // add all succeeding path elements to this group + XMLElementNode *group = new XMLElementNode("g"); + group->addAttribute("clip-path", XMLString("url(#pc")+XMLString(psID())+")"); + return group; +} + + +void PSTilingPattern::apply (SpecialActions *actions) { + PSPattern::apply(actions); + _groupNode = 0; +} + + +///////////////////////////////////////////////////////////////////////////// + +PSColoredTilingPattern::PSColoredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) + : PSTilingPattern(id, bbox, matrix, xstep, ystep) +{ +} + + +///////////////////////////////////////////////////////////////////////////// + +PSUncoloredTilingPattern::PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep) + : PSTilingPattern(id, bbox, matrix, xstep, ystep), _applied(false) +{ +} + + +PSUncoloredTilingPattern::~PSUncoloredTilingPattern () { + if (_applied) + setGroupNode(0); // prevent deleting the group node in the parent destructor +} + + +/** Returns an SVG id value that identifies this pattern with the current color applied. */ +string PSUncoloredTilingPattern::svgID () const { + ostringstream oss; + oss << PSPattern::svgID() << '-' << hex << _currentColor; + return oss.str(); +} + + +/** Appends the definition of this pattern with the current color applied + * to the "def" section of the SVG tree. */ +void PSUncoloredTilingPattern::apply (SpecialActions* actions) { + set::iterator it=_colors.find(_currentColor); + if (it == _colors.end()) { + if (_applied) + setGroupNode(static_cast(getGroupNode()->clone())); + // assign current color to the pattern graphic + vector colored_elems; + const char *attribs[] = {"fill", "stroke"}; + for (int i=0; i < 2; i++) { + getGroupNode()->getDescendants(0, attribs[i], colored_elems); + for (vector::iterator it=colored_elems.begin(); it != colored_elems.end(); ++it) + if (string((*it)->getAttributeValue(attribs[i])) != "none") + (*it)->addAttribute(attribs[i], _currentColor.svgColorString()); + colored_elems.clear(); + } + PSPattern::apply(actions); + _colors.insert(_currentColor); + _applied = true; + } +} + + +XMLElementNode* PSUncoloredTilingPattern::createClipNode() const { + // only the first instance of this patterns get a clip element + if (_colors.empty()) + return PSTilingPattern::createClipNode(); + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h new file mode 100644 index 00000000000..d394f5a65ab --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPattern.h @@ -0,0 +1,100 @@ +/************************************************************************* +** PSPattern.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PSPATTERN_H +#define DVISVGM_PSPATTERN_H + +#include +#include +#include "BoundingBox.h" +#include "Color.h" +#include "Matrix.h" + + +struct SpecialActions; +class SVGTree; +class XMLElementNode; + +class PSPattern +{ + public: + virtual ~PSPattern () {} + virtual int psID () const {return _id;} + virtual std::string svgID () const; + virtual void apply (SpecialActions *actions); + + protected: + PSPattern (int id) : _id(id) {} + virtual XMLElementNode* createPatternNode () const =0; + + private: + int _id; ///< PostSCript ID of this pattern +}; + + +class PSTilingPattern : public PSPattern +{ + public: + ~PSTilingPattern (); + virtual XMLElementNode* getContainerNode () {return _groupNode;} + void apply (SpecialActions *actions); + + protected: + PSTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); + XMLElementNode* createPatternNode () const; + virtual XMLElementNode* createClipNode () const; + virtual XMLElementNode* createGroupNode () const; + virtual XMLElementNode* getGroupNode () const {return _groupNode;} + virtual void setGroupNode (XMLElementNode *node) {_groupNode = node;} + + private: + BoundingBox _bbox; ///< bounding box of the tile graphics + Matrix _matrix; ///< tile transformation + double _xstep, _ystep; ///< horizontal and vertical distance between neighboured tiles + XMLElementNode *_groupNode; ///< group containing the drawing elements +}; + + +class PSColoredTilingPattern : public PSTilingPattern +{ + public: + PSColoredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); +}; + + +class PSUncoloredTilingPattern : public PSTilingPattern +{ + public: + PSUncoloredTilingPattern (int id, BoundingBox &bbox, Matrix &matrix, double xstep, double ystep); + ~PSUncoloredTilingPattern (); + std::string svgID () const; + void setColor (Color color) {_currentColor = color;} + void apply (SpecialActions *actions); + + protected: + XMLElementNode* createClipNode () const; + + private: + std::set _colors; ///< colors this pattern has already been drawn with + Color _currentColor; ///< current color to be applied + bool _applied; ///< has pattern with current group node already been applied to the SVG tree? +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp new file mode 100644 index 00000000000..5029874c681 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp @@ -0,0 +1,118 @@ +/************************************************************************* +** PSPreviewFilter.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "InputBuffer.h" +#include "InputReader.h" +#include "PSInterpreter.h" +#include "PSPreviewFilter.h" +#include "SpecialActions.h" + + +using namespace std; + +PSPreviewFilter::PSPreviewFilter (PSInterpreter &psi) + : PSFilter(psi), _active(false), _tightpage(false), _dvi2bp(1.0/65536.0) +{ +} + + +/** Activates this filter so that the PS code will be redirected through it if + * it's hooked into the PSInterpreter. */ +void PSPreviewFilter::activate () { + if (_tightpage) // reactivate filter? + _active = true; + else { // first activation? + _tightpage = _active = false; + // try to retrieve version string of preview package set in the PS header section + if (psInterpreter().executeRaw("SDict begin currentdict/preview@version known{preview@version}{0}ifelse end", 1)) + _version = psInterpreter().rawData()[0]; + // check if tightpage option was set + if (_version != "0" && psInterpreter().executeRaw("SDict begin preview@tightpage end", 1)) { + _tightpage = (psInterpreter().rawData()[0] == "true"); + _active = true; + } + } + _boxExtents.clear(); +} + + +/** Tries to extract the bounding box information from a chunk of PostScript code. + * @param[in] code pointer to buffer with PS code to filter + * @param[in] len number of bytes in buffer */ +void PSPreviewFilter::execute (const char *code, size_t len) { + // If the "tightpage" option was set in the TeX file, 7 integers representing the + // extent of the bounding box are present at the begin of each page. + if (!_tightpage) + psInterpreter().execute(code, len); + else { + CharInputBuffer ib(code, len); + BufferInputReader ir(ib); + ir.skipSpace(); + int val; + while (ir.parseInt(val) && _boxExtents.size() <= 7) { + _boxExtents.push_back(val); + ir.skipSpace(); + } + } + _active = false; // no further processing required +} + + +/** Returns the bounding box defined by the preview package. */ +bool PSPreviewFilter::getBoundingBox (BoundingBox &bbox) const { + if (_boxExtents.size() < 7) + return false; + double left = -_boxExtents[0]*_dvi2bp; + bbox = BoundingBox(-left, -height(), width()-left, depth()); + return true; +} + + +/** Gets the 4 border values set by the preview package. + * @return true if the border data is available */ +bool PSPreviewFilter::getBorders (double &left, double &right, double &top, double &bottom) const { + if (_boxExtents.size() < 4) + return false; + left = -_boxExtents[0]*_dvi2bp; + top = -_boxExtents[1]*_dvi2bp; + right = _boxExtents[2]*_dvi2bp; + bottom = _boxExtents[3]*_dvi2bp; + return true; +} + + +/** Returns the box height in PS points, or -1 if no data was found or read yet. */ +double PSPreviewFilter::height () const { + return _boxExtents.size() > 4 ? (_boxExtents[4]-_boxExtents[1])*_dvi2bp : -1; +} + + +/** Returns the box depth in PS points, or -1 if no data was found or read yet. */ +double PSPreviewFilter::depth () const { + return _boxExtents.size() > 5 ? (_boxExtents[5]+_boxExtents[3])*_dvi2bp : -1; +} + + +/** Returns the box width in PS points, or -1 if no data was found or read yet. */ +double PSPreviewFilter::width () const { + return _boxExtents.size() > 6 ? (_boxExtents[6]+_boxExtents[2]-_boxExtents[0])*_dvi2bp : -1; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h new file mode 100644 index 00000000000..3e9f9ad2052 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.h @@ -0,0 +1,56 @@ +/************************************************************************* +** PSPreviewFilter.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PSPREVIEWFILTER_H +#define DVISVGM_PSPREVIEWFILTER_H + +#include +#include +#include "BoundingBox.h" +#include "PSFilter.h" + +struct SpecialActions; + +class PSPreviewFilter : public PSFilter +{ + public: + PSPreviewFilter (PSInterpreter &psi); + void activate (); + void execute (const char *code, size_t len); + bool active () const {return _active;} + std::string version () const {return _version;} + bool tightpage () const {return _tightpage;} + void setDviScaleFactor (double dvi2bp) {_dvi2bp = dvi2bp;} + bool getBorders (double &left, double &right, double &top, double &bottom) const; + void assignBorders (BoundingBox &bbox) const; + bool getBoundingBox (BoundingBox &bbox) const; + double height () const; + double depth () const; + double width () const; + + private: + std::string _version; ///< version string of preview package + bool _active; ///< true if filter is active + bool _tightpage; ///< true if tightpage option was given + double _dvi2bp; ///< factor to convert dvi units to PS points + std::vector _boxExtents; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp new file mode 100644 index 00000000000..8e6339c72e8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.cpp @@ -0,0 +1,87 @@ +/************************************************************************* +** PageRanges.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "InputBuffer.h" +#include "InputReader.h" +#include "PageRanges.h" + +#include "macros.h" + +using namespace std; + + +/** Analyzes a string describing a range sequence. + * Syntax: ([0-9]+(-[0-9]*)?)|(-[0-9]+)(,([0-9]+(-[0-9]*)?)|(-[0-9]+))* + * @param[in] str string to parse + * @param[in] max_page greatest allowed value + * @return true on success; false denotes a syntax error */ +bool PageRanges::parse (string str, int max_page) { + StringInputBuffer ib(str); + BufferInputReader ir(ib); + while (ir) { + int first=1; + int last=max_page; + ir.skipSpace(); + if (!isdigit(ir.peek()) && ir.peek() != '-') + return false; + + if (isdigit(ir.peek())) + first = ir.getInt(); + ir.skipSpace(); + if (ir.peek() == '-') { + while (ir.peek() == '-') + ir.get(); + ir.skipSpace(); + if (isdigit(ir.peek())) + last = ir.getInt(); + } + else + last = first; + ir.skipSpace(); + if (ir.peek() == ',') { + ir.get(); + if (ir.eof()) + return false; + } + else if (!ir.eof()) + return false; + if (first > last) + swap(first, last); + first = max(1, first); + last = max(first, last); + if (max_page > 0) { + first = min(first, max_page); + last = min(last, max_page); + } + addRange(first, last); + } + return true; +} + + +/** Returns the number of pages. */ +size_t PageRanges::numberOfPages () const { + size_t sum=0; + for (NumericRanges::ConstIterator it=begin(); it != end(); ++it) + sum += it->second - it->first + 1; + return sum; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h new file mode 100644 index 00000000000..0f5e2faafa3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageRanges.h @@ -0,0 +1,36 @@ +/************************************************************************* +** PageRanges.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PAGERANGES_H +#define DVISVGM_PAGERANGES_H + +#include +#include +#include +#include "NumericRanges.h" + +class PageRanges : public NumericRanges +{ + public: + bool parse (std::string str, int max_page=0); + size_t numberOfPages () const; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp new file mode 100644 index 00000000000..d3e60571d06 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.cpp @@ -0,0 +1,157 @@ +/************************************************************************* +** PageSize.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "PageSize.h" + +using namespace std; + +// make sure tolower is a function (and not a macro) +// so that 'transform' can be applied +static int my_tolower (int c) { + return tolower(c); +} + + +/** Computes width and height of ISO/DIN An in millimeters. + * @param[in] n the A level (e.g. n=4 => DIN A4) + * @param[out] width contains the page width when function returns + * @param[out] height contains the page height when function returns */ +static void computeASize (int n, double &width, double &height) { + double sqrt2 = sqrt(2.0); + height = floor(1189.0/pow(sqrt2, n)+0.5); + width = floor(height/sqrt2+0.5); +} + + +/** Computes width and height of ISO/DIN Bn in millimeters. + * @param[in] n the B level (e.g. n=4 => DIN B4) + * @param[out] width contains the page width when function returns + * @param[out] height contains the page height when function returns */ +static void computeBSize (int n, double &width, double &height) { + double w, h; + computeASize(n, width, height); + computeASize(n-1, w, h); + width = floor(sqrt(width * w)+0.5); + height = floor(sqrt(height * h)+0.5); +} + + +/** Computes width and height of ISO/DIN Cn in millimeters. + * @param[in] n the C level (e.g. n=4 => DIN C4) + * @param[out] width contains the page width when function returns + * @param[out] height contains the page height when function returns */ +static void computeCSize (int n, double &width, double &height) { + double w, h; + computeASize(n, width, height); + computeBSize(n, w, h); + width = floor(sqrt(width * w)+0.5); + height = floor(sqrt(height * h)+0.5); +} + + +/** Computes width and height of ISO/DIN Dn in millimeters. + * @param[in] n the D level (e.g. n=4 => DIN D4) + * @param[out] width contains the page width when function returns + * @param[out] height contains the page height when function returns */ +static void computeDSize (int n, double &width, double &height) { + double w, h; + computeASize(n, width, height); + computeBSize(n+1, w, h); + width = floor(sqrt(width * w)+0.5); + height = floor(sqrt(height * h)+0.5); +} + + +/** Constructs a PageSize object of given size. + * @param[in] name specifies the page size, e.g. "A4" or "letter" */ +PageSize::PageSize (string name) : _width(0), _height(0) { + resize(name); +} + + +void PageSize::resize (double w, double h) { + _width = w; + _height = h; +} + +void PageSize::resize (string name) { + if (name.length() < 2) + throw PageSizeException("unknown page format: "+name); + + transform(name.begin(), name.end(), name.begin(), my_tolower); + // extract optional suffix + size_t pos = name.rfind("-"); + bool landscape = false; + if (pos != string::npos) { + string suffix = name.substr(pos); + name = name.substr(0, pos); + if (suffix == "-l" || suffix == "-landscape") + landscape = true; + else if (suffix != "-p" && suffix != "-portrait") + throw PageSizeException("invalid page format suffix: " + suffix); + } + + if (name == "invoice") { + _width = 140; + _height = 216; + } + else if (name == "executive") { + _width = 184; + _height = 267; + } + else if (name == "legal") { + _width = 216; + _height = 356; + } + else if (name == "letter") { + _width = 216; + _height = 279; + } + else if (name == "ledger") { + _width = 279; + _height = 432; + } + else if (isdigit(name[1]) && name.length() < 5) { // limit length of number to prevent arithmetic errors + istringstream iss(name.substr(1)); + int n; + iss >> n; + switch (name[0]) { + case 'a' : computeASize(n, _width, _height); break; + case 'b' : computeBSize(n, _width, _height); break; + case 'c' : computeCSize(n, _width, _height); break; + case 'd' : computeDSize(n, _width, _height); break; + default : throw PageSizeException("invalid page format: "+name); + } + } + if (_width == 0 || _height == 0) + throw PageSizeException("unknown page format: "+name); + if (landscape) + swap(_width, _height); + + const double bppmm = 72/25.4; // PS points per millimeter (72pt = 1in = 25.4mm) + _width *= bppmm; + _height *= bppmm; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h new file mode 100644 index 00000000000..b86218393c1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PageSize.h @@ -0,0 +1,48 @@ +/************************************************************************* +** PageSize.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PAGESIZE_H +#define DVISVGM_PAGESIZE_H + +#include "MessageException.h" + +struct PageSizeException : public MessageException +{ + PageSizeException (const std::string &msg) : MessageException(msg) {} +}; + +class PageSize +{ + public: + PageSize (double w=0, double h=0) : _width(w), _height(h) {} + PageSize (std::string name); + void resize (std:: string name); + void resize (double w, double h); + double widthInBP () const {return _width;} + double heightInBP () const {return _height;} + double widthInMM () const {return _width*25.4/72;} + double heightInMM () const {return _height*25.4/72;} + bool valid () const {return _width > 0 && _height > 0;} + + private: + double _width, _height; // in PS points +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h new file mode 100644 index 00000000000..fa27033b199 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Pair.h @@ -0,0 +1,79 @@ +/************************************************************************* +** Pair.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PAIR_H +#define DVISVGM_PAIR_H + +#include +#include +#include "macros.h" +#include "types.h" + +template +class Pair +{ + public: + Pair (T x=0, T y=0) : _x(x), _y(y) {} + Pair operator += (const Pair &p) {_x += p._x; _y += p._y; return *this;} + Pair operator -= (const Pair &p) {_x -= p._x; _y -= p._y; return *this;} + Pair operator *= (T c) {_x *= c; _y *= c; return *this;} + Pair operator /= (T c) {_x /= c; _y /= c; return *this;} + Pair ortho () const {return Pair(-_y, _x);} + double length () const {return std::sqrt(_x*_x + _y*_y);} + bool operator == (const Pair &p) const {return _x == p._x && _y == p._y;} + bool operator != (const Pair &p) const {return _x != p._x || _y != p._y;} + T x () const {return _x;} + T y () const {return _y;} + void x (const T &xx) {_x = xx;} + void y (const T &yy) {_y = yy;} + std::ostream& write (std::ostream &os) const {return os << '(' << _x << ',' << _y << ')';} + + private: + T _x, _y; +}; + + +struct Pair32 : public Pair +{ + Pair32 (Int32 x=0, Int32 y=0) : Pair(x, y) {} + explicit Pair32 (double x, double y) : Pair(Int32(x+0.5), Int32(y+0.5)) {} + Pair32 (const Pair &p) : Pair(p) {} +// operator Pair () {return *this;} +}; + +typedef Pair DPair; + +template +IMPLEMENT_ARITHMETIC_OPERATOR(Pair, +) + +template +IMPLEMENT_ARITHMETIC_OPERATOR(Pair, -) + +template +IMPLEMENT_ARITHMETIC_OPERATOR2(Pair, T, *) + +template +IMPLEMENT_ARITHMETIC_OPERATOR2(Pair, T, /) + +template +IMPLEMENT_OUTPUT_OPERATOR(Pair) + +IMPLEMENT_ARITHMETIC_OPERATOR2(Pair32, Int32, *) +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp new file mode 100644 index 00000000000..02816ecac18 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.cpp @@ -0,0 +1,340 @@ +/************************************************************************* +** PathClipper.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "Bezier.h" +#include "PathClipper.h" +#include "types.h" + +using namespace std; +using namespace ClipperLib; + +typedef ClipperLib::Path Polygon; +typedef ClipperLib::Paths Polygons; +typedef PathClipper::CurvedPath CurvedPath; + +const int SCALE_FACTOR = 1000; + +inline cInt to_cInt (double x) { + if (x < 0) + return static_cast(x*SCALE_FACTOR - 0.5); + return static_cast(x*SCALE_FACTOR + 0.5); +} + + +inline double to_double (cInt x) { + return static_cast(x)/SCALE_FACTOR; +} + + +inline DPair to_DPair (const IntPoint &p) { + return DPair(to_double(p.X), to_double(p.Y)); +} + + +/** In order to flatten a curved path, all path segements are processed sequentially. + * Depending on the type of the segment, one of the methods provided by this class + * is called. */ +class FlattenActions : public CurvedPath::Actions { + public: + FlattenActions (vector &curves, Polygons &polygons, int &numLines) + : _polygons(polygons), _curves(curves), _numLines(numLines) {} + + void moveto (const CurvedPath::Point &p) { + if (p == _currentPoint && !_currentPoly.empty()) + return; + closepath(); + _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), 0)); + _currentPoint = _startPoint = p; + } + + void lineto (const CurvedPath::Point &p) { + if (p == _currentPoint && !_currentPoly.empty()) + return; + if (_currentPoly.empty()) // this shouldn't happen but in case it does... + _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first + _numLines--; + _currentPoly.back().Z.label2 = _numLines; + _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(_numLines, 0))); + _currentPoint = p; + } + + void conicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2) { + Bezier bezier(_currentPoint, p1, p2); + addCurvePoints(bezier); + } + + void cubicto (const CurvedPath::Point &p1, const CurvedPath::Point &p2, const CurvedPath::Point &p3) { + Bezier bezier(_currentPoint, p1, p2, p3); + addCurvePoints(bezier); + } + + void closepath () { + if (_currentPoly.empty()) + return; + _numLines--; + _currentPoly.back().Z.label2 = ZLabel(_numLines, 0); + _currentPoly.front().Z.label1 = ZLabel(_numLines, 0); + _polygons.push_back(_currentPoly); + _currentPoly.clear(); + } + + void finished () { + closepath(); + } + + protected: + void addCurvePoints (const Bezier &bezier) { + if (_currentPoly.empty()) // this shouldn't happen but in case it does, ... + _currentPoly.push_back(IntPoint(0, 0, 0)); // ...add a start point first + vector points; // points of flattened curve + vector t; // corresponding 'time' parameters + bezier.approximate(0.01, points, &t); + if (points.size() < 2) + return; + _curves.push_back(bezier); + for (size_t i=1; i < points.size(); i++) { + const DPair &p = points[i]; + if (p == _currentPoint) + continue; + _currentPoly.back().Z.label2 = ZLabel(_curves.size(), t[i-1]); + ZLabel label(_curves.size(), t[i]); + _currentPoly.push_back(IntPoint(to_cInt(p.x()), to_cInt(p.y()), ZType(label, label))); + _currentPoint = p; + } + } + + private: + CurvedPath::Point _startPoint, _currentPoint; + Polygon _currentPoly; ///< polygon being created + Polygons &_polygons; ///< all polygons created + vector &_curves; + int &_numLines; +}; + + +/** Removes adjacent polygon vertices that equal their predecessor. */ +static void remove_redundant_vertices (Polygon &polygon) { + Polygon::iterator it1=polygon.begin(); + while (it1 != polygon.end()) { + Polygon::iterator it2 = it1+1; + if (it2 == polygon.end()) + it2 = polygon.begin(); + if (it1 == it2) + return; + + if (*it1 != *it2) + ++it1; + else { + it1->Z.label2 = it2->Z.label2; + polygon.erase(it2); + } + } +} + + +/** Approximates a curved path by a set of polygons and stores information + * to reconstruct the curved segments later. The z component of each + * polygon vertex holds two integers representing information about the two + * adjacent edges the vertex belongs to. This is required to identify the + * affected edges and thus the former (curve/line) segment of the path during + * the intersection process. + * @param[in] curvedPath curved path to be flattened + * @param[out] polygons the flattened path (set of polygons) */ +void PathClipper::flatten (const CurvedPath &curvedPath, Polygons &polygons) { + FlattenActions flattenActions(_curves, polygons, _numLines); + curvedPath.iterate(flattenActions, false); + for (size_t i=0; i < polygons.size(); i++) + remove_redundant_vertices(polygons[i]); +} + + +/** Returns the ID of the path segment the polygon edge defined by its start + * and end point belongs to. The z component of a polygon vertex holds a pair + * of labels that allows to identify the original path segments the point belongs to. + * Since always two adjacent segments share a point, each point gets two values assigned. + * Negative numbers denote line segments, positive ones Bézier curves. + * There are only these two segment types, so we don't need further flags in + * order to distinguish them. By comparing the labels of two adjacent polygon + * vertexes it's possible to identify the original path segment the corresponding + * edge belongs to. + * @param[in] p1 first of two adjacent vertices + * @param[in] p2 second of two adjacent vertices + * @param[out] t1 time paramater of p1 + * @param[out] t2 time paramater of p2 + * @return id of edge between p1 and p2, or 0 if it's not possible to identify the segment */ +static Int32 segment_id (const IntPoint &p1, const IntPoint &p2, double &t1, double &t2) { + const ZType &z1=p1.Z, &z2=p2.Z; + if (z1 == z2 && z1.minLabel().id < 0) return z1.minLabel().id; + if (z1.label1 == z2.label2) {t1=z1.label1.t; t2=z2.label2.t; return z1.label1.id;} + if (z1.label2 == z2.label1) {t1=z1.label2.t; t2=z2.label1.t; return z1.label2.id;} + if (z1.label1 == z2.label1) {t1=z1.label1.t; t2=z2.label1.t; return z1.label1.id;} + if (z1.label2 == z2.label2) {t1=z1.label2.t; t2=z2.label2.t; return z1.label2.id;} + // if we get here, it's not possible to identify the segment + // => the edge is going to be handled as line segment + return 0; +} + + +inline Int32 edge_id (const IntPoint &p1, const IntPoint &p2) { + double t; + return segment_id(p1, p2, t, t); +} + + +/** This function expects 3 colinear points p1, p2, and q where q lies between p1 and p2, + * i.e. q divides the line \f$ \overline{p_1 p_2} \f$ somewhere. The function returns + * the corresponding division ratio. */ +static double division_ratio (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { + if (p1 == p2 || q == p1) + return 0; + if (q == p2) + return 1; + if (p1.X == p2.X) + return double(q.Y-p1.Y)/(p2.Y-p1.Y); + return double(q.X-p1.X)/(p2.X-p1.X); +} + + +/** Returns the label of point q that lies on the line between points p1 and p2. */ +inline ZLabel division_label (const IntPoint &p1, const IntPoint &p2, const IntPoint &q) { + double t1, t2; + double s=0; + Int32 id = segment_id(p1, p2, t1, t2); + if (id > 0) + s = t1+(t2-t1)*division_ratio(p1, p2, q); + return ZLabel(id, s); +} + + +/** This method is called if the clipper library finds an intersection between two polygon edges. + * It populates the z coordinate of the intersection point with the idexes of the two edges. + * @param[in] e1bot first endpoint of edge 1 + * @param[in] e1top second endpoint of edge 1 + * @param[in] e2bot first endpoint of edge 2 + * @param[in] e2top second endpoint of edge 2 + * @param[in] ip intersection point of edge 1 and 2 */ +void PathClipper::callback (IntPoint &e1bot, IntPoint &e1top, IntPoint &e2bot, IntPoint &e2top, IntPoint &ip) { + ZLabel label1 = division_label(e1bot, e1top, ip); + ZLabel label2 = division_label(e2bot, e2top, ip); + ip.Z = ZType(label1, label2); +} + + +/** Iterates along the polygon edges until the endpoint of the current + * path segment is found and returns its vector index afterwards. + * @param[in] polygon the polygon to be processed + * @param[in] start index of the vertex where the iteration starts + * @param[out] label if not 0, retrieves the label of the endpoint + * @param[in] startLabel if true, the found endpoint is treated as start point and + * parameter 'label' gets the corresponding value */ +static size_t find_segment_endpoint (const Polygon &polygon, size_t start, ZLabel *label=0, bool startLabel=false) { + if (polygon.empty()) + return 0; + + const size_t num_points = polygon.size(); + int i = start%num_points; + double t1, t2; // time parameters of start and endpoint of current edge + Int32 id1 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); + Int32 id2 = id1; + double t = t2; // time parameter of resulting endpoint + for (size_t j=1; id1 == id2 && j < num_points; j++) { + t = t2; + i = (i+1)%num_points; + if (id1 == 0) + break; + id2 = segment_id(polygon[i], polygon[(i+1)%num_points], t1, t2); + } + if (label) { + *label = ZLabel(id1, id1 < 0 ? 0 : t); + if (startLabel && id1 != 0) + *label = polygon[i].Z.otherLabel(*label); + } + return i; +} + + +/** Reconstructs a curved path from the set of polygons. + * @param[in] polygons set of polygons to reconstruct + * @param[out] path the reconstructed curved path */ +void PathClipper::reconstruct (const Polygons &polygons, CurvedPath &path) { + for (size_t i=0; i < polygons.size(); i++) + reconstruct(polygons[i], path); +} + + +/** Reconstructs a curved path from a single polygon. + * @param[in] polygon polygon to reconstruct + * @param[out] path the reconstructed curved path */ +void PathClipper::reconstruct (const Polygon &polygon, CurvedPath &path) { + size_t num_points = polygon.size(); + if (num_points < 2) + return; + + ZLabel label1, label2; // labels of the current segment's start and endpoint + int index1 = find_segment_endpoint(polygon, 0, &label1, true); + int index2 = find_segment_endpoint(polygon, index1, &label2); + int diff = (num_points+index2-index1)%num_points; + path.moveto(to_DPair(polygon[index1])); + for (size_t count = diff; count <= num_points; count += diff) { + if (diff == 1 || label1.id <= 0) // line segment? + path.lineto(to_DPair(polygon[index2])); + else { // Bézier curve segment + Bezier bezier(_curves[label1.id-1], label1.t, label2.t); + if (label1.t > label2.t) + bezier.reverse(); + path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); + } + if (label1.id == 0) + find_segment_endpoint(polygon, index2, &label1, true); + else + label1 = polygon[index2].Z.otherLabel(label2); + index1 = index2; + index2 = find_segment_endpoint(polygon, index1, &label2); + diff = (num_points+index2-index1)%num_points; + } + path.closepath(); +} + + +inline PolyFillType polyFillType (CurvedPath::WindingRule wr) { + return (wr == CurvedPath::WR_NON_ZERO) ? pftNonZero : pftEvenOdd; +} + + +/** Computes the intersection of to curved path. + * @param[in] p1 first curved path + * @param[in] p2 second curved path + * @param[out] result intersection of p1 and p2 */ +void PathClipper::intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result) { + if (p1.size() < 2 || p2.size() < 2) + return; + Clipper clipper; + Polygons polygons; + flatten(p1, polygons); + clipper.AddPaths(polygons, ptSubject, true); + polygons.clear(); + flatten(p2, polygons); + clipper.AddPaths(polygons, ptClip, true); + clipper.ZFillFunction(callback); + Polygons flattenedPath; + clipper.Execute(ctIntersection, flattenedPath, polyFillType(p1.windingRule()), polyFillType(p2.windingRule())); + reconstruct(flattenedPath, result); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h new file mode 100644 index 00000000000..b9c9158a228 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PathClipper.h @@ -0,0 +1,55 @@ +/************************************************************************* +** PathClipper.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PATHCLIPPER_H +#define DVISVGM_PATHCLIPPER_H + +#include +#include +#include +#include "Bezier.h" +#include "GraphicPath.h" +#include "MessageException.h" + + +using ClipperLib::IntPoint; + +class PathClipper +{ + public: + typedef GraphicPath CurvedPath; + + public: + PathClipper () : _numLines(0) {} + void intersect (const CurvedPath &p1, const CurvedPath &p2, CurvedPath &result); + + protected: + void flatten (const CurvedPath &gp, ClipperLib::Paths &polygons); +// void divide (IntPoint &p1, IntPoint &p2, IntPoint &ip); + void reconstruct (const ClipperLib::Path &polygon, CurvedPath &path); + void reconstruct (const ClipperLib::Paths &polygons, CurvedPath &path); + static void callback (IntPoint &e1bot, IntPoint &e1top, IntPoint &e2bot, IntPoint &e2top, IntPoint &ip); + + private: + std::vector _curves; + int _numLines; ///< negative number of straight line segments in path been processed +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp new file mode 100644 index 00000000000..848d38b562d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.cpp @@ -0,0 +1,77 @@ +/************************************************************************* +** PdfSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "InputReader.h" +#include "MapLine.h" +#include "PdfSpecialHandler.h" +#include "FontMap.h" +#include "Message.h" + +using namespace std; + + +PdfSpecialHandler::PdfSpecialHandler () : _maplineProcessed(false) +{ +} + + +bool PdfSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + if (!actions) + return true; + StreamInputReader ir(is); + ir.skipSpace(); + string cmd = ir.getWord(); + ir.skipSpace(); + if (cmd == "mapline" || cmd == "mapfile") { + // read mode selector ('+', '-', or '=') + char modechar = '+'; // default mode (append if new, do not replace existing mapping) + if (strchr("=+-", ir.peek())) // leading modifier given? + modechar = ir.get(); + else if (!_maplineProcessed) { // no modifier given? + // remove default map entries if this is the first mapline/mapfile special called + FontMap::instance().clear(); + } + + if (cmd == "mapline") { + try { + MapLine mapline(is); + FontMap::instance().apply(mapline, modechar); + } + catch (const MapLineException &ex) { + Message::wstream(true) << "pdf:mapline: " << ex.what() << '\n'; + } + } + else { // mapfile + string fname = ir.getString(); + if (!FontMap::instance().read(fname, modechar)) + Message::wstream(true) << "can't open map file " << fname << '\n'; + } + _maplineProcessed = true; + } + return true; +} + + +const char** PdfSpecialHandler::prefixes () const { + static const char *pfx[] = {"pdf:", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h new file mode 100644 index 00000000000..cdb24b6ad76 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PdfSpecialHandler.h @@ -0,0 +1,39 @@ +/************************************************************************* +** PdfSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PDFSPECIALHANDLER_H +#define DVISVGM_PDFSPECIALHANDLER_H + +#include "SpecialHandler.h" + +class PdfSpecialHandler : public SpecialHandler +{ + public: + PdfSpecialHandler (); + const char* info () const {return "pdfTeX font map specials";} + const char* name () const {return "pdf";} + const char** prefixes () const; + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + + private: + bool _maplineProcessed; ///< true if a mapline or mapfile special has already been processed +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp new file mode 100644 index 00000000000..9d45be980f1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.cpp @@ -0,0 +1,44 @@ +/************************************************************************* +** PreScanDVIReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include "DVIActions.h" +#include "PreScanDVIReader.h" + +using namespace std; + + +PreScanDVIReader::PreScanDVIReader (std::istream &is, DVIActions *actions) + : BasicDVIReader(is), _actions(actions), _currentPageNumber(0) +{ +} + + +void PreScanDVIReader::cmdBop (int) { + _currentPageNumber++; + BasicDVIReader::cmdBop(0); +} + + +void PreScanDVIReader::cmdXXX (int len) { + UInt32 numBytes = readUnsigned(len); + string s = readString(numBytes); + if (_actions) + _actions->special(s, 0, true); // pre-process special +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h new file mode 100644 index 00000000000..6e1642548f5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PreScanDVIReader.h @@ -0,0 +1,43 @@ +/************************************************************************* +** PreScanDVIReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef PRESCANDVIREADER_H +#define PRESCANDVIREADER_H + +#include "BasicDVIReader.h" + +struct DVIActions; + +class PreScanDVIReader : public BasicDVIReader +{ + public: + PreScanDVIReader (std::istream &is, DVIActions *actions); + unsigned getCurrentPageNumber () const {return _currentPageNumber;} + + protected: + void cmdBop (int); + void cmdXXX (int len); + + private: + DVIActions *_actions; + unsigned _currentPageNumber; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp new file mode 100644 index 00000000000..3e15c4d6864 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.cpp @@ -0,0 +1,191 @@ +/************************************************************************* +** Process.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include + +#ifdef __WIN32__ + #include +#else + #include + #include + #include + #include +#endif + +#include +#include "FileSystem.h" +#include "Process.h" +#include "SignalHandler.h" +#include "macros.h" + +using namespace std; + +Process::Process (const string &cmd, const string ¶mstr) + : _cmd(cmd), _paramstr(paramstr) +{ +} + + +#ifdef __WIN32__ +static void pipe_read (HANDLE handle, string &out) { + char buf[4096]; + out.clear(); + for (;;) { + DWORD num_chars; + bool success = ReadFile(handle, buf, 1024, &num_chars, NULL); + if (!success || num_chars == 0) + break; + out.append(buf, num_chars); + } + // remove trailing space + if (!out.empty()) { + int pos = out.size()-1; + while (pos >= 0 && isspace(out[pos])) + pos--; + out.erase(pos+1); + } +} + + +static inline void close_handle (HANDLE handle) { + if (handle != NULL) + CloseHandle(handle); +} + +#else + +/** Extracts whitespace-sparated parameters from a string. + * @param[in,out] paramstr the parameter string + * @param[out] params vector holding the extracted parameters */ +static void split_paramstr (string ¶mstr, vector ¶ms) { + size_t left=0, right=0; // index of first and last character of current parameter + char quote=0; // current quote character, 0=none + const size_t len = paramstr.length(); + while (left <= right && right < len) { + while (left < len && isspace(paramstr[left])) + ++left; + if (left < len && (paramstr[left] == '"' || paramstr[left] == '\'')) + quote = paramstr[left++]; + right = left; + while (right < len && (quote || !isspace(paramstr[right]))) { + if (quote && paramstr[right] == quote) { + quote=0; + break; + } + else + ++right; + } + if (right < len) + paramstr[right]=0; + if (left < len) + params.push_back(¶mstr[left]); + left = ++right; + } +} + +#endif + + +/** Runs the process and waits until it's finished. + * @param[out] out takes the output written to stdout by the executed process + * @return true if process terminated properly + * @throw SignalException if CTRL-C was pressed during execution */ +bool Process::run (string *out) { +#ifdef __WIN32__ + SECURITY_ATTRIBUTES sa; + ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = true; + + STARTUPINFO si; + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + si.dwFlags = STARTF_USESTDHANDLES; + HANDLE devnull = NULL; + HANDLE proc_read_handle = NULL; + HANDLE proc_write_handle = NULL; + if (out) { + CreatePipe(&proc_read_handle, &proc_write_handle, &sa, 0); + SetHandleInformation(proc_read_handle, HANDLE_FLAG_INHERIT, 0); + si.hStdOutput = proc_write_handle; + } + else { + devnull = CreateFile("nul", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + si.hStdOutput = devnull; + } + si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + si.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + PROCESS_INFORMATION pi; + ZeroMemory(&pi, sizeof(pi)); + DWORD exitcode = DWORD(-1); + string cmdline = _cmd+" "+_paramstr; + bool success = CreateProcess(NULL, (LPSTR)cmdline.c_str(), NULL, NULL, true, 0, NULL, NULL, &si, &pi); + if (success) { + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &exitcode); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + close_handle(proc_write_handle); // must be closed before reading from pipe to prevent blocking + if (success && out) + pipe_read(proc_read_handle, *out); + close_handle(proc_read_handle); + close_handle(devnull); + return exitcode == 0; +#else + pid_t pid = fork(); + if (pid == 0) { // child process + if (!out) { + int devnull = open(FileSystem::DEVNULL, O_WRONLY); + if (devnull >= 0) { + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); + } + } + vector params; + params.push_back(_cmd.c_str()); + string paramstr = _paramstr; // private copy to be changed by split_paramstr() + split_paramstr(paramstr, params); + params.push_back(0); // trailing NULL marks end + execvp(_cmd.c_str(), const_cast(¶ms[0])); + exit(1); + } + if (pid > 0) { // main process + int status; + for (;;) { + waitpid(pid, &status, WNOHANG); + if (WIFEXITED(status)) // child process exited normally + return WEXITSTATUS(status) == 0; + + try { + SignalHandler::instance().check(); + } + catch (SignalException &e) { // caught ctrl-c + kill(pid, SIGKILL); + throw; + } + } + } + return false; +#endif +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h new file mode 100644 index 00000000000..45a6b4df020 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Process.h @@ -0,0 +1,41 @@ +/************************************************************************* +** Process.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PROCESS_H +#define DVISVGM_PROCESS_H + +#include + +class Process +{ + public: + Process (const std::string &cmd, const std::string ¶mstr); + bool run (std::string *out=0); + + protected: + Process (const Process& orig) {} + + private: + std::string _cmd; + const std::string _paramstr; +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp new file mode 100644 index 00000000000..7140b6be270 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -0,0 +1,1190 @@ +/************************************************************************* +** PsSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "EPSFile.h" +#include "FileFinder.h" +#include "Ghostscript.h" +#include "Message.h" +#include "PathClipper.h" +#include "PSPattern.h" +#include "PSPreviewFilter.h" +#include "PsSpecialHandler.h" +#include "SpecialActions.h" +#include "SVGTree.h" +#include "TensorProductPatch.h" +#include "VectorIterator.h" +#include "XMLNode.h" +#include "XMLString.h" +#include "TriangularPatch.h" + + +using namespace std; + + +static inline double str2double (const string &str) { + double ret; + istringstream iss(str); + iss >> ret; + return ret; +} + + +bool PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = false; +bool PsSpecialHandler::SHADING_SEGMENT_OVERLAP = false; +int PsSpecialHandler::SHADING_SEGMENT_SIZE = 20; +double PsSpecialHandler::SHADING_SIMPLIFY_DELTA = 0.01; + + +PsSpecialHandler::PsSpecialHandler () : _psi(this), _actions(0), _previewFilter(_psi), _psSection(PS_NONE), _xmlnode(0) +{ +} + + +PsSpecialHandler::~PsSpecialHandler () { + _psi.setActions(0); // ensure no further PS actions are performed + for (map::iterator it=_patterns.begin(); it != _patterns.end(); ++it) + delete it->second; +} + + +/** Initializes the PostScript handler. It's called by the first use of process(). The + * deferred initialization speeds up the conversion of DVI files that doesn't contain + * PS specials. */ +void PsSpecialHandler::initialize () { + if (_psSection == PS_NONE) { + // initial values of graphics state + _linewidth = 1; + _linecap = _linejoin = 0; + _miterlimit = 4; + _xmlnode = _savenode = 0; + _opacityalpha = 1; // fully opaque + _sx = _sy = _cos = 1.0; + _pattern = 0; + + // execute dvips prologue/header files + const char *headers[] = {"tex.pro", "texps.pro", "special.pro", /*"color.pro",*/ 0}; + for (const char **p=headers; *p; ++p) + processHeaderFile(*p); + // disable bop/eop operators to prevent side-effects by + // unexpected bobs/eops present in PS specials + _psi.execute("\nTeXDict begin /bop{pop pop}def /eop{}def end "); + _psSection = PS_HEADERS; // allow to process header specials now + } +} + + +void PsSpecialHandler::processHeaderFile (const char *name) { + if (const char *path = FileFinder::lookup(name, false)) { + ifstream ifs(path); + _psi.execute(string("%%BeginProcSet: ")+name+" 0 0\n", false); + _psi.execute(ifs, false); + _psi.execute("%%EndProcSet\n", false); + } + else + Message::wstream(true) << "PostScript header file " << name << " not found\n"; +} + + +void PsSpecialHandler::enterBodySection () { + if (_psSection == PS_HEADERS) { + _psSection = PS_BODY; // don't process any PS header code + ostringstream oss; + // process collected header code + if (!_headerCode.empty()) { + oss << "\nTeXDict begin @defspecial " << _headerCode << "\n@fedspecial end"; + _headerCode.clear(); + } + // push dictionary "TeXDict" with dvips definitions on dictionary stack + // and initialize basic dvips PostScript variables + oss << "\nTeXDict begin 0 0 1000 72 72 () @start 0 0 moveto "; + _psi.execute(oss.str(), false); + // Check for information generated by preview.sty. If the tightpage options + // was set, don't execute the bop-hook but allow the PS filter to read + // the bbox data present at the beginning of the page. + _psi.setFilter(&_previewFilter); + _previewFilter.activate(); + if (!_previewFilter.tightpage()) + _psi.execute("userdict/bop-hook known{bop-hook}if\n", false); + } +} + + +/** Move PS graphic position to current DVI location. */ +void PsSpecialHandler::moveToDVIPos () { + if (_actions) { + const double x = _actions->getX(); + const double y = _actions->getY(); + ostringstream oss; + oss << '\n' << x << ' ' << y << " moveto "; + _psi.execute(oss.str()); + _currentpoint = DPair(x, y); + } +} + + +/** Executes a PS snippet and optionally synchronizes the DVI cursor position + * with the current PS point. + * @param[in] is stream to read the PS code from + * @param[in] updatePos if true, move the DVI drawing position to the current PS point */ +void PsSpecialHandler::executeAndSync (istream &is, bool updatePos) { + if (_actions && _actions->getColor() != _currentcolor) { + // update the PS graphics state if the color has been changed by a color special + double r, g, b; + _actions->getColor().getRGB(r, g, b); + ostringstream oss; + oss << '\n' << r << ' ' << g << ' ' << b << " setrgbcolor "; + _psi.execute(oss.str(), false); + } + _psi.execute(is); + if (updatePos) { + // retrieve current PS position (stored in _currentpoint) + _psi.execute("\nquerypos "); + if (_actions) { + _actions->setX(_currentpoint.x()); + _actions->setY(_currentpoint.y()); + } + } +} + + +void PsSpecialHandler::preprocess (const char *prefix, istream &is, SpecialActions *actions) { + initialize(); + if (_psSection != PS_HEADERS) + return; + + _actions = actions; + if (*prefix == '!') { + _headerCode += "\n"; + _headerCode += string(istreambuf_iterator(is), istreambuf_iterator()); + } + else if (strcmp(prefix, "header=") == 0) { + // read and execute PS header file + string fname; + is >> fname; + processHeaderFile(fname.c_str()); + } +} + + +bool PsSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + // process PS headers only once (in prescan) + if (*prefix == '!' || strcmp(prefix, "header=") == 0) + return true; + + _actions = actions; + initialize(); + if (_psSection != PS_BODY) + enterBodySection(); + + if (*prefix == '"') { + // read and execute literal PostScript code (isolated by a wrapping save/restore pair) + moveToDVIPos(); + _psi.execute("\n@beginspecial @setspecial "); + executeAndSync(is, false); + _psi.execute("\n@endspecial "); + } + else if (strcmp(prefix, "psfile=") == 0 || strcmp(prefix, "PSfile=") == 0) { + if (_actions) { + StreamInputReader in(is); + string fname = in.getQuotedString(in.peek() == '"' ? '"' : 0); + map attr; + in.parseAttributes(attr); + psfile(fname, attr); + } + } + else if (strcmp(prefix, "ps::") == 0) { + if (_actions) + _actions->finishLine(); // reset DVI position on next DVI command + if (is.peek() == '[') { + // collect characters inside the brackets + string code; + for (int i=0; i < 9 && is.peek() != ']' && !is.eof(); ++i) + code += is.get(); + if (is.peek() == ']') + code += is.get(); + + if (code == "[begin]" || code == "[nobreak]") { + moveToDVIPos(); + executeAndSync(is, true); + } + else { + // no move to DVI position here + if (code != "[end]") // PS array? + _psi.execute(code); + executeAndSync(is, true); + } + } + else { // ps:: behaves like ps::[end] + // no move to DVI position here + executeAndSync(is, true); + } + } + else { // ps: ... + if (_actions) + _actions->finishLine(); + moveToDVIPos(); + StreamInputReader in(is); + if (in.check(" plotfile ")) { // ps: plotfile fname + string fname = in.getString(); + ifstream ifs(fname.c_str()); + if (ifs) + _psi.execute(ifs); + else + Message::wstream(true) << "file '" << fname << "' not found in ps: plotfile\n"; + } + else { + // ps: is almost identical to ps::[begin] but does + // a final repositioning to the current DVI location + executeAndSync(is, true); + moveToDVIPos(); + } + } + return true; +} + + +/** Handles psfile special. + * @param[in] fname EPS file to be included + * @param[in] attr attributes given with \\special psfile */ +void PsSpecialHandler::psfile (const string &fname, const map &attr) { + EPSFile epsfile(fname); + istream &is = epsfile.istream(); + if (!is) + Message::wstream(true) << "file '" << fname << "' not found in special 'psfile'\n"; + else { + map::const_iterator it; + + // bounding box of EPS figure + double llx = (it = attr.find("llx")) != attr.end() ? str2double(it->second) : 0; + double lly = (it = attr.find("lly")) != attr.end() ? str2double(it->second) : 0; + double urx = (it = attr.find("urx")) != attr.end() ? str2double(it->second) : 0; + double ury = (it = attr.find("ury")) != attr.end() ? str2double(it->second) : 0; + + // desired width/height of resulting figure + double rwi = (it = attr.find("rwi")) != attr.end() ? str2double(it->second)/10.0 : -1; + double rhi = (it = attr.find("rhi")) != attr.end() ? str2double(it->second)/10.0 : -1; + if (rwi == 0 || rhi == 0 || urx-llx == 0 || ury-lly == 0) + return; + + // user transformations (default values chosen according to dvips manual) + double hoffset = (it = attr.find("hoffset")) != attr.end() ? str2double(it->second) : 0; + double voffset = (it = attr.find("voffset")) != attr.end() ? str2double(it->second) : 0; +// double hsize = (it = attr.find("hsize")) != attr.end() ? str2double(it->second) : 612; +// double vsize = (it = attr.find("vsize")) != attr.end() ? str2double(it->second) : 792; + double hscale = (it = attr.find("hscale")) != attr.end() ? str2double(it->second) : 100; + double vscale = (it = attr.find("vscale")) != attr.end() ? str2double(it->second) : 100; + double angle = (it = attr.find("angle")) != attr.end() ? str2double(it->second) : 0; + + Matrix m(1); + m.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); + BoundingBox bbox(llx, lly, urx, ury); + bbox.transform(m); + + double sx = rwi/bbox.width(); + double sy = rhi/bbox.height(); + if (sx < 0) sx = sy; + if (sy < 0) sy = sx; + if (sx < 0) sx = sy = 1.0; + + // save current DVI position (in pt units) + const double x = _actions->getX(); + const double y = _actions->getY(); + + // all following drawings are relative to (0,0) + _actions->setX(0); + _actions->setY(0); + moveToDVIPos(); + + _xmlnode = new XMLElementNode("g"); + _psi.execute("\n@beginspecial @setspecial "); // enter \special environment + _psi.limit(epsfile.pslength()); // limit the number of bytes to be processed + _psi.execute(is); // process EPS file + _psi.limit(0); // disable limitation + _psi.execute("\n@endspecial "); // leave special environment + if (!_xmlnode->empty()) { // has anything been drawn? + Matrix m(1); + m.rotate(angle).scale(hscale/100, vscale/100).translate(hoffset, voffset); + m.translate(-llx, lly); + m.scale(sx, sy); // resize image to width "rwi" and height "rhi" + m.translate(x, y); // move image to current DVI position + _xmlnode->addAttribute("transform", m.getSVG()); + _actions->appendToPage(_xmlnode); + } + else + delete _xmlnode; + _xmlnode = 0; + + // restore DVI position + _actions->setX(x); + _actions->setY(y); + moveToDVIPos(); + + // update bounding box + m.scale(sx, -sy); + m.translate(x, y); + bbox = BoundingBox(0, 0, fabs(urx-llx), fabs(ury-lly)); + bbox.transform(m); + _actions->embed(bbox); + } +} + + +/** Apply transformation to width, height, and depth set by preview package. + * @param[in] matrix transformation matrix to apply + * @param[out] w width + * @param[out] h height + * @param[out] d depth + * @return true if the baseline is still horizontal after the transformation */ +static bool transform_box_extents (const Matrix &matrix, double &w, double &h, double &d) { + DPair shift = matrix*DPair(0,0); // the translation component of the matrix + DPair ex = matrix*DPair(1,0)-shift; + DPair ey = matrix*DPair(0,1)-shift; + if (ex.y() != 0 && ey.x() != 0) // rotation != mod 90 degrees? + return false; // => non-horizontal baseline, can't compute meaningful extents + + if (ex.y() == 0) // horizontal scaling or skewing? + w *= fabs(ex.x()); + if (ey.x()==0 || ex.y()==0) { // vertical scaling? + if (ey.y() < 0) swap(h, d); + if (double sy = fabs(ey.y())/ey.length()) { + h *= fabs(ey.y()/sy); + d *= fabs(ey.y()/sy); + } + else + h = d = 0; + } + return true; +} + + +void PsSpecialHandler::dviEndPage (unsigned) { + BoundingBox bbox; + if (_previewFilter.getBoundingBox(bbox)) { + double w = _previewFilter.width(); + double h = _previewFilter.height(); + double d = _previewFilter.depth(); + bool horiz_baseline = true; + if (_actions) { + _actions->bbox() = bbox; + // apply page transformations to box extents + Matrix pagetrans; + _actions->getPageTransform(pagetrans); + horiz_baseline = transform_box_extents(pagetrans, w, h, d); + _actions->bbox().lock(); + } + Message::mstream() << "\napplying bounding box set by preview package (version " << _previewFilter.version() << ")\n"; + if (horiz_baseline) { + const double bp2pt = 72.27/72.0; + Message::mstream() << + "width=" << XMLString(w*bp2pt) << "pt, " + "height=" << XMLString(h*bp2pt) << "pt, " + "depth=" << XMLString(d*bp2pt) << "pt\n"; + } + else + Message::mstream() << "can't determine height, width, and depth due to non-horizontal baseline\n"; + } + // close dictionary TeXDict and execute end-hook if defined + if (_psSection == PS_BODY) { + _psi.execute("\nend userdict/end-hook known{end-hook}if "); + _psSection = PS_HEADERS; + } +} + +/////////////////////////////////////////////////////// + +void PsSpecialHandler::gsave (vector &p) { + _clipStack.dup(); +} + + +void PsSpecialHandler::grestore (vector &p) { + _clipStack.pop(); +} + + +void PsSpecialHandler::grestoreall (vector &p) { + _clipStack.pop(-1, true); +} + + +void PsSpecialHandler::save (vector &p) { + _clipStack.dup(static_cast(p[0])); +} + + +void PsSpecialHandler::restore (vector &p) { + _clipStack.pop(static_cast(p[0])); +} + + +void PsSpecialHandler::moveto (vector &p) { + _path.moveto(p[0], p[1]); +} + + +void PsSpecialHandler::lineto (vector &p) { + _path.lineto(p[0], p[1]); +} + + +void PsSpecialHandler::curveto (vector &p) { + _path.cubicto(p[0], p[1], p[2], p[3], p[4], p[5]); +} + + +void PsSpecialHandler::closepath (vector &p) { + _path.closepath(); +} + + +/** Draws the current path recorded by previously executed path commands (moveto, lineto,...). + * @param[in] p not used */ +void PsSpecialHandler::stroke (vector &p) { + if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) + return; + + BoundingBox bbox; + if (!_actions->getMatrix().isIdentity()) { + _path.transform(_actions->getMatrix()); + if (!_xmlnode) + bbox.transform(_actions->getMatrix()); + } + if (_clipStack.clippathLoaded() && _clipStack.top()) + _path.prepend(*_clipStack.top()); + XMLElementNode *path=0; + Pair 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 = new XMLElementNode("circle"); + path->addAttribute("cx", x); + path->addAttribute("cy", y); + path->addAttribute("r", r); + path->addAttribute("fill", _actions->getColor().svgColorString()); + bbox = BoundingBox(x-r, y-r, x+r, y+r); + } + } + else { + // compute bounding box + _path.computeBBox(bbox); + bbox.expand(_linewidth/2); + + ostringstream oss; + _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + path = new XMLElementNode("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 (_opacityalpha < 1) + path->addAttribute("stroke-opacity", _opacityalpha); + if (!_dashpattern.empty()) { + ostringstream oss; + for (size_t i=0; i < _dashpattern.size(); i++) { + if (i > 0) + oss << ','; + oss << XMLString(_dashpattern[i]); + } + path->addAttribute("stroke-dasharray", oss.str()); + if (_dashoffset != 0) + path->addAttribute("stroke-dashoffset", _dashoffset); + } + } + if (path && _clipStack.top()) { + // assign clipping path and clip bounding box + path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + BoundingBox clipbox; + _clipStack.top()->computeBBox(clipbox); + bbox.intersect(clipbox); + _clipStack.setClippathLoaded(false); + } + if (_xmlnode) + _xmlnode->append(path); + else { + _actions->appendToPage(path); + _actions->embed(bbox); + } + _path.clear(); +} + + +/** Draws a closed path filled with the current color. + * @param[in] p not used + * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ +void PsSpecialHandler::fill (vector &p, bool evenodd) { + if ((_path.empty() && !_clipStack.clippathLoaded()) || !_actions) + return; + + // compute bounding box + BoundingBox bbox; + _path.computeBBox(bbox); + if (!_actions->getMatrix().isIdentity()) { + _path.transform(_actions->getMatrix()); + if (!_xmlnode) + bbox.transform(_actions->getMatrix()); + } + if (_clipStack.clippathLoaded() && _clipStack.top()) + _path.prepend(*_clipStack.top()); + + ostringstream oss; + _path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + XMLElementNode *path = new XMLElementNode("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.top()) { + // assign clipping path and clip bounding box + path->addAttribute("clip-path", XMLString("url(#clip")+XMLString(_clipStack.topID())+")"); + BoundingBox clipbox; + _clipStack.top()->computeBBox(clipbox); + bbox.intersect(clipbox); + _clipStack.setClippathLoaded(false); + } + if (evenodd) // SVG default fill rule is "nonzero" algorithm + path->addAttribute("fill-rule", "evenodd"); + if (_opacityalpha < 1) + path->addAttribute("fill-opacity", _opacityalpha); + if (_xmlnode) + _xmlnode->append(path); + else { + _actions->appendToPage(path); + _actions->embed(bbox); + } + _path.clear(); +} + + +/** Creates a Matrix object out of a given sequence of 6 double values. + * The given values must be arranged in PostScript matrix order. + * @param[in] v vector containing the matrix values + * @param[in] startindex vector index of first component + * @param[out] matrix the generated matrix */ +static void create_matrix (vector &v, int startindex, Matrix &matrix) { + // Ensure vector p has 6 elements. If necessary, add missing ones + // using corresponding values of the identity matrix. + if (v.size()-startindex < 6) { + v.resize(6+startindex); + for (int i=v.size()-startindex; i < 6; ++i) + v[i+startindex] = (i%3 ? 0 : 1); + } + // PS matrix [a b c d e f] equals ((a,b,0),(c,d,0),(e,f,1)). + // Since PS uses left multiplications, we must transpose and reorder + // the matrix to ((a,c,e),(b,d,f),(0,0,1)). This is done by the + // following swaps. + swap(v[startindex+1], v[startindex+2]); // => (a, c, b, d, e, f) + swap(v[startindex+2], v[startindex+4]); // => (a, c, e, d, b, f) + swap(v[startindex+3], v[startindex+4]); // => (a, c, e, b, d, f) + matrix.set(v, startindex); +} + + +/** Starts the definition of a new fill pattern. This operator + * expects 9 parameters for tiling patterns (see PS reference 4.9.2): + * @param[in] p the 9 values defining a tiling pattern (see PS reference 4.9.2): + * 0: pattern type (0:none, 1:tiling, 2:shading) + * 1: pattern ID + * 2-5: lower left and upper right coordinates of pattern box + * 6: horizontal distance of adjacent tiles + * 7: vertical distance of adjacent tiles + * 8: paint type (1: colored pattern, 2: uncolored pattern) + * 9-14: pattern matrix */ +void PsSpecialHandler::makepattern (vector &p) { + int pattern_type = static_cast(p[0]); + int id = static_cast(p[1]); + switch (pattern_type) { + case 0: + // pattern definition completed + if (_savenode) { + _xmlnode = _savenode; + _savenode = 0; + } + break; + case 1: { // tiling pattern + BoundingBox bbox(p[2], p[3], p[4], p[5]); + const double &xstep=p[6], &ystep=p[7]; // horizontal and vertical distance of adjacent tiles + int paint_type = static_cast(p[8]); + + Matrix matrix; // transformation matrix given together with pattern definition + create_matrix(p, 9, matrix); + matrix.rmultiply(_actions->getMatrix()); + + PSTilingPattern *pattern=0; + if (paint_type == 1) + pattern = new PSColoredTilingPattern(id, bbox, matrix, xstep, ystep); + else + pattern = new PSUncoloredTilingPattern(id, bbox, matrix, xstep, ystep); + _patterns[id] = pattern; + _savenode = _xmlnode; + _xmlnode = pattern->getContainerNode(); // insert the following SVG elements into this node + break; + } + case 2: { + // define a shading pattern + } + } +} + + +/** Selects a previously defined fill pattern. + * 0: pattern ID + * 1-3: (optional) RGB values for uncolored tiling patterns + * further parameters depend on the pattern type */ +void PsSpecialHandler::setpattern (vector &p) { + int pattern_id = p[0]; + Color color; + if (p.size() == 4) + color.setRGB(p[1], p[2], p[3]); + map::iterator it = _patterns.find(pattern_id); + if (it == _patterns.end()) + _pattern = 0; + else { + if (PSUncoloredTilingPattern *pattern = dynamic_cast(it->second)) + pattern->setColor(color); + it->second->apply(_actions); + if (PSTilingPattern *pattern = dynamic_cast(it->second)) + _pattern = pattern; + else + _pattern = 0; + } +} + + +/** Clears the current clipping path. + * @param[in] p not used */ +void PsSpecialHandler::initclip (vector &) { + _clipStack.pushEmptyPath(); +} + + +/** Assigns the current clipping path to the graphics path. */ +void PsSpecialHandler::clippath (std::vector&) { + if (!_clipStack.empty()) { + _clipStack.setClippathLoaded(true); + _path.clear(); + } +} + + +/** Assigns a new clipping path to the graphics state using the current path. + * If the graphics state already contains a clipping path, the new one is + * computed by intersecting the current clipping path with the current graphics + * path (see PS language reference, 3rd edition, pp. 193, 542) + * @param[in] p not used + * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ +void PsSpecialHandler::clip (vector &, bool evenodd) { + clip(_path, evenodd); +} + + +/** Assigns a new clipping path to the graphics state using the current path. + * If the graphics state already contains a clipping path, the new one is + * computed by intersecting the current one with the given path. + * @param[in] path path used to restrict the clipping region + * @param[in] evenodd true: use even-odd fill algorithm, false: use nonzero fill algorithm */ +void PsSpecialHandler::clip (Path &path, bool evenodd) { + // when this method is called, _path contains the clipping path + if (path.empty() || !_actions) + return; + + Path::WindingRule windingRule = evenodd ? Path::WR_EVEN_ODD : Path::WR_NON_ZERO; + path.setWindingRule(windingRule); + + if (!_actions->getMatrix().isIdentity()) + path.transform(_actions->getMatrix()); + + int oldID = _clipStack.topID(); + + ostringstream oss; + if (!COMPUTE_CLIPPATHS_INTERSECTIONS || oldID < 1) { + _clipStack.replace(path); + path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + } + else { + // compute the intersection of the current clipping path with the current graphics path + Path *oldPath = _clipStack.getPath(oldID); + Path intersectedPath(windingRule); + PathClipper clipper; + clipper.intersect(*oldPath, path, intersectedPath); + _clipStack.replace(intersectedPath); + intersectedPath.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + } + + XMLElementNode *pathElem = new XMLElementNode("path"); + pathElem->addAttribute("d", oss.str()); + if (evenodd) + pathElem->addAttribute("clip-rule", "evenodd"); + + int newID = _clipStack.topID(); + XMLElementNode *clipElem = new XMLElementNode("clipPath"); + clipElem->addAttribute("id", XMLString("clip")+XMLString(newID)); + if (!COMPUTE_CLIPPATHS_INTERSECTIONS && oldID) + clipElem->addAttribute("clip-path", XMLString("url(#clip")+XMLString(oldID)+")"); + + clipElem->append(pathElem); + _actions->appendToDefs(clipElem); +} + + +/** Applies a gradient fill to the current graphics path. Vector p contains the shading parameters + * in the following order: + * - shading type (6=Coons, 7=tensor product) + * - color space (1=gray, 3=rgb, 4=cmyk) + * - 1.0 followed by the background color components based on the declared color space, or 0.0 + * - 1.0 followed by the bounding box coordinates, or 0.0 + * - geometry and color parameters depending on the shading type */ +void PsSpecialHandler::shfill (vector ¶ms) { + if (params.size() < 9) + return; + + // collect common data relevant for all shading types + int shadingTypeID = static_cast(params[0]); + ColorSpace colorSpace = Color::RGB_SPACE; + switch (static_cast(params[1])) { + case 1: colorSpace = Color::GRAY_SPACE; break; + case 3: colorSpace = Color::RGB_SPACE; break; + case 4: colorSpace = Color::CMYK_SPACE; break; + } + VectorIterator it = params; + it += 2; // skip shading type and color space + // Get color to fill the whole mesh area before drawing the gradient colors on top of that background. + // This is an optional parameter to shfill. + bool bgcolorGiven = static_cast(*it++); + Color bgcolor; + if (bgcolorGiven) + bgcolor.set(colorSpace, it); + // Get clipping rectangle to limit the drawing area of the gradient mesh. + // This is an optional parameter to shfill too. + bool bboxGiven = static_cast(*it++); + if (bboxGiven) { // bounding box given + Path bboxPath; + const double &x1 = *it++; + const double &y1 = *it++; + const double &x2 = *it++; + const double &y2 = *it++; + bboxPath.moveto(x1, y1); + bboxPath.lineto(x2, y1); + bboxPath.lineto(x2, y2); + bboxPath.lineto(x1, y2); + bboxPath.closepath(); + clip(bboxPath, false); + } + try { + if (shadingTypeID == 5) + processLatticeTriangularPatchMesh(colorSpace, it); + else + processSequentialPatchMesh(shadingTypeID, colorSpace, it); + } + catch (ShadingException &e) { + Message::estream(false) << "PostScript error: " << e.what() << '\n'; + it.invalidate(); // stop processing the remaining patch data + } + catch (IteratorException &e) { + Message::estream(false) << "PostScript error: incomplete shading data\n"; + } + if (bboxGiven) + _clipStack.pop(); +} + + +/** Reads position and color data of a single shading patch from the data vector. + * @param[in] shadingTypeID PS shading type ID identifying the format of the subsequent patch data + * @param[in] edgeflag edge flag specifying how to connect the current patch to the preceding one + * @param[in] cspace color space used to compute the color gradient + * @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, + VectorIterator &it, vector &points, vector &colors) +{ + // number of control points and colors required to define a single patch + int numPoints = patch.numPoints(edgeflag); + int numColors = patch.numColors(edgeflag); + points.resize(numPoints); + colors.resize(numColors); + if (patch.psShadingType() == 4) { + // format of a free-form triangular patch definition, where eN denotes + // the edge of the corresponding vertex: + // edge flag = 0, x1, y1, {color1}, e2, x2, y2, {color2}, e3, x3, y3, {color3} + // edge flag > 0, x1, y1, {color1} + for (int i=0; i < numPoints; i++) { + if (i > 0) ++it; // skip redundant edge flag from free-form triangular patch + double x = *it++; + double y = *it++; + points[i] = DPair(x, y); + colors[i].set(patch.colorSpace(), it); + } + } + else if (patch.psShadingType() == 6 || patch.psShadingType() == 7) { + // format of each Coons/tensor product patch definition: + // edge flag = 0, x1, y1, ... , xn, yn, {color1}, {color2}, {color3}, {color4} + // edge flag > 0, x5, y5, ... , xn, yn, {color3}, {color4} + for (int i=0; i < numPoints; i++) { + double x = *it++; + double y = *it++; + points[i] = DPair(x, y); + } + for (int i=0; i < numColors; i++) + colors[i].set(patch.colorSpace(), it); + } +} + + +class ShadingCallback : public ShadingPatch::Callback { + public: + ShadingCallback (SpecialActions *actions, XMLElementNode *parent, int clippathID) + : _actions(actions), _group(new XMLElementNode("g")) + { + if (parent) + parent->append(_group); + else + actions->appendToPage(_group); + if (clippathID > 0) + _group->addAttribute("clip-path", XMLString("url(#clip")+XMLString(clippathID)+")"); + } + + void patchSegment (GraphicPath &path, const Color &color) { + if (!_actions->getMatrix().isIdentity()) + path.transform(_actions->getMatrix()); + + // draw a single patch segment + ostringstream oss; + path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + XMLElementNode *pathElem = new XMLElementNode("path"); + pathElem->addAttribute("d", oss.str()); + pathElem->addAttribute("fill", color.svgColorString()); + _group->append(pathElem); + } + + private: + SpecialActions *_actions; + XMLElementNode *_group; +}; + + +/** Handle all patch meshes whose patches and their connections can be processed sequentially. + * This comprises free-form triangular, Coons, and tensor-product patch meshes. */ +void PsSpecialHandler::processSequentialPatchMesh (int shadingTypeID, ColorSpace colorSpace, VectorIterator &it) { + auto_ptr previousPatch; + while (it.valid()) { + int edgeflag = static_cast(*it++); + vector points; + vector colors; + auto_ptr patch; + + patch = auto_ptr(ShadingPatch::create(shadingTypeID, colorSpace)); + read_patch_data(*patch, edgeflag, it, points, colors); + patch->setPoints(points, edgeflag, previousPatch.get()); + patch->setColors(colors, edgeflag, previousPatch.get()); + ShadingCallback callback(_actions, _xmlnode, _clipStack.topID()); +#if 0 + if (bgcolorGiven) { + // fill whole patch area with given background color + GraphicPath outline; + patch->getBoundaryPath(outline); + callback.patchSegment(outline, bgcolor); + } +#endif + patch->approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); + if (!_xmlnode) { + // update bounding box + BoundingBox bbox; + patch->getBBox(bbox); + bbox.transform(_actions->getMatrix()); + _actions->embed(bbox); + } + previousPatch = patch; + } +} + + +struct PatchVertex { + DPair point; + Color color; +}; + + +void PsSpecialHandler::processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator &it) { + int verticesPerRow = static_cast(*it++); + if (verticesPerRow < 2) + return; + + // hold two adjacent rows of vertices and colors + vector row1(verticesPerRow); + vector row2(verticesPerRow); + vector *rowptr1 = &row1; + vector *rowptr2 = &row2; + // read data of first row + for (int i=0; i < verticesPerRow; i++) { + PatchVertex &vertex = (*rowptr1)[i]; + vertex.point.x(*it++); + vertex.point.y(*it++); + vertex.color.set(colorSpace, it); + } + LatticeTriangularPatch patch(colorSpace); + ShadingCallback callback(_actions, _xmlnode, _clipStack.topID()); + while (it.valid()) { + // read next row + for (int i=0; i < verticesPerRow; i++) { + PatchVertex &vertex = (*rowptr2)[i]; + vertex.point.x(*it++); + vertex.point.y(*it++); + vertex.color.set(colorSpace, it); + } + // create triangular patches for the vertices of the two rows + for (int i=0; i < verticesPerRow-1; i++) { + const PatchVertex &v1 = (*rowptr1)[i], &v2 = (*rowptr1)[i+1]; + const PatchVertex &v3 = (*rowptr2)[i], &v4 = (*rowptr2)[i+1]; + patch.setPoints(v1.point, v2.point, v3.point); + patch.setColors(v1.color, v2.color, v3.color); + patch.approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); + + patch.setPoints(v2.point, v3.point, v4.point); + patch.setColors(v2.color, v3.color, v4.color); + patch.approximate(SHADING_SEGMENT_SIZE, SHADING_SEGMENT_OVERLAP, SHADING_SIMPLIFY_DELTA, callback); + } + swap(rowptr1, rowptr2); + } +} + + +/** Clears current path */ +void PsSpecialHandler::newpath (vector &p) { + bool drawing = (p[0] > 0); + if (!drawing || !_clipStack.clippathLoaded()) { + _path.clear(); + _clipStack.setClippathLoaded(false); + } +} + + +void PsSpecialHandler::setmatrix (vector &p) { + if (_actions) { + Matrix m; + create_matrix(p, 0, m); + _actions->setMatrix(m); + } +} + + +// In contrast to SVG, PostScript transformations are applied in +// reverse order (M' = T*M). Thus, the transformation matrices must be +// left-multiplied in the following methods scale(), translate() and rotate(). + + +void PsSpecialHandler::scale (vector &p) { + if (_actions) { + Matrix m = _actions->getMatrix(); + ScalingMatrix s(p[0], p[1]); + m.lmultiply(s); + _actions->setMatrix(m); + } +} + + +void PsSpecialHandler::translate (vector &p) { + if (_actions) { + Matrix m = _actions->getMatrix(); + TranslationMatrix t(p[0], p[1]); + m.lmultiply(t); + _actions->setMatrix(m); + } +} + + +void PsSpecialHandler::rotate (vector &p) { + if (_actions) { + Matrix m = _actions->getMatrix(); + RotationMatrix r(p[0]); + m.lmultiply(r); + _actions->setMatrix(m); + } +} + + +void PsSpecialHandler::setgray (vector &p) { + _pattern = 0; + _currentcolor.setGray(p[0]); + if (_actions) + _actions->setColor(_currentcolor); +} + + +void PsSpecialHandler::setrgbcolor (vector &p) { + _pattern= 0; + _currentcolor.setRGB(p[0], p[1], p[2]); + if (_actions) + _actions->setColor(_currentcolor); +} + + +void PsSpecialHandler::setcmykcolor (vector &p) { + _pattern = 0; + _currentcolor.setCMYK(p[0], p[1], p[2], p[3]); + if (_actions) + _actions->setColor(_currentcolor); +} + + +void PsSpecialHandler::sethsbcolor (vector &p) { + _pattern = 0; + _currentcolor.setHSB(p[0], p[1], p[2]); + if (_actions) + _actions->setColor(_currentcolor); +} + + +/** Sets the dash parameters used for stroking. + * @param[in] p dash pattern array m1,...,mn plus trailing dash offset */ +void PsSpecialHandler::setdash (vector &p) { + _dashpattern.clear(); + for (size_t i=0; i < p.size()-1; i++) + _dashpattern.push_back(scale(p[i])); + _dashoffset = scale(p.back()); +} + + +/** This method is called by the PSInterpreter if an PS operator has been executed. */ +void PsSpecialHandler::executed () { + if (_actions) + _actions->progress("ps"); +} + +//////////////////////////////////////////// + +void PsSpecialHandler::ClippingStack::pushEmptyPath () { + if (!_stack.empty()) + _stack.push(Entry(0, -1)); +} + + +void PsSpecialHandler::ClippingStack::push (const Path &path, int saveID) { + if (path.empty()) + _stack.push(Entry(0, saveID)); + else { + _paths.push_back(path); + _stack.push(Entry(_paths.size(), saveID)); + } +} + + +/** Pops a single or several elements from the clipping stack. + * The method distingushes between the following cases: + * 1) saveID < 0 and grestoreall == false: + * pop top element if it was pushed by gsave (its saveID is < 0 as well) + * 2) saveID < 0 and grestoreall == true + * repeat popping until stack is empty or the top element was pushed + * by save (its saveID is >= 0) + * 3) saveID >= 0: + * pop all elements until the saveID of the top element equals parameter saveID */ +void PsSpecialHandler::ClippingStack::pop (int saveID, bool grestoreall) { + if (!_stack.empty()) { + if (saveID < 0) { // grestore? + if (_stack.top().saveID < 0) // pushed by 'gsave'? + _stack.pop(); + // pop all further elements pushed by 'gsave' if grestoreall == true + while (grestoreall && !_stack.empty() && _stack.top().saveID < 0) + _stack.pop(); + } + else { + // pop elements pushed by 'gsave' + while (!_stack.empty() && _stack.top().saveID != saveID) + _stack.pop(); + // pop element pushed by 'save' + if (!_stack.empty()) + _stack.pop(); + } + } +} + + +/** Returns a pointer to the path on top of the stack, or 0 if the stack is empty. */ +const PsSpecialHandler::Path* PsSpecialHandler::ClippingStack::top () const { + return (!_stack.empty() && _stack.top().pathID) + ? &_paths[_stack.top().pathID-1] + : 0; +} + + +PsSpecialHandler::Path* PsSpecialHandler::ClippingStack::getPath (size_t id) { + return (id > 0 && id <= _paths.size()) ? &_paths[id-1] : 0; +} + + +/** Returns true if the clipping path was loaded into the graphics path (via PS operator 'clippath') */ +bool PsSpecialHandler::ClippingStack::clippathLoaded () const { + return !_stack.empty() && _stack.top().cpathLoaded; +} + + +void PsSpecialHandler::ClippingStack::setClippathLoaded (bool loaded) { + if (_stack.empty()) + return; + _stack.top().cpathLoaded = loaded; +} + + +/** Pops all elements from the stack. */ +void PsSpecialHandler::ClippingStack::clear() { + _paths.clear(); + while (!_stack.empty()) + _stack.pop(); +} + + +/** Replaces the top element by a new one. + * @param[in] path new path to be on top of the stack */ +void PsSpecialHandler::ClippingStack::replace (const Path &path) { + if (_stack.empty()) + push(path, -1); + else { + _paths.push_back(path); + _stack.top().pathID = _paths.size(); + } +} + + +/** Duplicates the top element, i.e. the top element is pushed again. */ +void PsSpecialHandler::ClippingStack::dup (int saveID) { + _stack.push(_stack.empty() ? Entry(0, -1) : _stack.top()); + _stack.top().saveID = saveID; +} + + +const char** PsSpecialHandler::prefixes () const { + static const char *pfx[] = {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h new file mode 100644 index 00000000000..38c04c50afa --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.h @@ -0,0 +1,169 @@ +/************************************************************************* +** PsSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_PSSPECIALHANDLER_H +#define DVISVGM_PSSPECIALHANDLER_H + +#include +#include +#include +#include +#include "GraphicPath.h" +#include "PSInterpreter.h" +#include "SpecialHandler.h" +#include "PSPattern.h" +#include "PSPreviewFilter.h" + + +class PSPattern; +class XMLElementNode; + +class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, protected PSActions +{ + typedef GraphicPath Path; + typedef std::vector::const_iterator DoubleVecIt; + typedef Color::ColorSpace ColorSpace; + + class ClippingStack + { + public: + void pushEmptyPath (); + void push (const Path &path, int saveID=-1); + void replace (const Path &path); + void dup (int saveID=-1); + void pop (int saveID=-1, bool grestore=false); + void clear (); + bool empty () const {return _stack.empty();} + bool clippathLoaded () const; + void setClippathLoaded (bool loaded); + const Path* top () const; + Path* getPath (size_t id); + int topID () const {return _stack.empty() ? 0 : _stack.top().pathID;} + + private: + struct Entry { + int pathID; ///< index referencing a path of the pool + int saveID; ///< if >=0, path was pushed by 'save', and saveID holds the ID of the + bool cpathLoaded; ///< true if clipping path was loaded into current path + Entry (int pid, int sid) : pathID(pid), saveID(sid), cpathLoaded(false) {} + }; + std::vector _paths; ///< pool of all clipping paths + std::stack _stack; + }; + + enum PsSection {PS_NONE, PS_HEADERS, PS_BODY}; + + public: + PsSpecialHandler (); + ~PsSpecialHandler (); + const char* name () const {return "ps";} + const char* info () const {return "dvips PostScript specials";} + const char** prefixes () const; + void preprocess (const char *prefix, std::istream &is, SpecialActions *actions); + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + void setDviScaleFactor (double dvi2bp) {_previewFilter.setDviScaleFactor(dvi2bp);} + void enterBodySection (); + + public: + static bool COMPUTE_CLIPPATHS_INTERSECTIONS; + static bool SHADING_SEGMENT_OVERLAP; + static int SHADING_SEGMENT_SIZE; + static double SHADING_SIMPLIFY_DELTA; + + protected: + void initialize (); + void moveToDVIPos (); + void executeAndSync (std::istream &is, bool updatePos); + void processHeaderFile (const char *fname); + void psfile (const std::string &fname, const std::map &attr); + void dviEndPage (unsigned pageno); + void clip (Path &path, bool evenodd); + void processSequentialPatchMesh (int shadingTypeID, ColorSpace cspace, VectorIterator &it); + void processLatticeTriangularPatchMesh (ColorSpace colorSpace, VectorIterator &it); + + /// scale given value by current PS scale factors + double scale (double v) const {return v*(_sx*_cos*_cos + _sy*(1-_cos*_cos));} + + void applyscalevals (std::vector &p) {_sx = p[0]; _sy = p[1]; _cos = p[2];} + void clip (std::vector &p) {clip(p, false);} + void clip (std::vector &p, bool evenodd); + void clippath (std::vector &p); + void closepath (std::vector &p); + void curveto (std::vector &p); + void eoclip (std::vector &p) {clip(p, true);} + void eofill (std::vector &p) {fill(p, true);} + void fill (std::vector &p, bool evenodd); + void fill (std::vector &p) {fill(p, false);} + void grestore (std::vector &p); + void grestoreall (std::vector &p); + void gsave (std::vector &p); + void initclip (std::vector &p); + void lineto (std::vector &p); + void makepattern (std::vector &p); + void moveto (std::vector &p); + void newpath (std::vector &p); + void querypos (std::vector &p) {_currentpoint = DPair(p[0], p[1]);} + void restore (std::vector &p); + void rotate (std::vector &p); + void save (std::vector &p); + void scale (std::vector &p); + void setcmykcolor (std::vector &cmyk); + void setdash (std::vector &p); + void setgray (std::vector &p); + void sethsbcolor (std::vector &hsb); + void setlinecap (std::vector &p) {_linecap = UInt8(p[0]);} + void setlinejoin (std::vector &p) {_linejoin = UInt8(p[0]);} + void setlinewidth (std::vector &p) {_linewidth = p[0] ? scale(p[0])*1.00375 : 0.5;} + void setmatrix (std::vector &p); + void setmiterlimit (std::vector &p) {_miterlimit = p[0]*1.00375;} + void setopacityalpha (std::vector &p){_opacityalpha = p[0];} + void setpattern (std::vector &p); + void setrgbcolor (std::vector &rgb); + void shfill (std::vector &p); + void stroke (std::vector &p); + void translate (std::vector &p); + void executed (); + + private: + PSInterpreter _psi; + SpecialActions *_actions; + PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package + PsSection _psSection; ///< current section processed (nothing yet, headers, or body specials) + XMLElementNode *_xmlnode; ///< if != 0, created SVG elements are appended to this node + XMLElementNode *_savenode; ///< pointer to temporaryly store _xmlnode + std::string _headerCode; ///< collected literal PS header code + Path _path; + DPair _currentpoint; ///< current PS position in bp units + Color _currentcolor; ///< current stroke/fill color + double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" + double _cos; ///< cosine of angle between (1,0) and transform(1,0) + double _linewidth; ///< current linewidth + double _miterlimit; ///< current miter limit + double _opacityalpha; ///< opacity level (0=fully transparent, ..., 1=opaque) + UInt8 _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) + UInt8 _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) + double _dashoffset; ///< current dash offset + std::vector _dashpattern; + ClippingStack _clipStack; + std::map _patterns; + PSTilingPattern *_pattern; ///< current pattern +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp new file mode 100644 index 00000000000..ba9a9463b70 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp @@ -0,0 +1,188 @@ +/************************************************************************* +** RangeMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include "RangeMap.h" + +using namespace std; + + +/** Tries to merge range r into this one. This is only possible if the ranges + * touch or overlap and if the assigned values match at the junction points. + * @param[in] r range to join + * @return true if join was successful */ +bool RangeMap::Range::join (const Range &r) { + // check most common cases first + if (_max+1 < r._min || _min-1 > r._max) // disjoint ranges? + return false; + if (r._min-1 == _max) { // does r touch *this on the right? + if (valueAt(r._min) == r._minval) { + _max = r._max; + return true; + } + return false; + } + if (r._max+1 == _min) { // does r touch *this on the left + if (r.valueAt(_min) == _minval) { + setMinAndAdaptValue(r._min); + return true; + } + return false; + } + // the following cases should be pretty rare + if (r._min <= _min && r._max >= _max) { // does r overlap *this on both sides? + *this = r; + return true; + } + if (r._min < _min) { // left overlap only? + if (r.valueAt(_min) == _minval) { + _min = r._min; + _minval = r._minval; + return true; + } + return false; + } + if (r._max > _max) { // right overlap only? + if (valueAt(r._min) == r._minval) { + _max = r._max; + return true; + } + return false; + } + // r completely inside *this + return valueAt(r._min) == r._minval; +} + + +/** Adds a new number range. The range describes a mapping from c to v(c), where + * \f$c \in [cmin,cmax]\f$ and \f$v(cmin):=vmin, v(c):=vmin+c-cmin\f$. + * @param[in] cmin smallest number in the range + * @param[in] cmax largest number in the range + * @param[in] vmin map value of cmin */ +void RangeMap::addRange (UInt32 cmin, UInt32 cmax, UInt32 vmin) { + if (cmin > cmax) + swap(cmin, cmax); + + Range range(cmin, cmax, vmin); + if (_ranges.empty()) + _ranges.push_back(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.push_back(range); + } + else if (cmax < lrange.min()) { // non-overlapping range at begin of vector? + if (!lrange.join(range)) + _ranges.insert(_ranges.begin(), range); + } + else { + // ranges overlap and/or must be inserted somewhere inside the vector + Ranges::iterator it = lower_bound(_ranges.begin(), _ranges.end(), range); + const bool at_end = (it == _ranges.end()); + if (at_end) + --it; + if (!it->join(range) && (it == _ranges.begin() || !(it-1)->join(range))) { + if (it->min() < cmin && it->max() > cmax) { // new range completely inside an existing range? + //split existing range + UInt32 itmax = it->max(); + it->max(cmin-1); + it = _ranges.insert(it+1, Range(cmax+1, itmax, it->valueAt(cmax+1))); + } + else if (at_end) // does new range overlap right side of last range in vector? + it = _ranges.end(); // => append new range at end of vector + it = _ranges.insert(it, range); + } + adaptNeighbors(it); // resolve overlaps + } + } +} + + +/** Adapts the left and right neighbor elements of a newly inserted range. + * The new range could overlap ranges in the neighborhood so that those must be + * adapted or removed. All ranges in the range vector are ordered ascendingly, i.e. + * [min_1, max_1],...,[min_n, max_n] where min_i < min_j for all i < j. + * @param[in] it pointer to the newly inserted range */ +void RangeMap::adaptNeighbors (Ranges::iterator it) { + if (it != _ranges.end()) { + // adapt left neighbor + Ranges::iterator lit = it-1; // points to left neighbor + if (it != _ranges.begin() && it->min() <= lit->max()) { + bool left_neighbor_valid = (it->min() > 0 && it->min()-1 >= lit->min()); + if (left_neighbor_valid) // is adapted left neighbor valid? + lit->max(it->min()-1); // => assign new max value + if (!left_neighbor_valid || it->join(*lit)) + it = _ranges.erase(lit); + } + // remove right neighbors completely overlapped by *it + Ranges::iterator rit = it+1; // points to right neighbor + while (rit != _ranges.end() && it->max() >= rit->max()) { // complete overlap? + _ranges.erase(rit); + rit = it+1; + } + // adapt rightmost range partially overlapped by *it + if (rit != _ranges.end()) { + if (it->max() >= rit->min()) + rit->setMinAndAdaptValue(it->max()+1); + // try to merge right neighbor into *this + if (it->join(*rit)) + _ranges.erase(rit); // remove merged neighbor + } + } +} + + +/** Finds the index of the range that contains a given value c. + * @param[in] c find range that contains this value + * @return index of the range found, or -1 if range was not found */ +int RangeMap::lookup (UInt32 c) const { + // simple binary search + int left=0, right=_ranges.size()-1; + while (left <= right) { + int mid = (left+right)/2; + if (c < _ranges[mid].min()) + right = mid-1; + else if (c > _ranges[mid].max()) + left = mid+1; + else + return mid; + } + return -1; +} + + +UInt32 RangeMap::valueAt (UInt32 c) const { + int pos = lookup(c); + return pos < 0 ? 0 : _ranges[pos].valueAt(c); +} + + +ostream& RangeMap::Range::write (ostream& os) const { + return os << '[' << _min << ',' << _max << "] => " << _minval; +} + + +ostream& RangeMap::write (ostream& os) const { + for (size_t i=0; i < _ranges.size(); i++) + _ranges[i].write(os) << '\n'; + return os; +} \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h new file mode 100644 index 00000000000..a1d2f139070 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.h @@ -0,0 +1,87 @@ +/************************************************************************* +** RangeMap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_RANGEMAP_H +#define DVISVGM_RANGEMAP_H + +#include +#include +#include +#include "types.h" + + +class RangeMap { + class Range + { + friend class RangeMap; + + public: + Range () : _min(0), _max(0), _minval(0) {} + + Range (UInt32 min, UInt32 max, UInt32 minval) : _min(min), _max(max), _minval(minval) { + if (_min > _max) + std::swap(_min, _max); + } + + UInt32 min () const {return _min;} + UInt32 max () const {return _max;} + UInt32 minval () const {return _minval;} + UInt32 maxval () const {return valueAt(_max);} + UInt32 valueAt (UInt32 c) const {return c-_min+_minval;} + bool operator < (const Range &r) const {return _min < r._min;} + std::ostream& write (std::ostream &os) const; + + protected: + void min (UInt32 m) {_min = m;} + void max (UInt32 m) {_max = m;} + void setMinAndAdaptValue (UInt32 c) {_minval = valueAt(c); _min = c;} + bool join (const Range &r); + + private: + UInt32 _min, _max; + UInt32 _minval; + }; + + typedef std::vector Ranges; + + public: + void addRange (UInt32 first, UInt32 last, UInt32 cid); + bool valueExists (UInt32 c) const {return lookup(c) >= 0;} + UInt32 valueAt (UInt32 c) const; + size_t size () const {return _ranges.size();} + bool empty () const {return _ranges.empty();} + void clear () {_ranges.clear();} + std::ostream& write (std::ostream &os) const; + + protected: + void adaptNeighbors (Ranges::iterator it); + int lookup (UInt32 c) const; + const Range& rangeAt (size_t n) const {return _ranges[n];} + + private: + Ranges _ranges; +}; + + +inline std::ostream& operator << (std::ostream& os, const RangeMap &rangemap) { + return rangemap.write(os); +} + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp new file mode 100644 index 00000000000..26621d49303 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.cpp @@ -0,0 +1,174 @@ +/************************************************************************* +** SVGOutput.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "gzstream.h" +#include "Calculator.h" +#include "FileSystem.h" +#include "Message.h" +#include "SVGOutput.h" + + +using namespace std; + +SVGOutput::SVGOutput (const char *base, string pattern, int zipLevel) + : _path(base ? base : ""), + _pattern(pattern), + _stdout(base == 0), + _zipLevel(zipLevel), + _page(-1), + _os(0) +{ +} + + +/** Returns an output stream for the given page. + * @param[in] page number of current page + * @param[in] numPages total number of pages in the DVI file + * @return output stream for the given page */ +ostream& SVGOutput::getPageStream (int page, int numPages) const { + string fname = filename(page, numPages); + if (fname.empty()) { + delete _os; + _os = 0; + return cout; + } + if (page == _page) + return *_os; + + _page = page; + delete _os; + if (_zipLevel > 0) + _os = new ogzstream(fname.c_str(), _zipLevel); + else + _os = new ofstream(fname.c_str()); + if (!_os || !*_os) { + delete _os; + _os = 0; + throw MessageException("can't open file "+fname+" for writing"); + } + return *_os; +} + + +/** Returns the name of the SVG file containing the given page. + * @param[in] page number of current page + * @param[in] numPages total number of pages */ +string SVGOutput::filename (int page, int numPages) const { + if (_stdout) + return ""; + string pattern = _pattern; + expandFormatString(pattern, page, numPages); + // remove leading and trailing whitespace + stringstream trim; + trim << pattern; + pattern.clear(); + trim >> pattern; + // set and expand default pattern if necessary + if (pattern.empty()) { + pattern = numPages > 1 ? "%f-%p" : "%f"; + expandFormatString(pattern, page, numPages); + } + // append suffix if necessary + FilePath outpath(pattern, true); + if (outpath.suffix().empty()) + outpath.suffix(_zipLevel > 0 ? "svgz" : "svg"); + string abspath = outpath.absolute(); + string relpath = outpath.relative(); + return abspath.length() < relpath.length() ? abspath : relpath; +} + + +static int ilog10 (int n) { + int result = 0; + while (n >= 10) { + result++; + n /= 10; + } + return result; +} + + +/** Replace expressions in a given string by the corresponing values. + * Supported constructs: + * %f: basename of the current file (filename without suffix) + * %[0-9]?p: current page number + * %[0-9]?P: number of pages in DVI file + * %[0-9]?(expr): arithmetic expression */ +void SVGOutput::expandFormatString (string &str, int page, int numPages) const { + string result; + while (!str.empty()) { + size_t pos = str.find('%'); + if (pos == string::npos) { + result += str; + str.clear(); + } + else { + result += str.substr(0, pos); + str = str.substr(pos); + pos = 1; + ostringstream oss; + if (isdigit(str[pos])) { + oss << setw(str[pos]-'0') << setfill('0'); + pos++; + } + else { + oss << setw(ilog10(numPages)+1) << setfill('0'); + } + switch (str[pos]) { + case 'f': + result += _path.basename(); + break; + case 'p': + case 'P': + oss << (str[pos] == 'p' ? page : numPages); + result += oss.str(); + break; + case '(': { + size_t endpos = str.find(')', pos); + if (endpos == string::npos) + throw MessageException("missing ')' in filename pattern"); + else if (endpos-pos-1 > 1) { + try { + Calculator calculator; + calculator.setVariable("p", page); + calculator.setVariable("P", numPages); + oss << floor(calculator.eval(str.substr(pos, endpos-pos+1))); + result += oss.str(); + } + catch (CalculatorException &e) { + oss.str(""); + oss << "error in filename pattern (" << e.what() << ")"; + throw MessageException(oss.str()); + } + pos = endpos; + } + break; + } + } + str = str.substr(pos+1); + } + } + str = result; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h new file mode 100644 index 00000000000..b696a32b8f8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGOutput.h @@ -0,0 +1,56 @@ +/************************************************************************* +** SVGOutput.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SVGOUTPUT_H +#define DVISVGM_SVGOUTPUT_H + +#include +#include +#include "FilePath.h" + + +struct SVGOutputBase { + virtual ~SVGOutputBase () {} + virtual std::ostream& getPageStream (int page, int numPages) const =0; + virtual std::string filename (int page, int numPages) const =0; +}; + + +class SVGOutput : public SVGOutputBase +{ + public: + SVGOutput (const char *base=0, std::string pattern="", int zipLevel=0); + ~SVGOutput () {delete _os;} + std::ostream& getPageStream (int page, int numPages) const; + std::string filename (int page, int numPages) const; + + protected: + void expandFormatString (std::string &str, int page, int numPages) const; + + private: + FilePath _path; + std::string _pattern; + bool _stdout; ///< write to STDOUT? + int _zipLevel; ///< compression level + mutable int _page; ///< number of current page being written + mutable std::ostream *_os; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp new file mode 100644 index 00000000000..fce034a3bf4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp @@ -0,0 +1,479 @@ +/************************************************************************* +** SVGTree.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "BoundingBox.h" +#include "DependencyGraph.h" +#include "DVIToSVG.h" +#include "Font.h" +#include "FontManager.h" +#include "SVGTree.h" +#include "XMLDocument.h" +#include "XMLNode.h" +#include "XMLString.h" + +using namespace std; + + +// static class variables +bool SVGTree::CREATE_STYLE=true; +bool SVGTree::USE_FONTS=true; +bool SVGTree::CREATE_USE_ELEMENTS=false; +bool SVGTree::RELATIVE_PATH_CMDS=false; +bool SVGTree::MERGE_CHARS=true; +double SVGTree::ZOOM_FACTOR=1.0; + + +SVGTree::SVGTree () : _vertical(false), _font(0), _color(Color::BLACK), _matrix(1) { + _xchanged = _ychanged = false; + _fontnum = 0; + reset(); +} + + +/** Clears the SVG tree and initializes the root element. */ +void SVGTree::reset () { + _doc.clear(); + _root = new XMLElementNode("svg"); + _root->addAttribute("version", "1.1"); + _root->addAttribute("xmlns", "http://www.w3.org/2000/svg"); + _root->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); + _doc.setRootNode(_root); + _page = _text = _span = _defs = 0; +} + + +/** Sets the bounding box of the document. + * @param[in] bbox bounding box in PS point units */ +void SVGTree::setBBox (const BoundingBox &bbox) { + if (ZOOM_FACTOR >= 0) { + _root->addAttribute("width", XMLString(bbox.width()*ZOOM_FACTOR)+"pt"); + _root->addAttribute("height", XMLString(bbox.height()*ZOOM_FACTOR)+"pt"); + } + _root->addAttribute("viewBox", bbox.toSVGViewBox()); +} + + +void SVGTree::setColor (const Color &c) { + if (!_font.get() || _font.get()->color() == Color::BLACK) + _color.set(c); +} + + +void SVGTree::setFont (int num, const Font *font) { + _font.set(font); + _fontnum = num; + // set default color assigned to the font + if (font->color() != Color::BLACK && _color.get() != font->color()) + _color.set(font->color()); +} + + +/** Starts a new page. + * @param[in] pageno number of new page */ +void SVGTree::newPage (int pageno) { + _page = new XMLElementNode("g"); + if (pageno >= 0) + _page->addAttribute("id", string("page")+XMLString(pageno)); + _root->append(_page); + _text = _span = 0; + while (!_pageContainerStack.empty()) + _pageContainerStack.pop(); +} + + +void SVGTree::appendToDefs (XMLNode *node) { + if (!_defs) { + _defs = new XMLElementNode("defs"); + _root->prepend(_defs); + } + _defs->append(node); +} + + +void SVGTree::appendToPage (XMLNode *node) { + if (_pageContainerStack.empty()) + _page->append(node); + else + _pageContainerStack.top()->append(node); + if (node != _text) // if the appended node differ from text element currently in use, + _text = 0; // then force creating a new text element for the following characters +} + + +void SVGTree::prependToPage (XMLNode *node) { + if (_pageContainerStack.empty()) + _page->prepend(node); + else + _pageContainerStack.top()->prepend(node); +} + + +/** Appends a single charater to the current text node. If necessary, and depending on output mode + * and further output states, new XML elements (text, tspan, g, ...) are created. + * @param[in] c character to be added + * @param[in] x x coordinate + * @param[in] y y coordinate + * @param[in] font font to be used */ +void SVGTree::appendChar (int c, double x, double y, const Font &font) { + XMLElementNode *node=_span; + if (USE_FONTS) { + // changes of fonts and transformations require a new text element + if (!MERGE_CHARS || !_text || _font.changed() || _matrix.changed() || _vertical.changed()) { + newTextNode(x, y); + node = _text; + _color.changed(true); + } + if (MERGE_CHARS && (_xchanged || _ychanged || (_color.changed() && _color.get() != Color::BLACK))) { + // if drawing position was explicitly changed, create a new tspan element + _span = new XMLElementNode("tspan"); + if (_xchanged) { + if (_vertical) { + // align glyphs designed for horizontal layout properly + if (const PhysicalFont *pf = dynamic_cast(_font.get())) + if (!pf->getMetrics()->verticalLayout()) + x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset + } + _span->addAttribute("x", x); + _xchanged = false; + } + if (_ychanged) { + _span->addAttribute("y", y); + _ychanged = false; + } + if (_color.get() != font.color()) { + _span->addAttribute("fill", _color.get().svgColorString()); + _color.changed(false); + } + _text->append(_span); + node = _span; + } + if (!node) { + if (!_text) + newTextNode(x, y); + node = _text; + } + node->append(XMLString(font.unicode(c), false)); + if (!MERGE_CHARS && _color.get() != font.color()) { + node->addAttribute("fill", _color.get().svgColorString()); + _color.changed(false); + } + } + else { + if (_color.changed() || _matrix.changed()) { + bool set_color = (_color.changed() && _color.get() != Color::BLACK); + bool set_matrix = (_matrix.changed() && !_matrix.get().isIdentity()); + if (set_color || set_matrix) { + _span = new XMLElementNode("g"); + if (_color.get() != Color::BLACK) + _span->addAttribute("fill", _color.get().svgColorString()); + if (!_matrix.get().isIdentity()) + _span->addAttribute("transform", _matrix.get().getSVG()); + appendToPage(_span); + node = _span; + _color.changed(false); + _matrix.changed(false); + } + else if (_color.get() == Color::BLACK && _matrix.get().isIdentity()) + node = _span = 0; + } + if (!node) + node = _pageContainerStack.empty() ? _page : _pageContainerStack.top(); + if (font.verticalLayout()) { + // move glyph graphics so that its origin is located at the top center position + GlyphMetrics metrics; + font.getGlyphMetrics(c, _vertical, metrics); + x -= metrics.wl; + if (const PhysicalFont *pf = dynamic_cast(&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); + y += exact_metrics.h+(metrics.d-exact_metrics.h-exact_metrics.d)/2; + } + else + y += metrics.d; + } + Matrix rotation(1); + if (_vertical && !font.verticalLayout()) { + // alphabetic text designed for horizontal mode + // must be rotated by 90 degrees if in vertical mode + rotation.translate(-x, -y); + rotation.rotate(90); + rotation.translate(x, y); + } + if (CREATE_USE_ELEMENTS) { + ostringstream oss; + oss << "#g" << FontManager::instance().fontID(_font) << '-' << c; + XMLElementNode *use = new XMLElementNode("use"); + use->addAttribute("x", XMLString(x)); + use->addAttribute("y", XMLString(y)); + use->addAttribute("xlink:href", oss.str()); + if (!rotation.isIdentity()) + use->addAttribute("transform", rotation.getSVG()); + node->append(use); + } + else { + Glyph glyph; + const PhysicalFont *pf = dynamic_cast(&font); + if (pf && pf->getGlyph(c, glyph)) { + double sx = pf->scaledSize()/pf->unitsPerEm(); + double sy = -sx; + ostringstream oss; + glyph.writeSVG(oss, RELATIVE_PATH_CMDS, sx, sy, x, y); + XMLElementNode *glyph_node = new XMLElementNode("path"); + glyph_node->addAttribute("d", oss.str()); + if (!rotation.isIdentity()) + glyph_node->addAttribute("transform", rotation.getSVG()); + node->append(glyph_node); + } + } + } +} + + +/** Creates a new text element. This is a helper function used by appendChar(). + * @param[in] x current x coordinate + * @param[in] y current y coordinate */ +void SVGTree::newTextNode (double x, double y) { + _text = new XMLElementNode("text"); + _span = 0; // no tspan in text element yet + if (USE_FONTS) { + const Font *font = _font.get(); + if (CREATE_STYLE || !font) + _text->addAttribute("class", string("f")+XMLString(_fontnum)); + else { + _text->addAttribute("font-family", font->name()); + _text->addAttribute("font-size", XMLString(font->scaledSize())); + if (font->color() != Color::BLACK) + _text->addAttribute("fill", font->color().svgColorString()); + } + if (_vertical) { + _text->addAttribute("writing-mode", "tb"); + // align glyphs designed for horizontal layout properly + if (const PhysicalFont *pf = dynamic_cast(_font.get())) + if (!pf->getMetrics()->verticalLayout()) { // alphabetic text designed for horizontal layout? + x += pf->scaledAscent()/2.5; // move vertical baseline to the right by strikethrough offset + _text->addAttribute("glyph-orientation-vertical", 90); // ensure rotation + } + } + } + _text->addAttribute("x", x); + _text->addAttribute("y", y); + if (!_matrix.get().isIdentity()) + _text->addAttribute("transform", _matrix.get().getSVG()); + appendToPage(_text); + _vertical.changed(false); + _font.changed(false); + _matrix.changed(false); + _xchanged = false; + _ychanged = false; +} + + +void SVGTree::transformPage (const Matrix *usermatrix) { + if (usermatrix && !usermatrix->isIdentity()) + _page->addAttribute("transform", usermatrix->getSVG()); +} + + +/** Creates an SVG element for a single glyph. + * @param[in] c character number + * @param[in] font font to extract the glyph from + * @param[in] cb pointer to callback object for sending feedback to the glyph tracer (may be 0) + * @return pointer to element node if glyph exists, 0 otherwise */ +static XMLElementNode* createGlyphNode (int c, const PhysicalFont &font, GFGlyphTracer::Callback *cb) { + Glyph glyph; + if (!font.getGlyph(c, glyph, cb) || (!SVGTree::USE_FONTS && !SVGTree::CREATE_USE_ELEMENTS)) + return 0; + + double sx=1.0, sy=1.0; + double upem = font.unitsPerEm(); + XMLElementNode *glyph_node=0; + if (SVGTree::USE_FONTS) { + double extend = font.style() ? font.style()->extend : 1; + glyph_node = new XMLElementNode("glyph"); + glyph_node->addAttribute("unicode", XMLString(font.unicode(c), false)); + glyph_node->addAttribute("horiz-adv-x", XMLString(font.hAdvance(c)*extend)); + glyph_node->addAttribute("vert-adv-y", XMLString(font.vAdvance(c))); + string name = font.glyphName(c); + if (!name.empty()) + glyph_node->addAttribute("glyph-name", name); + } + else { + ostringstream oss; + oss << 'g' << FontManager::instance().fontID(&font) << '-' << c; + glyph_node = new XMLElementNode("path"); + glyph_node->addAttribute("id", oss.str()); + sx = font.scaledSize()/upem; + sy = -sx; + } + ostringstream oss; + glyph.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS, sx, sy); + glyph_node->addAttribute("d", oss.str()); + return glyph_node; +} + + +void SVGTree::appendFontStyles (const set &fonts) { + if (CREATE_STYLE && USE_FONTS && !fonts.empty() && _defs) { + XMLElementNode *styleNode = new XMLElementNode("style"); + styleNode->addAttribute("type", "text/css"); + _root->insertAfter(styleNode, _defs); + typedef map SortMap; + SortMap sortmap; + FORALL(fonts, set::const_iterator, it) + if (!dynamic_cast(*it)) // skip virtual fonts + sortmap[FontManager::instance().fontID(*it)] = *it; + ostringstream style; + // add font style definitions in ascending order + FORALL(sortmap, SortMap::const_iterator, it) { + style << "text.f" << it->first << ' ' + << "{font-family:" << it->second->name() + << ";font-size:" << XMLString(it->second->scaledSize()) << "px"; + if (it->second->color() != Color::BLACK) + style << ";fill:" << it->second->color().svgColorString(); + style << "}\n"; + } + XMLCDataNode *cdata = new XMLCDataNode(style.str()); + styleNode->append(cdata); + } +} + + +/** Appends glyph definitions of a given font to the defs section of the SVG tree. + * @param[in] font font to be appended + * @param[in] chars codes of the characters whose glyph outlines should be appended + * @param[in] cb pointer to callback object for sending feedback to the glyph tracer (may be 0) */ +void SVGTree::append (const PhysicalFont &font, const set &chars, GFGlyphTracer::Callback *cb) { + if (chars.empty()) + return; + + if (USE_FONTS) { + XMLElementNode *fontNode = new XMLElementNode("font"); + string fontname = font.name(); + fontNode->addAttribute("id", fontname); + fontNode->addAttribute("horiz-adv-x", XMLString(font.hAdvance())); + appendToDefs(fontNode); + + XMLElementNode *faceNode = new XMLElementNode("font-face"); + faceNode->addAttribute("font-family", fontname); + faceNode->addAttribute("units-per-em", XMLString(font.unitsPerEm())); + if (font.type() != PhysicalFont::MF && !font.verticalLayout()) { + faceNode->addAttribute("ascent", XMLString(font.ascent())); + faceNode->addAttribute("descent", XMLString(font.descent())); + } + fontNode->append(faceNode); + FORALL(chars, set::const_iterator, i) + fontNode->append(createGlyphNode(*i, font, cb)); + } + else if (CREATE_USE_ELEMENTS && &font != font.uniqueFont()) { + // If the same character is used in various sizes, we don't want to embed the complete (lengthy) path + // descriptions multiple times. Because they would only differ by a scale factor, it's better to + // reference the already embedded path together with a transformation attribute and let the SVG renderer + // scale the glyphs properly. This is only necessary if we don't want to use font but path elements. + FORALL(chars, set::const_iterator, it) { + ostringstream oss; + XMLElementNode *use = new XMLElementNode("use"); + oss << 'g' << FontManager::instance().fontID(&font) << '-' << *it; + use->addAttribute("id", oss.str()); + oss.str(""); + oss << "#g" << FontManager::instance().fontID(font.uniqueFont()) << '-' << *it; + use->addAttribute("xlink:href", oss.str()); + double scale = font.scaledSize()/font.uniqueFont()->scaledSize(); + if (scale != 1.0) { + oss.str(""); + oss << "scale(" << scale << ')'; + use->addAttribute("transform", oss.str()); + } + appendToDefs(use); + } + } + else { + FORALL(chars, set::const_iterator, i) + appendToDefs(createGlyphNode(*i, font, cb)); + } +} + + +/** Pushes a new context element that will take all following nodes added to the page. */ +void SVGTree::pushContextElement (XMLElementNode *node) { + if (_pageContainerStack.empty()) + _page->append(node); + else + _pageContainerStack.top()->append(node); + _pageContainerStack.push(node); + _text = _span = 0; // ensure the creation of a new text element for the following characters added +} + + +/** Pops the current context element and restored the previous one. */ +void SVGTree::popContextElement () { + if (!_pageContainerStack.empty()) { + _pageContainerStack.pop(); + _text = _span = 0; // ensure the creation of a new text element for the following characters added + } +} + + +/** Extracts the ID from a local URL reference like url(#abcde) */ +inline string extract_id_from_url (const string &url) { + return url.substr(5, url.length()-6); +} + + +/** Removes elements present in the SVH tree that are not required. + * For now, only clipPath elements are removed. */ +void SVGTree::removeRedundantElements () { + vector clipElements; + if (!_defs || !_defs->getDescendants("clipPath", 0, clipElements)) + return; + + // collect dependencies between clipPath elements in the defs section of the SVG tree + DependencyGraph idTree; + for (vector::iterator it=clipElements.begin(); it != clipElements.end(); ++it) { + if (const char *id = (*it)->getAttributeValue("id")) { + if (const char *url = (*it)->getAttributeValue("clip-path")) + idTree.insert(extract_id_from_url(url), id); + else + idTree.insert(id); + } + } + // collect elements that reference a clipPath (have a clip-path attribute) + vector descendants; + _page->getDescendants(0, "clip-path", descendants); + // remove referenced IDs and their dependencies from the dependency graph + for (vector::iterator it=descendants.begin(); it != descendants.end(); ++it) { + string idref = extract_id_from_url((*it)->getAttributeValue("clip-path")); + idTree.removeDependencyPath(idref); + } + descendants.clear(); + vector ids; + idTree.getKeys(ids); + for (vector::iterator it=ids.begin(); it != ids.end(); ++it) { + XMLElementNode *node = _defs->getFirstDescendant("clipPath", "id", it->c_str()); + _defs->remove(node); + } +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h new file mode 100644 index 00000000000..a8d123a013d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.h @@ -0,0 +1,114 @@ +/************************************************************************* +** SVGTree.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SVGTREE_H +#define DVISVGM_SVGTREE_H + +#include +#include +#include +#include "Color.h" +#include "GFGlyphTracer.h" +#include "Matrix.h" +#include "XMLDocument.h" +#include "XMLNode.h" + +class BoundingBox; +class Color; +struct Font; +class Matrix; +class PhysicalFont; + +class SVGTree +{ + template + class Property { + public: + Property (const T &v) : _value(v), _changed(false) {} + + void set (const T &v) { + if (v != _value) { + _value = v; + _changed = true; + } + } + + const T& get () const {return _value;} + operator const T& () {return _value;} + bool changed () const {return _changed;} + void changed (bool c) {_changed = c;} + + private: + T _value; + bool _changed; + }; + + public: + SVGTree (); + void reset (); + void write (std::ostream &os) const {_doc.write(os);} + void newPage (int pageno); + void appendToDefs (XMLNode *node); + void appendToPage (XMLNode *node); + void prependToPage (XMLNode *node); + void appendToDoc (XMLNode *node) {_doc.append(node);} + void appendToRoot (XMLNode *node) {_root->append(node);} + void appendChar (int c, double x, double y, const Font &font); + void appendFontStyles (const std::set &fonts); + void append (const PhysicalFont &font, const std::set &chars, GFGlyphTracer::Callback *cb=0); + void pushContextElement (XMLElementNode *node); + void popContextElement (); + void removeRedundantElements (); + void setBBox (const BoundingBox &bbox); + void setFont (int id, const Font *font); + void setX (double x) {_xchanged = true;} + void setY (double y) {_ychanged = true;} + void setMatrix (const Matrix &m) {_matrix.set(m);} + void setColor (const Color &c); + void setVertical (bool state) {_vertical.set(state);} + void transformPage (const Matrix *m); + const Color& getColor () const {return _color.get();} + const Matrix& getMatrix () const {return _matrix.get();} + XMLElementNode* rootNode () const {return _root;} + + public: + static bool USE_FONTS; ///< if true, create font references and don't draw paths directly + static bool CREATE_STYLE; ///< use style elements and class attributes to reference fonts? + static bool CREATE_USE_ELEMENTS; ///< allow generation of elements? + static bool RELATIVE_PATH_CMDS; ///< relative path commands rather than absolute ones? + static bool MERGE_CHARS; ///< whether to merge chars with common properties into the same tag + static double ZOOM_FACTOR; ///< factor applied to width/height attribute + + protected: + void newTextNode (double x, double y); + + private: + XMLDocument _doc; + XMLElementNode *_root, *_page, *_text, *_span, *_defs; + bool _xchanged, _ychanged; + Property _vertical; ///< true if in vertical writing mode + Property _font; + Property _color; + Property _matrix; + int _fontnum; + std::stack _pageContainerStack; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp new file mode 100644 index 00000000000..057f67f3f65 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.cpp @@ -0,0 +1,64 @@ +/************************************************************************* +** ShadingPatch.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "ShadingPatch.h" +#include "TensorProductPatch.h" +#include "TriangularPatch.h" + +using namespace std; + +/** Get functions to get/set the current color depending on the assigned color space. */ +void ShadingPatch::colorQueryFuncs (ColorGetter &getter, ColorSetter &setter) const { + switch (_colorspace) { + case Color::CMYK_SPACE: + getter = &Color::getCMYK; + setter = &Color::setCMYK; + break; + case Color::LAB_SPACE: + getter = &Color::getLab; + setter = &Color::setLab; + break; + case Color::RGB_SPACE: + getter = &Color::getRGB; + setter = &Color::setRGB; + break; + case Color::GRAY_SPACE: + getter = &Color::getGray; + setter = &Color::setGray; + } +} + + +/** Factory method: Creates a shading patch object depending on the given PostScript shading type. */ +ShadingPatch* ShadingPatch::create (int psShadingType, Color::ColorSpace cspace) { + switch (psShadingType) { + case 4: return new TriangularPatch(cspace); + case 5: return new LatticeTriangularPatch(cspace); + case 6: return new CoonsPatch(cspace); + case 7: return new TensorProductPatch(cspace); + } + ostringstream oss; + if (psShadingType > 0 && psShadingType < 4) + oss << "shading type " << psShadingType << " not supported"; + else + oss << "invalid shading type " << psShadingType; + throw ShadingException(oss.str()); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h new file mode 100644 index 00000000000..84c44041e5e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ShadingPatch.h @@ -0,0 +1,71 @@ +/************************************************************************* +** ShadingPatch.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SHADINGPATCH_H +#define DVISVGM_SHADINGPATCH_H + +#include "Color.h" +#include "GraphicPath.h" +#include "MessageException.h" + + +class ShadingPatch +{ + public: + struct Callback { + virtual ~Callback () {} + virtual void patchSegment (GraphicPath &path, const Color &color) =0; + }; + + typedef std::vector PointVec; + typedef std::vector ColorVec; + + public: + ShadingPatch (Color::ColorSpace colorSpace) : _colorspace(colorSpace) {} + virtual ~ShadingPatch () {} + virtual int psShadingType () const =0; + virtual void approximate (int gridsize, bool overlap, double delta, Callback &callback) const =0; + virtual void getBBox (BoundingBox &bbox) const =0; + virtual void getBoundaryPath (GraphicPath &path) const =0; + virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) =0; + virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) =0; + virtual int numPoints (int edgeflag) const =0; + virtual int numColors (int edgeflag) const =0; + virtual Color averageColor() const =0; + Color::ColorSpace colorSpace () const {return _colorspace;} + static ShadingPatch* create (int psShadingType, Color::ColorSpace cspace); + + protected: + typedef void (Color::*ColorGetter)(std::valarray &va) const; + typedef void (Color::*ColorSetter)(const std::valarray &va); + void colorQueryFuncs (ColorGetter &getter, ColorSetter &setter) const; + + private: + Color::ColorSpace _colorspace; ///< color space used to compute the shading values +}; + + +struct ShadingException : public MessageException +{ + ShadingException (const std::string &msg) : MessageException(msg) {} +}; + +#endif + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp new file mode 100644 index 00000000000..3af78a66012 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.cpp @@ -0,0 +1,86 @@ +/************************************************************************* +** SignalHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "SignalHandler.h" + +using namespace std; + +bool SignalHandler::_break = false; + + +SignalHandler::~SignalHandler() { + stop(); +} + + +/** Returns the singleton handler object. */ +SignalHandler& SignalHandler::instance() { + static SignalHandler handler; + return handler; +} + + +/** Starts listening to CTRL-C signals. + * @return true if handler was activated. */ +bool SignalHandler::start () { + if (!_active) { + _break = false; + if (signal(SIGINT, SignalHandler::callback) != SIG_ERR) { + _active = true; + return true; + } + } + return false; +} + + +/** Stops listening for CTRL-C signals. */ +void SignalHandler::stop () { + if (_active) { + signal(SIGINT, SIG_DFL); + _active = false; + } +} + + +/** Checks for incoming signals and throws an exception if CTRL-C was caught. + * @throw SignalException */ +void SignalHandler::check() { + if (_break) + throw SignalException(); +} + + +void SignalHandler::trigger (bool notify) { + _break = true; + if (notify) + check(); +} + + +/** This function is called on CTRL-C signals. */ +void SignalHandler::callback (int) { + _break = true; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h new file mode 100644 index 00000000000..25ee5fba118 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SignalHandler.h @@ -0,0 +1,50 @@ +/************************************************************************* +** SignalHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SIGNALHANDLER_H +#define DVISVGM_SIGNALHANDLER_H + +#include + +struct SignalException : public std::exception { +}; + + +class SignalHandler +{ + public: + ~SignalHandler (); + static SignalHandler& instance (); + bool start (); + void stop (); + void check (); + void trigger (bool notify); + bool active () const {return _active;} + + protected: + SignalHandler () : _active(false) {} + static void callback (int signal); + + private: + bool _active; ///< true if listening for signals + static bool _break; ///< true if signal has been caught +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h new file mode 100644 index 00000000000..e0f35c78738 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialActions.h @@ -0,0 +1,96 @@ +/************************************************************************* +** SpecialActions.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SPECIALACTIONS_H +#define DVISVGM_SPECIALACTIONS_H + +#include +#include "BoundingBox.h" +#include "Color.h" +#include "Matrix.h" + + +struct XMLNode; +class XMLElementNode; + +struct SpecialActions +{ + virtual ~SpecialActions () {} + virtual double getX () const =0; + virtual double getY () const =0; + virtual void setX (double x) =0; + virtual void setY (double y) =0; + virtual void finishLine () =0; + virtual void setColor (const Color &color) =0; + virtual Color getColor () const =0; + virtual void setMatrix (const Matrix &m) =0; + virtual const Matrix& getMatrix () const =0; + virtual void getPageTransform (Matrix &matrix) const =0; + virtual void setBgColor (const Color &color) =0; + virtual void appendToPage (XMLNode *node) =0; + virtual void appendToDefs (XMLNode *node) =0; + virtual void prependToPage (XMLNode *node) =0; + virtual void pushContextElement (XMLElementNode *node) =0; + virtual void popContextElement () =0; + virtual BoundingBox& bbox () =0; + virtual BoundingBox& bbox (const std::string &name, bool reset=false) =0; + virtual void embed (const BoundingBox &bbox) =0; + virtual void embed (const DPair &p, double r=0) =0; + virtual unsigned getCurrentPageNumber () const =0; + virtual std::string getSVGFilename (unsigned pageno) const =0; + virtual void progress (const char *id) {} + virtual int getDVIStackDepth () const {return 0;} + + static double PROGRESSBAR_DELAY; ///< progress bar doesn't appear before this time has elapsed (in sec) +}; + + +class EmptySpecialActions : public SpecialActions +{ + public: + double getX () const {return 0;} + double getY () const {return 0;} + void setX (double x) {} + void setY (double y) {} + void finishLine () {} + void setColor (const Color &color) {} + void setBgColor (const Color &color) {} + Color getColor () const {return Color::BLACK;} + void setMatrix (const Matrix &m) {} + const Matrix& getMatrix () const {return _matrix;} + void getPageTransform (Matrix &matrix) const {} + void appendToPage (XMLNode *node) {} + void appendToDefs (XMLNode *node) {} + void prependToPage (XMLNode *node) {} + void pushContextElement (XMLElementNode *node) {} + void popContextElement () {} + BoundingBox& bbox () {return _bbox;} + BoundingBox& bbox (const std::string &name, bool reset=false) {return _bbox;} + void embed (const BoundingBox &bbox) {} + void embed (const DPair &p, double r=0) {} + unsigned getCurrentPageNumber() const {return 0;} + std::string getSVGFilename (unsigned pageno) const {return "";} + + private: + BoundingBox _bbox; + Matrix _matrix; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h new file mode 100644 index 00000000000..1924bf12102 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h @@ -0,0 +1,74 @@ +/************************************************************************* +** SpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SPECIALHANDLER_H +#define DVISVGM_SPECIALHANDLER_H + +#include +#include +#include "MessageException.h" + + +struct SpecialActions; +class SpecialManager; + + +struct SpecialException : public MessageException +{ + SpecialException (const std::string &msg) : MessageException(msg) {} +}; + + +struct DVIPreprocessingListener +{ + virtual ~DVIPreprocessingListener () {} + virtual void dviPreprocessingFinished () =0; +}; + + +struct DVIEndPageListener +{ + virtual ~DVIEndPageListener () {} + virtual void dviEndPage (unsigned pageno) =0; +}; + + +struct DVIPositionListener +{ + virtual ~DVIPositionListener () {} + virtual void dviMovedTo (double x, double y) =0; +}; + + +struct SpecialHandler +{ + friend class SpecialManager; + + virtual ~SpecialHandler () {} + virtual const char** prefixes () const=0; + virtual const char* info () const=0; + virtual const char* name () const=0; + virtual void setDviScaleFactor (double dvi2bp) {} + virtual void preprocess (const char *prefix, std::istream &is, SpecialActions *actions) {} + virtual bool process (const char *prefix, std::istream &is, SpecialActions *actions)=0; +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp new file mode 100644 index 00000000000..6699b9ee0c7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp @@ -0,0 +1,183 @@ +/************************************************************************* +** SpecialManager.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "SpecialActions.h" +#include "SpecialHandler.h" +#include "SpecialManager.h" +#include "PsSpecialHandler.h" +#include "macros.h" + +using namespace std; + +double SpecialActions::PROGRESSBAR_DELAY=1000; // initial delay in seconds (values >= 1000 disable the progressbar) + + +SpecialManager::~SpecialManager () { + unregisterHandlers(); +} + + +SpecialManager& SpecialManager::instance() { + static SpecialManager sm; + return sm; +} + + +/** Remove all registered handlers. */ +void SpecialManager::unregisterHandlers () { + FORALL(_pool, vector::iterator, it) + delete *it; + _pool.clear(); + _handlers.clear(); + _endPageListeners.clear(); + _positionListeners.clear(); +} + + +/** Registers a single special handler. This method doesn't check if a + * handler of the same class is already registered. + * @param[in] handler pointer to handler to be registered */ +void SpecialManager::registerHandler (SpecialHandler *handler) { + if (handler) { + // get array of prefixes this handler is responsible for + _pool.push_back(handler); + for (const char **p=handler->prefixes(); *p; ++p) + _handlers[*p] = handler; + if (DVIPreprocessingListener *listener = dynamic_cast(handler)) + _preprocListeners.push_back(listener); + if (DVIEndPageListener *listener = dynamic_cast(handler)) + _endPageListeners.push_back(listener); + if (DVIPositionListener *listener = dynamic_cast(handler)) + _positionListeners.push_back(listener); + } +} + + +/** Registers several special handlers at once. + * If ignorelist == 0, all given handlers are registered. To exclude selected sets of + * specials, the corresponding names can be given separated by non alpha-numeric characters, + * e.g. "color, ps, em" or "color: ps em" etc. + * @param[in] handlers pointer to zero-terminated array of handlers to be registered + * @param[in] ignorelist list of special names to be ignored */ +void SpecialManager::registerHandlers (SpecialHandler **handlers, const char *ignorelist) { + if (handlers) { + string ign = ignorelist ? ignorelist : ""; + FORALL(ign, string::iterator, it) + if (!isalnum(*it)) + *it = '%'; + ign = "%"+ign+"%"; + + for (; *handlers; handlers++) { + if (!(*handlers)->name() || ign.find("%"+string((*handlers)->name())+"%") == string::npos) + registerHandler(*handlers); + else + delete *handlers; + } + } +} + + +/** Looks for an appropriate handler for a given special prefix. + * @param[in] prefix the special prefix, e.g. "color" or "em" + * @return in case of success: pointer to handler, 0 otherwise */ +SpecialHandler* SpecialManager::findHandler (const string &prefix) const { + ConstIterator it = _handlers.find(prefix); + if (it != _handlers.end()) + return it->second; + return 0; +} + + +static string extract_prefix (istream &is) { + int c; + string prefix; + while (isalnum(c=is.get())) + prefix += c; + if (ispunct(c)) // also add seperation character to identifying prefix + prefix += c; + if (prefix == "ps:" && is.peek() == ':') + prefix += is.get(); + return prefix; +} + + +void SpecialManager::preprocess (const string &special, SpecialActions *actions) const { + istringstream iss(special); + string prefix = extract_prefix(iss); + if (SpecialHandler *handler = findHandler(prefix)) + handler->preprocess(prefix.c_str(), iss, actions); +} + + +/** Executes a special command. + * @param[in] special the special expression + * @param[in] dvi2bp factor to convert DVI units to PS points + * @param[in] actions actions the special handlers can perform + * @return true if the special could be processed successfully + * @throw SpecialException in case of errors during special processing */ +bool SpecialManager::process (const string &special, double dvi2bp, SpecialActions *actions) const { + istringstream iss(special); + string prefix = extract_prefix(iss); + bool success=false; + if (SpecialHandler *handler = findHandler(prefix)) { + handler->setDviScaleFactor(dvi2bp); + success = handler->process(prefix.c_str(), iss, actions); + } + return success; +} + + +void SpecialManager::notifyPreprocessingFinished () const { + FORALL(_preprocListeners, vector::const_iterator, it) + (*it)->dviPreprocessingFinished(); +} + + +void SpecialManager::notifyEndPage (unsigned pageno) const { + FORALL(_endPageListeners, vector::const_iterator, it) + (*it)->dviEndPage(pageno); +} + + +void SpecialManager::notifyPositionChange (double x, double y) const { + FORALL(_positionListeners, vector::const_iterator, it) + (*it)->dviMovedTo(x, y); +} + + +void SpecialManager::writeHandlerInfo (ostream &os) const { + ios::fmtflags osflags(os.flags()); + typedef map SortMap; + SortMap m; + FORALL(_handlers, ConstIterator, it) + if (it->second->name()) + m[it->second->name()] = it->second; + FORALL(m, SortMap::iterator, it) { + os << setw(10) << left << it->second->name() << ' '; + if (it->second->info()) + os << it->second->info(); + os << endl; + } + os.flags(osflags); // restore format flags +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h new file mode 100644 index 00000000000..29c325c20cc --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h @@ -0,0 +1,66 @@ +/************************************************************************* +** SpecialManager.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SPECIALMANAGER_H +#define DVISVGM_SPECIALMANAGER_H + +#include +#include +#include +#include +#include "SpecialHandler.h" + +struct SpecialActions; + +class SpecialManager +{ + private: + typedef std::vector HandlerPool; + typedef std::map HandlerMap; + typedef HandlerMap::iterator Iterator; + typedef HandlerMap::const_iterator ConstIterator; + + public: + ~SpecialManager (); + static SpecialManager& instance (); + void registerHandler (SpecialHandler *handler); + void registerHandlers (SpecialHandler **handlers, const char *ignorelist); + void unregisterHandlers (); + void preprocess (const std::string &special, SpecialActions *actions) const; + bool process (const std::string &special, double dvi2bp, SpecialActions *actions) const; + void notifyPreprocessingFinished () const; + void notifyEndPage (unsigned pageno) const; + void notifyPositionChange (double x, double y) const; + void writeHandlerInfo (std::ostream &os) const; + + protected: + SpecialManager () {} + SpecialManager (const SpecialManager &) {} + SpecialHandler* findHandler (const std::string &prefix) const; + + private: + HandlerPool _pool; ///< stores pointers to all handlers + HandlerMap _handlers; ///< pointers to handlers for corresponding prefixes + std::vector _preprocListeners; + std::vector _endPageListeners; + std::vector _positionListeners; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp new file mode 100644 index 00000000000..95722a77c87 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.cpp @@ -0,0 +1,160 @@ +/************************************************************************* +** StreamReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "CRC32.h" +#include "StreamReader.h" +#include "macros.h" + +using namespace std; + + +istream& StreamReader::replaceStream (istream &in) { + istream &ret = *_is; + _is = ∈ + return ret; +} + + +/** Reads an unsigned integer from assigned input stream. + * @param[in] bytes number of bytes to read (max. 4) + * @return read integer */ +UInt32 StreamReader::readUnsigned (int bytes) { + UInt32 ret = 0; + for (bytes--; bytes >= 0 && !_is->eof(); bytes--) { + UInt32 b = _is->get(); + ret |= b << (8*bytes); + } + return ret; +} + + +/** Reads an unsigned integer from assigned input stream and updates the CRC32 checksum. + * @param[in] bytes number of bytes to read (max. 4) + * @param[in,out] crc32 checksum to be updated + * @return read integer */ +UInt32 StreamReader::readUnsigned (int bytes, CRC32 &crc32) { + UInt32 ret = readUnsigned(bytes); + crc32.update(ret, bytes); + return ret; +} + + +/** Reads an signed integer from assigned input stream. + * @param[in] bytes number of bytes to read (max. 4) + * @return read integer */ +Int32 StreamReader::readSigned (int bytes) { + Int32 ret = _is->get(); + if (ret & 128) // negative value? + ret |= 0xffffff00; + for (bytes-=2; bytes >= 0 && !_is->eof(); bytes--) + ret = (ret << 8) | _is->get(); + return ret; +} + + +/** Reads an signed integer from assigned input stream and updates the CRC32 checksum. + * @param[in] bytes number of bytes to read (max. 4) + * @param[in,out] crc32 checksum to be updated + * @return read integer */ +Int32 StreamReader::readSigned (int bytes, CRC32 &crc32) { + Int32 ret = readSigned(bytes); + crc32.update(ret, bytes); + return ret; +} + + +/** Reads a string terminated by a 0-byte. */ +string StreamReader::readString () { + if (!_is) + throw StreamReaderException("no stream assigned"); + string ret; + while (!_is->eof() && _is->peek() > 0) + ret += _is->get(); + _is->get(); // skip 0-byte + return ret; +} + + +/** Reads a string terminated by a 0-byte and updates the CRC32 checksum. + * @param[in,out] crc32 checksum to be updated + * @param[in] finalZero consider final 0-byte in checksum + * @return the string read */ +string StreamReader::readString (CRC32 &crc32, bool finalZero) { + string ret = readString(); + crc32.update((const UInt8*)ret.c_str(), ret.length()); + if (finalZero) + crc32.update(0, 1); + return ret; +} + + +/** Reads a string of a given length. + * @param[in] length number of characters to read + * @return the string read */ +string StreamReader::readString (int length) { + if (!_is) + throw StreamReaderException("no stream assigned"); + char *buf = new char[length+1]; + if (length <= 0) + *buf = 0; + else { + _is->read(buf, length); // reads 'length' bytes + buf[length] = 0; + } + string ret = buf; + delete [] buf; + return ret; +} + + +/** Reads a string of a given length and updates the CRC32 checksum. + * @param[in] length number of characters to read + * @param[in,out] crc32 checksum to be updated + * @return the string read */ +string StreamReader::readString (int length, CRC32 &crc32) { + string ret = readString(length); + crc32.update(ret.c_str()); + return ret; +} + + +vector& StreamReader::readBytes (int n, vector &bytes) { + if (n > 0) + _is->read((char*)&bytes[0], n); + return bytes; +} + + +vector& StreamReader::readBytes (int n, vector &bytes, CRC32 &crc32) { + readBytes(n, bytes); + crc32.update(&bytes[0], bytes.size()); + return bytes; +} + + +int StreamReader::readByte (CRC32 &crc32) { + int ret = readByte(); + if (ret >= 0) { + const UInt8 c = UInt8(ret & 0xff); + crc32.update(&c, 1); + } + return ret; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h new file mode 100644 index 00000000000..24c37c487d2 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamReader.h @@ -0,0 +1,71 @@ +/************************************************************************* +** StreamReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_STREAMREADER_H +#define DVISVGM_STREAMREADER_H + +#include +#include +#include +#include "MessageException.h" +#include "types.h" + +class CRC32; + +class StreamReader +{ + public: + StreamReader (std::istream &is) : _is(&is) {} + virtual ~StreamReader () {} + bool isStreamValid () const {return _is;} + bool eof () const {return _is->eof();} + void clearStream () {_is->clear();} + std::istream& replaceStream (std::istream &s); + UInt32 readUnsigned (int n); + UInt32 readUnsigned (int n, CRC32 &crc32); + Int32 readSigned (int n); + Int32 readSigned (int n, CRC32 &crc32); + std::string readString (); + std::string readString (CRC32 &crc32, bool finalZero=false); + std::string readString (int length); + std::string readString (int length, CRC32 &crc32); + std::vector& readBytes (int n, std::vector &bytes); + std::vector& readBytes (int n, std::vector &bytes, CRC32 &crc32); + int readByte () {return _is->get();} + int readByte (CRC32 &crc32); + void seek (std::streampos pos, std::ios::seekdir dir) {_is->seekg(pos, dir);} + void seek (std::streampos pos) {_is->seekg(pos);} + std::streampos tell () const {return _is->tellg();} + int peek () const {return _is->peek();} + + protected: + std::istream& getInputStream () {return *_is;} + + private: + std::istream *_is; +}; + + +struct StreamReaderException : public MessageException +{ + StreamReaderException (const std::string &msg) : MessageException(msg) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp new file mode 100644 index 00000000000..db336b64d5f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.cpp @@ -0,0 +1,82 @@ +/************************************************************************* +** StreamWriter.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "CRC32.h" +#include "StreamWriter.h" + +using namespace std; + + +/** Writes an unsigned integer to the output stream. + * @param[in] val the value to write + * @param[in] n number of bytes to be considered */ +void StreamWriter::writeUnsigned (UInt32 val, int n) { + for (n--; n >= 0; n--) + _os.put((val >> (8*n)) & 0xff); +} + + +/** Writes a signed integer to the output stream. + * @param[in] val the value to write + * @param[in] n number of bytes to be considered */ +void StreamWriter::writeSigned (Int32 val, int n) { + writeUnsigned((UInt32)val, n); +} + + +/** Writes a signed integer to the output stream. + * @param[in] val the value to write + * @param[in] finalZero if true, a final 0-byte is appended */ +void StreamWriter::writeString (const string &str, bool finalZero) { + for (size_t i=0; i < str.length(); i++) + _os.put(str[i]); + if (finalZero) + _os.put(0); +} + + +/** Writes an unsigned integer to the output stream. + * @param[in] val the value to write + * @param[in] n number of bytes to be considered + * @param[in,out] crc32 checksum to be updated */ +void StreamWriter::writeUnsigned (UInt32 val, int n, CRC32 &crc32) { + writeUnsigned(val, n); + crc32.update(val, n); +} + + +/** Writes a signed integer to the output stream and updates the CRC32 checksum. + * @param[in] val the value to write + * @param[in] n number of bytes to be considered + * @param[in,out] crc32 checksum to be updated */ +void StreamWriter::writeSigned (Int32 val, int n, CRC32 &crc32) { + writeUnsigned((UInt32)val, n, crc32); +} + + +/** Writes a string to the output stream and updates the CRC32 checksum. + * @param[in] str the string to write + * @param[in,out] crc32 checksum to be updated + * @param[in] finalZero if true, a final 0-byte is appended */ +void StreamWriter::writeString (const std::string &str, CRC32 &crc32, bool finalZero) { + writeString(str, finalZero); + crc32.update((const UInt8*)str.c_str(), str.length() + (finalZero ? 1 : 0)); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h new file mode 100644 index 00000000000..a17c891e741 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/StreamWriter.h @@ -0,0 +1,46 @@ +/************************************************************************* +** StreamWriter.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_STREAMWRITER_H +#define DVISVGM_STREAMWRITER_H + +#include +#include "types.h" + + +class CRC32; + +class StreamWriter +{ + public: + StreamWriter (std::ostream &os) : _os(os) {} + virtual ~StreamWriter () {} + void writeUnsigned (UInt32 val, int n); + void writeSigned (Int32 val, int n); + void writeString (const std::string &str, bool finalZero=false); + void writeUnsigned (UInt32 val, int n, CRC32 &crc32); + void writeSigned (Int32 val, int n, CRC32 &crc32); + void writeString (const std::string &str, CRC32 &crc32, bool finalZero=false); + + private: + std::ostream &_os; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp new file mode 100644 index 00000000000..b71775e9297 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.cpp @@ -0,0 +1,267 @@ +/************************************************************************* +** Subfont.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "FileFinder.h" +#include "Subfont.h" +#include "Message.h" + +using namespace std; + +// helper functions + +static int skip_mapping_data (istream &is); +static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, int &pos); + + +/** Constructs a new SubfontDefinition object. + * @param[in] name name of subfont definition + * @param[in] fpath path to corresponding .sfd file*/ +SubfontDefinition::SubfontDefinition (const string &name, const char *fpath) : _sfname(name) { + // read all subfont IDs from the .sfd file but skip the mapping data + ifstream is(fpath); + while (is) { + if (is.peek() == '#') // comment line? + is.ignore(numeric_limits::max(), '\n'); // => skip it + else if (isspace(is.peek())) + is.get(); + else { + string id; + while (is && !isspace(is.peek())) + id += is.get(); + if (!id.empty()) { + pair state = _subfonts.insert(pair(id, (Subfont*)0)); + if (state.second) // id was not present in map already + state.first->second = new Subfont(*this, state.first->first); + skip_mapping_data(is); + } + } + } +} + + +SubfontDefinition::~SubfontDefinition () { + for (Iterator it=_subfonts.begin(); it != _subfonts.end(); ++it) + delete it->second; +} + + +/** Looks for a subfont definition of the given name and returns the corresponding object. + * All objects are only created once for a given name and stored in an internal cache. + * @param[in] name name of subfont definition to lookup + * @return pointer to subfont definition object or 0 if it doesn't exist */ +SubfontDefinition* SubfontDefinition::lookup (const std::string &name) { + typedef map SFDMap; + static SFDMap sfdMap; + SFDMap::iterator it = sfdMap.find(name); + if (it != sfdMap.end()) + return it->second; + SubfontDefinition *sfd=0; + if (const char *path = FileFinder::lookup(name+".sfd", false)) { + sfd = new SubfontDefinition(name, path); + sfdMap[name] = sfd; + } + return sfd; +} + + +/** Returns the full path to the corresponding .sfd file or 0 if it can't be found. */ +const char* SubfontDefinition::path () const { + return FileFinder::lookup(filename(), false); +} + + +/** Returns the subfont with the given ID, or 0 if it doesn't exist. */ +Subfont* SubfontDefinition::subfont (const string &id) const { + ConstIterator it = _subfonts.find(id); + if (it != _subfonts.end()) + return it->second; + return 0; +} + + +/** Returns all subfonts defined in this SFD. */ +int SubfontDefinition::subfonts (vector &sfs) const { + for (ConstIterator it=_subfonts.begin(); it != _subfonts.end(); ++it) + sfs.push_back(it->second); + return sfs.size(); +} + +////////////////////////////////////////////////////////////////////// + +Subfont::~Subfont () { + delete [] _mapping; +} + + +/** Reads the character mappings for a given subfont ID. + * Format of subfont definition (sfd) files: + * sfd ::= (ID entries | '#' '\n')* + * ID ::= + * entries ::= (integer | integer ':' | integer '_' integer)* + * The mapping data for a subfont is given as a sequence of 256 16-bit values where + * value v at position c defines the (global) character code that is assigned to the + * local subfont character c. The sequence v,v+1,v+2,...,v+n can be abbreviated with + * v '_' v+n, e.g. 10_55. In order to continue the sequence at a different position, + * the syntax number ':' can be used. Example: 10: 5 6 7 assigns the values v=5, 6, 7 + * to c=10, 11 and 12, respectively. + * @return true if the data has been read successfully */ +bool Subfont::read () { + if (_mapping) // if there's already a mapping assigned, we're finished here + return true; + if (const char *p = _sfd.path()) { + ifstream is(p); + if (!is) + return false; + + int lineno=1; + while (is) { + if (is.peek() == '#' || is.peek() == '\n') { + is.ignore(numeric_limits::max(), '\n'); // skip comment and empty line + lineno++; + } + else if (isspace(is.peek())) + is.get(); + else { + string id; + while (is && !isspace(is.peek())) + id += is.get(); + if (id != _id) + lineno += skip_mapping_data(is); + else { + // build mapping array + _mapping = new UInt16[256]; + memset(_mapping, 0, 256*sizeof(UInt16)); + int pos=0; + char buf[1024]; + bool complete=false; + while (!complete) { + is.getline(buf, 1024); + complete = scan_line(buf, lineno, _mapping, _sfd.filename() ,pos); + } + return true; + } + } + } + } + return false; +} + + +/** Returns the global character code of the target font for a + * (local) character code of the subfont. + * @param[in] c local character code relative to the subfont + * @return character code of the target font */ +UInt16 Subfont::decode (unsigned char c) { + if (!_mapping && !read()) + return 0; + return _mapping[c]; +} + + +////////////////////////////////////////////////////////////////////// + + +/** Skips the mapping data of a subfont entry. + * @param[in] is stream to read from + * @return number of lines skipped */ +static int skip_mapping_data (istream &is) { + char buf[1024]; + bool complete=false; + int lines=0; + while (is && !complete) { + is.getline(buf, 1024); + if (is.gcount() > 1) + lines++; + const char *p = buf+is.gcount()-2; + while (p >= buf && isspace(*p)) + p--; + complete = (p < buf || *p != '\\'); // line doesn't end with backslash + } + return lines; +} + + +/** Scans a single line of mapping data and stores the values in the given array. + * @param[in] line the line of text to be scanned + * @param[in] lineno line number used in exception messages + * @param[in,out] mapping the mapping data + * @param[in] fname name of the mapfile being scanned + * @param[in,out] offset position/index of next mapping value + * @return true if the line is the last one the current mapping sequence, i.e. the line doesn't end with a backslash */ +static bool scan_line (const char *line, int lineno, UInt16 *mapping, const string &fname, int &offset) { + const char *p=line; + char *q; + for (; *p && isspace(*p); p++); + while (*p) { + if (*p == '\\') { + while (*++p) + if (!isspace(*p)) + throw SubfontException("unexpected backslash in mapping table", fname, lineno); + } + else { + long val1 = strtol(p, &q, 0); // first value of range + long val2; // last value of range + ostringstream oss; // output stream for exception messages + switch (*q) { + case ':': + if (val1 < 0 || val1 > 255) + throw SubfontException(oss << "offset value " << val1 << " out of range (0-255)", fname, lineno); + offset = val1; + val1 = -1; + q++; + break; + case '_': + p = q+1; + val2 = strtol(p, &q, 0); + if (val1 < 0 || val1 > 0xffffL) + throw SubfontException(oss << "table value " << val1 << " out of range", fname, lineno); + if (val2 < 0 || val2 > 0xffffL) + throw SubfontException(oss << "table value " << val2 << " out of range", fname, lineno); + if (p == q || (!isspace(*q) && *q != '\\' && *q)) + throw SubfontException(oss << "unexpected character '" << *q << "'", fname, lineno); + break; + default: + if (p == q || (!isspace(*q) && *q != '\\' && *q)) + throw SubfontException(oss << "unexpected character '" << *q << "'", fname, lineno); + if (val1 < 0 || val1 > 0xffffL) + throw SubfontException("invalid character code", fname, lineno); + val2 = val1; + } + if (val1 >= 0) { + if (val1 > val2 || offset+val2-val1 > 255) + throw SubfontException(oss << "invalid range in mapping table: " << hex << val1 << '_' << val2, fname, lineno); + for (long v=val1; v <= val2; v++) { + if (mapping[offset]) + throw SubfontException(oss << "mapping of character " << offset << " already defined", fname, lineno); + mapping[offset++] = static_cast(v); + } + } + for (p=q; *p && isspace(*p); p++); + } + } + for (p--; p >= line && isspace(*p); p--); + return p < line || *p != '\\'; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h new file mode 100644 index 00000000000..4585a0981df --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Subfont.h @@ -0,0 +1,102 @@ +/************************************************************************* +** Subfont.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SUBFONT_H +#define DVISVGM_SUBFONT_H + +#include +#include +#include +#include +#include +#include "MessageException.h" +#include "types.h" + + +class Subfont; + + +/** Represents a collection of subfont mappings as defined in a .sfd file, and + * encapsulates the evaluation of these files. */ +class SubfontDefinition +{ + typedef std::map Subfonts; + typedef Subfonts::iterator Iterator; + typedef Subfonts::const_iterator ConstIterator; + public: + ~SubfontDefinition (); + static SubfontDefinition* lookup (const std::string &name); +// int getIDs (std::vector &ids) const; + const std::string& name() const {return _sfname;} + std::string filename() const {return _sfname+".sfd";} + Subfont* subfont (const std::string &id) const; + int subfonts (std::vector &sfs) const; + const char* path () const; + + protected: + SubfontDefinition (const std::string &name, const char *fpath); + SubfontDefinition (const SubfontDefinition &sfd) {} + + private: + std::string _sfname; ///< name of subfont + Subfonts _subfonts; ///< all subfonts defined in the corresponding .sfd file +}; + + +/** Represents a single subfont mapping defined in a SubfontDefinition (.sfd file). */ +class Subfont +{ + friend class SubfontDefinition; + public: + ~Subfont(); + const std::string& id () const {return _id;} + UInt16 decode (unsigned char c); + + protected: + Subfont (SubfontDefinition &sfd, const std::string &id) : _sfd(sfd), _id(id), _mapping(0) {} + bool read (); + + private: + SubfontDefinition &_sfd; ///< SubfontDefinition where this Subfont belongs to + const std::string &_id; ///< id of this subfont as specified in the .sfd file + UInt16 *_mapping; ///< the character mapping table with 256 entries +}; + + +class SubfontException : public MessageException +{ + public: + SubfontException (const std::string &msg, const std::string &fname, int lineno=0) + : MessageException(msg), _fname(fname), _lineno(lineno) {} + + SubfontException (const std::ostream &oss, const std::string &fname, int lineno=0) + : MessageException(dynamic_cast(oss).str()), _fname(fname), _lineno(lineno) {} + + virtual ~SubfontException () throw() {} + + const char* filename () const {return _fname.c_str();} + int lineno () const {return _lineno;} + + private: + std::string _fname; + int _lineno; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp new file mode 100644 index 00000000000..1bbd4378df4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.cpp @@ -0,0 +1,50 @@ +/************************************************************************* +** System.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "System.h" + +#if defined (HAVE_SYS_TIME_H) +#include +#elif defined (HAVE_SYS_TIMEB_H) +#include +#endif + + +using namespace std; + + +/** Returns timestamp (wall time) in seconds. */ +double System::time () { +#if defined (HAVE_SYS_TIME_H) + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + tv.tv_usec/1000000.0; +#elif defined (HAVE_SYS_TIMEB_H) + struct timeb tb; + ftime(&tb); + return tb.time + tb.millitm/1000.0; +#else + clock_t myclock = clock(); + return double(myclock)/CLOCKS_PER_SEC; +#endif +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/System.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.h new file mode 100644 index 00000000000..ffca48e1cd3 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/System.h @@ -0,0 +1,29 @@ +/************************************************************************* +** System.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_SYSTEM_H +#define DVISVGM_SYSTEM_H + +namespace System +{ + double time (); +} + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp new file mode 100644 index 00000000000..6e3ad81eb9a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.cpp @@ -0,0 +1,156 @@ +/************************************************************************* +** TFM.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include "FileFinder.h" +#include "Message.h" +#include "StreamReader.h" +#include "TFM.h" + +using namespace std; + + +/** Reads a sequence of n TFM words (4 Bytes each). + * @param[in] sr the TFM data is read from this object + * @param[out] v the read words + * @param[in] n number of words to be read */ +template +static void read_words (StreamReader &sr, vector &v, unsigned n) { + v.clear(); + v.resize(n); + for (unsigned i=0; i < n; i++) + v[i] = sr.readUnsigned(4); +} + + +/** Converts a TFM fix point value to double (PS point units). */ +static double fix2double (FixWord fix) { + const double pt2bp = 72/72.27; + return double(fix)/(1 << 20)*pt2bp; +} + + +TFM::TFM (istream &is) { + is.seekg(0); + StreamReader sr(is); + UInt16 lf = UInt16(sr.readUnsigned(2)); // length of entire file in 4 byte words + UInt16 lh = UInt16(sr.readUnsigned(2)); // length of header in 4 byte words + _firstChar= UInt16(sr.readUnsigned(2)); // smallest character code in font + _lastChar = UInt16(sr.readUnsigned(2)); // largest character code in font + UInt16 nw = UInt16(sr.readUnsigned(2)); // number of words in width table + UInt16 nh = UInt16(sr.readUnsigned(2)); // number of words in height table + UInt16 nd = UInt16(sr.readUnsigned(2)); // number of words in depth table + UInt16 ni = UInt16(sr.readUnsigned(2)); // number of words in italic corr. table + UInt16 nl = UInt16(sr.readUnsigned(2)); // number of words in lig/kern table + UInt16 nk = UInt16(sr.readUnsigned(2)); // number of words in kern table + UInt16 ne = UInt16(sr.readUnsigned(2)); // number of words in ext. char table + UInt16 np = UInt16(sr.readUnsigned(2)); // number of font parameter words + + if (6+lh+(_lastChar-_firstChar+1)+nw+nh+nd+ni+nl+nk+ne+np != lf) + throw FontMetricException("inconsistent length values"); + if (_firstChar >= _lastChar || _lastChar > 255 || ne > 256) + throw FontMetricException("character codes out of range"); + + readHeader(sr); + is.seekg(24+lh*4); // move to char info table + readTables(sr, nw, nh, nd, ni); +} + + +void TFM::readHeader (StreamReader &sr) { + _checksum = sr.readUnsigned(4); + _designSize = sr.readUnsigned(4); +} + + +void TFM::readTables (StreamReader &sr, int nw, int nh, int nd, int ni) { + read_words(sr, _charInfoTable, _lastChar-_firstChar+1); + read_words(sr, _widthTable, nw); + read_words(sr, _heightTable, nh); + read_words(sr, _depthTable, nd); + read_words(sr, _italicTable, ni); +} + + +/** Returns the design size of this font in PS point units. */ +double TFM::getDesignSize () const { + return fix2double(_designSize); +} + + +/** Returns the index to the entry of the character info table that describes the metric of a given character. + * @param[in] c character whose index is retrieved + * @return table index for character c, or -1 if there's no entry */ +int TFM::charIndex (int c) const { + if (c < _firstChar || c > _lastChar || size_t(c-_firstChar) >= _charInfoTable.size()) + return -1; + return c-_firstChar; +} + + +// the char info word for each character consists of 4 bytes holding the following information: +// width index w, height index (h), depth index (d), italic correction index (it), +// tag (tg) and a remainder: +// +// byte 1 | byte 2 | byte 3 | byte 4 +// xxxxxxxx | xxxx xxxx | xxxxxx xx | xxxxxxxx +// w | h d | it tg | remainder + +/** Returns the width of char c in PS point units. */ +double TFM::getCharWidth (int c) const { + int index = charIndex(c); + if (index < 0) + return 0; + index = (_charInfoTable[index] >> 24) & 0xFF; + return fix2double(_widthTable[index]) * fix2double(_designSize); +} + + +/** Returns the height of char c in PS point units. */ +double TFM::getCharHeight (int c) const { + int index = charIndex(c); + if (index < 0) + return 0; + index = (_charInfoTable[index] >> 20) & 0x0F; + return fix2double(_heightTable[index]) * fix2double(_designSize); +} + + +/** Returns the depth of char c in PS point units. */ +double TFM::getCharDepth (int c) const { + int index = charIndex(c); + if (index < 0) + return 0; + index = (_charInfoTable[index] >> 16) & 0x0F; + return fix2double(_depthTable[index]) * fix2double(_designSize); +} + + +/** Returns the italic correction of char c in PS point units. */ +double TFM::getItalicCorr (int c) const { + int index = charIndex(c); + if (index < 0) + return 0; + index = (_charInfoTable[index] >> 10) & 0x3F; + return fix2double(_italicTable[index]) * fix2double(_designSize); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h new file mode 100644 index 00000000000..3afc88ec83d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TFM.h @@ -0,0 +1,66 @@ +/************************************************************************* +** TFM.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_TFM_H +#define DVISVGM_TFM_H + +#include +#include +#include +#include "FontMetrics.h" +#include "types.h" +#include "StreamReader.h" + +class StreamReader; + +class TFM : public FontMetrics +{ + public: +// TFM (const char *fname); + TFM (std::istream &is); + double getDesignSize () const; + double getCharWidth (int c) const; + double getCharHeight (int c) const; + double getCharDepth (int c) const; + double getItalicCorr (int c) const; + bool verticalLayout () const {return false;} + UInt32 getChecksum () const {return _checksum;} + UInt16 firstChar () const {return _firstChar;} + UInt16 lastChar () const {return _lastChar;} + + protected: + TFM () : _checksum(0), _firstChar(0), _lastChar(0), _designSize(0) {} + void readHeader (StreamReader &sr); + void readTables (StreamReader &sr, int nw, int nh, int nd, int ni); + virtual int charIndex (int c) const; + void setCharRange (int firstchar, int lastchar) {_firstChar=firstchar; _lastChar=lastchar;} + + private: + UInt32 _checksum; + UInt16 _firstChar, _lastChar; + FixWord _designSize; ///< design size of the font in TeX points (7227 pt = 254 cm) + std::vector _charInfoTable; + std::vector _widthTable; ///< character widths in design size units + std::vector _heightTable; ///< character height in design size units + std::vector _depthTable; ///< character depth in design size units + std::vector _italicTable; ///< italic corrections in design size units +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp new file mode 100644 index 00000000000..2ad8a4c29dc --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.cpp @@ -0,0 +1,549 @@ +/************************************************************************* +** TensorProductPatch.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "TensorProductPatch.h" + +using namespace std; + + +TensorProductPatch::TensorProductPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TensorProductPatch *patch) + : ShadingPatch(cspace) +{ + setPoints(points, edgeflag, patch); + setColors(colors, edgeflag, patch); +} + + +void TensorProductPatch::setFirstMatrixColumn (const DPair source[4], bool reverse) { + for (int i=0; i < 4; i++) + _points[i][0] = source[reverse ? 3-i : i]; +} + + +void TensorProductPatch::setFirstMatrixColumn (DPair source[4][4], int col, bool reverse) { + for (int i=0; i < 4; i++) + _points[i][0] = source[reverse ? 3-i : i][col]; +} + + +/*void TensorProductPatch::setPoints (const DPair points[4][4]) { + for (int i=0; i < 4; i++) + for (int j=0; j < 4; j++) + _points[i][j] = points[i][j]; +}*/ + + +/** Sets the control points defining the structure of the patch. If the edge flag is 0, + * the point vector must contain all 16 control points of the 4x4 matrix in "spiral" order: + * 0 11 10 9 + * 1 12 15 8 + * 2 13 14 7 + * 3 4 5 6 + * If the edge flag is 1,2, or 3, the points of the first matrix collumn + * are omitted, and taken from a reference patch instead. + * @param[in] points the control points in "spiral" order as described in the PS reference, p. 286 + * @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) { + TensorProductPatch *tpPatch = dynamic_cast(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)) + throw ShadingException("invalid number of control points in tensor-product patch definition"); + + // assign the 12 control points that are invariant for all edge flag values + int i = (edgeflag == 0 ? 4 : 0); + _points[3][1] = points[i++]; + _points[3][2] = points[i++]; + _points[3][3] = points[i++]; + _points[2][3] = points[i++]; + _points[1][3] = points[i++]; + _points[0][3] = points[i++]; + _points[0][2] = points[i++]; + _points[0][1] = points[i++]; + _points[1][1] = points[i++]; + _points[2][1] = points[i++]; + _points[2][2] = points[i++]; + _points[1][2] = points[i]; + // populate the first column of the control point matrix + switch (edgeflag) { + case 0: setFirstMatrixColumn(&points[0], false); break; + case 1: setFirstMatrixColumn(tpPatch->_points[3], false); break; + case 2: setFirstMatrixColumn(tpPatch->_points, 3, true); break; + case 3: setFirstMatrixColumn(tpPatch->_points[0], true); break; + } +} + + +/** Sets the vertex colors of the patch. If the edge flag is 0, + * the color vector must contain all 4 colors in the following order: + * c00, c30, c33, c03, where cXY belongs to the vertex pXY of the control + * point matrix. + * c00 ---- c03 + * | | + * | | + * c30 ---- c33 + * If the edge flag is 1,2, or 3, the colors c00 and c30 are omitted, + * and taken from a reference patch instead. + * @param[in] points the color values in the order c00, c30, c33, c03 + * @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) { + TensorProductPatch *tpPatch = dynamic_cast(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)) + throw ShadingException("invalid number of colors in tensor-product patch definition"); + + int i = (edgeflag == 0 ? 2 : 0); + _colors[3] = colors[i]; + _colors[1] = colors[i+1]; + switch (edgeflag) { + case 0: _colors[0] = colors[0]; _colors[2] = colors[1]; break; + case 1: _colors[0] = tpPatch->_colors[2]; _colors[2] = tpPatch->_colors[3]; break; + case 2: _colors[0] = tpPatch->_colors[3]; _colors[2] = tpPatch->_colors[1]; break; + case 3: _colors[0] = tpPatch->_colors[1]; _colors[2] = tpPatch->_colors[0]; break; + } +} + + +/** Returns the point P(u,v) of the patch. */ +DPair TensorProductPatch::valueAt (double u, double v) const { + // check if we can return one of the vertices + if (u == 0) { + if (v == 0) + return _points[0][0]; + else if (v == 1) + return _points[3][0]; + } + else if (u == 1) { + if (v == 0) + return _points[0][3]; + else if (v == 1) + return _points[3][3]; + } + // compute tensor product + DPair p[4]; + for (int i=0; i < 4; i++) { + Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); + p[i] = bezier.valueAt(u); + } + Bezier bezier(p[0], p[1], p[2], p[3]); + return bezier.valueAt(v); +} + + +/** Returns the color at point P(u,v) which is bilinearly interpolated from + * the colors assigned to vertices of the patch. */ +Color TensorProductPatch::colorAt (double u, double v) const { + // check if we can return one of the vertex colors + if (u == 0) { + if (v == 0) + return _colors[0]; + else if (v == 1) + return _colors[2]; + } + else if (u == 1) { + if (v == 0) + return _colors[1]; + else if (v == 1) + return _colors[3]; + } + // interpolate color + ColorGetter getComponents; + ColorSetter setComponents; + colorQueryFuncs(getComponents, setComponents); + valarray comp[4]; + for (int i=0; i < 4; i++) + (_colors[i].*getComponents)(comp[i]); + Color color; + (color.*setComponents)((1-u)*(1-v)*comp[0] + u*(1-v)*comp[1] + (1-u)*v*comp[2] + u*v*comp[3]); + return color; +} + + +Color TensorProductPatch::averageColor () const { + return averageColor(_colors[0], _colors[1], _colors[2], _colors[3]); +} + + +/** Compute the average of four given colors depending on the assigned color space. */ +Color TensorProductPatch::averageColor (const Color &c1, const Color &c2, const Color &c3, const Color &c4) const { + ColorGetter getComponents; + ColorSetter setComponents; + colorQueryFuncs(getComponents, setComponents); + valarray va1, va2, va3, va4; + (c1.*getComponents)(va1); + (c2.*getComponents)(va2); + (c3.*getComponents)(va3); + (c4.*getComponents)(va4); + Color averageColor; + (averageColor.*setComponents)((va1+va2+va3+va4)/4.0); + return averageColor; +} + + +void TensorProductPatch::getBoundaryPath (GraphicPath &path) const { + // Simple approach: Use the outer curves as boundary path. This doesn't always lead + // to correct results since, depending on the control points, P(u,v) might exceed + // the simple boundary. + path.moveto(_points[0][0]); + path.cubicto(_points[0][1], _points[0][2], _points[0][3]); + path.cubicto(_points[1][3], _points[2][3], _points[3][3]); + path.cubicto(_points[3][2], _points[3][1], _points[3][0]); + path.cubicto(_points[2][0], _points[1][0], _points[0][0]); + path.closepath(); +} + + +/** Computes the bicubically interpolated isoparametric Bézier curve P(u,t) that + * runs "vertically" from P(u,0) to P(u,1) through the patch P. + * @param[in] u "horizontal" parameter in the range from 0 to 1 + * @param[out] bezier the resulting Bézier curve */ +void TensorProductPatch::verticalCurve (double u, Bezier &bezier) const { + // check for simple cases (boundary curves) first + if (u == 0) + bezier.setPoints(_points[0][0], _points[1][0], _points[2][0], _points[3][0]); + else if (u == 1) + bezier.setPoints(_points[0][3], _points[1][3], _points[2][3], _points[3][3]); + else { + // compute "inner" curve + DPair p[4]; + for (int i=0; i < 4; i++) { + Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); + p[i] = bezier.valueAt(u); + } + bezier.setPoints(p[0], p[1], p[2], p[3]); + } +} + + +/** Computes the bicubically interpolated isoparametric Bézier curve P(t,v) that + * runs "horizontally" from P(0,v) to P(1,v) through the patch P. + * @param[in] v "vertical" parameter in the range from 0 to 1 + * @param[out] bezier the resulting Bézier curve */ +void TensorProductPatch::horizontalCurve (double v, Bezier &bezier) const { + // check for simple cases (boundary curves) first + if (v == 0) + bezier.setPoints(_points[0][0], _points[0][1], _points[0][2], _points[0][3]); + else if (v == 1) + bezier.setPoints(_points[3][0], _points[3][1], _points[3][2], _points[3][3]); + else { + // compute "inner" curve + DPair p[4]; + for (int i=0; i < 4; i++) { + Bezier bezier(_points[0][i], _points[1][i], _points[2][i], _points[3][i]); + p[i] = bezier.valueAt(v); + } + bezier.setPoints(p[0], p[1], p[2], p[3]); + } +} + + +/** Computes the sub-patch that maps the unit square [0,1]x[0,1] to + * the area P([u1,u2],[v1,v2]) of patch P. The control points of the sub-patch + * can easily be calculated using the tensor product blossom of patch P. + * See G. Farin: Curves and Surfaces for CAGD, p. 259 for example. */ +void TensorProductPatch::subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const { + if (u1 > u2) swap(u1, u2); + if (v1 > v2) swap(v1, v2); + // compute control points + double u[] = {u1, u1, u1, 0}; // blossom parameters of the "horizontal" domain (plus dummy value 0) + for (int i=0; i < 4; i++) { + u[3-i] = u2; + double v[] = {v1, v1, v1, 0}; // blossom parameters of the "vertical" domain (plus dummy value 0) + for (int j=0; j < 4; j++) { + v[3-j] = v2; + patch._points[i][j] = blossomValue(u, v); + } + } + // assign color values + patch._colors[0] = colorAt(u1, v1); + patch._colors[1] = colorAt(u2, v1); + patch._colors[2] = colorAt(u1, v2); + patch._colors[3] = colorAt(u2, v2); +} + + +/** Computes the value b(u1,u2,u3;v1,v2,v3) where b is tensor product blossom of the patch. */ +DPair TensorProductPatch::blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const { + DPair p[4]; + for (int i=0; i < 4; i++) { + Bezier bezier(_points[i][0], _points[i][1], _points[i][2], _points[i][3]); + p[i] = bezier.blossomValue(u1, u2, u3); + } + Bezier bezier(p[0], p[1], p[2], p[3]); + return bezier.blossomValue(v1, v2, v3); +} + + +/** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values + * greater than or near 1 are mapped to 1. */ +static inline double snap (double x) { + if (fabs(x) < 0.001) + return 0; + if (fabs(1-x) < 0.001) + return 1; + return x; +} + + +/** Computes a single row of segments approximating the patch region between v1 and v1+inc. */ +void TensorProductPatch::approximateRow (double v1, double inc, bool overlap, double delta, const vector &vbeziers, Callback &callback) const { + double v2 = snap(v1+inc); + double ov2 = (overlap && v2 < 1) ? snap(v2+inc) : v2; + Bezier hbezier1, hbezier2; + horizontalCurve(v1, hbezier1); + horizontalCurve(ov2, hbezier2); + double u1 = 0; + for (size_t i=1; i < vbeziers.size(); i++) { + double u2 = snap(u1+inc); + double ou2 = (overlap && u2 < 1) ? snap(u2+inc) : u2; + // compute segment boundaries + Bezier b1(hbezier1, u1, ou2); + Bezier b2(vbeziers[i + (overlap && i < vbeziers.size()-1 ? 1 : 0)], v1, ov2); + Bezier b3(hbezier2, u1, ou2); + Bezier b4(vbeziers[i-1], v1, ov2); + GraphicPath path; + path.moveto(b1.point(0)); + if (inc > delta) { + path.cubicto(b1.point(1), b1.point(2), b1.point(3)); + path.cubicto(b2.point(1), b2.point(2), b2.point(3)); + path.cubicto(b3.point(2), b3.point(1), b3.point(0)); + path.cubicto(b4.point(2), b4.point(1), b4.point(0)); + } + else { + path.lineto(b1.point(3)); + path.lineto(b2.point(3)); + path.lineto(b3.point(0)); + } + path.closepath(); + callback.patchSegment(path, averageColor(colorAt(u1, v1), colorAt(u2, v1), colorAt(u1, v2), colorAt(u2, v2))); + u1 = u2; + } +} + + +/** Approximate the patch by dividing it into a grid of segments that are filled with the + * average color of the corresponding region. The boundary of each segment consists of + * four Bézier curves, too. In order to prevent visual gaps between neighbored segments due + * to anti-aliasing, the flag 'overlap' can be set. It enlarges the segments so that they overlap + * with their right and bottom neighbors (which are drawn on top of the overlapping regions). + * @param[in] gridsize number of segments per row/column + * @param[in] overlap if true, enlarge each segment to overlap with its right and bottom neighbors + * @param[in] delta reduce level of detail if the segment size is smaller than the given value + * @param[in] callback object notified */ +void TensorProductPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { + if (_colors[0] == _colors[1] && _colors[1] == _colors[2] && _colors[2] == _colors[3]) { + // simple case: monochromatic patch + GraphicPath path; + getBoundaryPath(path); + callback.patchSegment(path, _colors[0]); + } + else { + const double inc = 1.0/gridsize; + // collect curves dividing the patch into several columns (curved vertical stripes) + vector vbeziers(gridsize+1); + double u=0; + for (int i=0; i <= gridsize; i++) { + verticalCurve(u, vbeziers[i]); + u = snap(u+inc); + } + // compute the segments row by row + double v=0; + for (int i=0; i < gridsize; i++) { + approximateRow(v, inc, overlap, delta, vbeziers, callback); + v = snap(v+inc); + } + } +} + + +void TensorProductPatch::getBBox (BoundingBox &bbox) const { + Bezier bezier; + BoundingBox bezierBox; + for (int i=0; i <= 1; i++) { + horizontalCurve(i, bezier); + bezier.getBBox(bezierBox); + bbox.embed(bezierBox); + verticalCurve(i, bezier); + bezier.getBBox(bezierBox); + bbox.embed(bezierBox); + } +} + + +#if 0 +void TensorProductPatch::approximate (int gridsize, Callback &callback) const { + const double inc = 1.0/gridsize; + Bezier ubezier0; verticalCurve(0, ubezier0); + Bezier ubezier1; verticalCurve(1, ubezier1); + Bezier vbezier0; horizontalCurve(0, vbezier0); + Bezier vbezier1; horizontalCurve(1, vbezier1); + for (double v1=0; v1 < 1; v1=snap(v1+inc)) { + double v2 = snap(v1+inc); + DPair p0 = valueAt(0, v1); + DPair p2 = valueAt(0, v2); + Color c0 = colorAt(0, v1); + Color c2 = colorAt(0, v2); + double u1 = 0; + for (double u2=inc; u2 <= 1; u2=snap(u2+inc)) { + DPair p1 = valueAt(u2, v1); + DPair p3 = valueAt(u2, v2); + Color c1 = colorAt(u2, v1); + Color c3 = colorAt(u2, v2); + // Compute a single patch segment. Only those segment edges that lay on the + // patch boundary are drawn as Bézier curves, all other edges are approximated + // with straight lines. This ensures a smooth outline and reduces the number of + // time consuming computations. + GraphicPath path; + path.moveto(p0); + if (v1 > 0) + path.lineto(p1); + else { + Bezier bezier(vbezier0, u1, u2); + path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); + } + if (u2 < 1) + path.lineto(p3); + else { + Bezier bezier(ubezier1, v1, v2); + path.cubicto(bezier.point(1), bezier.point(2), bezier.point(3)); + } + if (v2 < 1) + path.lineto(p2); + else { + Bezier bezier(vbezier1, u1, u2); + path.cubicto(bezier.point(2), bezier.point(1), bezier.point(0)); + } + if (u1 > 0) + path.closepath(); + else { + Bezier bezier(ubezier0, v1, v2); + path.cubicto(bezier.point(2), bezier.point(1), bezier.point(0)); + path.closepath(); + } + callback.patchSegment(path, averageColor(c0, c1, c2, c3)); + p0 = p1; + p2 = p3; + c0 = c1; + c2 = c3; + u1 = u2; + } + } +} +#endif + + +///////////////////////////////////////////////////////////////////////////////////// + + +CoonsPatch::CoonsPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, CoonsPatch *patch) + : TensorProductPatch(cspace) +{ + setPoints(points, edgeflag, patch); + setColors(colors, edgeflag, patch); +} + + +DPair CoonsPatch::valueAt (double u, double v) const { + // Compute the value of P(u,v) using the Coons equation rather than the + // tensor product since the "inner" control points of the tensor matrix + // might not be set yet. + Bezier bezier1(_points[3][0], _points[3][1], _points[3][2], _points[3][3]); + Bezier bezier2(_points[0][0], _points[0][1], _points[0][2], _points[0][3]); + Bezier bezier3(_points[3][0], _points[2][0], _points[1][0], _points[0][0]); + Bezier bezier4(_points[3][3], _points[2][3], _points[1][3], _points[0][3]); + DPair ph = bezier1.valueAt(u)*(1-v) + bezier2.valueAt(u)*v; + DPair pv = bezier3.valueAt(v)*(1-u) + bezier4.valueAt(v)*u; + DPair pc = (_points[3][0]*(1-u) + _points[3][3]*u)*(1-v) + (_points[0][0]*(1-u) + _points[0][3]*u)*v; + return ph+pv-pc; +} + + +/** Sets the 12 control points defining the geometry of the coons patch. The points + * must be given in the following order: + * 3 4 5 6 + * 2 7 + * 1 8 + * 0 11 10 9 + * where each edge of the square represents the four control points of a cubic Bézier curve. + * If the edge flag is 1, 2, or 3, the points 0 to 3 are omitted, and taken from a reference + * patch instead. + * @param[in] points the control points in cyclic order as described in the PS reference, p. 281 + * @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) { + CoonsPatch *coonsPatch = dynamic_cast(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)) + throw ShadingException("invalid number of control points in Coons patch definition"); + + // Since a Coons patch is a special tensor product patch, we only have to reorder the + // control points and compute the additional "inner" points of the 4x4 point tensor matrix. + + // set outer control points of the tensor matrix except those of the first column + // because these points depend on the edge flag + int i = (edgeflag == 0 ? 4 : 0); + _points[3][1] = points[i++]; + _points[3][2] = points[i++]; + _points[3][3] = points[i++]; + _points[2][3] = points[i++]; + _points[1][3] = points[i++]; + _points[0][3] = points[i++]; + _points[0][2] = points[i++]; + _points[0][1] = points[i]; + + // set control points of first matrix column + switch (edgeflag) { + case 0: setFirstMatrixColumn(&points[0], false); break; + case 1: setFirstMatrixColumn(coonsPatch->_points[3], false); break; + case 2: setFirstMatrixColumn(coonsPatch->_points, 3, true); break; + case 3: setFirstMatrixColumn(coonsPatch->_points[0], true); break; + } + // compute inner control points of the tensor matrix + _points[1][1] = valueAt(1.0/3.0, 2.0/3.0); + _points[1][2] = valueAt(2.0/3.0, 2.0/3.0); + _points[2][1] = valueAt(1.0/3.0, 1.0/3.0); + _points[2][2] = valueAt(2.0/3.0, 1.0/3.0); +} + + +void CoonsPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { + CoonsPatch *coonsPatch = dynamic_cast(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)) + throw ShadingException("invalid number of colors in Coons patch definition"); + + int i = (edgeflag == 0 ? 2 : 0); + _colors[3] = colors[i]; + _colors[1] = colors[i+1]; + switch (edgeflag) { + case 0: _colors[0] = colors[0]; _colors[2] = colors[1]; break; + case 1: _colors[0] = coonsPatch->_colors[2]; _colors[2] = coonsPatch->_colors[3]; break; + case 2: _colors[0] = coonsPatch->_colors[3]; _colors[2] = coonsPatch->_colors[1]; break; + case 3: _colors[0] = coonsPatch->_colors[1]; _colors[2] = coonsPatch->_colors[0]; break; + } +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h new file mode 100644 index 00000000000..50fcac5a1e5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TensorProductPatch.h @@ -0,0 +1,95 @@ +/************************************************************************* +** TensorProductPatch.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef TENSORPRODUCTPATCH_H +#define TENSORPRODUCTPATCH_H + +#include +#include +#include +#include "Bezier.h" +#include "Color.h" +#include "MessageException.h" +#include "Pair.h" +#include "ShadingPatch.h" + + +/** This class represents a single tensor product patch P which is defined by 16 control points + * and 4 color values. The mapping of the unit square to the patch surface is defined as the sum + * \f[P(u,v):=\sum_{i=0}^3\sum_{j=0}^3 p_{ij} B_i(u) B_j(v)\f] + * where \f$B_k(t)={3\choose k}(1-t)^k t^k\f$ and \f$u,v \in [0,1]\f$. The four colors assigned + * to the vertices are interpolated bilinearily over the unit square. */ +class TensorProductPatch : public ShadingPatch +{ + friend class CoonsPatch; + + public: + TensorProductPatch () : ShadingPatch(Color::RGB_SPACE) {} + TensorProductPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} + TensorProductPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TensorProductPatch *patch); + int psShadingType() const {return 7;} + void setPoints (const DPair points[4][4], int edgeflag, TensorProductPatch *patch); + void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); + void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); + virtual DPair valueAt (double u, double v) const; + Color colorAt (double u, double v) const; + Color averageColor () const; + void horizontalCurve (double v, Bezier &bezier) const; + void verticalCurve (double u, Bezier &bezier) const; + void getBoundaryPath (GraphicPath &path) const; + void subpatch (double u1, double u2, double v1, double v2, TensorProductPatch &patch) const; + DPair blossomValue (double u1, double u2, double u3, double v1, double v2, double v3) const; + DPair blossomValue (double u[3], double v[3]) const {return blossomValue(u[0], u[1], u[2], v[0], v[1], v[2]);} + void approximate (int gridsize, bool overlap, double delta, Callback &callback) const; + void getBBox (BoundingBox &bbox) const; + int numPoints (int edgeflag) const {return edgeflag == 0 ? 16 : 12;} + int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} + + protected: + Color averageColor (const Color &c1, const Color &c2, const Color &c3, const Color &c4) const; + void approximateRow (double v1, double inc, bool overlap, double delta, const std::vector &beziers, Callback &callback) const; + void setFirstMatrixColumn (const DPair source[4], bool reverse); + void setFirstMatrixColumn (DPair source[4][4], int col, bool reverse); + + private: + DPair _points[4][4]; ///< control point matrix defining the patch surface + Color _colors[4]; ///< vertex colors cK (c0->p00, c1->p03, c2->p30, c3->p33) +}; + + +/** Coons patches are special tensor product patches where the four "inner" control points + * depend on the outer ones, i.e. they are computed automatically and can't be set by the user. + * Thus, a Coons patch is defined by 12 control points, 4 vertex colors and a corresponding + * color space. */ +class CoonsPatch : public TensorProductPatch +{ + public: + CoonsPatch () {} + CoonsPatch (Color::ColorSpace cspace) : TensorProductPatch(cspace) {} + CoonsPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, CoonsPatch *patch); + int psShadingType() const {return 6;} + virtual void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); + virtual void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); + virtual DPair valueAt (double u, double v) const; + int numPoints (int edgeflag) const {return edgeflag == 0 ? 12 : 8;} + int numColors (int edgeflag) const {return edgeflag == 0 ? 4 : 2;} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp new file mode 100644 index 00000000000..c0d74a5c16e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.cpp @@ -0,0 +1,208 @@ +/************************************************************************* +** Terminal.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "Terminal.h" + +#ifdef HAVE_TERMIOS_H +#include +#endif + +#ifdef GWINSZ_IN_SYS_IOCTL +#include +#endif + +#ifdef __WIN32__ +#include +#endif + +#include + + +using namespace std; + + +const int Terminal::RED = 1; +const int Terminal::GREEN = 2; +const int Terminal::BLUE = 4; + +const int Terminal::CYAN = GREEN|BLUE; +const int Terminal::YELLOW = RED|GREEN; +const int Terminal::MAGENTA = RED|BLUE; +const int Terminal::WHITE = RED|GREEN|BLUE; +const int Terminal::DEFAULT = -1; +const int Terminal::BLACK = 0; + +#ifdef __WIN32__ +int Terminal::_defaultColor; +int Terminal::_cursorHeight; +#endif + +int Terminal::_fgcolor = Terminal::DEFAULT; +int Terminal::_bgcolor = Terminal::DEFAULT; + + +/** Initializes the terminal. This method should be called before any of the others. + * @param[in,out] os terminal output stream (currently unused) */ +void Terminal::init (ostream &os) { +#ifdef __WIN32__ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + if (h != INVALID_HANDLE_VALUE) { + CONSOLE_SCREEN_BUFFER_INFO buffer_info; + GetConsoleScreenBufferInfo(h, &buffer_info); + _defaultColor = (buffer_info.wAttributes & 0xff); + CONSOLE_CURSOR_INFO cursor_info; + GetConsoleCursorInfo(h, &cursor_info); + _cursorHeight = cursor_info.dwSize; + } +#endif +} + + +/** Finishes the terminal output. Should be called after last terminal action. + * @param[in,out] os terminal output stream */ +void Terminal::finish (ostream &os) { + fgcolor(DEFAULT, os); + bgcolor(DEFAULT, os); + cursor(true); +} + + +/** Returns the number of terminal columns (number of characters per row). + * If it's not possible to retrieve information about the terminal size, 0 is returned. */ +int Terminal::columns () { +#if defined(TIOCGWINSZ) + struct winsize ws; + if (ioctl(fileno(stderr), TIOCGWINSZ, &ws) < 0) + return 0; + return ws.ws_col; +#elif defined(__WIN32__) + CONSOLE_SCREEN_BUFFER_INFO info; + if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &info)) + return 0; + return info.dwSize.X; +#else + return 0; +#endif +} + + +/** Returns the number of terminal rows. + * If it's not possible to retrieve information about the terminal size, 0 is returned. */ +int Terminal::rows () { +#if defined(TIOCGWINSZ) + struct winsize ws; + if (ioctl(fileno(stderr), TIOCGWINSZ, &ws) < 0) + return 0; + return ws.ws_row; +#elif defined(__WIN32__) + CONSOLE_SCREEN_BUFFER_INFO info; + if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &info)) + return 0; + return info.dwSize.Y; +#else + return 0; +#endif +} + + +/** Sets the foreground color. + * @param[in] color color code + * @param[in] os terminal output stream */ +void Terminal::fgcolor (int color, ostream &os) { + _fgcolor = color; + +#ifdef __WIN32__ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + if (h != INVALID_HANDLE_VALUE) { + CONSOLE_SCREEN_BUFFER_INFO info; + GetConsoleScreenBufferInfo(h, &info); + if (_fgcolor == DEFAULT) + color = _defaultColor & 0x0f; + else { + // swap red and blue bits + color = (color & 0x0a) | ((color & 1) << 2) | ((color & 4) >> 2); + } + color = (info.wAttributes & 0xf0) | (color & 0x0f); + SetConsoleTextAttribute(h, (DWORD)color); + } +#else + bool light = false; + if (color != DEFAULT && color > 7) { + light = true; + color %= 8; + } + if (color == DEFAULT) { + os << "\x1B[0m"; + if (_bgcolor != DEFAULT) + bgcolor(_bgcolor, os); + } + else + os << "\x1B[" << (light ? '1': '0') << ';' << (30+(color & 0x07)) << 'm'; +#endif +} + + +/** Sets the background color. + * @param[in] color color code + * @param[in] os terminal output stream */ +void Terminal::bgcolor (int color, ostream &os) { + _bgcolor = color; +#ifdef __WIN32__ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + if (h != INVALID_HANDLE_VALUE) { + CONSOLE_SCREEN_BUFFER_INFO info; + GetConsoleScreenBufferInfo(h, &info); + if (_bgcolor == DEFAULT) + color = (_defaultColor & 0xf0) >> 4; + else { + // swap red and blue bits + color = (color & 0x0a) | ((color & 1) << 2) | ((color & 4) >> 2); + } + color = (info.wAttributes & 0x0f) | ((color & 0x0f) << 4); + SetConsoleTextAttribute(h, (DWORD)color); + } +#else + if (color != DEFAULT && color > 7) + color %= 8; + if (color == DEFAULT) { + os << "\x1B[0m"; + if (_fgcolor != DEFAULT) + fgcolor(_fgcolor, os); + } + else + os << "\x1B[" << (40+(color & 0x07)) << 'm'; +#endif +} + + +/** Disables or enables the console cursor + * @param[in] visible if false, the cursor is disabled, and enabled otherwise */ +void Terminal::cursor (bool visible) { +#ifdef __WIN32__ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + if (h != INVALID_HANDLE_VALUE) { + CONSOLE_CURSOR_INFO cursor_info; + cursor_info.bVisible = visible; + cursor_info.dwSize = _cursorHeight; + SetConsoleCursorInfo(h, &cursor_info); + } +#endif +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h new file mode 100644 index 00000000000..8998e054f77 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Terminal.h @@ -0,0 +1,58 @@ +/************************************************************************* +** Terminal.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_TERMINAL_H +#define DVISVGM_TERMINAL_H + +#include + +class Terminal +{ + public: + static const int DEFAULT; + static const int BLACK; + static const int RED; + static const int GREEN; + static const int BLUE; + static const int CYAN; + static const int YELLOW; + static const int MAGENTA; + static const int WHITE; + + public: + static void init (std::ostream &os); + static void finish (std::ostream &os); + static int columns (); + static int rows (); + static void fgcolor (int color, std::ostream &os); + static void bgcolor (int color, std::ostream &os); + static void cursor (bool visible); + + private: + static int _fgcolor; ///< current foreground color + static int _bgcolor; ///< current background color + +#ifdef __WIN32__ + static int _defaultColor; + static int _cursorHeight; ///< current height of the cursor in percent +#endif +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp new file mode 100644 index 00000000000..fa749d31f38 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp @@ -0,0 +1,106 @@ +/************************************************************************* +** ToUnicodeMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "ToUnicodeMap.h" +#include "Unicode.h" + +using namespace std; + + +/** Adds valid but random mappings for all missing character indexes. + * If a font's cmap table doesn't provide Unicode mappings for some + * glyphs in the font, it's necessary to fill the gaps in order to + * handle all characters correctly. This functions assumes that the + * characters are numbered from 1 to maxIndex. + * @param[in] maxIndex largest character index to consider + * @return true on success */ +bool ToUnicodeMap::addMissingMappings (UInt32 maxIndex) { + bool success=true; + // collect Unicode points already in assigned + NumericRanges codepoints; + for (size_t i=0; i < size() && success; i++) + codepoints.addRange(rangeAt(i).minval(), rangeAt(i).maxval()); + // fill unmapped ranges + if (empty()) // no Unicode mapping present at all? + success = fillRange(1, maxIndex, 1, codepoints, true); + else { // (partial) Unicode mapping present? + success = fillRange(1, rangeAt(0).min()-1, rangeAt(0).minval()-1, codepoints, false); + for (size_t i=0; i < size()-1 && success; i++) + success = fillRange(rangeAt(i).max()+1, rangeAt(i+1).min()-1, rangeAt(i).maxval()+1, codepoints, true); + if (success) + success = fillRange(rangeAt(size()-1).max()+1, maxIndex, rangeAt(size()-1).maxval()+1, codepoints, true); + } + return success; +} + + +/** Checks if a given codepoint is valid and unused. Otherwise, try to find an alternative. + * @param[in,out] ucp codepoint to fix + * @param[in] used_codepoints codepoints already in use + * @param[in] ascending if true, increase ucp to look for valid/unused codepoints + * @return true on success */ +static bool fix_codepoint (UInt32 &ucp, const NumericRanges &used_codepoints, bool ascending) { + UInt32 start = ucp; + while (!Unicode::isValidCodepoint(ucp) && used_codepoints.valueExists(ucp)) { + if (ascending) + ucp = (ucp == numeric_limits::max()) ? 0 : ucp+1; + else + ucp = (ucp == 0) ? numeric_limits::max() : ucp-1; + if (ucp == start) // no free Unicode point found + return false; + } + return true; +} + + +static bool is_less_or_equal (UInt32 a, UInt32 b) {return a <= b;} +static bool is_greater_or_equal (UInt32 a, UInt32 b) {return a >= b;} + + +/** Adds index to Unicode mappings for a given range of character indexes. + * @param[in] minIndex lower bound of range to fill + * @param[in] maxIndex upper bound of range to fill + * @param[in] ucp first Unicode point to add (if possible) + * @param[in,out] used_ucps Unicode points already in use + * @param[in] ascending if true, fill range from lower to upper bound + * @return true on success */ +bool ToUnicodeMap::fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges &used_ucps, bool ascending) { + if (minIndex <= maxIndex) { + UInt32 first=minIndex, last=maxIndex; + int inc=1; + bool (*cmp)(UInt32, UInt32) = is_less_or_equal; + if (!ascending) { + swap(first, last); + inc = -1; + cmp = is_greater_or_equal; + } + for (UInt32 i=first; cmp(i, last); i += inc) { + if (!fix_codepoint(ucp, used_ucps, ascending)) + return false; + else { + addRange(i, i, ucp); + used_ucps.addRange(ucp); + ucp += inc; // preferred Unicode point for the next character of the current range + } + } + } + return true; +} \ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h new file mode 100644 index 00000000000..bf7788b7b98 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.h @@ -0,0 +1,38 @@ +/************************************************************************* +** ToUnicodeMap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef TOUNICODEMAP_H +#define TOUNICODEMAP_H + +#include "NumericRanges.h" +#include "RangeMap.h" + + +/** Represents a mapping from character indexes to unicode points. */ +class ToUnicodeMap : public RangeMap +{ + public: + bool addMissingMappings (UInt32 maxIndex); + + protected: + bool fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges &used_ucps, bool ascending); +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp new file mode 100644 index 00000000000..93fe0b19385 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -0,0 +1,329 @@ +/************************************************************************* +** TpicSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#define _USE_MATH_DEFINES +#include +#include +#include +#include +#include "Color.h" +#include "InputBuffer.h" +#include "InputReader.h" +#include "GraphicPath.h" +#include "SpecialActions.h" +#include "SVGTree.h" +#include "TpicSpecialHandler.h" +#include "XMLNode.h" +#include "XMLString.h" +#include "types.h" + +using namespace std; + + +TpicSpecialHandler::TpicSpecialHandler () { + reset(); +} + + +void TpicSpecialHandler::dviEndPage (unsigned pageno) { + reset(); +} + + +void TpicSpecialHandler::reset () { + _points.clear(); + _penwidth = 1.0; + _fill = -1.0; // no fill +} + + +/** Creates SVG elements that draw lines through the recorded points. + * @param[in] stroke if true, the (out)line is drawn (in black) + * @param[in] fill if true, enclosed area is filled with current color + * @param[in] ddist dash/dot distance of line in PS point units + * (0:solid line, >0:dashed line, <0:dotted line) + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +void TpicSpecialHandler::drawLines (bool stroke, bool fill, double ddist, SpecialActions *actions) { + if (actions && !_points.empty()) { + XMLElementNode *elem=0; + if (_points.size() == 1) { + const DPair &p = _points.back(); + elem = new XMLElementNode("circle"); + elem->addAttribute("cx", p.x()+actions->getX()); + elem->addAttribute("cy", p.y()+actions->getY()); + elem->addAttribute("r", _penwidth/2.0); + actions->embed(p, _penwidth/2.0); + } + else { + if (_points.size() == 2 || (!fill && _points.front() != _points.back())) { + elem = new XMLElementNode("polyline"); + elem->addAttribute("fill", "none"); + elem->addAttribute("stroke-linecap", "round"); + } + else { + if (_points.front() == _points.back()) + _points.pop_back(); + if (_fill < 0) + _fill = 1; + Color color = actions->getColor(); + color *= _fill; + elem = new XMLElementNode("polygon"); + elem->addAttribute("fill", fill ? color.svgColorString() : "none"); + } + ostringstream oss; + FORALL(_points, vector::iterator, it) { + if (it != _points.begin()) + oss << ' '; + double x = it->x()+actions->getX(); + double y = it->y()+actions->getY(); + oss << XMLString(x) << ',' << XMLString(y); + actions->embed(DPair(x, y)); + } + elem->addAttribute("points", oss.str()); + if (stroke) { // draw outline? + elem->addAttribute("stroke", "black"); + elem->addAttribute("stroke-width", XMLString(_penwidth)); + } + } + if (ddist > 0) + elem->addAttribute("stroke-dasharray", XMLString(ddist)); + else if (ddist < 0) + elem->addAttribute("stroke-dasharray", XMLString(_penwidth) + ' ' + XMLString(-ddist)); + actions->appendToPage(elem); + } + reset(); +} + + +/** Stroke a quadratic spline through the midpoints of the lines defined by + * the previously recorded points. The spline starts with a straight line + * from the first point to the mid-point of the first line. The spline ends + * with a straight line from the mid-point of the last line to the last point. + * If ddist=0, the spline is stroked solid. Otherwise ddist denotes the length + * of the dashes and the gaps inbetween. + * @param[in] ddist length of dashes and gaps + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +void TpicSpecialHandler::drawSplines (double ddist, SpecialActions *actions) { + if (!actions || _points.empty()) + return; + const size_t size = _points.size(); + if (size < 3) + drawLines(true, false, ddist, actions); + else { + DPair p(actions->getX(), actions->getY()); + GraphicPath path; + path.moveto(p+_points[0]); + DPair mid = p+_points[0]+(_points[1]-_points[0])/2.0; + path.lineto(mid); + actions->embed(p+_points[0]); + for (size_t i=1; i < size-1; i++) { + const DPair p0 = p+_points[i-1]; + const DPair p1 = p+_points[i]; + const DPair p2 = p+_points[i+1]; + mid = p1+(p2-p1)/2.0; + path.conicto(p1, mid); + actions->embed(mid); + actions->embed((p0+p1*6.0+p2)/8.0, _penwidth); + } + if (_points[0] == _points[size-1]) // closed path? + path.closepath(); + else { + path.lineto(p+_points[size-1]); + actions->embed(p+_points[size-1]); + } + + Color color = actions->getColor(); + color *= _fill; + XMLElementNode *pathElem = new XMLElementNode("path"); + if (_fill >= 0) { + if (_points[0] != _points[size-1]) + path.closepath(); + pathElem->addAttribute("fill", color.svgColorString()); + } + else + pathElem->addAttribute("fill", "none"); + + ostringstream oss; + path.writeSVG(oss, SVGTree::RELATIVE_PATH_CMDS); + pathElem->addAttribute("d", oss.str()); + pathElem->addAttribute("stroke", actions->getColor().svgColorString()); + pathElem->addAttribute("stroke-width", XMLString(_penwidth)); + if (ddist > 0) + pathElem->addAttribute("stroke-dasharray", XMLString(ddist)); + else if (ddist < 0) + pathElem->addAttribute("stroke-dasharray", XMLString(_penwidth) + ' ' + XMLString(-ddist)); + actions->appendToPage(pathElem); + } + reset(); +} + + +/** Draws an elliptical arc. + * @param[in] cx x-coordinate of arc center + * @param[in] cy y-coordinate of arc center + * @param[in] rx length of horizonal semi-axis + * @param[in] ry length of vertical semi-axis + * @param[in] angle1 starting angle (clockwise) relative to x-axis + * @param[in] angle2 ending angle (clockwise) relative to x-axis + * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ +void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions *actions) { + if (actions) { + const double PI2 = 2*M_PI; + angle1 *= -1; + angle2 *= -1; + if (fabs(angle1) > PI2) { + int n = (int)(angle1/PI2); + angle1 = angle1 - n*PI2; + angle2 = angle2 - n*PI2; + } + + double x = cx + actions->getX(); + double y = cy + actions->getY(); + XMLElementNode *elem=0; + if (fabs(angle1-angle2) >= PI2) { // closed ellipse? + elem = new XMLElementNode("ellipse"); + elem->addAttribute("cx", XMLString(x)); + elem->addAttribute("cy", XMLString(y)); + elem->addAttribute("rx", XMLString(rx)); + elem->addAttribute("ry", XMLString(ry)); + } + else { + if (angle1 < 0) + angle1 = PI2+angle1; + if (angle2 < 0) + angle2 = PI2+angle2; + elem = new XMLElementNode("path"); + int large_arg = fabs(angle1-angle2) > M_PI ? 0 : 1; + int sweep_flag = angle1 > angle2 ? 0 : 1; + if (angle1 > angle2) { + large_arg = 1-large_arg; + sweep_flag = 1-sweep_flag; + } + ostringstream oss; + oss << 'M' << XMLString(x+rx*cos(angle1)) << ',' << XMLString(y+ry*sin(-angle1)) + << 'A' << XMLString(rx) << ',' << XMLString(ry) + << " 0 " + << large_arg << ' ' << sweep_flag << ' ' + << XMLString(x+rx*cos(angle2)) << ',' << XMLString(y-ry*sin(angle2)); + if (_fill >= 0) + oss << 'Z'; + elem->addAttribute("d", oss.str()); + } + elem->addAttribute("stroke-width", _penwidth); + elem->addAttribute("stroke", actions->getColor().svgColorString()); + elem->addAttribute("stroke-linecap", "round"); + elem->addAttribute("fill", "none"); + if (_fill >= 0) { + Color color=actions->getColor(); + color *= _fill; + elem->addAttribute("fill", color.svgColorString()); + } + else + elem->addAttribute("fill", "none"); + actions->appendToPage(elem); + actions->embed(BoundingBox(cx-rx, cy-ry, cx+rx, cy+ry)); + } + reset(); +} + + +#define cmd_id(c1,c2) ((c1 << 8) | c2) + +bool TpicSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { + if (!prefix || strlen(prefix) != 2) + return false; + + const double mi2bp=0.072; // factor for milli-inch to PS points + StreamInputBuffer ib(is); + BufferInputReader in(ib); + switch (cmd_id(prefix[0], prefix[1])) { + case cmd_id('p','n'): // set pen width in milli-inches + _penwidth = in.getDouble()*mi2bp; + break; + case cmd_id('b','k'): // set fill color to black + _fill = 0; + break; + case cmd_id('w','h'): // set fill color to white + _fill = 1; + break; + case cmd_id('s','h'): // set fill color to given gray level + in.skipSpace(); + _fill = in.eof() ? 0.5 : max(0.0, min(1.0, in.getDouble())); + break; + case cmd_id('t','x'): // set fill pattern + break; + case cmd_id('p','a'): { // add point to path + double x = in.getDouble()*mi2bp; + double y = in.getDouble()*mi2bp; + _points.push_back(DPair(x,y)); + break; + } + case cmd_id('f','p'): // draw solid lines through recorded points; close and fill path if fill color was defined + drawLines(true, _fill >= 0, 0, actions); + break; + case cmd_id('i','p'): // don't draw outlines but close the recorded path and fill the resulting polygon + drawLines(false, true, 0, actions); + break; + case cmd_id('d','a'): // as fp but draw dashed lines + drawLines(true, _fill >= 0, in.getDouble()*72, actions); + break; + case cmd_id('d','t'): // as fp but draw dotted lines + drawLines(true, _fill >= 0, -in.getDouble()*72, actions); + break; + case cmd_id('s','p'): { // draw quadratic splines through recorded points + double ddist = in.getDouble(); + drawSplines(ddist, actions); + break; + } + case cmd_id('a','r'): { // draw elliptical arc + double cx = in.getDouble()*mi2bp; + double cy = in.getDouble()*mi2bp; + double rx = in.getDouble()*mi2bp; + double ry = in.getDouble()*mi2bp; + double a1 = in.getDouble(); + double a2 = in.getDouble(); + drawArc(cx, cy, rx, ry, a1, a2, actions); + break; + } + case cmd_id('i','a'): { // fill elliptical arc + double cx = in.getDouble()*mi2bp; + double cy = in.getDouble()*mi2bp; + double rx = in.getDouble()*mi2bp; + double ry = in.getDouble()*mi2bp; + double a1 = in.getDouble(); + double a2 = in.getDouble(); + if (_fill < 0) + _fill = 1; + drawArc(cx, cy, rx, ry, a1, a2, actions); + if (_fill < 0) + _fill = -1; + break; + } + default: + return false; + } + return true; +} + + +const char** TpicSpecialHandler::prefixes () const { + static const char *pfx[] = {"ar", "bk", "da", "dt", "fp", "ia", "ip", "pa", "pn", "sh", "sp", "tx", "wh", 0}; + return pfx; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h new file mode 100644 index 00000000000..3c5ea9fa876 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.h @@ -0,0 +1,50 @@ +/************************************************************************* +** TpicSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_TPICSPECIALHANDLER_H +#define DVISVGM_TPICSPECIALHANDLER_H + +#include +#include "Pair.h" +#include "SpecialHandler.h" + +class TpicSpecialHandler : public SpecialHandler, public DVIEndPageListener +{ + public: + TpicSpecialHandler (); + const char* info () const {return "TPIC specials";} + const char* name () const {return "tpic";} + const char** prefixes () const; + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + + protected: + void dviEndPage (unsigned pageno); + void reset (); + void drawLines (bool stroke, bool fill, double ddist, SpecialActions *actions); + void drawSplines (double ddist, SpecialActions *actions); + void drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions *actions); + + private: + double _penwidth; ///< pen width in PS point units + double _fill; ///< fill intensity [0,1]; if < 0, we don't fill anything + std::vector _points; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp new file mode 100644 index 00000000000..75b3132345b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -0,0 +1,214 @@ +/************************************************************************* +** TriangularPatch.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include "TriangularPatch.h" + +using namespace std; + +TriangularPatch::TriangularPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TriangularPatch *patch) + : ShadingPatch(cspace) +{ + setPoints(points, edgeflag, patch); + setColors(colors, edgeflag, patch); +} + + +void TriangularPatch::setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch) { + TriangularPatch *triangularPatch = dynamic_cast(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)) + throw ShadingException("invalid number of vertices in triangular patch definition"); + + _points[0] = points[0]; + switch (edgeflag) { + case 0: + _points[1] = points[1]; + _points[2] = points[2]; + break; + case 1: + _points[1] = triangularPatch->_points[1]; + _points[2] = triangularPatch->_points[2]; + break; + case 2: + _points[1] = triangularPatch->_points[2]; + _points[2] = triangularPatch->_points[0]; + } +} + + +void TriangularPatch::setPoints (const DPair &p1, const DPair &p2, const DPair &p3) { + _points[0] = p1; + _points[1] = p2; + _points[2] = p3; +} + + +void TriangularPatch::setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch) { + TriangularPatch *triangularPatch = dynamic_cast(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)) + throw ShadingException("invalid number of colors in triangular patch definition"); + + _colors[0] = colors[0]; + switch (edgeflag) { + case 0: + _colors[1] = colors[1]; + _colors[2] = colors[2]; + break; + case 1: + _colors[1] = triangularPatch->_colors[1]; + _colors[2] = triangularPatch->_colors[2]; + break; + case 2: + _colors[1] = triangularPatch->_colors[2]; + _colors[2] = triangularPatch->_colors[0]; + } +} + + +void TriangularPatch::setColors (const Color &c1, const Color &c2, const Color &c3) { + _colors[0] = c1; + _colors[1] = c2; + _colors[2] = c3; +} + + +/** Returns the Cartesian coordinates for the barycentric coordinates \f$(u, v, 1-u-v)\f$ + * of a point of the triangle, where \f$u, v \in [0,1]\f$ and \f$u+v \le 1\f$. + * The relation between the vertices of the triangle and their barycentric coordinates + * is as follows: \f$(1,0,0)=p_1, (0,1,0)=p_2, (0,0,1)=p_0\f$. */ +DPair TriangularPatch::valueAt (double u, double v) const { + return _points[0] + (_points[1]-_points[0])*u + (_points[2]-_points[0])*v; +} + + +/** Returns the color at a given point of the triangle. The point must be given + * in barycentric coordinates \f$(u, v, 1-u-v)\f$, where \f$u, v \in [0,1]\f$ + * and \f$u+v \le 1\f$. + * The relation between the vertices of the triangle and their barycentric coordinates + * is as follows: \f$(1,0,0)=p_1, (0,1,0)=p_2, (0,0,1)=p_0\f$. */ +Color TriangularPatch::colorAt (double u, double v) const { + ColorGetter getComponents; + ColorSetter setComponents; + colorQueryFuncs(getComponents, setComponents); + valarray comp[3]; + for (int i=0; i < 3; i++) + (_colors[i].*getComponents)(comp[i]); + Color color; + (color.*setComponents)(comp[0]*(1-u-v) + comp[1]*u + comp[2]*v); + return color; +} + + +Color TriangularPatch::averageColor () const { + return averageColor(_colors[0], _colors[1], _colors[2]); +} + + +/** Compute the average of three given colors depending on the assigned color space. */ +Color TriangularPatch::averageColor (const Color &c1, const Color &c2, const Color &c3) const { + ColorGetter getComponents; + ColorSetter setComponents; + colorQueryFuncs(getComponents, setComponents); + valarray va1, va2, va3; + (c1.*getComponents)(va1); + (c2.*getComponents)(va2); + (c3.*getComponents)(va3); + Color averageColor; + (averageColor.*setComponents)((va1+va2+va3)/3.0); + return averageColor; +} + + +/** Snaps value x to the interval [0,1]. Values lesser than or near 0 are mapped to 0, values + * greater than or near 1 are mapped to 1. */ +static inline double snap (double x) { + if (fabs(x) < 0.001) + return 0; + if (fabs(1-x) < 0.001) + return 1; + return x; +} + + +/** Approximate the patch by dividing it into a grid of triangular segments that are filled + * with the average color of the corresponding region. In order to prevent visual gaps between + * adjacent segments due to anti-aliasing, the flag 'overlap' can be set. It enlarges the + * segments so that they overlap with their right and bottom neighbors (which are drawn on + * top of the overlapping regions). + * @param[in] gridsize number of segments per row/column + * @param[in] overlap if true, enlarge each segment to overlap with its right and bottom neighbors + * @param[in] delta reduce level of detail if the segment size is smaller than the given value + * @param[in] callback object notified */ +void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Callback &callback) const { + if (_colors[0] == _colors[1] && _colors[1] == _colors[2]) { + GraphicPath path; + getBoundaryPath(path); + callback.patchSegment(path, _colors[0]); + } + else { + const double inc = 1.0/gridsize; + for (double u1=0; u1 < 1; u1=snap(u1+inc)) { + double u2 = snap(u1+inc); + double ou2 = (overlap && snap(u2+inc) <= 1 ? snap(u2+inc) : u2); + for (double v1=0; snap(u1+v1) < 1; v1=snap(v1+inc)) { + double v2 = snap(v1+inc); + double ov2 = (overlap && snap(v2+inc) <= 1 ? snap(v2+inc) : v2); + if (!overlap || (snap(u1+ov2) <= 1 && snap(ou2+v1) <= 1)) { + // create triangular segments pointing in the same orientation as the whole patch + GraphicPath path; + path.moveto(valueAt(u1, v1)); + path.lineto(valueAt(ou2, v1)); + path.lineto(valueAt(u1, ov2)); + path.closepath(); + callback.patchSegment(path, averageColor(colorAt(u1, v1), colorAt(u2, v1), colorAt(u1, v2))); + if (snap(u2+v2) <= 1 && (!overlap || inc > delta)) { + // create triangular segments pointing in the opposite direction as the whole patch + path.clear(); + path.moveto(valueAt(u1, v2)); + path.lineto(valueAt(u2, v1)); + path.lineto(valueAt(u2, v2)); + path.closepath(); + callback.patchSegment(path, averageColor(colorAt(u1, v2), colorAt(u2, v1), colorAt(u2, v2))); + } + } + } + } + } +} + + +void TriangularPatch::getBoundaryPath(GraphicPath &path) const { + path.clear(); + path.moveto(_points[0]); + path.lineto(_points[1]); + path.lineto(_points[2]); + path.closepath(); +} + + +void TriangularPatch::getBBox (BoundingBox &bbox) const { + bbox.invalidate(); + bbox.embed(_points[0]); + bbox.embed(_points[1]); + bbox.embed(_points[2]); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h new file mode 100644 index 00000000000..d18d76ebb0a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.h @@ -0,0 +1,64 @@ +/************************************************************************* +** TriangularPatch.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_TRIANGULARPATCH_H +#define DVISVGM_TRIANGULARPATCH_H + +#include "Color.h" +#include "Pair.h" +#include "ShadingPatch.h" + +class TriangularPatch : public ShadingPatch +{ + public: + TriangularPatch (); + TriangularPatch (Color::ColorSpace cspace) : ShadingPatch(cspace) {} + TriangularPatch (const PointVec &points, const ColorVec &colors, Color::ColorSpace cspace, int edgeflag, TriangularPatch *patch); + int psShadingType() const {return 4;} + DPair valueAt (double u, double v) const; + Color colorAt (double u, double v) const; + Color averageColor() const; + void setPoints (const PointVec &points, int edgeflag, ShadingPatch *patch); + void setPoints (const DPair &p1, const DPair &p2, const DPair &p3); + void setColors (const ColorVec &colors, int edgeflag, ShadingPatch *patch); + void setColors (const Color &c1, const Color &c2, const Color &c3); + void approximate (int gridsize, bool overlap, double delta, Callback &listener) const; + void getBBox (BoundingBox &bbox) const; + void getBoundaryPath(GraphicPath &path) const; + int numPoints (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} + int numColors (int edgeflag) const {return edgeflag == 0 ? 3 : 1;} + + protected: + Color averageColor (const Color &c1, const Color &c2, const Color &c3) const; + + private: + DPair _points[3]; + Color _colors[3]; +}; + + +class LatticeTriangularPatch : public TriangularPatch +{ + public: + LatticeTriangularPatch (Color::ColorSpace cspace) : TriangularPatch(cspace) {} + int psShadingType() const {return 5;} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp new file mode 100644 index 00000000000..b0a8ace7f3b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.cpp @@ -0,0 +1,4553 @@ +/************************************************************************* +** Unicode.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "Unicode.h" + +using namespace std; + + +/** Returns true if c is a valid Unicode point in XML documents. + * XML version 1.0 doesn't allow various Unicode character references + * ( for example). */ +bool Unicode::isValidCodepoint (UInt32 c) { + if ((c & 0xffff) == 0xfffe || (c & 0xffff) == 0xffff) + return false; + + UInt32 ranges[] = { + 0x0000, 0x0020, // basic control characters + space + 0x007f, 0x009f, // use of control characters is discouraged by the XML standard + 0x202a, 0x202e, // bidi control characters + 0xd800, 0xdfff, // High Surrogates are not allowed in XML + 0xfdd0, 0xfdef, // non-characters for internal use by applications + }; + for (size_t i=0; i < sizeof(ranges)/sizeof(UInt32) && c >= ranges[i]; i+=2) + if (c <= ranges[i+1]) + return false; + return true; +} + + +/** Returns a valid Unicode point for the given character code. Character codes + * that are invalid code points because the XML standard forbids or discourages + * their usage, are mapped to the Private Use Zone U+E000-U+F8FF. */ +UInt32 Unicode::charToCodepoint (UInt32 c) { + UInt32 ranges[] = { + 0x0000, 0x0020, 0xe000, // basic control characters + space + 0x007f, 0x009f, 0xe021, // use of control characters is discouraged by the XML standard + 0x202a, 0x202e, 0xe042, // bidi control characters + 0xd800, 0xdfff, 0xe047, // High Surrogates are not allowed in XML + 0xfdd0, 0xfdef, 0xe847, // non-characters for internal use by applications + 0xfffe, 0xffff, 0xe867, + 0x1fffe, 0x1ffff, 0xe869, + 0x2fffe, 0x2ffff, 0xe86b, + 0x3fffe, 0x3ffff, 0xe86d, + 0x4fffe, 0x4ffff, 0xe86f, + 0x5fffe, 0x5ffff, 0xe871, + 0x6fffe, 0x6ffff, 0xe873, + 0x7fffe, 0x7ffff, 0xe875, + 0x8fffe, 0x8ffff, 0xe877, + 0x9fffe, 0x9ffff, 0xe879, + 0xafffe, 0xaffff, 0xe87b, + 0xbfffe, 0xbffff, 0xe87d, + 0xcfffe, 0xcffff, 0xe87f, + 0xdfffe, 0xdffff, 0xe881, + 0xefffe, 0xeffff, 0xe883, + 0xffffe, 0xfffff, 0xe885, + 0x10fffe, 0x10ffff, 0xe887 + }; + for (size_t i=0; i < sizeof(ranges)/sizeof(unsigned) && c >= ranges[i]; i+=3) + if (c <= ranges[i+1]) + return ranges[i+2]+c-ranges[i]; + return c; +} + + +/** Converts a Unicode value to a UTF-8 byte sequence. + * @param[in] c character code + * @return utf8 sequence consisting of 1-4 bytes */ +string Unicode::utf8 (Int32 c) { + string utf8; + if (c >= 0) { + if (c < 0x80) + utf8 += c; + else if (c < 0x800) { + utf8 += 0xC0 + (c >> 6); + utf8 += 0x80 + (c & 0x3F); + } + else if (c < 0x10000) { + utf8 += 0xE0 + (c >> 12); + utf8 += 0x80 + ((c >> 6) & 0x3F); + utf8 += 0x80 + (c & 0x3F); + } + else if (c < 0x110000) { + utf8 += 0xF0 + (c >> 18); + utf8 += 0x80 + ((c >> 12) & 0x3F); + utf8 += 0x80 + ((c >> 6) & 0x3F); + utf8 += 0x80 + (c & 0x3F); + } + // UTF-8 does not support codepoints >= 0x110000 + } + return utf8; +} + + +/* The following table provides a compact mapping from PostScript character names + * to Unicode points. Instead of using the character names directly it maps the + * hash values (xxhash32) of the names to the corresponding code points. + * The character mapping is derived from + * http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt and + * http://tug.ctan.org/macros/latex/contrib/pdfx/glyphtounicode-cmr.tex */ +static struct Hash2Unicode { + UInt32 hash; + UInt32 codepoint; +} hash2unicode[] = { + {0x001cf4a9, 0x0118}, // Eogonek + {0x003b11fb, 0x055f}, // abbreviationmarkarmenian + {0x0050a316, 0x0444}, // afii10086 + {0x0066ddfe, 0x03a5}, // Upsilon + {0x0067a87d, 0x0026}, // ampersand + {0x007399ea, 0x2118}, // weierstrass + {0x009a8cbc, 0x30c8}, // tokatakana + {0x00a8ecc1, 0xfb93}, // gaffinalarabic + {0x00b0f8d6, 0x05b2}, // hatafpatahwidehebrew + {0x00b1b890, 0x2486}, // nineteenparen + {0x00b92975, 0x05a7}, // dargalefthebrew + {0x00c458a3, 0x2154}, // twothirds + {0x00e73988, 0x09b8}, // sabengali + {0x00f475c4, 0x03ee}, // Deicoptic + {0x00fa9974, 0x0303}, // tildecmb + {0x01012c9a, 0x05b4}, // hiriq + {0x0107d6e3, 0x0933}, // lladeva + {0x01127238, 0x3237}, // ideographiccongratulationparen + {0x011abc50, 0x0547}, // Shaarmenian + {0x01297545, 0x25aa}, // H18543 + {0x012d44bc, 0x05d6}, // afii57670 + {0x013044fb, 0x2205}, // emptyset + {0x01422ce1, 0x0486}, // psilipneumatacyrilliccmb + {0x01532d0f, 0x002f}, // slashBig + {0x01571757, 0xfe6b}, // atsmall + {0x01678eeb, 0x066b}, // decimalseparatorpersian + {0x018643fe, 0x091a}, // cadeva + {0x019e6772, 0x3148}, // cieuckorean + {0x019fa822, 0x05de}, // mem + {0x01a69c0c, 0x221a}, // radicalbigg + {0x01cfa7b3, 0x0a3e}, // aamatragurmukhi + {0x01d7c979, 0x3007}, // ideographiczero + {0x02057d9e, 0x05e8}, // reshhatafsegol + {0x0209914d, 0xf7fe}, // Thornsmall + {0x020d70ad, 0x278b}, // twocircleinversesansserif + {0x0239eab1, 0x3131}, // kiyeokkorean + {0x023b0c79, 0xff87}, // nukatakanahalfwidth + {0x023deac8, 0x3183}, // yesieungpansioskorean + {0x02409db2, 0x1ed1}, // ocircumflexacute + {0x02574652, 0x0e1b}, // poplathai + {0x025b8acc, 0x0a47}, // eematragurmukhi + {0x02610d57, 0x2668}, // hotsprings + {0x0292f83b, 0x0e11}, // thonangmonthothai + {0x0293c9db, 0xff49}, // imonospace + {0x029e63cc, 0x21e7}, // arrowupwhite + {0x02a32a9d, 0x0275}, // obarred + {0x02a97908, 0x09f7}, // fournumeratorbengali + {0x02abe0be, 0x2556}, // SF210000 + {0x02acd87a, 0x2461}, // twocircle + {0x02bb8927, 0x0154}, // Racute + {0x02bd043f, 0x3392}, // mhzsquare + {0x02bdc138, 0x304a}, // ohiragana + {0x02c40de7, 0xffe6}, // wonmonospace + {0x02dab625, 0x310c}, // lbopomofo + {0x02df8edf, 0x30e7}, // yosmallkatakana + {0x02e3dfc8, 0x3062}, // dihiragana + {0x02f13fd7, 0x0029}, // parenrightbig + {0x02f32b9b, 0x002f}, // slashbigg + {0x0306380d, 0xff35}, // Umonospace + {0x03170204, 0x0495}, // ghemiddlehookcyrillic + {0x03182c9f, 0x25b4}, // blackuppointingsmalltriangle + {0x0319d343, 0x329e}, // ideographicprintcircle + {0x031ad266, 0x331e}, // kooposquare + {0x03274b72, 0x0018}, // controlCAN + {0x032ef9aa, 0xf7f6}, // Odieresissmall + {0x0334c4d5, 0x0aa7}, // dhagujarati + {0x03396436, 0x1ed0}, // Ocircumflexacute + {0x033b64c4, 0x047f}, // otcyrillic + {0x033e74dc, 0x1e44}, // Ndotaccent + {0x034ec8b1, 0x30b0}, // gukatakana + {0x037b5e30, 0x00b9}, // onesuperior + {0x03993e60, 0xff57}, // wmonospace + {0x03a136c3, 0x0e0b}, // sosothai + {0x03b0103c, 0x2270}, // notlessnorequal + {0x03c2a8d8, 0x1eb3}, // abrevehookabove + {0x03d234c7, 0xfea7}, // khahinitialarabic + {0x03f4da1a, 0x05b8}, // qamatsnarrowhebrew + {0x040b8001, 0x230a}, // floorleftBig + {0x0410b525, 0x0138}, // kgreenlandic + {0x0433eb22, 0x014e}, // Obreve + {0x043f3fc5, 0x040a}, // afii10059 + {0x044589fe, 0x0646}, // afii57446 + {0x044ba421, 0x0585}, // oharmenian + {0x0454dddc, 0x0432}, // afii10067 + {0x048b164e, 0x01c3}, // clickretroflex + {0x048e8b97, 0x0161}, // scaron + {0x0491732e, 0x3186}, // yeorinhieuhkorean + {0x049c65ac, 0x2121}, // telephone + {0x04a45907, 0x041a}, // afii10028 + {0x04c4d94b, 0x05b5}, // tsere1e + {0x04c8ee7d, 0x042d}, // Ereversedcyrillic + {0x04de1db0, 0x0950}, // omdeva + {0x04f4d676, 0x0027}, // quotesingle + {0x04fb1584, 0xf6c4}, // afii10063 + {0x0500f909, 0x0407}, // Yicyrillic + {0x0503fcb5, 0x00b1}, // plusminus + {0x05116c6a, 0x30fc}, // prolongedkana + {0x05302abd, 0x2025}, // twodotleader + {0x053ece0c, 0x3050}, // guhiragana + {0x05574c05, 0x09a3}, // nnabengali + {0x056bac6c, 0x30a3}, // ismallkatakana + {0x058218bb, 0x0386}, // Alphatonos + {0x058691a9, 0x33d2}, // squarelog + {0x059c61cd, 0x0436}, // zhecyrillic + {0x059eb4a3, 0x2085}, // fiveinferior + {0x05a47299, 0x320d}, // hieuhparenkorean + {0x05a53e96, 0x0282}, // shook + {0x05b0f8c3, 0x02b5}, // rhookturnedsuperior + {0x05c5a128, 0xf76b}, // Ksmall + {0x05cee53c, 0x201d}, // quotedblright + {0x05de47fd, 0x1e7f}, // vdotbelow + {0x05e340f3, 0x1e70}, // Tcircumflexbelow + {0x05e8321d, 0x0325}, // ringbelowcmb + {0x05ec5d36, 0x2471}, // eighteencircle + {0x05f03fff, 0x0ae0}, // rrvocalicgujarati + {0x060beb03, 0x0175}, // wcircumflex + {0x0618af48, 0x005c}, // backslashBig + {0x061ad8fc, 0x24ca}, // Ucircle + {0x061f0bd8, 0x2a00}, // circledotdisplay + {0x062d146d, 0xf88b}, // maieklowrightthai + {0x0642035b, 0x0010}, // controlDLE + {0x0646584a, 0x003d}, // equal + {0x064874b1, 0x05d3}, // afii57667 + {0x066433cf, 0x20a4}, // lira + {0x06823c6b, 0xfb4d}, // kafrafehebrew + {0x06894954, 0xff5e}, // asciitildemonospace + {0x069a405d, 0x00e6}, // ae + {0x06b00ffc, 0x0101}, // amacron + {0x06b72f51, 0x27e8}, // angbracketleftbig + {0x06be8647, 0x0442}, // afii10084 + {0x06e56a17, 0x05dc}, // lamedholamdagesh + {0x06ec3366, 0xfe42}, // cornerbracketrightvertical + {0x0700a693, 0x0475}, // izhitsacyrillic + {0x07019244, 0xfb02}, // fl + {0x07072da3, 0x2299}, // circleot + {0x07099ef9, 0xfeae}, // rehfinalarabic + {0x0710dd39, 0x02de}, // rhotichookmod + {0x074aba74, 0x09af}, // yabengali + {0x07562010, 0x09bc}, // nuktabengali + {0x075a830a, 0x21e6}, // arrowleftwhite + {0x076312db, 0x2497}, // sixteenperiod + {0x0767cf10, 0x1ea8}, // Acircumflexhookabove + {0x076c3b34, 0x1ec3}, // ecircumflexhookabove + {0x076dbf41, 0x05b7}, // patah11 + {0x07726745, 0x0e25}, // lolingthai + {0x078184fa, 0x00f7}, // divide + {0x0790751c, 0x2466}, // sevencircle + {0x0793d50d, 0x30bb}, // sekatakana + {0x07a1ce35, 0x0906}, // aadeva + {0x07ab20a8, 0x0ab3}, // llagujarati + {0x07b2b22c, 0x02c6}, // hatwidest + {0x07e20c30, 0x017b}, // Zdot + {0x07e38c67, 0x33bb}, // nwsquare + {0x081dd122, 0x0a38}, // sagurmukhi + {0x082543e5, 0x33a0}, // cmsquaredsquare + {0x083d0b54, 0x3227}, // eightideographicparen + {0x08429fa7, 0x2591}, // ltshade + {0x084b888b, 0x311a}, // abopomofo + {0x085499c4, 0x0925}, // thadeva + {0x086a99d9, 0x01af}, // Uhorn + {0x087038eb, 0xfb20}, // ayinaltonehebrew + {0x08729ac0, 0xed18}, // bracehtipdownright + {0x08905fd6, 0x230b}, // floorrightbigg + {0x089d739a, 0x005a}, // Z + {0x08a131c8, 0x096d}, // sevendeva + {0x08a6b099, 0x02a6}, // ts + {0x08b5de5a, 0x038a}, // Iotatonos + {0x08b78f6b, 0xff86}, // nikatakanahalfwidth + {0x08d57b6a, 0x0019}, // controlEM + {0x08ddb521, 0x3226}, // sevenideographicparen + {0x092aa224, 0x0a90}, // aigujarati + {0x092cd86d, 0x03d6}, // omega1 + {0x09310ab8, 0x027f}, // rfishhookreversed + {0x094ceadc, 0x0047}, // G + {0x09751504, 0x038c}, // Omicrontonos + {0x09790f28, 0x33be}, // kwsquare + {0x09853aa3, 0x01c1}, // clicklateral + {0x099430b2, 0xf7f5}, // Otildesmall + {0x09a03740, 0xfe5b}, // braceleftsmall + {0x09a4b050, 0x0ae8}, // twogujarati + {0x09adf253, 0xf721}, // exclamsmall + {0x09d4b5eb, 0x3388}, // calsquare + {0x09f2217d, 0x00a9}, // copyright + {0x09f9df24, 0x1e0c}, // Ddotbelow + {0x0a040d76, 0x098a}, // uubengali + {0x0a1d800c, 0x0291}, // zcurl + {0x0a3a2809, 0xf767}, // Gsmall + {0x0a3b8eb5, 0x044b}, // yericyrillic + {0x0a46f2f1, 0x0284}, // dotlessjstrokehook + {0x0a5cb3b1, 0x30d6}, // bukatakana + {0x0a5ff1a8, 0xff6b}, // osmallkatakanahalfwidth + {0x0a67f8fb, 0x24b2}, // wparen + {0x0a704676, 0xfccc}, // lammeeminitialarabic + {0x0a8ba8e8, 0x0112}, // Emacron + {0x0a9b47dd, 0x306f}, // hahiragana + {0x0aa2156d, 0xfc0c}, // tehhahisolatedarabic + {0x0abb4ec1, 0x0441}, // afii10083 + {0x0ac66fc0, 0x005b}, // bracketleftBigg + {0x0adbba15, 0x21c0}, // harpoonrightbarbup + {0x0ae79191, 0x01e1}, // adotmacron + {0x0aecd30e, 0x05e8}, // reshpatahhebrew + {0x0af77d49, 0x09ea}, // fourbengali + {0x0b1d2d0d, 0xf6f3}, // tsuperior + {0x0b367d7a, 0x0421}, // Escyrillic + {0x0b4b7082, 0xff62}, // cornerbracketlefthalfwidth + {0x0b6abf22, 0x20aa}, // sheqel + {0x0b7f2b2d, 0x0a5a}, // ghhagurmukhi + {0x0b92d660, 0x32a6}, // ideographiclowcircle + {0x0b9e2621, 0x2665}, // heartsuitblack + {0x0ba5f00c, 0x03cc}, // omicrontonos + {0x0bae12ff, 0xff2a}, // Jmonospace + {0x0bd4abb3, 0x0254}, // oopen + {0x0bd8d304, 0x3215}, // ieungaparenkorean + {0x0bdad647, 0x0970}, // abbreviationsigndeva + {0x0bdb550e, 0x0669}, // ninehackarabic + {0x0be3cda3, 0x1e0b}, // ddotaccent + {0x0bf8ed4a, 0x09f2}, // rupeemarkbengali + {0x0bfa9d4e, 0x05b6}, // afii57795 + {0x0c138c8e, 0x308f}, // wahiragana + {0x0c17017e, 0x02a5}, // dzcurl + {0x0c19fd92, 0x037a}, // ypogegrammeni + {0x0c255ae5, 0x0553}, // Piwrarmenian + {0x0c356707, 0x0625}, // afii57413 + {0x0c678de3, 0x032a}, // bridgebelowcmb + {0x0c810887, 0x0a88}, // iigujarati + {0x0c83c594, 0x1e63}, // sdotbelow + {0x0c8f5261, 0x0164}, // Tcaron + {0x0cacee48, 0xfba8}, // hehinitialaltonearabic + {0x0cbb507c, 0x3036}, // circlepostalmark + {0x0cd99820, 0x05c0}, // paseqhebrew + {0x0cdb81c4, 0x24a2}, // gparen + {0x0ce8bb7e, 0x30d5}, // hukatakana + {0x0cf04968, 0x02be}, // ringhalfright + {0x0d0eb2f0, 0x315d}, // weokorean + {0x0d21bb72, 0x2550}, // SF430000 + {0x0d3a66b8, 0x2309}, // ceilingrightbigg + {0x0d47308f, 0x05d4}, // he + {0x0d747cfe, 0x04c3}, // Kahookcyrillic + {0x0d932b5b, 0x30d2}, // hikatakana + {0x0da4d862, 0x05b6}, // segol13 + {0x0db7d6e4, 0x05d4}, // hehebrew + {0x0dc03ecb, 0x0a9c}, // jagujarati + {0x0dd6f75d, 0x09f6}, // threenumeratorbengali + {0x0de664af, 0x01fa}, // Aringacute + {0x0deddd7b, 0x017a}, // zacute + {0x0df6966e, 0x1e4f}, // otildedieresis + {0x0e0870a7, 0x2713}, // checkmark + {0x0e0aefc5, 0x05af}, // masoracirclehebrew + {0x0e15512a, 0xff43}, // cmonospace + {0x0e157c7d, 0x0166}, // Tbar + {0x0e34eac4, 0x06ba}, // afii57514 + {0x0e359de3, 0x332b}, // paasentosquare + {0x0e35e57d, 0x01f4}, // Gacute + {0x0e6ec8aa, 0x0a40}, // iimatragurmukhi + {0x0e8140cb, 0x2318}, // propellor + {0x0e8e8ac7, 0x25aa}, // blacksmallsquare + {0x0e8ed92c, 0x05b3}, // hatafqamatsquarterhebrew + {0x0e9c1a93, 0x0149}, // quoterightn + {0x0eb0ce00, 0xff30}, // Pmonospace + {0x0ec7e019, 0xfc4b}, // noonjeemisolatedarabic + {0x0ed8b040, 0x33b5}, // nvsquare + {0x0edd0c59, 0x0e35}, // saraiithai + {0x0ee06289, 0x05b0}, // shevaquarterhebrew + {0x0efc1459, 0x09b6}, // shabengali + {0x0f02712c, 0x00ea}, // ecircumflex + {0x0f066e82, 0x33b3}, // mssquare + {0x0f13ed93, 0xf7f8}, // Oslashsmall + {0x0f1a6991, 0x24c4}, // Ocircle + {0x0f2768b1, 0x05b1}, // hatafsegolwidehebrew + {0x0f332d5e, 0x002e}, // period + {0x0f35dd15, 0x04b0}, // Ustraightstrokecyrillic + {0x0f432338, 0x0020}, // space + {0x0f433f21, 0xff7d}, // sukatakanahalfwidth + {0x0f610d68, 0x1e53}, // omacronacute + {0x0f61debf, 0x33b9}, // mvmegasquare + {0x0f8de5e5, 0xff4b}, // kmonospace + {0x0f984d6e, 0xfec0}, // dadmedialarabic + {0x0fcfb12d, 0x016c}, // Ubreve + {0x0fdfc487, 0x02a8}, // tccurl + {0x0ff64b0b, 0x0665}, // fivehackarabic + {0x1001b5d7, 0xfc48}, // meemmeemisolatedarabic + {0x100f790a, 0x20ac}, // Euro + {0x101477b7, 0x216a}, // Elevenroman + {0x1030f103, 0x0918}, // ghadeva + {0x103612b8, 0x2287}, // supersetorequal + {0x10459048, 0x2217}, // asteriskmath + {0x10529f46, 0x0e59}, // ninethai + {0x10656b29, 0x042a}, // afii10044 + {0x10659a4d, 0x0041}, // A + {0x106ab99c, 0x0943}, // rvocalicvowelsigndeva + {0x10827219, 0x01e4}, // Gstroke + {0x1087cbb6, 0x318d}, // araeakorean + {0x10c49213, 0x094d}, // viramadeva + {0x10c6b04c, 0xfee8}, // noonmedialarabic + {0x10e1204e, 0x224c}, // allequal + {0x1112335e, 0x0e24}, // ruthai + {0x1113e9a7, 0x0a87}, // igujarati + {0x11140e23, 0xff50}, // pmonospace + {0x112533be, 0x0446}, // tsecyrillic + {0x1128968b, 0x03dc}, // Digammagreek + {0x113f9725, 0x1ea1}, // adotbelow + {0x11572f90, 0x3240}, // ideographicfestivalparen + {0x1159e298, 0x2484}, // seventeenparen + {0x115b5935, 0xff78}, // kukatakanahalfwidth + {0x115c3cb2, 0x3179}, // kapyeounssangpieupkorean + {0x11672a1e, 0x3051}, // kehiragana + {0x1179ac42, 0x00a0}, // nbspace + {0x1198b8ba, 0x05f1}, // vavyodhebrew + {0x11adf5a7, 0x24a9}, // nparen + {0x11aeb63a, 0x2272}, // lessorequivalent + {0x11ba40f5, 0x05ea}, // tavhebrew + {0x11c11092, 0x1e2c}, // Itildebelow + {0x11c8e4b3, 0x2660}, // spadesuitblack + {0x11d3eac3, 0x3060}, // dahiragana + {0x11d67798, 0xfb33}, // daletdagesh + {0x11e401c1, 0x05d6}, // zayin + {0x1216fef8, 0x328e}, // ideographmetalcircle + {0x1219f723, 0xff6e}, // yosmallkatakanahalfwidth + {0x1224d569, 0xfee4}, // meemmedialarabic + {0x1228548c, 0x05d0}, // alefhebrew + {0x1233afe9, 0x30df}, // mikatakana + {0x123a07fe, 0x05e6}, // tsadihebrew + {0x1242de49, 0x042b}, // Yericyrillic + {0x1246d709, 0x315f}, // wikorean + {0x126c42a3, 0x21d0}, // arrowleftdbl + {0x1278a8d5, 0x3087}, // yosmallhiragana + {0x129b0140, 0x0445}, // afii10087 + {0x12a29be8, 0x03c5}, // upsilon + {0x12bdd9c7, 0x21a6}, // mapsto + {0x12d3e8f7, 0x30c0}, // dakatakana + {0x12def4bb, 0xfeba}, // sadfinalarabic + {0x12e14144, 0xf726}, // ampersandsmall + {0x12e22bb8, 0x33c2}, // amsquare + {0x1329e467, 0x0311}, // breveinvertedcmb + {0x132b7bd0, 0x2a04}, // unionmultitext + {0x132e0697, 0x01b3}, // Yhook + {0x13402162, 0xf6be}, // dotlessj + {0x134d9c31, 0x304c}, // gahiragana + {0x13597fb3, 0x04d9}, // afii10846 + {0x135d6341, 0x33c8}, // dbsquare + {0x13635045, 0x0300}, // gravecmb + {0x1367bcdf, 0xf88a}, // maiekupperleftthai + {0x1369554a, 0x207f}, // nsuperior + {0x136e8d95, 0xf885}, // saraileftthai + {0x1376f153, 0x0403}, // afii10052 + {0x1384d3da, 0x05b4}, // hiriqnarrowhebrew + {0x13868087, 0x0636}, // afii57430 + {0x138b1601, 0x0621}, // hamzafathatanarabic + {0x138fca68, 0x0a30}, // ragurmukhi + {0x13a69297, 0x0917}, // gadeva + {0x13bc5cc6, 0xf88d}, // maithoupperleftthai + {0x13bcc567, 0x25d1}, // circlewithrighthalfblack + {0x13ccaf5f, 0x3061}, // tihiragana + {0x13dc1f9e, 0x05b1}, // hatafsegol + {0x13e2dbb5, 0x1e3a}, // Llinebelow + {0x140e7a7e, 0x0551}, // Coarmenian + {0x14117f5a, 0x1e77}, // ucircumflexbelow + {0x141d63ad, 0x1eda}, // Ohornacute + {0x142c024d, 0x013a}, // lacute + {0x142c46b3, 0x2a06}, // unionsqdisplay + {0x143d707c, 0x05a6}, // merkhakefulalefthebrew + {0x146c75cf, 0x3275}, // ieungacirclekorean + {0x146f18bb, 0xfb36}, // zayindagesh + {0x147a2240, 0x1e81}, // wgrave + {0x1486cc9b, 0x054b}, // Jheharmenian + {0x14ac715c, 0x2473}, // twentycircle + {0x14b421a5, 0x0638}, // zaharabic + {0x14c795cf, 0x0051}, // Q + {0x14d1cd4b, 0x2284}, // notsubset + {0x14d2cd8a, 0x012f}, // iogonek + {0x14eb6d31, 0x02dc}, // tildewider + {0x14f2bc91, 0x1eab}, // acircumflextilde + {0x15045632, 0x05d1}, // bet + {0x1505dc02, 0x3083}, // yasmallhiragana + {0x152785c0, 0x30a1}, // asmallkatakana + {0x1532a7b6, 0x05e7}, // qofsegolhebrew + {0x15642935, 0x23a9}, // braceleftbt + {0x1564e3f1, 0x05b9}, // holam26 + {0x15771621, 0x042c}, // Softsigncyrillic + {0x159ac6ab, 0x0591}, // etnahtafoukhlefthebrew + {0x159b9dc9, 0x24c6}, // Qcircle + {0x15d1c25e, 0x04bf}, // chedescenderabkhasiancyrillic + {0x15dd6b0c, 0x25d9}, // whitecircleinverse + {0x15f64606, 0x33c5}, // cdsquare + {0x15f8ec13, 0x037e}, // questiongreek + {0x1602acd3, 0xff38}, // Xmonospace + {0x1610c2ad, 0x3181}, // yesieungkorean + {0x161db4d0, 0xf76c}, // Lsmall + {0x16393f6d, 0xfef6}, // lamalefmaddaabovefinalarabic + {0x164a5cd1, 0x0058}, // X + {0x164b6531, 0xf7eb}, // Edieresissmall + {0x165341dd, 0x02e0}, // gammasuperior + {0x167b1fac, 0xfebc}, // sadmedialarabic + {0x168b9d05, 0x04d5}, // aiecyrillic + {0x169cceb3, 0x005b}, // bracketleft + {0x16ad260d, 0x0253}, // bhook + {0x16b23c67, 0x3135}, // nieuncieuckorean + {0x16ba0a7a, 0x30a9}, // osmallkatakana + {0x16d5ac91, 0x3018}, // whitetortoiseshellbracketleft + {0x16f9045d, 0x0a16}, // khagurmukhi + {0x17093caa, 0x01e3}, // aemacron + {0x170fc75c, 0x306c}, // nuhiragana + {0x171b516a, 0x0a39}, // hagurmukhi + {0x17301afd, 0x3023}, // threehangzhou + {0x17314b3c, 0xf7a8}, // Dieresissmall + {0x173c8456, 0x338b}, // nfsquare + {0x178d45ae, 0x337e}, // meizierasquare + {0x17a9e49b, 0x322a}, // ideographicmoonparen + {0x17ad5313, 0x09ab}, // phabengali + {0x17da2afa, 0x0335}, // strokeshortoverlaycmb + {0x17deda0e, 0x00ed}, // iacute + {0x17e36acb, 0x05b8}, // qamats + {0x17ef9c62, 0x0a05}, // agurmukhi + {0x180419cd, 0xfc62}, // shaddakasraarabic + {0x18120be8, 0x200b}, // zerowidthspace + {0x18175789, 0x05b3}, // hatafqamatswidehebrew + {0x181f5c91, 0x091f}, // ttadeva + {0x182bd096, 0x0148}, // ncaron + {0x183028bb, 0x04da}, // Schwadieresiscyrillic + {0x1840ed9a, 0xfea0}, // jeemmedialarabic + {0x18492236, 0x0e5a}, // angkhankhuthai + {0x1855a5e3, 0xfe5f}, // numbersignsmall + {0x185b816d, 0x0146}, // ncommaaccent + {0x187ab455, 0x0e42}, // saraothai + {0x1885706c, 0x3157}, // okorean + {0x18905b85, 0x05e8}, // reshsegol + {0x18923bff, 0x2135}, // aleph + {0x1892a13e, 0x005d}, // bracketrightbigg + {0x18a1a8e1, 0x02c2}, // a40 + {0x18a5c10a, 0x2584}, // dnblock + {0x18a72a69, 0xfb3a}, // finalkafdageshhebrew + {0x18b82c53, 0x045c}, // afii10109 + {0x18c46fec, 0x033c}, // seagullbelowcmb + {0x18d47bfd, 0x3298}, // ideographiclaborcircle + {0x18dbddd2, 0x0993}, // obengali + {0x18df8652, 0x2286}, // subsetorequal + {0x18ea53c7, 0x0663}, // afii57395 + {0x18ec3f78, 0x05e8}, // afii57688 + {0x18f0d507, 0xfe9f}, // jeeminitialarabic + {0x18fb8128, 0x25c1}, // a1 + {0x190a56aa, 0xfe5a}, // parenrightsmall + {0x1920c2c2, 0xff65}, // middledotkatakanahalfwidth + {0x1925bd4b, 0xf6f9}, // Lslashsmall + {0x192c8826, 0x2283}, // superset + {0x1940b4fd, 0x2251}, // geometricallyequal + {0x19427103, 0x2a01}, // circleplustext + {0x1946a31f, 0x05ae}, // zinorhebrew + {0x194ec3dd, 0xfb38}, // tetdageshhebrew + {0x195fdeed, 0x3013}, // getamark + {0x197f461f, 0x1e03}, // bdotaccent + {0x1991ce27, 0x007b}, // braceleftBigg + {0x1994a487, 0x0481}, // koppacyrillic + {0x19985117, 0x339a}, // nmsquare + {0x19a1a98b, 0x00ad}, // sfthyphen + {0x19ad4aac, 0xfef2}, // yehfinalarabic + {0x19b22272, 0x3269}, // chieuchcirclekorean + {0x19b344e4, 0x0123}, // gcedilla + {0x19b3f208, 0x05b8}, // qamats27 + {0x19d833fe, 0x02ba}, // dblprimemod + {0x19dea593, 0x0428}, // afii10042 + {0x19f7c320, 0x04d1}, // abrevecyrillic + {0x19fa29b1, 0x327f}, // koreanstandardsymbol + {0x1a00d3da, 0x032b}, // dblarchinvertedbelowcmb + {0x1a260946, 0x0447}, // checyrillic + {0x1a287ed9, 0x0922}, // ddhadeva + {0x1a28dcc1, 0x005b}, // bracketleftBig + {0x1a3b33cb, 0xfed7}, // qafinitialarabic + {0x1a3bf649, 0x05b2}, // hatafpatahhebrew + {0x1a4f3484, 0x0913}, // odeva + {0x1a533d39, 0x0306}, // brevecmb + {0x1ac76244, 0x0425}, // Khacyrillic + {0x1ac90440, 0x010f}, // dcaron + {0x1b240a74, 0x00d8}, // Oslash + {0x1b2b4015, 0xfe65}, // greatersmall + {0x1b33167a, 0xfe3e}, // dblanglebracketrightvertical + {0x1b342691, 0x017c}, // zdot + {0x1b39339b, 0x253c}, // SF050000 + {0x1b3f9c21, 0x1e72}, // Udieresisbelow + {0x1b4399b2, 0x04c7}, // Enhookcyrillic + {0x1b5874ea, 0x091b}, // chadeva + {0x1b8c8992, 0x2122}, // trademark + {0x1ba72293, 0xff03}, // numbersignmonospace + {0x1bbb8fb3, 0x0477}, // izhitsadblgravecyrillic + {0x1bcb2bfd, 0x337d}, // taisyouerasquare + {0x1be98812, 0x24d4}, // ecircle + {0x1c079308, 0x09cc}, // auvowelsignbengali + {0x1c16ebae, 0x0126}, // Hbar + {0x1c2631dd, 0x3385}, // KBsquare + {0x1c56e166, 0xfd3f}, // parenrightaltonearabic + {0x1c70f0f3, 0xf7e7}, // Ccedillasmall + {0x1c94529b, 0x21b5}, // carriagereturn + {0x1cb10674, 0x0a27}, // dhagurmukhi + {0x1cb5367a, 0x0532}, // Benarmenian + {0x1cdb3e05, 0x2514}, // SF020000 + {0x1ce17c08, 0xfea6}, // khahfinalarabic + {0x1ce29209, 0x02cc}, // verticallinelowmod + {0x1ce40996, 0xff3b}, // bracketleftmonospace + {0x1cf31612, 0x0598}, // zarqahebrew + {0x1d2559c8, 0x03b9}, // iota + {0x1d25e3ef, 0x043c}, // emcyrillic + {0x1d420ccb, 0x0430}, // afii10065 + {0x1d91efe5, 0xf6d8}, // dieresisgrave + {0x1d954d85, 0x09a4}, // tabengali + {0x1da7ae8c, 0x00d7}, // multiply + {0x1db92094, 0x053d}, // Xeharmenian + {0x1dbbea92, 0x02e6}, // tonebarhighmod + {0x1dbc2a14, 0x2245}, // congruent + {0x1dbe86c5, 0x246d}, // fourteencircle + {0x1dc0644e, 0x2012}, // figuredash + {0x1ded853e, 0x01cc}, // nj + {0x1df7638a, 0x00e4}, // adieresis + {0x1dfc2837, 0x217a}, // elevenroman + {0x1e0312fa, 0x0290}, // zretroflexhook + {0x1e065c3a, 0xf7f1}, // Ntildesmall + {0x1e1332fd, 0x0287}, // tturned + {0x1e25355a, 0x0461}, // omegacyrillic + {0x1e38c8d8, 0x012a}, // Imacron + {0x1e56afb4, 0xfc61}, // shaddadammaarabic + {0x1e645fd0, 0x00b2}, // twosuperior + {0x1e6cddcb, 0x0563}, // gimarmenian + {0x1e7c9862, 0x338f}, // squarekg + {0x1e82a7c3, 0x2302}, // house + {0x1e860782, 0x0983}, // visargabengali + {0x1e917582, 0x09a2}, // ddhabengali + {0x1ea7d113, 0x031c}, // ringhalfleftbelowcmb + {0x1eae034a, 0x3122}, // anbopomofo + {0x1eae1716, 0x0434}, // afii10069 + {0x1edf9913, 0x1e16}, // Emacronacute + {0x1ef123d5, 0x0413}, // Gecyrillic + {0x1f06ae25, 0xfb31}, // betdageshhebrew + {0x1f0c6a2a, 0x0651}, // shaddafathatanarabic + {0x1f1df6d1, 0x3381}, // nasquare + {0x1f2383d4, 0x0004}, // controlEOT + {0x1f2a4214, 0xfdfa}, // sallallahoualayhewasallamarabic + {0x1f5314ee, 0xf6fc}, // Ringsmall + {0x1f5dc79d, 0xf7b4}, // Acutesmall + {0x1f60dad4, 0x05e8}, // reshhebrew + {0x1f686fbe, 0xff2c}, // Lmonospace + {0x1f90aeb4, 0xff7b}, // sakatakanahalfwidth + {0x1f93ce2b, 0xff33}, // Smonospace + {0x1f9b52d4, 0x0323}, // dotbelowcmb + {0x1faa2fdf, 0x203e}, // overline + {0x1faf20cc, 0x02b9}, // primemod + {0x1fba9d24, 0x1e4a}, // Ncircumflexbelow + {0x1fc00e7e, 0x0050}, // P + {0x1fc99492, 0x3126}, // erbopomofo + {0x1feea4ab, 0x0623}, // afii57411 + {0x20061138, 0x1e02}, // Bdotaccent + {0x200e9513, 0x030f}, // dblgravecmb + {0x2012c16a, 0xf6d4}, // cyrbreve + {0x201a6676, 0x2310}, // logicalnotreversed + {0x201e3ee9, 0x0310}, // candrabinducmb + {0x2024cfd1, 0x0475}, // afii10196 + {0x2038e6d5, 0x307a}, // pehiragana + {0x205d0ec7, 0x03a0}, // Pi + {0x206a255a, 0xf775}, // Usmall + {0x207bf81e, 0xff84}, // tokatakanahalfwidth + {0x2086c569, 0x00d2}, // Ograve + {0x2086fb87, 0xf772}, // Rsmall + {0x208b3b40, 0xfed0}, // ghainmedialarabic + {0x209bfca6, 0x24d5}, // fcircle + {0x20a31ebd, 0x2489}, // twoperiod + {0x20abefc1, 0x0385}, // dialytikatonos + {0x20b8cfa5, 0x0443}, // afii10085 + {0x20bc528f, 0x2042}, // asterism + {0x20ca67b9, 0x09a1}, // ddabengali + {0x20ce09b9, 0xfb7b}, // tchehfinalarabic + {0x20dd36ea, 0x207e}, // parenrightsuperior + {0x20e840a0, 0x30d4}, // pikatakana + {0x2111e869, 0x092a}, // padeva + {0x21185c0e, 0x028e}, // yturned + {0x2130f98f, 0x0aa0}, // tthagujarati + {0x215fc096, 0x000d}, // controlCR + {0x21622652, 0x249e}, // cparen + {0x21669982, 0x0181}, // Bhook + {0x217143de, 0x05b3}, // hatafqamats34 + {0x2173a28b, 0x0295}, // glottalstopreversed + {0x218d5b62, 0x3232}, // ideographichaveparen + {0x21b37808, 0x2477}, // fourparen + {0x21bef9d7, 0x0e06}, // khorakhangthai + {0x21c0f31f, 0x013b}, // Lcommaaccent + {0x21ce0071, 0x2179}, // tenroman + {0x21d28f9e, 0x05e9}, // shin + {0x21f74f30, 0x043e}, // afii10080 + {0x2203033d, 0x019d}, // Nhookleft + {0x22037801, 0x044b}, // afii10093 + {0x220f1331, 0x05db}, // kafhebrew + {0x2221c36b, 0x06f6}, // sixpersian + {0x22351581, 0x059f}, // qarneyparahebrew + {0x223cb30f, 0xfc9f}, // behmeeminitialarabic + {0x225099c3, 0x3149}, // ssangcieuckorean + {0x22542ce4, 0x2207}, // nabla + {0x22702420, 0x3153}, // eokorean + {0x2274db8f, 0xff08}, // parenleftmonospace + {0x2282e86d, 0x00fa}, // uacute + {0x22a883d2, 0x25c7}, // whitediamond + {0x22b082b8, 0x005c}, // backslashBigg + {0x22c93a2b, 0x338d}, // mugsquare + {0x22e3ac9e, 0xff4c}, // lmonospace + {0x2320c842, 0x0277}, // omegalatinclosed + {0x2324e69c, 0x2665}, // heart + {0x2351e945, 0x0a8a}, // uugujarati + {0x2352b38c, 0xf6d7}, // dieresisacute + {0x2356706f, 0x0541}, // Jaarmenian + {0x23679572, 0x1ef1}, // uhorndotbelow + {0x236d79e4, 0x301e}, // quotedblprime + {0x237979f3, 0xff73}, // ukatakanahalfwidth + {0x23947e9f, 0x0266}, // hhook + {0x23b6327c, 0x304f}, // kuhiragana + {0x23b9408d, 0x2208}, // element + {0x23d291f5, 0x0639}, // ainarabic + {0x23d42e51, 0xff0b}, // plusmonospace + {0x23e15f1c, 0xff90}, // mikatakanahalfwidth + {0x23e70b3f, 0x0664}, // afii57396 + {0x23e9f46b, 0xff80}, // takatakanahalfwidth + {0x23ea33c4, 0x30f1}, // wekatakana + {0x23f0f542, 0xff2f}, // Omonospace + {0x2415f58f, 0x3069}, // dohiragana + {0x2419b09a, 0x038f}, // Omegatonos + {0x241b0583, 0x0a9e}, // nyagujarati + {0x241cc39b, 0x007b}, // braceleftbigg + {0x241f6494, 0x3105}, // bbopomofo + {0x2459d6f7, 0x0aea}, // fourgujarati + {0x24688db0, 0x02c1}, // glottalstopreversedmod + {0x24776c38, 0x0343}, // koroniscmb + {0x2479e0d2, 0x3021}, // onehangzhou + {0x249dd6ee, 0x0665}, // afii57397 + {0x24c0efcc, 0x316d}, // rieulyeorinhieuhkorean + {0x24ccbd1b, 0x09e6}, // zerobengali + {0x24d11d48, 0x02c2}, // arrowheadleftmod + {0x24d6b19b, 0xfee7}, // nooninitialarabic + {0x24deab24, 0x25a4}, // squarehorizontalfill + {0x24e9b4e5, 0x21e4}, // arrowtableft + {0x24f5be18, 0x0308}, // dieresiscmb + {0x2527d2da, 0x300c}, // cornerbracketleft + {0x252ef6ac, 0x01de}, // Adieresismacron + {0x2533ec5c, 0x05e8}, // reshtsere + {0x253f33be, 0x006e}, // n + {0x2543ce81, 0x05c1}, // shindothebrew + {0x254b8857, 0x0929}, // nnnadeva + {0x2556a01a, 0x005c}, // backslashbigg + {0x25725d01, 0x0496}, // Zhedescendercyrillic + {0x2592eb8c, 0x1e39}, // ldotbelowmacron + {0x25a29a9e, 0x000a}, // controlLF + {0x25bfabf1, 0x056c}, // liwnarmenian + {0x25c22a8d, 0x0927}, // dhadeva + {0x25c3f8ae, 0xff3e}, // asciicircummonospace + {0x25ca4638, 0x0576}, // nowarmenian + {0x25d83051, 0x0e19}, // nonuthai + {0x25e64388, 0x1ee5}, // udotbelow + {0x25eb8755, 0xff34}, // Tmonospace + {0x25ef68be, 0x0103}, // abreve + {0x25f0117e, 0x095f}, // yyadeva + {0x2614c40e, 0x0aaf}, // yagujarati + {0x262be20f, 0x0471}, // psicyrillic + {0x2637caf5, 0x0932}, // ladeva + {0x263e0b92, 0x09ac}, // babengali + {0x2652690c, 0x3137}, // tikeutkorean + {0x265be8ad, 0x01cf}, // Icaron + {0x265fdad4, 0x05b8}, // qamatshebrew + {0x26621b4d, 0x0072}, // r + {0x2669a6cb, 0x211c}, // Rfraktur + {0x26837556, 0x0048}, // H + {0x26a72a71, 0x3188}, // yoyaekorean + {0x26ab6d3a, 0x1ed9}, // ocircumflexdotbelow + {0x26af8089, 0x304e}, // gihiragana + {0x26b9c1d9, 0x0e30}, // saraathai + {0x26c43ea8, 0x0911}, // ocandradeva + {0x26caa803, 0x21d4}, // arrowdblboth + {0x26cb382e, 0xf8fc}, // bracerighttp + {0x26f6f992, 0x04e4}, // Idieresiscyrillic + {0x26fb496b, 0x3351}, // rittorusquare + {0x27075678, 0x012e}, // Iogonek + {0x271cd3fa, 0x27e8}, // angbracketleftBig + {0x2731451f, 0x0408}, // afii10057 + {0x273977ae, 0x0435}, // afii10070 + {0x27487450, 0x007e}, // asciitilde + {0x275654ea, 0x099b}, // chabengali + {0x275a3e46, 0x09a0}, // tthabengali + {0x275a5b3b, 0x1ee1}, // ohorntilde + {0x27607db6, 0x05b4}, // hiriq2d + {0x27a2d18f, 0x05b9}, // holam32 + {0x27b7bf17, 0x031f}, // plusbelowcmb + {0x27b7cc70, 0xfb2d}, // shindageshsindothebrew + {0x27d62d65, 0x200d}, // afii301 + {0x27d8dd28, 0x00e8}, // egrave + {0x27e6d9df, 0x0271}, // mhook + {0x27f31ec3, 0x3271}, // rieulacirclekorean + {0x283f3216, 0x2075}, // fivesuperior + {0x28898020, 0x0281}, // Rsmallinverted + {0x288edd59, 0x24cc}, // Wcircle + {0x2892f3ea, 0x2a02}, // circlemultiplydisplay + {0x28d9fe2f, 0x0e41}, // saraaethai + {0x28dd4931, 0x3234}, // ideographicnameparen + {0x28e31924, 0x0a6c}, // sixgurmukhi + {0x28e4057d, 0xfc58}, // yehmeemisolatedarabic + {0x28f71acd, 0x0633}, // afii57427 + {0x290ed42e, 0x1e18}, // Ecircumflexbelow + {0x2916bf1f, 0xf7ef}, // Idieresissmall + {0x29287ce1, 0x03d2}, // Upsilon1 + {0x29346ac3, 0x2021}, // daggerdbl + {0x29371ded, 0x1e8f}, // ydotaccent + {0x2951ba53, 0xf6e2}, // commasuperior + {0x29734fd7, 0x092d}, // bhadeva + {0x298e1b46, 0x01ea}, // Oogonek + {0x29958ce9, 0x0005}, // controlENQ + {0x29a8f130, 0x04d4}, // Aiecyrillic + {0x29ab0eda, 0x0146}, // ncedilla + {0x29b0158e, 0x05e7}, // qofshevahebrew + {0x29be1625, 0x0028}, // parenleftbig + {0x29c07bd0, 0x305e}, // zohiragana + {0x29d0597d, 0x262f}, // yinyang + {0x29d51dd2, 0x06d1}, // yehthreedotsbelowarabic + {0x29d5f944, 0x03e4}, // Feicoptic + {0x29e31b8f, 0x05b1}, // hatafsegolhebrew + {0x29e6e487, 0x30cc}, // nukatakana + {0x29e7f6bb, 0x0035}, // five + {0x2a0fca4c, 0x3085}, // yusmallhiragana + {0x2a239937, 0x0375}, // numeralsignlowergreek + {0x2a28d54e, 0x30aa}, // okatakana + {0x2a619f09, 0x2660}, // spade + {0x2a645de3, 0x3091}, // wehiragana + {0x2a64e363, 0x226e}, // notless + {0x2a6a5dc5, 0x3088}, // yohiragana + {0x2a72414c, 0x0e44}, // saraaimaimalaithai + {0x2a8e7779, 0x0ad0}, // omgujarati + {0x2ac0e180, 0x33a6}, // kmcubedsquare + {0x2ac17d0f, 0x00f3}, // oacute + {0x2acd450a, 0x002f}, // slashbig + {0x2ad04347, 0xed12}, // arrowvertexdbl + {0x2ae749c7, 0x00e1}, // aacute + {0x2ae8215f, 0x001d}, // controlGS + {0x2ae8c5a6, 0x21c4}, // arrowrightoverleft + {0x2aedcd2c, 0x09fa}, // issharbengali + {0x2afb134c, 0xfb03}, // ffi + {0x2b2385f1, 0xf760}, // Gravesmall + {0x2b27655e, 0x261c}, // pointingindexleftwhite + {0x2b3ff353, 0x2557}, // SF250000 + {0x2b42ad49, 0xfe55}, // colonsmall + {0x2b5ac1a6, 0x0045}, // E + {0x2b84f841, 0x30a6}, // ukatakana + {0x2b91651d, 0x0319}, // righttackbelowcmb + {0x2b93dd53, 0x0661}, // afii57393 + {0x2b9750e3, 0x2200}, // universal + {0x2b9c968a, 0x0315}, // commaaboverightcmb + {0x2bb5189c, 0x25e3}, // blacklowerlefttriangle + {0x2bb9b9bf, 0x0621}, // hamzafathaarabic + {0x2bd253b1, 0x09bf}, // ivowelsignbengali + {0x2be6415c, 0x05b3}, // hatafqamatshebrew + {0x2beb7c62, 0x013c}, // lcommaaccent + {0x2c0f9c0b, 0x0912}, // oshortdeva + {0x2c15e9f4, 0x091c}, // jadeva + {0x2c1b74f9, 0x2262}, // notidentical + {0x2c4944e4, 0x0393}, // Gamma + {0x2c91b61a, 0x0640}, // kashidaautonosidebearingarabic + {0x2c964b66, 0x334a}, // miribaarusquare + {0x2cb17e35, 0xfec6}, // zahfinalarabic + {0x2cd9d9ec, 0xfc6d}, // behnoonfinalarabic + {0x2cdfcd2a, 0x30cb}, // nikatakana + {0x2cf9daf5, 0x3228}, // nineideographicparen + {0x2d2e3883, 0x2190}, // arrowleft + {0x2d317780, 0xf778}, // Xsmall + {0x2d329c65, 0xfb3c}, // lameddageshhebrew + {0x2d39ea69, 0x019e}, // nlegrightlong + {0x2d3b565d, 0x05ea}, // afii57690 + {0x2d456f79, 0x25e2}, // blacklowerrighttriangle + {0x2d52bd2b, 0x3326}, // dorusquare + {0x2d84140a, 0x0293}, // ezhcurl + {0x2d8d5b1d, 0x33d0}, // lmsquare + {0x2d95d169, 0x3155}, // yeokorean + {0x2d975eca, 0xfb04}, // ffl + {0x2d9ae85a, 0x0661}, // onehackarabic + {0x2d9b14ff, 0xfb6d}, // vehmedialarabic + {0x2da2ea79, 0x313d}, // rieulsioskorean + {0x2daa1b6f, 0x090a}, // uudeva + {0x2db9bc28, 0xf7e3}, // Atildesmall + {0x2e04353d, 0x1ea9}, // acircumflexhookabove + {0x2e043b05, 0xff0a}, // asteriskmonospace + {0x2e10a2b1, 0x0374}, // numeralsigngreek + {0x2e1b300e, 0x05e8}, // reshpatah + {0x2e1eaa7d, 0xfb49}, // shindagesh + {0x2e2c25c0, 0x0392}, // Beta + {0x2e356485, 0x09c2}, // uuvowelsignbengali + {0x2e4224af, 0x05e4}, // afii57684 + {0x2e5e0023, 0x0a20}, // tthagurmukhi + {0x2e647759, 0x33d6}, // molsquare + {0x2e7c6436, 0x3048}, // ehiragana + {0x2e915a9d, 0xfe3b}, // blacklenticularbracketleftvertical + {0x2e9d6cac, 0xf7f0}, // Ethsmall + {0x2e9e14a6, 0x0454}, // ecyrillic + {0x2e9ef541, 0x0192}, // florin + {0x2ea8b970, 0x327a}, // phieuphacirclekorean + {0x2eb22aa1, 0x01dc}, // udieresisgrave + {0x2eb3bdc7, 0x027e}, // rfishhook + {0x2eb455b0, 0x25b6}, // blackrightpointingtriangle + {0x2ec430ea, 0x0078}, // x + {0x2ec8352a, 0x0143}, // Nacute + {0x2eea1838, 0x0170}, // Uhungarumlaut + {0x2efaa14d, 0x3015}, // tortoiseshellbracketright + {0x2f06c380, 0x0a91}, // ocandragujarati + {0x2f0e722f, 0x0021}, // exclam + {0x2f14e4ad, 0x0183}, // btopbar + {0x2f1fd59c, 0xf6d1}, // cyrBreve + {0x2f22b335, 0x305f}, // tahiragana + {0x2f247a45, 0x00b5}, // mu + {0x2f42e9c9, 0x0405}, // afii10054 + {0x2f4b01e9, 0x03e0}, // Sampigreek + {0x2f51a2a5, 0x0591}, // etnahtahebrew + {0x2f5af1cc, 0xfec4}, // tahmedialarabic + {0x2f5c74c9, 0x30a4}, // ikatakana + {0x2f5e2692, 0x033f}, // dbloverlinecmb + {0x2f7e3ce0, 0xfb35}, // vavdagesh65 + {0x2f7fe7da, 0x04ea}, // Obarreddieresiscyrillic + {0x2f8f84ed, 0x3019}, // whitetortoiseshellbracketright + {0x2f9c7ff4, 0x221f}, // orthogonal + {0x2fa13b0c, 0x0309}, // hookcmb + {0x2fa6d960, 0x0e05}, // khokhonthai + {0x2fb88e89, 0x0492}, // Ghestrokecyrillic + {0x2fe066dc, 0x24c8}, // Scircle + {0x2ff9eee3, 0x3231}, // ideographicstockparen + {0x30132e73, 0x2474}, // oneparen + {0x302d72c2, 0xfb2b}, // shinsindothebrew + {0x3033e257, 0x0416}, // Zhecyrillic + {0x3034a6d0, 0x0213}, // rinvertedbreve + {0x3043436d, 0x0208}, // Idblgrave + {0x3046485b, 0x0a41}, // umatragurmukhi + {0x30585e10, 0x0631}, // reharabic + {0x305b2089, 0x006d}, // m + {0x305dc9d7, 0x2480}, // thirteenparen + {0x3097f64c, 0x010c}, // Ccaron + {0x30b4b18c, 0x0e28}, // sosalathai + {0x30c0161e, 0x01d3}, // Ucaron + {0x30c9bc6e, 0x0a1e}, // nyagurmukhi + {0x30cd38cb, 0x33d8}, // pmsquare + {0x30d25d42, 0x2089}, // nineinferior + {0x30e6287a, 0x05e7}, // qofhatafpatah + {0x30eada85, 0x2219}, // bulletoperator + {0x30f64fef, 0x20aa}, // sheqelhebrew + {0x310a4774, 0x337f}, // corporationsquare + {0x31158bc3, 0x339f}, // mmsquaredsquare + {0x3116a838, 0x0647}, // heharabic + {0x312db4ff, 0x2040}, // tie + {0x313237dd, 0xff32}, // Rmonospace + {0x313f3c20, 0x09df}, // yyabengali + {0x3154a912, 0x04ab}, // esdescendercyrillic + {0x31f1489a, 0x0643}, // afii57443 + {0x31f928de, 0x05df}, // finalnun + {0x31fab77d, 0x1eea}, // Uhorngrave + {0x3207407e, 0x046b}, // yusbigcyrillic + {0x3225e9b9, 0x05dc}, // lamedholamhebrew + {0x3238fa28, 0x3004}, // jis + {0x323ea229, 0x33ac}, // gpasquare + {0x324496b3, 0x33bf}, // mwmegasquare + {0x3248fa12, 0xfe5e}, // tortoiseshellbracketrightsmall + {0x324bc39e, 0x22da}, // lessequalorgreater + {0x3266451e, 0x30f2}, // wokatakana + {0x326ca1fd, 0x013f}, // Ldot + {0x328fa9de, 0x230b}, // floorrightBigg + {0x32930f95, 0x046f}, // ksicyrillic + {0x329a975f, 0x0a0a}, // uugurmukhi + {0x329ed55c, 0x04e1}, // dzeabkhasiancyrillic + {0x32d855b8, 0x0ae9}, // threegujarati + {0x32e77f07, 0x22c2}, // intersectiontext + {0x32fd46a7, 0x041e}, // afii10032 + {0x32fe41c6, 0x0667}, // afii57399 + {0x330263f2, 0x3136}, // nieunhieuhkorean + {0x3303dbcb, 0x04b2}, // Hadescendercyrillic + {0x33042de7, 0x1e90}, // Zcircumflex + {0x33231bf5, 0x27e8}, // angbracketleftbigg + {0x335a816e, 0xf739}, // nineoldstyle + {0x335e3259, 0x3022}, // twohangzhou + {0x336106b8, 0x05d7}, // afii57671 + {0x33821f87, 0x05e2}, // ayinhebrew + {0x33849fcd, 0x304d}, // kihiragana + {0x339cb29c, 0x03cb}, // upsilondieresis + {0x339dfd30, 0x2200}, // forall + {0x33a4598f, 0x0e10}, // thothanthai + {0x33dd39ff, 0x0437}, // zecyrillic + {0x33ea63c8, 0x24df}, // pcircle + {0x33f59002, 0x0285}, // eshsquatreversed + {0x340746a2, 0xff4a}, // jmonospace + {0x340dcbd1, 0x21d1}, // arrowdbltp + {0x3425ba3a, 0x056d}, // xeharmenian + {0x342d52b5, 0x25cb}, // whitecircle + {0x34399add, 0x0034}, // four + {0x343b0ff5, 0x1e8b}, // xdotaccent + {0x343f59f3, 0x0437}, // afii10073 + {0x344b950b, 0x031d}, // uptackbelowcmb + {0x34515ec0, 0x01ca}, // NJ + {0x345791f2, 0x027c}, // rlongleg + {0x346086da, 0x2286}, // reflexsubset + {0x3463147c, 0x1e69}, // sdotbelowdotaccent + {0x3471790f, 0xf6f7}, // Dotaccentsmall + {0x3490ad97, 0x047a}, // Omegaroundcyrillic + {0x34a7b989, 0x006f}, // o + {0x34a88183, 0x2640}, // female + {0x34b5f401, 0x016a}, // Umacron + {0x34bab99c, 0x24e0}, // qcircle + {0x34c88fb4, 0x2312}, // arc + {0x34c908a5, 0x1eb4}, // Abrevetilde + {0x34d1f962, 0x05e8}, // reshholamhebrew + {0x34df3d1c, 0x00a1}, // exclamdown + {0x34e969fb, 0x05a0}, // telishagedolahebrew + {0x34f9cd37, 0x010b}, // cdot + {0x35188ac4, 0xfeac}, // thalfinalarabic + {0x351bf85e, 0x0257}, // dhook + {0x351e7136, 0x0482}, // thousandcyrillic + {0x352bce90, 0x00a3}, // sterling + {0x35378756, 0x2591}, // shadelight + {0x35440d94, 0x040c}, // Kjecyrillic + {0x354dad21, 0x0129}, // itilde + {0x35514624, 0x00d6}, // Odieresis + {0x357c478e, 0xf736}, // sixoldstyle + {0x3596098d, 0xfb9f}, // noonghunnafinalarabic + {0x359e9c03, 0x0418}, // Iicyrillic + {0x359f6846, 0x1ebc}, // Etilde + {0x35a9ba78, 0x0a95}, // kagujarati + {0x35b65af3, 0x33af}, // radoverssquaredsquare + {0x35ce2a2d, 0x066a}, // afii57381 + {0x35ddec6f, 0x00eb}, // edieresis + {0x35e5fe3b, 0x3118}, // cbopomofo + {0x3613bad2, 0x011b}, // ecaron + {0x361cb4c9, 0xfb6b}, // vehfinalarabic + {0x361e70b8, 0x0043}, // C + {0x362459fb, 0xfe97}, // tehinitialarabic + {0x362bfa3a, 0xf732}, // twooldstyle + {0x362c9d3a, 0x02b0}, // hsuperior + {0x36678fdf, 0x2326}, // deleteright + {0x3673a47b, 0x05e7}, // qofqamatshebrew + {0x3676afc0, 0x0ac9}, // ocandravowelsigngujarati + {0x368bf72e, 0x0038}, // eight + {0x36aaad0e, 0x307b}, // hohiragana + {0x36d3bc14, 0x0491}, // afii10098 + {0x36d54fb7, 0x015a}, // Sacute + {0x37117bac, 0x059b}, // tevirlefthebrew + {0x372986de, 0x05f3}, // gereshhebrew + {0x373e5e3f, 0xff27}, // Gmonospace + {0x37497fde, 0x25b7}, // a3 + {0x3781d925, 0xf6ed}, // isuperior + {0x37866f5c, 0x00df}, // germandbls + {0x37a73b5a, 0xfee0}, // lammedialarabic + {0x37a77cc1, 0x030b}, // hungarumlautcmb + {0x37b36429, 0xff68}, // ismallkatakanahalfwidth + {0x37b7557e, 0x001c}, // controlFS + {0x37c2175b, 0xfcca}, // lamhahinitialarabic + {0x37c23820, 0x24c5}, // Pcircle + {0x37d669b4, 0x090e}, // eshortdeva + {0x37e460db, 0x308d}, // rohiragana + {0x37e5061e, 0x04a3}, // endescendercyrillic + {0x37f67ca7, 0x029a}, // eopenclosed + {0x380974a8, 0xf735}, // fiveoldstyle + {0x381040c4, 0x310d}, // gbopomofo + {0x381640e0, 0xffe3}, // macronmonospace + {0x381c7e4d, 0x1ece}, // Ohookabove + {0x38201bde, 0x0961}, // llvocalicdeva + {0x38291591, 0x0e2e}, // honokhukthai + {0x3839681b, 0x3055}, // sahiragana + {0x3863c9a6, 0x208e}, // parenrightinferior + {0x386cda71, 0x01f0}, // jcaron + {0x38746563, 0x01b0}, // uhorn + {0x38880d1d, 0x0198}, // Khook + {0x38885f68, 0x091d}, // jhadeva + {0x3889a61f, 0x005b}, // bracketleftbigg + {0x388ccfdd, 0x30e3}, // yasmallkatakana + {0x3896be1c, 0x0025}, // percent + {0x38a80af1, 0x306d}, // nehiragana + {0x38bcbef5, 0x05b7}, // afii57798 + {0x38bebcf5, 0x2552}, // SF510000 + {0x38ce8c39, 0x059a}, // yetivhebrew + {0x38cea50a, 0x24d6}, // gcircle + {0x38d9b559, 0x3003}, // dittomark + {0x38de4662, 0x1e7c}, // Vtilde + {0x38e73ed2, 0x01c0}, // clickdental + {0x38efc9e4, 0x04a6}, // Pemiddlehookcyrillic + {0x391bc4d9, 0xf6d3}, // dblGrave + {0x391e728b, 0x099a}, // cabengali + {0x392c00af, 0x3305}, // intisquare + {0x3934b5de, 0x0e43}, // saraaimaimuanthai + {0x3946429a, 0x3010}, // blacklenticularbracketleft + {0x396642a3, 0x322d}, // ideographicwoodparen + {0x396b44dd, 0x0a3c}, // nuktagurmukhi + {0x396d8b52, 0x0930}, // radeva + {0x3989511a, 0xfc5e}, // shaddadammatanarabic + {0x39918d40, 0x30b6}, // zakatakana + {0x399ac15a, 0x0283}, // esh + {0x39aa6d90, 0x0a83}, // visargagujarati + {0x39b06752, 0x004a}, // J + {0x39d0b19b, 0x00ae}, // registered + {0x39d5a1b1, 0x019c}, // Mturned + {0x39e226d5, 0x05e3}, // afii57683 + {0x39f864d5, 0x2462}, // threecircle + {0x39fd88e8, 0x05a8}, // qadmahebrew + {0x3a029acd, 0x338e}, // squaremg + {0x3a0e66b8, 0x1ee6}, // Uhookabove + {0x3a1089b2, 0x0073}, // s + {0x3a3b69ae, 0x317c}, // siostikeutkorean + {0x3a3c0e00, 0xff9d}, // nkatakanahalfwidth + {0x3a40856d, 0x25a0}, // blacksquare + {0x3a7498f3, 0x05e2}, // ayin + {0x3a777405, 0x0945}, // ecandravowelsigndeva + {0x3a846086, 0xff9c}, // wakatakanahalfwidth + {0x3aa3cfcb, 0x0960}, // rrvocalicdeva + {0x3ab26d21, 0x062f}, // dalarabic + {0x3ade6670, 0x0440}, // afii10082 + {0x3afe4407, 0x25a9}, // squarediagonalcrosshatchfill + {0x3b0367b4, 0x0a6b}, // fivegurmukhi + {0x3b43910b, 0x0e36}, // sarauethai + {0x3b4774fb, 0xfb35}, // vavdageshhebrew + {0x3b6394a8, 0x30e0}, // mukatakana + {0x3b722aff, 0x02bf}, // ringhalfleft + {0x3b86faf7, 0x1e31}, // kacute + {0x3b8c9510, 0x0926}, // dadeva + {0x3b8f536a, 0x0564}, // daarmenian + {0x3b919910, 0x02b4}, // rturnedsuperior + {0x3b92b9ea, 0x1e4b}, // ncircumflexbelow + {0x3b9a0136, 0x2468}, // ninecircle + {0x3b9a26e8, 0x0637}, // taharabic + {0x3bf4dcc7, 0xfea3}, // hahinitialarabic + {0x3bf5a3f3, 0x301d}, // quotedblprimereversed + {0x3c2679f3, 0x25c3}, // whiteleftpointingsmalltriangle + {0x3c4101c7, 0x0a2b}, // phagurmukhi + {0x3c47c401, 0x0196}, // Iotaafrican + {0x3c5c7654, 0x0910}, // aideva + {0x3c6261b4, 0x322e}, // ideographicmetalparen + {0x3c6e58f4, 0x05d5}, // vavhebrew + {0x3c89c6b7, 0x2192}, // arrowright + {0x3c9425ca, 0x0666}, // sixhackarabic + {0x3c9b6897, 0xff0e}, // periodmonospace + {0x3c9bce6c, 0xf7ee}, // Icircumflexsmall + {0x3ca31461, 0x01d1}, // Ocaron + {0x3ca4227b, 0x0120}, // Gdot + {0x3ca9c5ab, 0x0345}, // ypogegrammenigreekcmb + {0x3cb5e1bf, 0x3146}, // ssangsioskorean + {0x3cb6098f, 0x25b9}, // whiterightpointingsmalltriangle + {0x3ccd3832, 0xfc60}, // shaddafathaarabic + {0x3cfd6c60, 0x305a}, // zuhiragana + {0x3cfe2d05, 0x018f}, // Schwa + {0x3d0581a8, 0x313c}, // rieulpieupkorean + {0x3d200141, 0x30c9}, // dokatakana + {0x3d25bc32, 0x2116}, // numero + {0x3d292466, 0x05b1}, // hatafsegol17 + {0x3d30abad, 0x0279}, // rturned + {0x3d3a35a3, 0x0252}, // ascriptturned + {0x3d3c2f4b, 0x309d}, // iterationhiragana + {0x3d44ad12, 0x3210}, // tikeutaparenkorean + {0x3d4a2f11, 0x0187}, // Chook + {0x3d50ceda, 0x21a8}, // arrowupdnbse + {0x3d59a63c, 0x30e2}, // mokatakana + {0x3d64f67d, 0xf6cd}, // DieresisGrave + {0x3d6d45f8, 0x0688}, // ddalarabic + {0x3d794ead, 0x04c8}, // enhookcyrillic + {0x3d888246, 0x300d}, // cornerbracketright + {0x3d93ad95, 0x0171}, // uhungarumlaut + {0x3d987773, 0x03c6}, // phi + {0x3da1e076, 0xfb2a}, // shinshindot + {0x3da24bf2, 0x004d}, // M + {0x3da45134, 0xff3d}, // bracketrightmonospace + {0x3dac6cb7, 0x212e}, // estimated + {0x3db24f7f, 0x04eb}, // obarreddieresiscyrillic + {0x3dc500c0, 0xf6ca}, // Caron + {0x3ddbfa17, 0xfe64}, // lesssmall + {0x3de34107, 0xf6d2}, // cyrFlex + {0x3de84dee, 0x3387}, // GBsquare + {0x3de8cd4d, 0x02c9}, // firsttonechinese + {0x3deb36dc, 0x0570}, // hoarmenian + {0x3dee4810, 0xf7a2}, // centoldstyle + {0x3e08b864, 0x1e1c}, // Ecedillabreve + {0x3e2966c3, 0x25a7}, // squareupperlefttolowerrightfill + {0x3e2ad069, 0x0125}, // hcircumflex + {0x3e2b18e7, 0x05d2}, // gimelhebrew + {0x3e2ddf1a, 0x00fb}, // ucircumflex + {0x3e4b0d7f, 0x2478}, // fiveparen + {0x3e5c6b2e, 0x2086}, // sixinferior + {0x3e78c213, 0x03f3}, // yotgreek + {0x3e7bef16, 0x063a}, // ghainarabic + {0x3e9c0cab, 0x0e0d}, // yoyingthai + {0x3ea9e6c5, 0x044e}, // afii10096 + {0x3eb04aa9, 0xf7f2}, // Ogravesmall + {0x3ec30c4d, 0x0168}, // Utilde + {0x3ed009a2, 0x05e8}, // reshhiriq + {0x3ed6d505, 0x3108}, // fbopomofo + {0x3edc9801, 0x031e}, // downtackbelowcmb + {0x3edf2653, 0x04ba}, // Shhacyrillic + {0x3edfbd48, 0x0959}, // khhadeva + {0x3ee5a28f, 0x0342}, // perispomenigreekcmb + {0x3ef03dd0, 0xf7e5}, // Aringsmall + {0x3ef2c5ca, 0x05df}, // finalnunhebrew + {0x3efcba10, 0x05d3}, // daletpatahhebrew + {0x3efcef55, 0x09a7}, // dhabengali + {0x3f19d4d4, 0x30e5}, // yusmallkatakana + {0x3f35ecb4, 0x0a0f}, // eegurmukhi + {0x3f36dce9, 0x061b}, // afii57403 + {0x3f3b739c, 0x05e7}, // qofpatahhebrew + {0x3f4e4960, 0xf76a}, // Jsmall + {0x3f5ead94, 0x0456}, // icyrillic + {0x3f61f37a, 0x1ea3}, // ahookabove + {0x3f76f3d1, 0x0214}, // Udblgrave + {0x3f77d74f, 0x05e8}, // reshqubuts + {0x3f817391, 0x314b}, // khieukhkorean + {0x3f8b0c34, 0x30c7}, // dekatakana + {0x3fa4349b, 0x0e1d}, // fofathai + {0x3fa5f151, 0x03de}, // Koppagreek + {0x3fbf7ccb, 0x01ae}, // Tretroflexhook + {0x3fddfa91, 0x22ce}, // curlyor + {0x3fe060fb, 0x0147}, // Ncaron + {0x3fe534eb, 0x0e12}, // thophuthaothai + {0x4016947c, 0x246b}, // twelvecircle + {0x401a74d3, 0x06f3}, // threepersian + {0x402ddc95, 0xed1a}, // bracehtipupright + {0x40663d0c, 0xfeb2}, // seenfinalarabic + {0x4069b3b1, 0x24ab}, // pparen + {0x407a7b83, 0x0531}, // Aybarmenian + {0x407de2ef, 0x06d5}, // afii57534 + {0x40882350, 0x0305}, // overlinecmb + {0x4096d7d2, 0x006a}, // j + {0x409d1b5a, 0xff97}, // rakatakanahalfwidth + {0x40b0365e, 0x092f}, // yadeva + {0x40e21552, 0x30de}, // makatakana + {0x40eb54f4, 0x046d}, // yusbigiotifiedcyrillic + {0x413f6e7c, 0x05b4}, // hiriq21 + {0x4144d56c, 0x016d}, // ubreve + {0x414507c4, 0x05b9}, // holamnarrowhebrew + {0x414a0074, 0x3336}, // hekutaarusquare + {0x4156eb7c, 0x3123}, // enbopomofo + {0x415d9061, 0xff42}, // bmonospace + {0x415fae27, 0x0398}, // Theta + {0x4161c806, 0x09e1}, // llvocalicbengali + {0x416a2ede, 0x0e04}, // khokhwaithai + {0x4178dd24, 0x2243}, // asymptoticallyequal + {0x41a22b2c, 0x007c}, // bar + {0x41a40813, 0xff2d}, // Mmonospace + {0x41a4780c, 0x0472}, // afii10147 + {0x41c544c2, 0x1ee7}, // uhookabove + {0x41c76cd5, 0x05d7}, // het + {0x41cb5b30, 0x02db}, // ogonek + {0x41da6e39, 0x098c}, // lvocalicbengali + {0x41e154b7, 0x1edd}, // ohorngrave + {0x41e44ef7, 0x0aaa}, // pagujarati + {0x41efdfc2, 0x33c1}, // mohmsquare + {0x42320627, 0x2495}, // fourteenperiod + {0x4235d221, 0xfecf}, // ghaininitialarabic + {0x423f9221, 0x05a7}, // dargahebrew + {0x4247685c, 0x01ff}, // oslashacute + {0x4252dd77, 0x02c7}, // caron + {0x42716524, 0x0069}, // i + {0x42737aaf, 0x3081}, // mehiragana + {0x427d3f50, 0x04a9}, // haabkhasiancyrillic + {0x42803db2, 0x0030}, // zero + {0x42813ae4, 0x1e24}, // Hdotbelow + {0x428fedda, 0xfb44}, // pedagesh + {0x42bba9f5, 0x30f0}, // wikatakana + {0x42bc1b07, 0x25c4}, // triaglf + {0x42bed72c, 0x33c0}, // kohmsquare + {0x42bf360e, 0x1e6e}, // Tlinebelow + {0x42d74152, 0x0578}, // voarmenian + {0x42e554b2, 0x013b}, // Lcedilla + {0x42ed7ca6, 0x0698}, // jeharabic + {0x42f02b62, 0xfb95}, // gafmedialarabic + {0x42f35290, 0x0064}, // d + {0x42fb2842, 0x3120}, // aubopomofo + {0x42fc57be, 0x3110}, // jbopomofo + {0x42fd43ba, 0x044c}, // afii10094 + {0x42fdb31a, 0x0070}, // p + {0x4305bc9e, 0x0920}, // tthadeva + {0x4306eed3, 0x015d}, // scircumflex + {0x430c20fb, 0x215e}, // seveneighths + {0x430ddad4, 0xff20}, // atmonospace + {0x431e0706, 0x00dc}, // Udieresis + {0x43221a39, 0x1e91}, // zcircumflex + {0x4328cb01, 0x339d}, // squarecm + {0x432e75ab, 0x055d}, // commaarmenian + {0x43399322, 0x026c}, // lbelt + {0x434b10a7, 0x0a86}, // aagujarati + {0x435f906e, 0xfb3e}, // memdageshhebrew + {0x436008b6, 0x3064}, // tuhiragana + {0x436f4b68, 0xfeaa}, // dalfinalarabic + {0x439bf74d, 0xff8b}, // hikatakanahalfwidth + {0x43a7e4d1, 0x0635}, // afii57429 + {0x43d0d1da, 0x0627}, // afii57415 + {0x43d651b4, 0x2663}, // clubsuitblack + {0x43d755d6, 0x2212}, // minus + {0x43dfb761, 0x0592}, // segoltahebrew + {0x4405f04b, 0x05be}, // afii57645 + {0x4425746a, 0x0a18}, // ghagurmukhi + {0x44317cf4, 0x2662}, // diamondsuitwhite + {0x443620cd, 0x00fe}, // thorn + {0x444b0abf, 0x0467}, // yuslittlecyrillic + {0x444f60e7, 0x007f}, // controlDEL + {0x445a3b6e, 0x0447}, // afii10089 + {0x4461957b, 0x041c}, // Emcyrillic + {0x4464a19f, 0x0acb}, // ovowelsigngujarati + {0x4483f355, 0x300f}, // whitecornerbracketright + {0x4487c491, 0x3342}, // hoonsquare + {0x4492e703, 0x0624}, // afii57412 + {0x44979567, 0x0a25}, // thagurmukhi + {0x449b4678, 0xfec3}, // tahinitialarabic + {0x44a78c72, 0x1eef}, // uhorntilde + {0x44b414b4, 0xff0c}, // commamonospace + {0x44d687fa, 0x1e06}, // Blinebelow + {0x450fad6c, 0xf6fd}, // Scaronsmall + {0x45116064, 0x2592}, // shade + {0x453aa0af, 0x09f0}, // ramiddlediagonalbengali + {0x4546a724, 0x05d0}, // afii57664 + {0x454cef44, 0x2642}, // mars + {0x455bcfc1, 0x041d}, // afii10031 + {0x457de97e, 0x3184}, // kapyeounphieuphkorean + {0x457e9e97, 0x1ee8}, // Uhornacute + {0x459f0c78, 0x23a7}, // bracelefttp + {0x45b3d9fd, 0x0a22}, // ddhagurmukhi + {0x45b6c88f, 0x029b}, // Gsmallhook + {0x45b98e95, 0x2163}, // Fourroman + {0x45c29649, 0x1ef4}, // Ydotbelow + {0x45c5ae6b, 0x0165}, // tcaron + {0x45d73e08, 0x0a09}, // ugurmukhi + {0x45e50e5b, 0x0384}, // tonos + {0x45f6e82c, 0x057f}, // tiwnarmenian + {0x45f7d5e0, 0x2084}, // fourinferior + {0x46038ece, 0x00b6}, // paragraph + {0x460c35ae, 0x05b8}, // qamats10 + {0x460ca9f0, 0x30e8}, // yokatakana + {0x4611c6d0, 0x000b}, // controlVT + {0x461bc854, 0x0194}, // Gammaafrican + {0x46271982, 0x23ac}, // bracerightmid + {0x46375ba2, 0x23d0}, // arrowvertex + {0x4652be4f, 0x1e6d}, // tdotbelow + {0x46541398, 0x0111}, // dmacron + {0x46577172, 0x22c3}, // uniondisplay + {0x465ea2f8, 0x3202}, // tikeutparenkorean + {0x46611d40, 0x05bb}, // qubuts31 + {0x466452b7, 0x321b}, // hieuhaparenkorean + {0x467a9a55, 0x055b}, // emphasismarkarmenian + {0x46ab407a, 0x322b}, // ideographicfireparen + {0x46ab921d, 0x3076}, // buhiragana + {0x46ba3911, 0x1e45}, // ndotaccent + {0x46bce40e, 0xfb4f}, // aleflamedhebrew + {0x46c4dd5b, 0x0433}, // afii10068 + {0x46ca3a49, 0x2791}, // eightcircleinversesansserif + {0x46e3006c, 0x055c}, // exclamarmenian + {0x46f10ed2, 0x222a}, // union + {0x46f3948a, 0x05d1}, // bethebrew + {0x46f5f918, 0x05c3}, // afii57658 + {0x46f9c8ca, 0x2195}, // arrowupdn + {0x470d662e, 0x042e}, // IUcyrillic + {0x470da4b8, 0x0453}, // gjecyrillic + {0x471d219d, 0x00f4}, // ocircumflex + {0x47246853, 0xf890}, // maitriupperleftthai + {0x472c971d, 0x1e4d}, // otildeacute + {0x47542f2d, 0x0107}, // cacute + {0x47849b51, 0x05e5}, // finaltsadi + {0x478eb915, 0x014f}, // obreve + {0x47a8409c, 0x05e8}, // reshqubutshebrew + {0x47b12f1d, 0x3009}, // anglebracketright + {0x47b78334, 0x09a5}, // thabengali + {0x47dfd2f2, 0xf7a1}, // exclamdownsmall + {0x47ee62a0, 0x04f1}, // udieresiscyrillic + {0x480265ce, 0x06f2}, // twopersian + {0x48175191, 0x0130}, // Idotaccent + {0x481e50de, 0xfb32}, // gimeldagesh + {0x4825c60d, 0x02c3}, // arrowheadrightmod + {0x482626d7, 0x09ee}, // eightbengali + {0x4826d3e4, 0x3391}, // khzsquare + {0x48270352, 0x1e42}, // Mdotbelow + {0x4848966d, 0x05b2}, // hatafpatah + {0x485d5052, 0x057d}, // seharmenian + {0x48908e05, 0xff28}, // Hmonospace + {0x48a3aad1, 0x1ec8}, // Ihookabove + {0x48adcc47, 0x0160}, // Scaron + {0x48b11825, 0x1e3f}, // macute + {0x48b31eb3, 0x02a3}, // dzaltone + {0x48bbab6b, 0x1e68}, // Sdotbelowdotaccent + {0x48cf810a, 0x27e8}, // angbracketleftBigg + {0x48d0cd97, 0x0460}, // Omegacyrillic + {0x48ed1289, 0x3180}, // ssangieungkorean + {0x48f1ea86, 0x007c}, // verticalbar + {0x49188fb6, 0x261d}, // pointingindexupwhite + {0x491e8c30, 0x2562}, // SF200000 + {0x4928f75b, 0x1e3d}, // lcircumflexbelow + {0x49299271, 0x1eee}, // Uhorntilde + {0x49314f7c, 0x1e96}, // hlinebelow + {0x493c6957, 0x01ec}, // Oogonekmacron + {0x497b2a29, 0x03c8}, // psi + {0x49877605, 0x1ecf}, // ohookabove + {0x49a6c904, 0x00d5}, // Otilde + {0x49a8fbe4, 0x227a}, // precedes + {0x49b28bf6, 0x011f}, // gbreve + {0x49c941c8, 0x0630}, // thalarabic + {0x49cf949f, 0x0011}, // controlDC1 + {0x49d53679, 0x053e}, // Caarmenian + {0x49de9093, 0x0029}, // parenrightBig + {0x49e41b40, 0x0117}, // edotaccent + {0x4a059748, 0x2329}, // angleleft + {0x4a0a939e, 0x02dc}, // ilde + {0x4a0dc7cd, 0x0273}, // nhookretroflex + {0x4a1b8688, 0x0a8f}, // egujarati + {0x4a26a1e2, 0xf88c}, // maieklowleftthai + {0x4a67a4cd, 0x33c6}, // coverkgsquare + {0x4a6dc3e0, 0x017c}, // zdotaccent + {0x4a8f25d9, 0x0134}, // Jcircumflex + {0x4a911686, 0x042a}, // Hardsigncyrillic + {0x4aa9a643, 0x220c}, // notcontains + {0x4ab184ff, 0x221a}, // radicalbt + {0x4ab871b2, 0x05a9}, // telishaqetanahebrew + {0x4ad4b644, 0x066c}, // thousandsseparatorpersian + {0x4ad593e8, 0x05e7}, // qofpatah + {0x4adaae02, 0x30bc}, // zekatakana + {0x4b13bfc7, 0x261f}, // pointingindexdownwhite + {0x4b146e46, 0x0076}, // v + {0x4b1cfc1b, 0x0052}, // R + {0x4b214add, 0x05e8}, // reshhatafsegolhebrew + {0x4b69c8eb, 0x3200}, // kiyeokparenkorean + {0x4b7a4380, 0x326b}, // thieuthcirclekorean + {0x4b8cb1d3, 0x315a}, // oekorean + {0x4b904ad7, 0x09ec}, // sixbengali + {0x4bc3db0d, 0xfe8e}, // aleffinalarabic + {0x4bcb1484, 0x0997}, // gabengali + {0x4bf3941c, 0x04e7}, // odieresiscyrillic + {0x4c1231bd, 0xfebe}, // dadfinalarabic + {0x4c224e3d, 0x0216}, // Uinvertedbreve + {0x4c31d446, 0x05b6}, // segolwidehebrew + {0x4c330dc7, 0x2303}, // control + {0x4c539c26, 0xff45}, // emonospace + {0x4c550d84, 0x0286}, // eshcurl + {0x4c63022b, 0x00ac}, // logicalnot + {0x4c636f96, 0xfe4c}, // overlinedblwavy + {0x4ca2293a, 0x0549}, // Chaarmenian + {0x4ca721bb, 0x24d9}, // jcircle + {0x4cbb6976, 0x054c}, // Raarmenian + {0x4cbfbcf5, 0xf6cb}, // Dieresis + {0x4cc2766b, 0x0474}, // Izhitsacyrillic + {0x4ccaa98f, 0x0292}, // ezh + {0x4cda32dd, 0x2592}, // shademedium + {0x4cf1d7c1, 0xfb2c}, // shindageshshindot + {0x4d08f8de, 0x278c}, // threecircleinversesansserif + {0x4d18f1c3, 0x01e5}, // gstroke + {0x4d3fee14, 0x2207}, // gradient + {0x4d5e2eea, 0x09c7}, // evowelsignbengali + {0x4d66ad61, 0x0259}, // schwa + {0x4d6f0f44, 0x03b6}, // zeta + {0x4d76cbca, 0x0939}, // hadeva + {0x4d773822, 0x007d}, // bracerightbig + {0x4da2ea17, 0x30f7}, // vakatakana + {0x4dad3b1f, 0xff47}, // gmonospace + {0x4db4092d, 0x05b2}, // hatafpatahquarterhebrew + {0x4dc635ef, 0x03c2}, // sigmafinal + {0x4dccadbd, 0xf6ea}, // bsuperior + {0x4dd49001, 0x04ae}, // Ustraightcyrillic + {0x4dd4e51e, 0x05e3}, // finalpe + {0x4ddb0ff8, 0x3014}, // tortoiseshellbracketleft + {0x4ddbe970, 0x0054}, // T + {0x4ddd9ef4, 0x3296}, // ideographicfinancialcircle + {0x4dedf33d, 0xff8d}, // hekatakanahalfwidth + {0x4def9c7c, 0x2327}, // clear + {0x4dfb4b2a, 0x247b}, // eightparen + {0x4e03617a, 0x0ac1}, // uvowelsigngujarati + {0x4e0fdced, 0x0a2d}, // bhagurmukhi + {0x4e1cdd9c, 0x247d}, // tenparen + {0x4e63a83b, 0x0642}, // qafarabic + {0x4e7d8096, 0xff53}, // smonospace + {0x4e8356bc, 0x0108}, // Ccircumflex + {0x4eb853e7, 0x3384}, // kasquare + {0x4ec3d2dc, 0xfccb}, // lamkhahinitialarabic + {0x4ec752cf, 0x2022}, // bullet + {0x4ef94777, 0x323b}, // ideographicstudyparen + {0x4efcaf3c, 0x01ff}, // ostrokeacute + {0x4f1d81af, 0x05bb}, // qubuts + {0x4f1d9a74, 0x1e15}, // emacrongrave + {0x4f1fbad2, 0x33b2}, // mussquare + {0x4f238367, 0x0270}, // mlonglegturned + {0x4f23d8fd, 0xfeda}, // kaffinalarabic + {0x4f2d09de, 0x0662}, // twohackarabic + {0x4f2efda5, 0xff07}, // quotesinglemonospace + {0x4f30c414, 0x01c6}, // dzcaron + {0x4f4be9c8, 0x3129}, // iubopomofo + {0x4f6c2078, 0x00e5}, // aring + {0x4f9b207b, 0x06c1}, // hehaltonearabic + {0x4f9deafc, 0x03c4}, // tau + {0x4fb92256, 0x216b}, // Twelveroman + {0x4fdd1a2b, 0x300a}, // dblanglebracketleft + {0x4feaecfe, 0x22c3}, // uniontext + {0x4fef28fa, 0xf6c3}, // commaaccent + {0x5004c9ab, 0x09ed}, // sevenbengali + {0x50166be8, 0x049a}, // Kadescendercyrillic + {0x501dd48e, 0x2229}, // intersection + {0x5024fa7b, 0x260f}, // whitetelephone + {0x5026482c, 0x228f}, // a60 + {0x502bdceb, 0x3290}, // ideographsuncircle + {0x503133b5, 0x0009}, // controlHT + {0x50604a35, 0x05e7}, // qofqubuts + {0x507713d7, 0x2a02}, // circlemultiplytext + {0x50794cf3, 0x255d}, // SF260000 + {0x508090a0, 0xff82}, // tukatakanahalfwidth + {0x50993bc3, 0x05dd}, // finalmemhebrew + {0x509ec6af, 0x0490}, // Gheupturncyrillic + {0x50a87245, 0x05b9}, // holamwidehebrew + {0x50be3a5b, 0x3189}, // yoikorean + {0x50cc5524, 0x00be}, // threequarters + {0x50cc8cef, 0x24a3}, // hparen + {0x50fb6106, 0x30c1}, // tikatakana + {0x510f444c, 0x0662}, // afii57394 + {0x511118c0, 0x05b8}, // qamatsqatanquarterhebrew + {0x51250a43, 0x0ab9}, // hagujarati + {0x5125d1fa, 0x25a1}, // whitesquare + {0x513a52c9, 0x2510}, // SF030000 + {0x51439af3, 0x064e}, // afii57454 + {0x5147986a, 0xff5b}, // braceleftmonospace + {0x514d7298, 0x3238}, // ideographiclaborparen + {0x5153d63f, 0xf895}, // maichattawalowleftthai + {0x515692ea, 0x0414}, // Decyrillic + {0x51616742, 0x328c}, // ideographwatercircle + {0x51817d65, 0xfca1}, // tehjeeminitialarabic + {0x51969939, 0x03ba}, // kappa + {0x51ca7ab6, 0x00f6}, // odieresis + {0x51cbc424, 0x014d}, // omacron + {0x51d34569, 0x00e9}, // eacute + {0x51e4f41a, 0xf6db}, // trademarkserif + {0x51e6847c, 0x05b2}, // hatafpatah16 + {0x51ed3cb2, 0x00af}, // macron + {0x51f006ea, 0x24af}, // tparen + {0x51f3c5bb, 0x2082}, // twoinferior + {0x51fee10e, 0x2210}, // coproducttext + {0x52099e7d, 0x3267}, // ieungcirclekorean + {0x5241ded3, 0x0428}, // Shacyrillic + {0x5247cafc, 0x0691}, // afii57513 + {0x524c924c, 0x02d6}, // plusmod + {0x525a3324, 0x2606}, // whitestar + {0x5282fafa, 0x0e09}, // chochingthai + {0x528afecc, 0xfb89}, // ddalfinalarabic + {0x52beac4f, 0x25bf}, // whitedownpointingsmalltriangle + {0x52e15cc8, 0x24b6}, // Acircle + {0x52f72574, 0x3322}, // sentisquare + {0x530e1856, 0x05dd}, // finalmem + {0x531472bf, 0x05bb}, // qubutswidehebrew + {0x531963a3, 0x0a73}, // uragurmukhi + {0x531c6e1f, 0x315b}, // yokorean + {0x532f469f, 0x093d}, // avagrahadeva + {0x533e9388, 0x02bc}, // afii57929 + {0x537b0d36, 0x0466}, // Yuslittlecyrillic + {0x5382e913, 0x002f}, // slashBigg + {0x5396a4ab, 0x2a04}, // unionmultidisplay + {0x53b3b784, 0xfb4a}, // tavdagesh + {0x53ca8524, 0x099d}, // jhabengali + {0x53d60270, 0x05d3}, // dalethiriqhebrew + {0x53d8dfb9, 0x3115}, // shbopomofo + {0x53e66e1a, 0x0476}, // Izhitsadblgravecyrillic + {0x53f49c2a, 0x066c}, // thousandsseparatorarabic + {0x53f951b5, 0x056f}, // kenarmenian + {0x53febc17, 0x05e8}, // reshqamatshebrew + {0x540493c8, 0x03b1}, // alpha + {0x540c5f40, 0x0552}, // Yiwnarmenian + {0x542576f9, 0x0a07}, // igurmukhi + {0x542f1e7a, 0x0151}, // ohungarumlaut + {0x54761f15, 0x0631}, // afii57425 + {0x54820079, 0x04df}, // zedieresiscyrillic + {0x548a6dde, 0x0451}, // iocyrillic + {0x5494ff15, 0x053c}, // Liwnarmenian + {0x54cc0e6b, 0x0212}, // Rinvertedbreve + {0x54d729fd, 0xf6bf}, // LL + {0x54dfda54, 0xfe44}, // whitecornerbracketrightvertical + {0x54f8c0f2, 0x1e78}, // Utildeacute + {0x55003750, 0x05b0}, // shevanarrowhebrew + {0x55021a5a, 0x0644}, // lamarabic + {0x5509dd21, 0xf7bf}, // questiondownsmall + {0x550a9f23, 0x0452}, // djecyrillic + {0x550d7456, 0x0061}, // a + {0x5512ec97, 0x0067}, // g + {0x55164cbd, 0xf7fb}, // Ucircumflexsmall + {0x552705b9, 0xf7e1}, // Aacutesmall + {0x552e72ea, 0x1e8d}, // xdieresis + {0x5532b75e, 0x3044}, // ihiragana + {0x554f67fa, 0x1e4e}, // Otildedieresis + {0x556bcf7c, 0xff1f}, // questionmonospace + {0x5575c7a8, 0x09a8}, // nabengali + {0x557f8e27, 0x1ee0}, // Ohorntilde + {0x558d2385, 0x0318}, // lefttackbelowcmb + {0x55aa99d5, 0xfe3f}, // anglebracketleftvertical + {0x55b44317, 0x1ef2}, // Ygrave + {0x55b8ceec, 0xed6b}, // radicalvertex + {0x55c6e8cd, 0x0aac}, // bagujarati + {0x55e74cbe, 0xf8fb}, // bracketrightbt + {0x55e81ebb, 0x3124}, // angbopomofo + {0x56000715, 0x33b0}, // pssquare + {0x560f90ad, 0x25e4}, // blackupperlefttriangle + {0x56200891, 0x092b}, // phadeva + {0x56217879, 0x0596}, // tipehalefthebrew + {0x56362764, 0x24d0}, // acircle + {0x565aa859, 0x30a8}, // ekatakana + {0x565d95fc, 0x3109}, // dbopomofo + {0x566af414, 0xed6a}, // radicaltp + {0x567e8709, 0xf6f4}, // Brevesmall + {0x569f0bdc, 0x05e7}, // qofqamats + {0x56a0101f, 0x04ac}, // Tedescendercyrillic + {0x56d036b9, 0x000f}, // controlSI + {0x56deae12, 0x0102}, // Abreve + {0x57050efe, 0x0145}, // Ncommaaccent + {0x5708e98e, 0x3154}, // ekorean + {0x570da3d3, 0xf8e9}, // copyrightsans + {0x5713d355, 0x2790}, // sevencircleinversesansserif + {0x575226bc, 0xf8f7}, // parenrightex + {0x57687403, 0x0e08}, // chochanthai + {0x576959da, 0x04b7}, // chedescendercyrillic + {0x577fdcc5, 0x033a}, // bridgeinvertedbelowcmb + {0x578594f4, 0x0e47}, // maitaikhuthai + {0x579e8de2, 0x2074}, // foursuperior + {0x57a10bfe, 0x0435}, // iecyrillic + {0x57a26403, 0xf6eb}, // dsuperior + {0x57c4d153, 0xfb1f}, // yodyodpatahhebrew + {0x57c8c90f, 0x313b}, // rieulmieumkorean + {0x57cea503, 0xff17}, // sevenmonospace + {0x57fc3d5e, 0x255b}, // SF280000 + {0x58064efc, 0x0448}, // shacyrillic + {0x580bc6b8, 0x2320}, // integraltop + {0x580e0aa6, 0x005e}, // asciicircum + {0x5817c838, 0x3141}, // mieumkorean + {0x581d6ffc, 0x1ef8}, // Ytilde + {0x58246165, 0x0152}, // OE + {0x582e4f2f, 0x02a1}, // glottalstopstroke + {0x58408a1e, 0x2321}, // integralbottom + {0x584e8397, 0x263a}, // whitesmilingface + {0x5855c496, 0x0465}, // eiotifiedcyrillic + {0x587d22eb, 0x208d}, // parenleftinferior + {0x58a61c85, 0x1e9a}, // arighthalfring + {0x58ab0a67, 0x0544}, // Menarmenian + {0x58ae8d36, 0x05e8}, // reshhatafpatah + {0x58ba15a9, 0x24c9}, // Tcircle + {0x58c52193, 0x221a}, // radical + {0x58df0572, 0x0301}, // acutecmb + {0x58dfd388, 0x3187}, // yoyakorean + {0x58e61a1f, 0x05e8}, // resh + {0x58ea1dd9, 0x0650}, // afii57456 + {0x59322213, 0xf7e8}, // Egravesmall + {0x593b3f38, 0x0aa1}, // ddagujarati + {0x5951351c, 0x0109}, // ccircumflex + {0x59664498, 0xff21}, // Amonospace + {0x597231b2, 0x1e00}, // Aringbelow + {0x598309ec, 0x1edc}, // Ohorngrave + {0x598631c5, 0x24c1}, // Lcircle + {0x59b5003e, 0x3274}, // siosacirclekorean + {0x59b9b187, 0x0075}, // u + {0x59be0f3a, 0xff7f}, // sokatakanahalfwidth + {0x59c46f70, 0x3299}, // ideographicsecretcircle + {0x59c80d40, 0x2482}, // fifteenparen + {0x59d6d87b, 0xff74}, // ekatakanahalfwidth + {0x59d7f689, 0x3393}, // ghzsquare + {0x59eccfd0, 0x05a3}, // munahlefthebrew + {0x5a1aca3c, 0xfe34}, // wavyunderscorevertical + {0x5a24f67c, 0x03b4}, // delta + {0x5a3b6461, 0xfeb8}, // sheenmedialarabic + {0x5a532aa6, 0x0586}, // feharmenian + {0x5a575dc4, 0x0582}, // yiwnarmenian + {0x5a62c8e8, 0x005c}, // backslash + {0x5a8d2a4a, 0x09c3}, // rvocalicvowelsignbengali + {0x5a963c7c, 0x0e02}, // khokhaithai + {0x5acd345c, 0x339c}, // squaremm + {0x5ad6e1c9, 0x05e7}, // qofsegol + {0x5af634c5, 0x059e}, // gershayimaccenthebrew + {0x5b041347, 0x0581}, // coarmenian + {0x5b0fd985, 0x0360}, // tildedoublecmb + {0x5b1907c0, 0x30a5}, // usmallkatakana + {0x5b1da33a, 0x2206}, // increment + {0x5b1dbca0, 0x0aa6}, // dagujarati + {0x5b426364, 0x30cf}, // hakatakana + {0x5b426591, 0xfeb7}, // sheeninitialarabic + {0x5b46f9e7, 0x2080}, // zeroinferior + {0x5b54a5c3, 0x05e1}, // afii57681 + {0x5b5f52e7, 0x0421}, // afii10035 + {0x5b68b5ed, 0xf892}, // maitrilowleftthai + {0x5b6ab184, 0x25ef}, // largecircle + {0x5b6f6c30, 0x0003}, // controlETX + {0x5b720455, 0x014c}, // Omacron + {0x5b72ad21, 0x03d5}, // phi1 + {0x5b785975, 0x02a7}, // tesh + {0x5b7a64f2, 0x0597}, // reviahebrew + {0x5bbfa15f, 0x25c4}, // blackleftpointingpointer + {0x5bc1fa37, 0xfb47}, // qofdageshhebrew + {0x5be94211, 0xff24}, // Dmonospace + {0x5beb1e0f, 0x24cf}, // Zcircle + {0x5c0e8b47, 0x0426}, // afii10040 + {0x5c185e06, 0x0250}, // aturned + {0x5c299659, 0x250c}, // SF010000 + {0x5c337c81, 0xff8a}, // hakatakanahalfwidth + {0x5c3478b9, 0xff3a}, // Zmonospace + {0x5c349e9d, 0x30c5}, // dukatakana + {0x5c352033, 0x092c}, // badeva + {0x5c3b9279, 0x307e}, // mahiragana + {0x5c3eecc5, 0x2561}, // SF190000 + {0x5c4a060e, 0x0e29}, // sorusithai + {0x5c6b0ced, 0x05b8}, // qamats33 + {0x5c71c76c, 0x24b8}, // Ccircle + {0x5c738b36, 0xf776}, // Vsmall + {0x5c7f4966, 0x01b8}, // Ezhreversed + {0x5c97be88, 0x0a2a}, // pagurmukhi + {0x5c9a7487, 0x30ec}, // rekatakana + {0x5c9f86aa, 0x05e8}, // reshshevahebrew + {0x5ca0edc2, 0x01e7}, // gcaron + {0x5cad2e17, 0x0679}, // tteharabic + {0x5cb64e9e, 0x0150}, // Ohungarumlaut + {0x5cb98a11, 0x05e9}, // afii57689 + {0x5cc203b0, 0x09eb}, // fivebengali + {0x5cde4fa9, 0xff39}, // Ymonospace + {0x5ce216d6, 0x02bb}, // commaturnedmod + {0x5ce89c18, 0x028c}, // vturned + {0x5cee9de2, 0x333b}, // peezisquare + {0x5d053ab9, 0x334d}, // meetorusquare + {0x5d06b34a, 0x01f5}, // gacute + {0x5d185c29, 0x0aec}, // sixgujarati + {0x5d23e967, 0x019a}, // lbar + {0x5d24fed7, 0x047d}, // omegatitlocyrillic + {0x5d26ca2e, 0x0996}, // khabengali + {0x5d32256c, 0x25c6}, // blackdiamond + {0x5d333915, 0x2234}, // therefore + {0x5d42ce05, 0x30c2}, // dikatakana + {0x5d4fa82e, 0xf724}, // dollaroldstyle + {0x5d590cb1, 0x05bb}, // qubutsnarrowhebrew + {0x5d71a05b, 0x0017}, // controlETB + {0x5d85b369, 0x05b8}, // qamats29 + {0x5d8c507f, 0xfb47}, // qofdagesh + {0x5da58253, 0x30d0}, // bakatakana + {0x5dba07ed, 0x22a5}, // perpendicular + {0x5dbeec87, 0x01cd}, // Acaron + {0x5de3b63c, 0x09cb}, // ovowelsignbengali + {0x5df717ca, 0x05e8}, // reshtserehebrew + {0x5e0aac56, 0x0200}, // Adblgrave + {0x5e1c8dfa, 0x05b0}, // sheva2e + {0x5e27fa57, 0xff6d}, // yusmallkatakanahalfwidth + {0x5e36a670, 0xfe33}, // underscorevertical + {0x5e483ddc, 0x3277}, // chieuchacirclekorean + {0x5e4f2fbb, 0x1e65}, // sacutedotaccent + {0x5ea7176f, 0x02d9}, // dotaccent + {0x5edd1e19, 0xff25}, // Emonospace + {0x5edd9086, 0x003a}, // colon + {0x5eddf92b, 0x0044}, // D + {0x5ee2af9c, 0x0e58}, // eightthai + {0x5f03252d, 0x0136}, // Kcedilla + {0x5f0ec9e9, 0x039a}, // Kappa + {0x5f1bf33a, 0x1e17}, // emacronacute + {0x5f4a5f07, 0x0abe}, // aavowelsigngujarati + {0x5f5c5d5f, 0x041b}, // Elcyrillic + {0x5f63748c, 0x03e6}, // Kheicoptic + {0x5f6ca553, 0x230a}, // floorleftbigg + {0x5f7dc76d, 0x033b}, // squarebelowcmb + {0x5f881d5c, 0x3160}, // yukorean + {0x5f8f63e2, 0x24a0}, // eparen + {0x5f99c0ac, 0x01ad}, // thook + {0x5fa5f5cc, 0xfefa}, // lamalefhamzabelowfinalarabic + {0x5fb56903, 0x095d}, // rhadeva + {0x5fbeac33, 0x028b}, // vhook + {0x5fd46519, 0xf6ef}, // msuperior + {0x5fe9065e, 0x042e}, // afii10048 + {0x6037ae88, 0x1ef3}, // ygrave + {0x603b5882, 0x2287}, // reflexsuperset + {0x603b9d93, 0x00d3}, // Oacute + {0x603ff393, 0x1e6c}, // Tdotbelow + {0x60753fe5, 0x066d}, // afii63167 + {0x607c93ed, 0x01b2}, // Vhook + {0x60a46930, 0x0197}, // Istroke + {0x60a4c80a, 0x30ee}, // wasmallkatakana + {0x60ac2314, 0x25cc}, // dottedcircle + {0x60ba7236, 0x000e}, // controlSO + {0x60d57bed, 0x0aa4}, // tagujarati + {0x60e1bf57, 0x1e0d}, // ddotbelow + {0x60ebe651, 0x1ed8}, // Ocircumflexdotbelow + {0x60f5a9fa, 0x03b7}, // eta + {0x6106119c, 0xff37}, // Wmonospace + {0x610b31e6, 0x01f1}, // DZ + {0x6114c811, 0x1ef0}, // Uhorndotbelow + {0x6121a3f6, 0x0e4d}, // nikhahitthai + {0x61239a5a, 0x01c2}, // clickalveolar + {0x6143b142, 0x1e67}, // scarondotaccent + {0x61503571, 0x027b}, // rhookturned + {0x6154bc05, 0x043b}, // afii10077 + {0x617c687c, 0x01a2}, // Oi + {0x618467d6, 0xf7f3}, // Oacutesmall + {0x6198a771, 0xfef3}, // alefmaksurainitialarabic + {0x61a21109, 0x01c9}, // lj + {0x61a2d0df, 0x258c}, // lfblock + {0x61a6f1a4, 0x0264}, // ramshorn + {0x61b4ed39, 0x25ba}, // triagrt + {0x61b7afbf, 0x05b5}, // tserenarrowhebrew + {0x61b9f022, 0x04c4}, // kahookcyrillic + {0x61ce131a, 0x0647}, // afii57470 + {0x61d46fc2, 0x1ed6}, // Ocircumflextilde + {0x61d7bcdb, 0x1e57}, // pdotaccent + {0x61e75298, 0x0417}, // afii10025 + {0x61f36361, 0x06f8}, // eightpersian + {0x61fe712f, 0x20a4}, // afii08941 + {0x621057dd, 0x1ef5}, // ydotbelow + {0x62106755, 0xf6e5}, // hypheninferior + {0x62127977, 0x266a}, // musicalnote + {0x62161c15, 0x05da}, // finalkafhebrew + {0x6229838d, 0x05d0}, // alef + {0x62447ae3, 0x0314}, // commareversedabovecmb + {0x6248b5e6, 0x33dd}, // wbsquare + {0x625320aa, 0x30b2}, // gekatakana + {0x6259e0bf, 0xf6f1}, // rsuperior + {0x6260c6fc, 0x0589}, // periodarmenian + {0x6265e881, 0x2266}, // lessoverequal + {0x626cbaa4, 0x01bf}, // wynn + {0x62724d89, 0x09ad}, // bhabengali + {0x62896f4a, 0x05f2}, // yodyodhebrew + {0x628a5951, 0xff56}, // vmonospace + {0x62a11b25, 0x1e87}, // wdotaccent + {0x62accaf5, 0xf8ed}, // parenleftbt + {0x62b2cd2d, 0x00c2}, // Acircumflex + {0x62b6e7ac, 0x01a5}, // phook + {0x62c361d5, 0x05e2}, // afii57682 + {0x62c52689, 0x05d5}, // afii57669 + {0x62ca59ed, 0x03aa}, // Iotadieresis + {0x62cfccee, 0x017d}, // Zcaron + {0x62d27ffc, 0x0567}, // eharmenian + {0x62f7161d, 0x3020}, // postalmarkface + {0x630680b1, 0x1e20}, // Gmacron + {0x63070542, 0x0401}, // afii10023 + {0x630758ff, 0x317e}, // sioscieuckorean + {0x632ae410, 0x0acc}, // auvowelsigngujarati + {0x634ac34b, 0x2297}, // timescircle + {0x634e42e5, 0xff2b}, // Kmonospace + {0x635a9554, 0x04e5}, // idieresiscyrillic + {0x636fabd5, 0x093c}, // nuktadeva + {0x637ae7ca, 0x0344}, // dialytikatonoscmb + {0x637d3539, 0x00bc}, // onequarter + {0x6389d9bb, 0x0641}, // afii57441 + {0x63a82931, 0x0297}, // cstretched + {0x63ab7e3b, 0xf6dd}, // rupiah + {0x63d84bb6, 0x2281}, // notsucceeds + {0x63dfed74, 0x311f}, // eibopomofo + {0x63e274d2, 0xfc0b}, // tehjeemisolatedarabic + {0x63e60b13, 0x0149}, // napostrophe + {0x63f6cd8f, 0x049d}, // kaverticalstrokecyrillic + {0x642b78c5, 0x1ed5}, // ocircumflexhookabove + {0x642e193e, 0x0469}, // yuslittleiotifiedcyrillic + {0x6434f04a, 0xfd88}, // lammeemhahinitialarabic + {0x64468e36, 0x0e18}, // thothongthai + {0x64517fe8, 0x004b}, // K + {0x6453c78e, 0x064e}, // fathalowarabic + {0x6454154f, 0xf6ec}, // esuperior + {0x6460d798, 0x3025}, // fivehangzhou + {0x64699e37, 0x2309}, // ceilingrightBigg + {0x646b157e, 0x3242}, // ideographicselfparen + {0x646c5c19, 0x0ab5}, // vagujarati + {0x64755597, 0x05e7}, // qofholamhebrew + {0x647eca4f, 0x09ae}, // mabengali + {0x64a1b76b, 0x30fa}, // vokatakana + {0x64d00b32, 0x0114}, // Ebreve + {0x64d7a402, 0x0e40}, // saraethai + {0x64d94f4a, 0x0e01}, // kokaithai + {0x64e7dff2, 0x09c4}, // rrvocalicvowelsignbengali + {0x64eb016b, 0x2245}, // approximatelyequal + {0x64fd7a48, 0x2078}, // eightsuperior + {0x650678be, 0x02cb}, // fourthtonechinese + {0x65070663, 0x0459}, // ljecyrillic + {0x6510d99a, 0x0938}, // sadeva + {0x651d5722, 0x04c2}, // zhebrevecyrillic + {0x6525cdb1, 0x00ad}, // softhyphen + {0x6543f12c, 0x01d5}, // Udieresismacron + {0x654d08a0, 0x0e3a}, // phinthuthai + {0x657ffabd, 0x22ee}, // ellipsisvertical + {0x6594aba1, 0x02c3}, // a41 + {0x6598fbfe, 0x3112}, // xbopomofo + {0x65a5bd1b, 0x24e1}, // rcircle + {0x65be15d1, 0x0a08}, // iigurmukhi + {0x65c095c5, 0x200e}, // afii299 + {0x65cc1f56, 0x0545}, // Yiarmenian + {0x662a6586, 0xf8f8}, // parenrightbt + {0x662a831c, 0x1eeb}, // uhorngrave + {0x663a2c1a, 0x3300}, // apaatosquare + {0x6642f834, 0x0361}, // breveinverteddoublecmb + {0x665bba62, 0x2017}, // dbllowline + {0x665e930f, 0x3264}, // mieumcirclekorean + {0x666ae75e, 0x0159}, // rcaron + {0x666e8927, 0xfc4e}, // noonmeemisolatedarabic + {0x666faf51, 0xfba5}, // hehhamzaabovefinalarabic + {0x6689dbc7, 0x33cb}, // HPsquare + {0x668e9764, 0x30a2}, // akatakana + {0x669881eb, 0xf8e5}, // radicalex + {0x66b92e17, 0x05e8}, // reshholam + {0x66bb979c, 0x246c}, // thirteencircle + {0x66c590a5, 0x2236}, // ratio + {0x66e750ef, 0xf7ec}, // Igravesmall + {0x66e9c5c7, 0x3084}, // yahiragana + {0x66ef8fdf, 0x040f}, // afii10145 + {0x66fb9b49, 0x33c9}, // gysquare + {0x67188e74, 0x0066}, // f + {0x6740a4ac, 0x25cf}, // H18533 + {0x67427e4a, 0x2079}, // ninesuperior + {0x674a0210, 0x02b6}, // Rsmallinvertedsuperior + {0x674c80b7, 0x03da}, // Stigmagreek + {0x67569fa6, 0x05b5}, // tsere + {0x6758c83c, 0x2588}, // block + {0x6776a85a, 0x0ac7}, // evowelsigngujarati + {0x6779be95, 0x3113}, // zhbopomofo + {0x6785194b, 0x221f}, // rightangle + {0x67949ab4, 0xf891}, // maitrilowrightthai + {0x679d9205, 0x02c5}, // arrowheaddownmod + {0x679dcadd, 0x0e54}, // fourthai + {0x679ffc49, 0x2024}, // onedotenleader + {0x67ea250f, 0x1e2d}, // itildebelow + {0x67ebcea4, 0x3209}, // chieuchparenkorean + {0x67f3db47, 0x3073}, // bihiragana + {0x67f3ecac, 0xfb4b}, // afii57700 + {0x67f7f220, 0x309c}, // semivoicedmarkkana + {0x67fa1db6, 0x203a}, // guilsinglright + {0x68070609, 0x0916}, // khadeva + {0x6808ec86, 0x02d8}, // breve + {0x6811e3e1, 0x0404}, // Ecyrillic + {0x6814026d, 0x02c8}, // verticallinemod + {0x682b08dd, 0x01ac}, // Thook + {0x683090d6, 0xf6f0}, // osuperior + {0x6853e235, 0x0652}, // sukunarabic + {0x685932be, 0xfe36}, // parenrightvertical + {0x68744fba, 0x220f}, // producttext + {0x68a76955, 0x00c7}, // Ccedilla + {0x68b3215e, 0x0339}, // ringhalfrightbelowcmb + {0x68b3ae0f, 0x222e}, // contintegraldisplay + {0x68b98a65, 0x0679}, // afii57511 + {0x68ccd1d8, 0x3212}, // mieumaparenkorean + {0x68eb418e, 0x3011}, // blacklenticularbracketright + {0x690f8118, 0x320b}, // thieuthparenkorean + {0x692bc1f7, 0x0a42}, // uumatragurmukhi + {0x693ccd9c, 0x0432}, // vecyrillic + {0x6962e430, 0x0322}, // hookretroflexbelowcmb + {0x6977f4b7, 0xff05}, // percentmonospace + {0x697925af, 0x05d2}, // gimel + {0x697feb80, 0x030d}, // verticallineabovecmb + {0x6991a62a, 0x0935}, // vadeva + {0x699d525a, 0x0111}, // dcroat + {0x69aabc4d, 0x06af}, // gafarabic + {0x69d31152, 0x0e51}, // onethai + {0x69faaae4, 0x33a7}, // moverssquare + {0x6a104703, 0x2569}, // SF400000 + {0x6a16e743, 0xfef0}, // alefmaksurafinalarabic + {0x6a3d8bdc, 0x0a99}, // ngagujarati + {0x6a511868, 0x03a7}, // Chi + {0x6a5f0a3f, 0x334e}, // yaadosquare + {0x6a721907, 0xfecc}, // ainmedialarabic + {0x6a8d644d, 0x1ead}, // acircumflexdotbelow + {0x6a972227, 0x0401}, // Iocyrillic + {0x6a988d53, 0x2035}, // primereversed + {0x6a9b2b92, 0x0414}, // afii10021 + {0x6aa62850, 0x0662}, // twoarabic + {0x6aa82ca6, 0x3218}, // khieukhaparenkorean + {0x6abb1490, 0x005d}, // bracketright + {0x6ad19d29, 0xfb1f}, // doubleyodpatahhebrew + {0x6b214948, 0xff6f}, // tusmallkatakanahalfwidth + {0x6b2d374c, 0xfcdd}, // yehmeeminitialarabic + {0x6b3f02ab, 0x211e}, // prescription + {0x6b58bab9, 0x0963}, // llvocalicvowelsigndeva + {0x6b83db74, 0x2295}, // circleplus + {0x6b85cd6e, 0x00a4}, // currency + {0x6b8b924f, 0x30d8}, // hekatakana + {0x6b8f0a54, 0xf6df}, // centinferior + {0x6b908b1b, 0x09e7}, // onebengali + {0x6b98f18c, 0x212b}, // angstrom + {0x6b9adcc4, 0x25cf}, // blackcircle + {0x6b9f4fbe, 0x0940}, // iivowelsigndeva + {0x6ba8c1e2, 0xf6ce}, // Grave + {0x6baa5ba4, 0x03ce}, // omegatonos + {0x6bb62dc9, 0xf77a}, // Zsmall + {0x6bbd76c8, 0x0936}, // shadeva + {0x6bca6ff5, 0xfe4a}, // overlinecenterline + {0x6bd59d12, 0x0915}, // kadeva + {0x6bd609d3, 0x00f0}, // eth + {0x6be13af7, 0x2199}, // arrowdownleft + {0x6bf10a81, 0x2015}, // horizontalbar + {0x6c0e37b1, 0x30ce}, // nokatakana + {0x6c0f6861, 0x05e7}, // qofhatafsegolhebrew + {0x6c11086e, 0x0a1c}, // jagurmukhi + {0x6c180b9f, 0x0462}, // Yatcyrillic + {0x6c23928a, 0x222e}, // contintegraltext + {0x6c429460, 0xfb40}, // nundageshhebrew + {0x6c5c9da6, 0x0457}, // yicyrillic + {0x6c781e8a, 0x25bd}, // whitedownpointingtriangle + {0x6c8584d5, 0x3065}, // duhiragana + {0x6c95b865, 0x0941}, // uvowelsigndeva + {0x6c98a67f, 0x0479}, // ukcyrillic + {0x6cbb9b7a, 0xfe5d}, // tortoiseshellbracketleftsmall + {0x6cce2d3d, 0x0aa5}, // thagujarati + {0x6cce7f58, 0x043b}, // elcyrillic + {0x6d02864a, 0x049c}, // Kaverticalstrokecyrillic + {0x6d1b554b, 0x0982}, // anusvarabengali + {0x6d3fc0d7, 0x040f}, // Dzhecyrillic + {0x6d4379b8, 0x220f}, // productdisplay + {0x6d519305, 0x2169}, // Tenroman + {0x6d63a915, 0x02bc}, // apostrophemod + {0x6d6c6ece, 0x307f}, // mihiragana + {0x6d794da3, 0x0057}, // W + {0x6d7a8d87, 0x00fd}, // yacute + {0x6d88930b, 0x044a}, // afii10092 + {0x6d89653d, 0x24e8}, // ycircle + {0x6d8f5cd4, 0xff95}, // yukatakanahalfwidth + {0x6d931b7f, 0x255c}, // SF270000 + {0x6d9b9c3e, 0x05dc}, // afii57676 + {0x6dd186b9, 0x0575}, // yiarmenian + {0x6ddcf118, 0x22a4}, // tackdown + {0x6ddd69da, 0x05b1}, // hatafsegolquarterhebrew + {0x6df68266, 0x0388}, // Epsilontonos + {0x6df8e451, 0x2203}, // existential + {0x6dfa6cea, 0x0a66}, // zerogurmukhi + {0x6dff449c, 0xff79}, // kekatakanahalfwidth + {0x6e298b2c, 0x3380}, // paampssquare + {0x6e2b4011, 0x2213}, // minusplus + {0x6e2e0a97, 0xfe66}, // equalsmall + {0x6e53b9b3, 0xfb00}, // ff + {0x6e5f0868, 0x30ed}, // rokatakana + {0x6e7cf223, 0x3071}, // pahiragana + {0x6e81816d, 0x1e5d}, // rdotbelowmacron + {0x6e897228, 0x0324}, // dieresisbelowcmb + {0x6e8ccbbb, 0xfb48}, // reshdageshhebrew + {0x6eb16a59, 0x2166}, // Sevenroman + {0x6eb40b0d, 0x04db}, // schwadieresiscyrillic + {0x6eba69ba, 0xfe9e}, // jeemfinalarabic + {0x6ebb53ea, 0x2261}, // equivalence + {0x6ecb4ba4, 0x0449}, // afii10091 + {0x6ecc1f68, 0x25bc}, // triagdn + {0x6ed918ed, 0xfcd1}, // meemmeeminitialarabic + {0x6ee27b35, 0x0321}, // hookpalatalizedbelowcmb + {0x6f028e08, 0x0571}, // jaarmenian + {0x6f1f2583, 0x25ce}, // bullseye + {0x6f2573bb, 0x30eb}, // rukatakana + {0x6f4833d3, 0x0a5c}, // rragurmukhi + {0x6f57587a, 0x227b}, // succeeds + {0x6f64edc9, 0x054f}, // Tiwnarmenian + {0x6f6b6e30, 0x0e0e}, // dochadathai + {0x6f75692f, 0x0ac8}, // aivowelsigngujarati + {0x6f7744aa, 0x2196}, // arrowupleft + {0x6fae2151, 0x0aef}, // ninegujarati + {0x6fbeef2a, 0x044d}, // ereversedcyrillic + {0x6fc01d9f, 0x00f8}, // oslash + {0x6fdfa2dc, 0xf6e7}, // periodinferior + {0x70068cb8, 0xf7ea}, // Ecircumflexsmall + {0x702ecc19, 0x3054}, // gohiragana + {0x70300d95, 0xf761}, // Asmall + {0x70534c83, 0x05a4}, // mahapakhlefthebrew + {0x7061d5ad, 0x255a}, // SF380000 + {0x707057b4, 0xfb2e}, // alefpatahhebrew + {0x7070c1c4, 0x0333}, // dbllowlinecmb + {0x7077f8df, 0x0163}, // tcommaaccent + {0x708cf64a, 0x0944}, // rrvocalicvowelsigndeva + {0x709b2bbe, 0x0056}, // V + {0x709b801f, 0x05da}, // finalkafshevahebrew + {0x70a0d365, 0xfeee}, // wawfinalarabic + {0x70a7b34b, 0x05b5}, // tsere12 + {0x70c1bcae, 0x1ede}, // Ohornhookabove + {0x70d74f05, 0x04b1}, // ustraightstrokecyrillic + {0x70d8442c, 0xff3c}, // backslashmonospace + {0x70e9d43c, 0x2202}, // partialdiff + {0x70f78dac, 0x24b5}, // zparen + {0x70f8a40d, 0x05b8}, // afii57797 + {0x71062567, 0xfeea}, // hehfinalalttwoarabic + {0x710fbfc8, 0x0179}, // Zacute + {0x712afb91, 0x310b}, // nbopomofo + {0x7138408a, 0x04cc}, // chekhakassiancyrillic + {0x71411a8f, 0x3156}, // yekorean + {0x7154079a, 0x1e50}, // Omacrongrave + {0x715a0e07, 0xfef4}, // alefmaksuramedialarabic + {0x715aaa7e, 0x0122}, // Gcommaaccent + {0x71693ad6, 0x0919}, // ngadeva + {0x718d2f07, 0xff16}, // sixmonospace + {0x71a4a95d, 0x1eaa}, // Acircumflextilde + {0x71b12b2f, 0x01e0}, // Adotmacron + {0x71b2c74d, 0x00b7}, // periodcentered + {0x71b2e09c, 0x0e32}, // saraaathai + {0x71e104c6, 0x3041}, // asmallhiragana + {0x71ebf117, 0x0640}, // afii57440 + {0x7222af0c, 0x25cb}, // circle + {0x722d9aa3, 0x2153}, // onethird + {0x72446324, 0x3164}, // hangulfiller + {0x7256dcb9, 0x0ac2}, // uuvowelsigngujarati + {0x725da2a5, 0x0548}, // Voarmenian + {0x7274464b, 0x0e31}, // maihanakatthai + {0x7276cdf0, 0x02d7}, // minusmod + {0x7278753d, 0x04d7}, // iebrevecyrillic + {0x728cf068, 0x020f}, // oinvertedbreve + {0x728f761b, 0x3111}, // qbopomofo + {0x72ad941b, 0xf733}, // threeoldstyle + {0x72b3c6a8, 0x00b4}, // acute + {0x72ba7ff6, 0x3093}, // nhiragana + {0x72c6f1c4, 0xff5c}, // barmonospace + {0x72c8f209, 0x0136}, // Kcommaaccent + {0x72e33f41, 0x0419}, // afii10027 + {0x72f1f5cf, 0x0438}, // iicyrillic + {0x72fc7974, 0x2111}, // Ifraktur + {0x72fd959a, 0x002a}, // asterisk + {0x73032cb1, 0x3268}, // cieuccirclekorean + {0x731486cf, 0xf6e1}, // commainferior + {0x731a7d35, 0xf6fb}, // Ogoneksmall + {0x731be3b3, 0x3140}, // rieulhieuhkorean + {0x73200dbd, 0x0e20}, // phosamphaothai + {0x7322d42e, 0x24b9}, // Dcircle + {0x73282fcd, 0x1ee3}, // ohorndotbelow + {0x732cf2ca, 0x2485}, // eighteenparen + {0x7338db3a, 0x066b}, // decimalseparatorarabic + {0x73392eb6, 0x1ed4}, // Ocircumflexhookabove + {0x733b0480, 0xfe94}, // tehmarbutafinalarabic + {0x734f6c6b, 0x3090}, // wihiragana + {0x7375cb46, 0x0686}, // tcheharabic + {0x73843708, 0x0434}, // decyrillic + {0x7387f092, 0x2088}, // eightinferior + {0x73b2bbd4, 0xfe63}, // hyphensmall + {0x73b70a88, 0x05d8}, // afii57672 + {0x73b7c451, 0x095a}, // ghhadeva + {0x73c3073f, 0xf6ee}, // lsuperior + {0x73c5e60b, 0x004e}, // N + {0x73e1033a, 0x22b4}, // a2 + {0x73e5498e, 0xf7fd}, // Yacutesmall + {0x73ee6902, 0x0965}, // dbldanda + {0x73f5578c, 0x093f}, // ivowelsigndeva + {0x74030714, 0x311c}, // ebopomofo + {0x7411ab47, 0x00ba}, // ordmasculine + {0x74144417, 0x311e}, // aibopomofo + {0x74157df0, 0x0667}, // sevenhackarabic + {0x741e8130, 0x00cf}, // Idieresis + {0x7435abfe, 0x057c}, // raarmenian + {0x743d1e25, 0x0456}, // afii10103 + {0x745c44bf, 0x02e3}, // xsuperior + {0x746e784f, 0xff48}, // hmonospace + {0x7476bb3d, 0x21d2}, // dblarrowright + {0x74814589, 0x05b9}, // holam19 + {0x748db30c, 0x33b1}, // nssquare + {0x7495de6c, 0x0008}, // controlBS + {0x74a2fb64, 0x2280}, // notprecedes + {0x74abeab2, 0x05ac}, // iluyhebrew + {0x74b1cbfb, 0x22c5}, // dotmath + {0x74caf1a5, 0x01b4}, // yhook + {0x74d74b92, 0x2209}, // notelement + {0x74f1fca9, 0x01db}, // Udieresisgrave + {0x7506e8c8, 0x24d1}, // bcircle + {0x751253a5, 0x2168}, // Nineroman + {0x7542c0c4, 0xf8e8}, // registersans + {0x7544678b, 0x307d}, // pohiragana + {0x754982de, 0x06a4}, // veharabic + {0x755a250b, 0x09dd}, // rhabengali + {0x755f707c, 0x1ebf}, // ecircumflexacute + {0x75811646, 0xf6e9}, // asuperior + {0x75841530, 0x2002}, // enspace + {0x75907eb0, 0x322c}, // ideographicwaterparen + {0x759ddc3d, 0x3068}, // tohiragana + {0x759f9daf, 0x00c4}, // Adieresis + {0x75aa325f, 0x3047}, // esmallhiragana + {0x75b73269, 0x27e9}, // angbracketrightbig + {0x75b9e64d, 0xff46}, // fmonospace + {0x75bf74c1, 0x0a59}, // khhagurmukhi + {0x75f4d85d, 0x0a2c}, // bagurmukhi + {0x7603459c, 0x094c}, // auvowelsigndeva + {0x760d83de, 0x222b}, // integral + {0x7612320f, 0x3273}, // pieupacirclekorean + {0x76186d8e, 0x01f3}, // dz + {0x7619aedc, 0xfb4c}, // betrafehebrew + {0x762dd6ce, 0x2260}, // notequal + {0x763e1836, 0x30c4}, // tukatakana + {0x7656c681, 0x01c4}, // DZcaron + {0x767695a3, 0xfed4}, // fehmedialarabic + {0x76811ae6, 0x0169}, // utilde + {0x7681e1d4, 0xfe9b}, // thehinitialarabic + {0x76a40aac, 0x001e}, // controlRS + {0x76a57fc1, 0x0117}, // edot + {0x76aa35a2, 0x1e27}, // hdieresis + {0x76abdb93, 0xfb41}, // samekhdageshhebrew + {0x76af2566, 0x05c1}, // afii57804 + {0x76b279b9, 0x1e76}, // Ucircumflexbelow + {0x76be5e67, 0x0389}, // Etatonos + {0x76e8986c, 0x27e9}, // angbracketrightBigg + {0x76ec167e, 0x3128}, // ubopomofo + {0x76ee8ef9, 0x326a}, // khieukhcirclekorean + {0x76fa92ba, 0x2225}, // parallel + {0x7722080a, 0x21e2}, // arrowdashright + {0x772d6b37, 0x3294}, // ideographnamecircle + {0x774eb078, 0x0328}, // ogonekcmb + {0x774fe771, 0x064d}, // kasratanarabic + {0x7752bcc4, 0xf8f6}, // parenrighttp + {0x775a46a9, 0xffe0}, // centmonospace + {0x77617e4f, 0xf762}, // Bsmall + {0x77651620, 0x007b}, // braceleft + {0x776629fd, 0x044a}, // hardsigncyrillic + {0x7766a0eb, 0x041e}, // Ocyrillic + {0x776cd4d6, 0x1e89}, // wdotbelow + {0x77741a8d, 0x0473}, // fitacyrillic + {0x7782c966, 0x1e46}, // Ndotbelow + {0x7786e0a6, 0x246f}, // sixteencircle + {0x779ce17f, 0x0390}, // iotadieresistonos + {0x77a6f721, 0x2165}, // Sixroman + {0x77aefb3f, 0x3027}, // sevenhangzhou + {0x77b3e914, 0x3106}, // pbopomofo + {0x77d27346, 0x0110}, // Dcroat + {0x77e1d263, 0x0442}, // tecyrillic + {0x77ee824a, 0xfba7}, // hehfinalaltonearabic + {0x77f415ae, 0x03eb}, // gangiacoptic + {0x77f608a5, 0x00ec}, // igrave + {0x78075c57, 0x007d}, // bracerightBig + {0x78151b28, 0x04f8}, // Yerudieresiscyrillic + {0x781b1710, 0x3175}, // pieupsiostikeutkorean + {0x782f5323, 0x2297}, // circlemultiply + {0x783bb2b4, 0xfeea}, // hehfinalarabic + {0x7849decd, 0x05f0}, // vavvavhebrew + {0x7865471d, 0x30f8}, // vikatakana + {0x7868522a, 0x0172}, // Uogonek + {0x78728968, 0x0e3f}, // bahtthai + {0x7877a9ea, 0x05d9}, // yodhebrew + {0x7878b2f0, 0x323c}, // ideographicsuperviseparen + {0x788e7d3e, 0x05b3}, // hatafqamats + {0x78965447, 0x0593}, // shalshelethebrew + {0x78a67a97, 0xf8ea}, // trademarksans + {0x78d4db12, 0x032e}, // brevebelowcmb + {0x78da6d23, 0x046e}, // Ksicyrillic + {0x78f4df25, 0x04d9}, // schwacyrillic + {0x79042ee6, 0x30e9}, // rakatakana + {0x79116479, 0x0039}, // nine + {0x7919f419, 0x0416}, // afii10024 + {0x792d6db9, 0x0272}, // nhookleft + {0x793801c3, 0x3158}, // wakorean + {0x79577113, 0x2565}, // SF480000 + {0x795917d1, 0x0583}, // piwrarmenian + {0x79638654, 0x1ecd}, // odotbelow + {0x796eb2f8, 0x3389}, // kcalsquare + {0x796edb96, 0x0387}, // anoteleia + {0x797aa124, 0x0445}, // khacyrillic + {0x7980bc25, 0x00c5}, // Aring + {0x7987b173, 0x03e8}, // Horicoptic + {0x79961e28, 0x20a7}, // peseta + {0x79c6a044, 0xfe3a}, // tortoiseshellbracketrightvertical + {0x79d35b17, 0x3229}, // tenideographicparen + {0x79dfa961, 0xfb2d}, // shindageshsindot + {0x79e5e3c1, 0x0e2f}, // paiyannoithai + {0x79fc5691, 0x24ce}, // Ycircle + {0x7a196523, 0x0451}, // afii10071 + {0x7a29214e, 0x006c}, // l + {0x7a32a546, 0x202d}, // afii61574 + {0x7a3f45e9, 0x0ab8}, // sagujarati + {0x7a49bde9, 0xfca4}, // tehmeeminitialarabic + {0x7a49dc21, 0xfee2}, // meemfinalarabic + {0x7a56cace, 0x33a1}, // squaremsquared + {0x7a6cfa6a, 0x0a3f}, // imatragurmukhi + {0x7a75be4d, 0x2559}, // SF490000 + {0x7a8736f8, 0x320c}, // phieuphparenkorean + {0x7aa071da, 0x0217}, // uinvertedbreve + {0x7aa95d24, 0xfb34}, // hedageshhebrew + {0x7aac463a, 0x0669}, // afii57401 + {0x7ab8ba14, 0x1ebe}, // Ecircumflexacute + {0x7ad78099, 0x05b5}, // afii57794 + {0x7b074f4f, 0x062c}, // jeemarabic + {0x7b0aca00, 0x3315}, // kiroguramusquare + {0x7b3db32a, 0x221a}, // radicalBig + {0x7b443626, 0x3331}, // birusquare + {0x7b5e0418, 0xff10}, // zeromonospace + {0x7b7b9d4d, 0x0424}, // afii10038 + {0x7b7fbb65, 0xf7b8}, // Cedillasmall + {0x7b80aee5, 0x05bb}, // qubutsquarterhebrew + {0x7b8c3862, 0x02b8}, // ysuperior + {0x7bac8f33, 0x0016}, // controlSYN + {0x7bc269dd, 0x0040}, // at + {0x7bd5ca88, 0x33ca}, // hasquare + {0x7bd8b82b, 0x3005}, // ideographiciterationmark + {0x7c301325, 0x0472}, // Fitacyrillic + {0x7c35d223, 0x05dc}, // lamedholam + {0x7c3e1570, 0x0028}, // parenleftbigg + {0x7c3f4566, 0x00e7}, // ccedilla + {0x7c4777ca, 0xfcc9}, // lamjeeminitialarabic + {0x7c4f7ece, 0x0ab2}, // lagujarati + {0x7c53c130, 0x0a13}, // oogurmukhi + {0x7c613499, 0x2566}, // SF410000 + {0x7c8ffdc8, 0x24e7}, // xcircle + {0x7c903e9b, 0x1ec7}, // ecircumflexdotbelow + {0x7cb539e8, 0x096e}, // eightdeva + {0x7cc006ef, 0x222c}, // dblintegral + {0x7cdf3e4a, 0x0a2f}, // yagurmukhi + {0x7cf2e5f4, 0x0029}, // parenright + {0x7cf2ebbd, 0xff96}, // yokatakanahalfwidth + {0x7cf8ce2e, 0x3394}, // thzsquare + {0x7d1ff070, 0xf896}, // thanthakhatupperleftthai + {0x7d32ca29, 0x0127}, // hbar + {0x7d44a576, 0x24b1}, // vparen + {0x7d4ddd33, 0x2554}, // SF390000 + {0x7d86a046, 0xff93}, // mokatakanahalfwidth + {0x7d8bc7c0, 0x255f}, // SF370000 + {0x7d981506, 0x0a9f}, // ttagujarati + {0x7dc79678, 0x062a}, // afii57418 + {0x7dc79708, 0x223c}, // tildeoperator + {0x7dc7cd45, 0x33b6}, // muvsquare + {0x7dcf75fb, 0x223c}, // similar + {0x7dd21a95, 0x30b5}, // sakatakana + {0x7dd63b6c, 0x1ec1}, // ecircumflexgrave + {0x7de5edf4, 0x05b9}, // afii57806 + {0x7df90cb9, 0x249c}, // aparen + {0x7e46df3d, 0x30d7}, // pukatakana + {0x7e4f805e, 0x3067}, // dehiragana + {0x7e5c9fda, 0x042f}, // IAcyrillic + {0x7e60a480, 0x0029}, // parenrightbigg + {0x7e701b6d, 0xff0d}, // hyphenmonospace + {0x7e739224, 0x3046}, // uhiragana + {0x7e7d09ba, 0xf6e4}, // dollarsuperior + {0x7e947543, 0xf773}, // Ssmall + {0x7ebf5260, 0x0031}, // one + {0x7eddac19, 0x09f4}, // onenumeratorbengali + {0x7eefb1cf, 0x05d3}, // daletshevahebrew + {0x7f0a4f83, 0x0631}, // rehyehaleflamarabic + {0x7f43cdd7, 0x0ab0}, // ragujarati + {0x7f56c599, 0x0141}, // Lslash + {0x7f5b3579, 0x1e74}, // Utildebelow + {0x7f630a55, 0x1ef9}, // ytilde + {0x7f7aa31e, 0x0648}, // afii57448 + {0x7f82e2ff, 0x098f}, // ebengali + {0x7f851974, 0x0568}, // etarmenian + {0x7f92fe37, 0x066d}, // asteriskarabic + {0x7f97f320, 0x301c}, // wavedash + {0x7f99701f, 0xfb2a}, // shinshindothebrew + {0x7fad7e30, 0xf737}, // sevenoldstyle + {0x7fbd4335, 0x2309}, // ceilingrightbig + {0x7ff2087d, 0x01df}, // adieresismacron + {0x7ffdad4c, 0x326e}, // kiyeokacirclekorean + {0x801f311e, 0x1ebb}, // ehookabove + {0x8020003f, 0x05e9}, // shinhebrew + {0x8027a085, 0x03d2}, // Upsilonhooksymbol + {0x8029e67d, 0x049b}, // kadescendercyrillic + {0x803a882f, 0x0a8b}, // rvocalicgujarati + {0x80417827, 0x33a9}, // pasquare + {0x80461d8b, 0xf6c7}, // afii10831 + {0x8048e51c, 0x24e6}, // wcircle + {0x80690312, 0x0155}, // racute + {0x8076b638, 0xfedf}, // laminitialarabic + {0x80792dfa, 0x0478}, // Ukcyrillic + {0x807bd424, 0xf886}, // saraiileftthai + {0x8082c40e, 0x251c}, // SF080000 + {0x8086d5c5, 0x0490}, // afii10050 + {0x80890e42, 0x0316}, // gravebelowcmb + {0x808de596, 0x2492}, // elevenperiod + {0x808eef1b, 0x0068}, // h + {0x80b21ab0, 0x00f5}, // otilde + {0x80b54bce, 0x3170}, // mieumpansioskorean + {0x80c36a57, 0x0480}, // Koppacyrillic + {0x80f8e4b8, 0x017f}, // slong + {0x80fb86d5, 0x00ff}, // ydieresis + {0x810ea19f, 0x02bd}, // afii64937 + {0x810f1d5a, 0x30c6}, // tekatakana + {0x812767fa, 0x0555}, // Oharmenian + {0x8140027d, 0x24d3}, // dcircle + {0x815134d6, 0x00cd}, // Iacute + {0x81589a47, 0x2220}, // angle + {0x816211ee, 0x05dc}, // lamedholamdageshhebrew + {0x81658581, 0x0207}, // einvertedbreve + {0x816871c9, 0x1ec2}, // Ecircumflexhookabove + {0x8169da43, 0x0483}, // titlocyrilliccmb + {0x8170d563, 0x256b}, // SF530000 + {0x81796466, 0xf6f2}, // ssuperior + {0x817f112a, 0x1e37}, // ldotbelow + {0x817f9471, 0x1e92}, // Zdotbelow + {0x81806da2, 0x328d}, // ideographwoodcircle + {0x8184073f, 0x053b}, // Iniarmenian + {0x818aac3d, 0x3165}, // ssangnieunkorean + {0x81b94a51, 0x3233}, // ideographicsocietyparen + {0x81e18c26, 0x30c3}, // tusmallkatakana + {0x81eec5b0, 0x320e}, // kiyeokaparenkorean + {0x8215ea5e, 0x02b2}, // jsuperior + {0x82173176, 0x05d9}, // afii57673 + {0x8218cc3e, 0x039c}, // Mu + {0x822cf82c, 0x3070}, // bahiragana + {0x8230e7a0, 0x32a7}, // ideographicleftcircle + {0x823da9d2, 0x0413}, // afii10020 + {0x825a2038, 0x3045}, // usmallhiragana + {0x8260fa87, 0x1ea5}, // acircumflexacute + {0x8272e0b5, 0x249b}, // twentyperiod + {0x827d6960, 0xff40}, // gravemonospace + {0x828072a0, 0x2666}, // diamond + {0x8281c05a, 0x00b5}, // mu1 + {0x8291bd7d, 0x248e}, // sevenperiod + {0x82ab3b91, 0x03a3}, // Sigma + {0x82b182a5, 0x057e}, // vewarmenian + {0x82b58e6a, 0x1e94}, // Zlinebelow + {0x82b5e1a0, 0x266b}, // eighthnotebeamed + {0x82b5fc2f, 0x05bc}, // afii57807 + {0x82c39f59, 0x1e62}, // Sdotbelow + {0x82c3da09, 0x0a1a}, // cagurmukhi + {0x82d03f46, 0x056e}, // caarmenian + {0x82d4758a, 0x25e6}, // whitebullet + {0x82db51c1, 0x05b6}, // segolnarrowhebrew + {0x82dffbf3, 0xfe9c}, // thehmedialarabic + {0x8322270c, 0x1e49}, // nlinebelow + {0x832d9a03, 0x263b}, // invsmileface + {0x83393d74, 0xfef7}, // lamalefhamzaaboveisolatedarabic + {0x83589346, 0x1eb0}, // Abrevegrave + {0x836fd101, 0x25c7}, // a51 + {0x83736e7a, 0x2308}, // ceilingleftBig + {0x837601e2, 0x0ae7}, // onegujarati + {0x8377c3f2, 0x026b}, // lmiddletilde + {0x837a2830, 0x2113}, // lsquare + {0x837c1552, 0x2172}, // threeroman + {0x8388f2be, 0x00c9}, // Eacute + {0x83a89a03, 0x045f}, // dzhecyrillic + {0x83aeaef2, 0x1e23}, // hdotaccent + {0x83c5c486, 0x05e7}, // afii57687 + {0x83cd4320, 0x0565}, // echarmenian + {0x83e3c3a4, 0x3075}, // huhiragana + {0x83f86a79, 0x339e}, // squarekm + {0x83fc4077, 0x0037}, // seven + {0x83fe9093, 0x0441}, // escyrillic + {0x840c8507, 0x0313}, // commaabovecmb + {0x8411d0c3, 0x1e3e}, // Macute + {0x84132896, 0x0140}, // ldot + {0x841d72ff, 0x02e4}, // glottalstopreversedsuperior + {0x841d9ceb, 0x0572}, // ghadarmenian + {0x8424a64d, 0x05b5}, // tserewidehebrew + {0x843c7aca, 0x323f}, // ideographicallianceparen + {0x8445bb28, 0x0905}, // adeva + {0x8459e5f4, 0x2248}, // approxequal + {0x84776c26, 0x329d}, // ideographicexcellentcircle + {0x847d9b8a, 0x1ec5}, // ecircumflextilde + {0x847ed2d4, 0x0540}, // Hoarmenian + {0x8487ed37, 0x0621}, // hamzaarabic + {0x848baa07, 0xfc5f}, // shaddakasratanarabic + {0x8494dfda, 0x05b1}, // hatafsegol24 + {0x8498dbae, 0xfe86}, // wawhamzaabovefinalarabic + {0x849b0297, 0x1e2e}, // Idieresisacute + {0x84a67fee, 0x323a}, // ideographiccallparen + {0x84b1d089, 0x0430}, // acyrillic + {0x84de35f4, 0x0210}, // Rdblgrave + {0x84e0b580, 0x04ef}, // umacroncyrillic + {0x8501599a, 0x30f6}, // kesmallkatakana + {0x85103d59, 0xfb39}, // yoddagesh + {0x851a3968, 0xf6da}, // registerserif + {0x853a4f53, 0x217b}, // twelveroman + {0x855c805d, 0xff1a}, // colonmonospace + {0x856013c8, 0x248a}, // threeperiod + {0x8567c154, 0x01bc}, // Tonefive + {0x856bfeb5, 0x0029}, // parenrightBigg + {0x85a6c8bc, 0x310a}, // tbopomofo + {0x85b41716, 0x201a}, // quotesinglbase + {0x85b6b018, 0x2228}, // logicalor + {0x85c83eb6, 0xff77}, // kikatakanahalfwidth + {0x85cde6eb, 0xf8e7}, // arrowhorizex + {0x85ce16f4, 0x05da}, // afii57674 + {0x85e92466, 0x2282}, // propersubset + {0x85ee23d7, 0x311b}, // obopomofo + {0x85f325ac, 0x064c}, // dammatanaltonearabic + {0x85f47ad1, 0x0660}, // zerohackarabic + {0x85f89b18, 0x3049}, // osmallhiragana + {0x86129c18, 0x2209}, // notelementof + {0x861e8048, 0xff54}, // tmonospace + {0x861ef200, 0x1e75}, // utildebelow + {0x864008ae, 0x05d3}, // daletqubutshebrew + {0x8654695b, 0x0020}, // spacehackarabic + {0x865c7659, 0x0312}, // commaturnedabovecmb + {0x8665f7ab, 0x201b}, // quotereversed + {0x8686768e, 0x093e}, // aavowelsigndeva + {0x8694e2ae, 0x3132}, // ssangkiyeokkorean + {0x8699e716, 0x09ef}, // ninebengali + {0x869fef4c, 0x064b}, // afii57451 + {0x86a662d1, 0x05e7}, // qofhebrew + {0x86a80595, 0x0535}, // Echarmenian + {0x86c2d4a4, 0x01ef}, // ezhcaron + {0x86d0b880, 0x01c7}, // LJ + {0x86d66230, 0x04ad}, // tedescendercyrillic + {0x86e222a0, 0x05d9}, // yod + {0x86eea6f9, 0x03a4}, // Tau + {0x870315b6, 0x30e1}, // mekatakana + {0x8713ac2f, 0xfb4b}, // vavholam + {0x87634c8c, 0x05bd}, // siluqhebrew + {0x877afbbb, 0xfb35}, // afii57723 + {0x877f7c7a, 0xfeb4}, // seenmedialarabic + {0x8787b92b, 0x02c0}, // glottalstopmod + {0x87a041c7, 0x0446}, // afii10088 + {0x87a4b30d, 0x263c}, // compass + {0x87b6c8ba, 0x00c3}, // Atilde + {0x87bb7ac5, 0x020b}, // iinvertedbreve + {0x87e03b4f, 0x0642}, // afii57442 + {0x87e97d46, 0x04dd}, // zhedieresiscyrillic + {0x87ef58ab, 0xfe30}, // twodotleadervertical + {0x87fc47e5, 0x24d2}, // ccircle + {0x88044bf5, 0x2167}, // Eightroman + {0x880a9911, 0x1e34}, // Klinebelow + {0x881905a5, 0x0e22}, // yoyakthai + {0x881a4ba0, 0x0931}, // rradeva + {0x88264250, 0x1e71}, // tcircumflexbelow + {0x8826a561, 0x03cd}, // upsilontonos + {0x883bae04, 0x248c}, // fiveperiod + {0x8841d986, 0x30b8}, // zikatakana + {0x8853f322, 0x339b}, // mumsquare + {0x885dcb80, 0x00a7}, // section + {0x886c5d13, 0x0636}, // dadarabic + {0x8876a700, 0x1e98}, // wring + {0x888833ba, 0x02e7}, // tonebarmidmod + {0x888e1142, 0x026d}, // lhookretroflex + {0x88a12621, 0x05d4}, // afii57668 + {0x88b6884b, 0x06f7}, // sevenpersian + {0x88c2fc70, 0x0a6a}, // fourgurmukhi + {0x88c96d26, 0xfb4a}, // tavdages + {0x88cc32a3, 0x1ef6}, // Yhookabove + {0x88da326f, 0x0546}, // Nowarmenian + {0x88e4df33, 0x1e1b}, // etildebelow + {0x88e6eee8, 0x3119}, // sbopomofo + {0x88ea0124, 0x0949}, // ocandravowelsigndeva + {0x88ea9631, 0xf7af}, // Macronsmall + {0x88f38eed, 0x21d0}, // arrowdblleft + {0x88f62270, 0x314f}, // akorean + {0x88fdc1bb, 0x308e}, // wasmallhiragana + {0x88fdcf2e, 0x039e}, // Xi + {0x89098ea4, 0x2211}, // summationdisplay + {0x893a8f13, 0x09b9}, // habengali + {0x89468742, 0x0e1f}, // fofanthai + {0x897340ea, 0x3207}, // ieungparenkorean + {0x897854cd, 0x060c}, // afii57388 + {0x897adc4f, 0x0128}, // Itilde + {0x89aa67b7, 0x2161}, // Tworoman + {0x89ace505, 0xff06}, // ampersandmonospace + {0x89d8daae, 0x25c9}, // fisheye + {0x89e05206, 0x0022}, // quotedbl + {0x89e2c74b, 0x062d}, // afii57421 + {0x89ed1e17, 0x3171}, // kapyeounmieumkorean + {0x89f4c981, 0x02dc}, // tilde + {0x89f7042b, 0xfe38}, // bracerightvertical + {0x89fc7dc4, 0x05bf}, // rafehebrew + {0x8a1958e1, 0x03d1}, // theta1 + {0x8a27f623, 0x030e}, // dblverticallineabovecmb + {0x8a36e0e0, 0x0a89}, // ugujarati + {0x8a64ee32, 0x23a2}, // bracketleftex + {0x8a743e71, 0x3279}, // thieuthacirclekorean + {0x8a7ff438, 0x0632}, // zainarabic + {0x8ab11ede, 0x0907}, // ideva + {0x8ab50af4, 0xfedb}, // kafinitialarabic + {0x8ac9c3df, 0x00cb}, // Edieresis + {0x8ad52e55, 0x05d3}, // dalethatafsegolhebrew + {0x8ae82e18, 0x05c2}, // sindothebrew + {0x8aebef01, 0x064f}, // afii57455 + {0x8af00e69, 0x3396}, // mlsquare + {0x8af0299d, 0x2465}, // sixcircle + {0x8af3a8ba, 0x1e55}, // pacute + {0x8afdb385, 0x05b2}, // hatafpatahnarrowhebrew + {0x8b04e879, 0x0573}, // cheharmenian + {0x8b2ea84b, 0x045f}, // afii10193 + {0x8b336b03, 0x33c3}, // bqsquare + {0x8b3d9ff3, 0x313a}, // rieulkiyeokkorean + {0x8b46ba2c, 0x1e10}, // Dcedilla + {0x8b5fbe71, 0x0209}, // idblgrave + {0x8b6e36e5, 0x0001}, // controlSTX + {0x8b91eefb, 0x0135}, // jcircumflex + {0x8ba07e30, 0x3236}, // ideographicfinancialparen + {0x8ba61ca6, 0x0170}, // Udblacute + {0x8bb0c7c5, 0x04a4}, // Enghecyrillic + {0x8bb9fe95, 0x1e35}, // klinebelow + {0x8bc6e552, 0x027a}, // rlonglegturned + {0x8bd60707, 0x33ce}, // squarekmcapital + {0x8bdd4dfa, 0x05a1}, // pazerhebrew + {0x8be0aeeb, 0x1e28}, // Hcedilla + {0x8bf3f9ec, 0x0aed}, // sevengujarati + {0x8bfc7ed2, 0x02e9}, // tonebarextralowmod + {0x8c09cf1f, 0x0251}, // ascript + {0x8c169f16, 0x0a4c}, // aumatragurmukhi + {0x8c1a91ec, 0x1ed2}, // Ocircumflexgrave + {0x8c21575a, 0x2175}, // sixroman + {0x8c31d770, 0x007d}, // bracerightBigg + {0x8c382c45, 0xf6c5}, // afii10064 + {0x8c3dc32f, 0x0632}, // afii57426 + {0x8c5fd3c7, 0x05dd}, // afii57677 + {0x8c6ceb51, 0xeb61}, // suppress + {0x8c7614fd, 0x0046}, // F + {0x8c789c98, 0x0255}, // ccurl + {0x8c7eba77, 0x3114}, // chbopomofo + {0x8c941f03, 0x0639}, // afii57433 + {0x8c9c3f66, 0x0e37}, // saraueethai + {0x8c9d6579, 0x2308}, // ceilingleftBigg + {0x8cb6cb59, 0xfb6c}, // vehinitialarabic + {0x8cbe2a76, 0x0951}, // udattadeva + {0x8cc838c1, 0x099f}, // ttabengali + {0x8ccab94e, 0x311d}, // ehbopomofo + {0x8cd2ceac, 0x322f}, // ideographicearthparen + {0x8cd87862, 0x2a01}, // circleplusdisplay + {0x8cdd7a5e, 0xfefb}, // lamalefisolatedarabic + {0x8cfeaaad, 0x04b4}, // Tetsecyrillic + {0x8d0e3bcc, 0x0162}, // Tcommaaccent + {0x8d15f0f9, 0x01d8}, // udieresisacute + {0x8d17055f, 0xff23}, // Cmonospace + {0x8d2183aa, 0x00ee}, // icircumflex + {0x8d24b8c2, 0x0457}, // afii10104 + {0x8d262f6a, 0x33ad}, // radsquare + {0x8d3bc051, 0x1eb1}, // abrevegrave + {0x8d430411, 0x0288}, // tretroflexhook + {0x8d4c7b99, 0x0473}, // afii10195 + {0x8d557bba, 0xfe98}, // tehmedialarabic + {0x8d5ae6d4, 0x0440}, // ercyrillic + {0x8d62c566, 0x21e0}, // arrowdashleft + {0x8d7f2614, 0x2164}, // Fiveroman + {0x8d983a6e, 0x22b5}, // a4 + {0x8db3e76c, 0x1e97}, // tdieresis + {0x8dbd6f57, 0xffe1}, // sterlingmonospace + {0x8dc41abc, 0x1e33}, // kdotbelow + {0x8de51633, 0x1ed7}, // ocircumflextilde + {0x8df7afeb, 0x0968}, // twodeva + {0x8e0d9fbd, 0x0337}, // solidusshortoverlaycmb + {0x8e2538f6, 0x0420}, // Ercyrillic + {0x8e325301, 0x0133}, // ij + {0x8e3386c6, 0x0439}, // iishortcyrillic + {0x8e360b54, 0x027d}, // rhook + {0x8e38f2c0, 0x005d}, // bracketrightbig + {0x8e40b292, 0x01fb}, // aringacute + {0x8e467ab5, 0x1ecc}, // Odotbelow + {0x8e474342, 0x1e2a}, // Hbrevebelow + {0x8e5ae93f, 0x0909}, // udeva + {0x8e5f575a, 0x0458}, // jecyrillic + {0x8e5f7ac5, 0x01d2}, // ocaron + {0x8e6f5aa1, 0x3074}, // pihiragana + {0x8e757f60, 0x308a}, // rihiragana + {0x8e7aa1b5, 0x207c}, // equalsuperior + {0x8e8e0711, 0x042f}, // afii10049 + {0x8e91af6c, 0x3000}, // ideographicspace + {0x8ec625f1, 0x2304}, // a43 + {0x8ec9ea4f, 0xfb40}, // nundagesh + {0x8eca9ee8, 0x045c}, // kjecyrillic + {0x8ed1765d, 0xff36}, // Vmonospace + {0x8ed539a2, 0x278a}, // onecircleinversesansserif + {0x8f084bdd, 0x3204}, // mieumparenkorean + {0x8f19bc84, 0x0e4a}, // maitrithai + {0x8f289d06, 0x0444}, // efcyrillic + {0x8f28eae1, 0x013f}, // Ldotaccent + {0x8f3d926c, 0xf7e2}, // Acircumflexsmall + {0x8f4b9c51, 0x0404}, // afii10053 + {0x8f505863, 0x04f2}, // Uhungarumlautcyrillic + {0x8f52df2f, 0x0256}, // dtail + {0x8f5e284f, 0xfed6}, // qaffinalarabic + {0x8f760fbe, 0x25e5}, // blackupperrighttriangle + {0x8f7f3f67, 0x0645}, // afii57445 + {0x8f89b56f, 0x05b8}, // qamatsqatanhebrew + {0x8f9b61ad, 0x22c0}, // logicalanddisplay + {0x8fa69b6c, 0x0331}, // macronbelowcmb + {0x8fbba331, 0x0205}, // edblgrave + {0x8fc968d8, 0x01b9}, // ezhreversed + {0x8fce94ba, 0x0395}, // Epsilon + {0x8fd18473, 0x2593}, // shadedark + {0x8fe2c390, 0x0e53}, // threethai + {0x8fe329b9, 0x266c}, // beamedsixteenthnotes + {0x8fe85541, 0x0637}, // afii57431 + {0x8ff897b6, 0x0042}, // B + {0x900e8281, 0x1e3b}, // llinebelow + {0x900fb5c0, 0x0144}, // nacute + {0x902443c2, 0xfe52}, // periodsmall + {0x9024a760, 0x029d}, // jcrossedtail + {0x90307534, 0x3059}, // suhiragana + {0x9059f738, 0x00b7}, // middot + {0x906746a4, 0xff75}, // okatakanahalfwidth + {0x907d968c, 0x0a9b}, // chagujarati + {0x90872973, 0x0538}, // Etarmenian + {0x9098fbd4, 0x0002}, // controlSOT + {0x90995fc1, 0x1e09}, // ccedillaacute + {0x90a162b6, 0x05b4}, // hiriqwidehebrew + {0x90b86ad8, 0x30dd}, // pokatakana + {0x90b9c076, 0xff0f}, // slashmonospace + {0x90c2be85, 0x0268}, // istroke + {0x90d8e15f, 0xf6e8}, // periodsuperior + {0x91032be8, 0x02c6}, // hatwide + {0x910a1b16, 0x03f1}, // rhosymbolgreek + {0x91306ea5, 0x2127}, // a48 + {0x9132f814, 0xff22}, // Bmonospace + {0x9134ebbc, 0x01cb}, // Nj + {0x913ff5ff, 0x3125}, // engbopomofo + {0x9141d43c, 0x2126}, // Ohm + {0x914548fb, 0xf7f9}, // Ugravesmall + {0x914ce494, 0x05e6}, // afii57686 + {0x9166eec8, 0x33ba}, // pwsquare + {0x916cdeb8, 0xfed2}, // fehfinalarabic + {0x917f2f3f, 0x0438}, // afii10074 + {0x9181b388, 0x01eb}, // oogonek + {0x9184e24f, 0x30ab}, // kakatakana + {0x919c9ad4, 0xf898}, // thanthakhatlowleftthai + {0x919f5679, 0x00ca}, // Ecircumflex + {0x91acc220, 0xff91}, // mukatakanahalfwidth + {0x91accd4b, 0x0937}, // ssadeva + {0x91c3e17e, 0x05f2}, // afii57718 + {0x91d99037, 0x1eb9}, // edotbelow + {0x91de3939, 0x064f}, // dammalowarabic + {0x91e65480, 0x0abf}, // ivowelsigngujarati + {0x91ea8b93, 0x2303}, // a42 + {0x91eaac20, 0x3214}, // siosaparenkorean + {0x920233a7, 0xf6de}, // threequartersemdash + {0x920dae79, 0x039f}, // Omicron + {0x9215b042, 0x3147}, // ieungkorean + {0x9220d7f0, 0xff69}, // usmallkatakanahalfwidth + {0x923767e3, 0x3133}, // kiyeoksioskorean + {0x9239e7fb, 0x062b}, // theharabic + {0x923bf3d0, 0x0330}, // tildebelowcmb + {0x926b691e, 0x0100}, // Amacron + {0x92aa52d3, 0x30fb}, // dotkatakana + {0x92e2ffd9, 0x21e8}, // arrowrightwhite + {0x92e50e35, 0xf88e}, // maitholowrightthai + {0x92f283dc, 0x25d8}, // bulletinverse + {0x92f96dbe, 0x1e56}, // Pdotaccent + {0x930724f6, 0x06ba}, // noonghunnaarabic + {0x930c1a0b, 0x001b}, // controlESC + {0x932512ee, 0x03ea}, // Gangiacoptic + {0x9330a2fc, 0x0336}, // strokelongoverlaycmb + {0x934b1595, 0x062d}, // haharabic + {0x93959445, 0x263a}, // smileface + {0x939a56c4, 0x03ad}, // epsilontonos + {0x939b5eb8, 0xfe92}, // behmedialarabic + {0x93bca3b6, 0x099e}, // nyabengali + {0x93e00dc4, 0x2193}, // arrowdown + {0x93eef318, 0x0263}, // gammalatinsmall + {0x9404d5fc, 0x33d5}, // squaremil + {0x941a6b5f, 0x0a23}, // nnagurmukhi + {0x941b20fa, 0xfe4b}, // overlinewavy + {0x942ad1c7, 0x09be}, // aavowelsignbengali + {0x9453959c, 0x24bd}, // Hcircle + {0x9464bc2e, 0x1e66}, // Scarondotaccent + {0x94724b66, 0x21bc}, // harpoonleftbarbup + {0x94803386, 0x09d7}, // aulengthmarkbengali + {0x948a9ce4, 0x05de}, // afii57678 + {0x949bc805, 0x01da}, // udieresiscaron + {0x94ae0441, 0x0410}, // Acyrillic + {0x94b7f6ea, 0x0463}, // yatcyrillic + {0x94c36e74, 0x3261}, // nieuncirclekorean + {0x94c9571f, 0x25ac}, // blackrectangle + {0x94ca16e5, 0xf893}, // maichattawaupperleftthai + {0x94d13d1c, 0xfe39}, // tortoiseshellbracketleftvertical + {0x94d44c33, 0x007b}, // braceleftbig + {0x94d74b96, 0x1e64}, // Sacutedotaccent + {0x94e6f584, 0x3058}, // zihiragana + {0x94ee5ae7, 0x2792}, // ninecircleinversesansserif + {0x94f9a508, 0x3265}, // pieupcirclekorean + {0x9518a20d, 0x30d9}, // bekatakana + {0x951a0238, 0xfdf2}, // lamlamhehisolatedarabic + {0x951ae869, 0x09dc}, // rrabengali + {0x952cce64, 0x04ee}, // Umacroncyrillic + {0x952ec009, 0x0988}, // iibengali + {0x95394a64, 0x05da}, // finalkafsheva + {0x953a0a51, 0x2211}, // summation + {0x954920d5, 0xf769}, // Ismall + {0x954a8776, 0x03d1}, // thetasymbolgreek + {0x95526ac8, 0x2500}, // SF100000 + {0x9559e176, 0x05b7}, // patah2a + {0x955dbbe7, 0x23aa}, // braceex + {0x957765bc, 0xfe8a}, // yehhamzaabovefinalarabic + {0x958830cb, 0x2669}, // quarternote + {0x9588e4f1, 0xff99}, // rukatakanahalfwidth + {0x959cf6c1, 0x203b}, // referencemark + {0x95af6475, 0x05e3}, // finalpehebrew + {0x95aff05f, 0x03ca}, // iotadieresis + {0x95b3bc07, 0xfb46}, // tsadidagesh + {0x95bed968, 0x0e15}, // totaothai + {0x95cabf3f, 0x21cf}, // arrowrightdblstroke + {0x95d7e2f4, 0x0032}, // two + {0x95ed768c, 0x05e0}, // nun + {0x960140f0, 0x2496}, // fifteenperiod + {0x961b2e15, 0x1e6f}, // tlinebelow + {0x96220dd7, 0x318a}, // yuyeokorean + {0x962b0c72, 0x3323}, // sentosquare + {0x9638605a, 0x0669}, // ninearabic + {0x967b01ac, 0x05b9}, // holamhebrew + {0x967d0326, 0x3134}, // nieunkorean + {0x968e4cb7, 0xf899}, // nikhahitleftthai + {0x96a5e022, 0x25d9}, // invcircle + {0x96b677d5, 0x0153}, // oe + {0x96c05d98, 0x01f2}, // Dz + {0x96c1ab16, 0x247f}, // twelveparen + {0x96d9cc68, 0x0427}, // Checyrillic + {0x96fd8ec6, 0x1e7a}, // Umacrondieresis + {0x9711eb31, 0x21aa}, // arrowhookleft + {0x9741ad45, 0x05bf}, // rafe + {0x975dc1dc, 0x32a5}, // ideographiccentrecircle + {0x9776a4ba, 0x0007}, // controlBEL + {0x977737b3, 0x0265}, // hturned + {0x9778a35b, 0x0562}, // benarmenian + {0x977e0dfa, 0x25d0}, // circlewithlefthalfblack + {0x97843a2e, 0x09f8}, // denominatorminusonenumeratorbengali + {0x978c8c89, 0x03ac}, // alphatonos + {0x97ae16ea, 0x23a1}, // bracketlefttp + {0x97b3e7db, 0x24c3}, // Ncircle + {0x97e45478, 0x05b6}, // segol2c + {0x97ea0cb5, 0x04d8}, // Schwacyrillic + {0x97ebb44e, 0x015f}, // scedilla + {0x97f03f9c, 0x0419}, // Iishortcyrillic + {0x97f6721e, 0x05bf}, // afii57841 + {0x980e76a2, 0x1e32}, // Kdotbelow + {0x98148d7b, 0xff14}, // fourmonospace + {0x981fc90b, 0x0a1b}, // chagurmukhi + {0x982585a7, 0x260e}, // telephoneblack + {0x982718e0, 0x003c}, // less + {0x982eb09a, 0x0e5b}, // khomutthai + {0x9853033e, 0x04b5}, // tetsecyrillic + {0x987e6d13, 0x0411}, // Becyrillic + {0x9896e370, 0x0402}, // afii10051 + {0x98b02dc0, 0x0a48}, // aimatragurmukhi + {0x98bf4a1b, 0xf6d0}, // Macron + {0x98c60f17, 0xf6d9}, // copyrightserif + {0x98d74b1c, 0x01c8}, // Lj + {0x98d9aba5, 0x03ae}, // etatonos + {0x98eba766, 0x018b}, // Dtopbar + {0x98f4783f, 0x24ac}, // qparen + {0x98f4b751, 0x0651}, // afii57457 + {0x98ffb065, 0x02c6}, // hatwider + {0x99104281, 0x02e5}, // tonebarextrahighmod + {0x99235205, 0x05dc}, // lamedhebrew + {0x994ebac3, 0x05c0}, // afii57842 + {0x99725844, 0x0320}, // minusbelowcmb + {0x9982855c, 0x0686}, // afii57507 + {0x99830dc7, 0x062c}, // afii57420 + {0x99863852, 0x03ed}, // shimacoptic + {0x99997c4f, 0x3314}, // kirosquare + {0x999c619c, 0x3078}, // hehiragana + {0x999f4db4, 0x05b4}, // afii57793 + {0x99cca883, 0xff04}, // dollarmonospace + {0x99e63f81, 0x0962}, // lvocalicvowelsigndeva + {0x9a069ea3, 0x2267}, // greateroverequal + {0x9a098276, 0xfea2}, // hahfinalarabic + {0x9a157ece, 0x246a}, // elevencircle + {0x9a1c929d, 0x043c}, // afii10078 + {0x9a310f17, 0xff51}, // qmonospace + {0x9a3391f5, 0x0190}, // Eopen + {0x9a464a33, 0x0174}, // Wcircumflex + {0x9a50ec2e, 0x05b6}, // segolquarterhebrew + {0x9a7aab21, 0x05c3}, // sofpasuqhebrew + {0x9ac6c137, 0x0e0f}, // topatakthai + {0x9ae2a69d, 0xf6c0}, // ll + {0x9aea680b, 0x3029}, // ninehangzhou + {0x9af6d63b, 0x054a}, // Peharmenian + {0x9b064cf1, 0xfedf}, // lammeemjeeminitialarabic + {0x9b09b61d, 0x0a10}, // aigurmukhi + {0x9b0db21d, 0x0402}, // Djecyrillic + {0x9b100042, 0x0e21}, // momathai + {0x9b29e68e, 0x0278}, // philatin + {0x9b3ff954, 0x0e56}, // sixthai + {0x9b5a3eb3, 0x0626}, // afii57414 + {0x9b712e01, 0x1eba}, // Ehookabove + {0x9b73811a, 0x2227}, // logicaland + {0x9b76648b, 0x041f}, // afii10033 + {0x9b7712b3, 0x1e5a}, // Rdotbelow + {0x9b8591a5, 0x30ca}, // nakatakana + {0x9b950b60, 0x095e}, // fadeva + {0x9ba02025, 0x01e9}, // kcaron + {0x9bca0720, 0x1e93}, // zdotbelow + {0x9bcccde6, 0x0e4e}, // yamakkanthai + {0x9bd59a36, 0x300e}, // whitecornerbracketleft + {0x9bdb98a4, 0x1e5e}, // Rlinebelow + {0x9bdfdedf, 0x05d3}, // daletsheva + {0x9be54046, 0x0e0a}, // chochangthai + {0x9bfe067d, 0x0405}, // Dzecyrillic + {0x9c14c866, 0x0484}, // palatalizationcyrilliccmb + {0x9c1ff986, 0x05f1}, // afii57717 + {0x9c30e64e, 0x0121}, // gdot + {0x9c3d076c, 0x002d}, // hyphen + {0x9c5df589, 0x03b2}, // beta + {0x9c5e488c, 0x05d3}, // dalethebrew + {0x9c743ddb, 0x3239}, // ideographicrepresentparen + {0x9cc9b890, 0x2a00}, // circledottext + {0x9cd2074a, 0x0a36}, // shagurmukhi + {0x9ce0dacf, 0xfebb}, // sadinitialarabic + {0x9ce3d2fe, 0x06d2}, // afii57519 + {0x9ce9cdfc, 0x0408}, // Jecyrillic + {0x9ce9f027, 0x0426}, // Tsecyrillic + {0x9cf54095, 0x20aa}, // newsheqelsign + {0x9d1b1141, 0x25d8}, // invbullet + {0x9d1ed2c0, 0x0120}, // Gdotaccent + {0x9d25f804, 0x0294}, // glottalstop + {0x9d3a5187, 0x03bb}, // lambda + {0x9d4507ca, 0x00a0}, // nonbreakingspace + {0x9d4ea24d, 0x045a}, // njecyrillic + {0x9d5ba323, 0x3145}, // sioskorean + {0x9d5eb9a4, 0x001f}, // controlUS + {0x9d662219, 0x332a}, // haitusquare + {0x9d760ad7, 0x3318}, // guramusquare + {0x9d770652, 0x1e2b}, // hbrevebelow + {0x9db9ebc8, 0x30ba}, // zukatakana + {0x9dee7277, 0x2015}, // afii00208 + {0x9df531bb, 0x059b}, // tevirhebrew + {0x9e021469, 0x22cf}, // curlyand + {0x9e062707, 0x02a2}, // glottalstopstrokereversed + {0x9e0bf218, 0x02b1}, // hhooksuperior + {0x9e0d1458, 0x02c4}, // arrowheadupmod + {0x9e1247f8, 0x0033}, // three + {0x9e248728, 0x3053}, // kohiragana + {0x9e2d5a68, 0x053f}, // Kenarmenian + {0x9e37413a, 0x22c2}, // intersectiondisplay + {0x9e4de0cc, 0x221a}, // radicalBigg + {0x9e5de325, 0x222e}, // contourintegral + {0x9e65e800, 0x248b}, // fourperiod + {0x9e98d52c, 0x2483}, // sixteenparen + {0x9ea14168, 0x05b7}, // patahquarterhebrew + {0x9ea23fe1, 0x00f1}, // ntilde + {0x9eac193b, 0x00ef}, // idieresis + {0x9eb5aea3, 0x3142}, // pieupkorean + {0x9ebea1a0, 0x3150}, // aekorean + {0x9ee7bbd1, 0x094b}, // ovowelsigndeva + {0x9eeac84b, 0xfee7}, // noonhehinitialarabic + {0x9eedaba9, 0x0113}, // emacron + {0x9ef0c911, 0xf765}, // Esmall + {0x9f023815, 0x20ac}, // euro + {0x9f30fc87, 0xfec2}, // tahfinalarabic + {0x9f37894c, 0x040e}, // afii10062 + {0x9f53036c, 0x0a19}, // ngagurmukhi + {0x9f65cf71, 0x1e25}, // hdotbelow + {0x9f69147e, 0x1e61}, // sdotaccent + {0x9f6f9105, 0x0433}, // gecyrillic + {0x9f739695, 0x04f9}, // yerudieresiscyrillic + {0x9f79f6eb, 0xfb33}, // daletdageshhebrew + {0x9f7f5e1f, 0xf897}, // thanthakhatlowrightthai + {0x9f8cff14, 0x003e}, // greater + {0x9f94b2e4, 0x04a1}, // kabashkircyrillic + {0x9fa5f7ad, 0x0e49}, // maithothai + {0x9fa872ec, 0x02dc}, // tildewidest + {0x9fc7ffac, 0x05b4}, // hiriqhebrew + {0x9fd406b1, 0xfed8}, // qafmedialarabic + {0x9fd7c50e, 0x05bb}, // afii57796 + {0x9fdfc7a1, 0x00b0}, // degree + {0x9ffeaad9, 0x01ed}, // oogonekmacron + {0xa0144bc6, 0xfc8d}, // noonnoonfinalarabic + {0xa0166e3d, 0x3159}, // waekorean + {0xa016fb2d, 0x016b}, // umacron + {0xa0286aa8, 0x1e04}, // Bdotbelow + {0xa03db58b, 0x02d2}, // ringhalfrightcentered + {0xa05ccf71, 0x05e1}, // samekhhebrew + {0xa069fd2d, 0x012b}, // imacron + {0xa08ca5a7, 0x2491}, // tenperiod + {0xa09c7d02, 0x05e8}, // reshhatafpatahhebrew + {0xa0a317f9, 0x0574}, // menarmenian + {0xa0adde45, 0xf884}, // maihanakatleftthai + {0xa0c2ffe3, 0x247a}, // sevenparen + {0xa0e40fac, 0x337b}, // heiseierasquare + {0xa0e487b8, 0x33cd}, // KKsquare + {0xa0ee672b, 0x3143}, // ssangpieupkorean + {0xa100bc11, 0x043e}, // ocyrillic + {0xa10462a8, 0x0394}, // Deltagreek + {0xa11f6f39, 0x0071}, // q + {0xa12507ea, 0x2177}, // eightroman + {0xa12d2230, 0x05b5}, // tsere2b + {0xa134a191, 0xff11}, // onemonospace + {0xa14f5367, 0x05b0}, // sheva15 + {0xa14fd78e, 0x2193}, // arrowbt + {0xa157c7c6, 0x0643}, // kafarabic + {0xa15811a3, 0x061f}, // questionarabic + {0xa1697005, 0x0015}, // controlNAK + {0xa16fa8a4, 0x22a3}, // tackleft + {0xa1703e0a, 0x3219}, // thieuthaparenkorean + {0xa1850262, 0x05c2}, // afii57803 + {0xa1a14a63, 0x1eb8}, // Edotbelow + {0xa1ed89db, 0x0202}, // Ainvertedbreve + {0xa20cadbf, 0x0062}, // b + {0xa20ea9da, 0x24aa}, // oparen + {0xa212ed2d, 0x0e38}, // sarauthai + {0xa23bb3ad, 0x222b}, // integraltext + {0xa2448aa1, 0x01e6}, // Gcaron + {0xa2543878, 0x326f}, // nieunacirclekorean + {0xa254ebdd, 0xfb3e}, // memdagesh + {0xa259bfe7, 0xff19}, // ninemonospace + {0xa262edc1, 0xfe49}, // overlinedashed + {0xa26bc10f, 0x061b}, // semicolonarabic + {0xa27876ee, 0xfe35}, // parenleftvertical + {0xa28a5f58, 0xfec8}, // zahmedialarabic + {0xa28ba8ac, 0x317d}, // siospieupkorean + {0xa2972ad9, 0x2305}, // projective + {0xa2be0dd9, 0x062b}, // afii57419 + {0xa2c2120e, 0x0e52}, // twothai + {0xa2d967e3, 0x2083}, // threeinferior + {0xa2e1fb7a, 0x221e}, // infinity + {0xa2f62d95, 0x306e}, // nohiragana + {0xa3004c6f, 0x092e}, // madeva + {0xa316ccc6, 0x2044}, // fraction + {0xa32a4538, 0xfb1f}, // afii57705 + {0xa334b2d1, 0x043d}, // afii10079 + {0xa34b5d2f, 0x0e57}, // seventhai + {0xa36dbdee, 0x30db}, // hokatakana + {0xa386d6fe, 0x3327}, // tonsquare + {0xa3903917, 0x3270}, // tikeutacirclekorean + {0xa39b2570, 0xfefc}, // lamaleffinalarabic + {0xa3b51a89, 0x0597}, // reviamugrashhebrew + {0xa3cc74fa, 0x3056}, // zahiragana + {0xa3d9a90d, 0x0499}, // zedescendercyrillic + {0xa3e95215, 0xfef9}, // lamalefhamzabelowisolatedarabic + {0xa3ec709c, 0x0569}, // toarmenian + {0xa3fbf1d9, 0x0497}, // zhedescendercyrillic + {0xa3fe88d1, 0x0104}, // Aogonek + {0xa40369ed, 0x32a9}, // ideographicmedicinecircle + {0xa4259ac9, 0xff76}, // kakatakanahalfwidth + {0xa43a91b7, 0x005b}, // bracketleftbig + {0xa43cdc2e, 0xfb44}, // pedageshhebrew + {0xa446d45f, 0x3224}, // fiveideographicparen + {0xa450f946, 0x0454}, // afii10101 + {0xa456f11e, 0x09e8}, // twobengali + {0xa457c062, 0x30ad}, // kikatakana + {0xa45b3183, 0x0aeb}, // fivegujarati + {0xa45b7f21, 0x010e}, // Dcaron + {0xa4627c0f, 0x0204}, // Edblgrave + {0xa478f921, 0x09e0}, // rrvocalicbengali + {0xa4863185, 0x30f4}, // vukatakana + {0xa4922e7c, 0x0341}, // acutetonecmb + {0xa4aa1092, 0x05b1}, // hatafsegol30 + {0xa4aa8935, 0xff58}, // xmonospace + {0xa4af8f73, 0x2282}, // subset + {0xa4decb10, 0x0a72}, // irigurmukhi + {0xa4ebd5d8, 0x05e7}, // qofhiriqhebrew + {0xa50a3a99, 0x0630}, // afii57424 + {0xa50cf621, 0xff7e}, // sekatakanahalfwidth + {0xa512e58d, 0xff83}, // tekatakanahalfwidth + {0xa517b724, 0xfee6}, // noonfinalarabic + {0xa52168e0, 0x2325}, // option + {0xa54253fb, 0x05e7}, // qof + {0xa545c2a6, 0xfb2a}, // afii57694 + {0xa553cf3e, 0x003b}, // semicolon + {0xa56dfce7, 0x0e03}, // khokhuatthai + {0xa58382dd, 0x0137}, // kcedilla + {0xa5b93826, 0x2555}, // SF220000 + {0xa5ecbdaa, 0x03b5}, // epsilon + {0xa6056425, 0x05b8}, // qamatswidehebrew + {0xa60745ee, 0x2250}, // approaches + {0xa6281f81, 0x0142}, // lslash + {0xa62afc92, 0x0534}, // Daarmenian + {0xa63a8cce, 0xf7f4}, // Ocircumflexsmall + {0xa6454b66, 0x2498}, // seventeenperiod + {0xa64723d6, 0x30af}, // kukatakana + {0xa6522894, 0x24da}, // kcircle + {0xa652cff2, 0x24a8}, // mparen + {0xa65ca284, 0x314d}, // phieuphkorean + {0xa65ea7b9, 0x00ab}, // guillemotleft + {0xa6644796, 0xfc94}, // yehnoonfinalarabic + {0xa66b3ab3, 0x00b8}, // cedilla + {0xa675e0d6, 0x0156}, // Rcommaaccent + {0xa683217b, 0x0ab7}, // ssagujarati + {0xa6a017fd, 0x0415}, // Iecyrillic + {0xa6ae34a8, 0x3028}, // eighthangzhou + {0xa6b19efc, 0x0591}, // etnahtafoukhhebrew + {0xa6b46028, 0xff72}, // ikatakanahalfwidth + {0xa6bd2b95, 0x1e6b}, // tdotaccent + {0xa6c10839, 0x0431}, // becyrillic + {0xa6e68e9f, 0x0966}, // zerodeva + {0xa6f16c03, 0x03c2}, // sigma1 + {0xa6f2df0d, 0x0a32}, // lagurmukhi + {0xa6f3cb6a, 0x21d3}, // arrowdblbt + {0xa716a470, 0x2464}, // fivecircle + {0xa71dfe13, 0x1ea2}, // Ahookabove + {0xa73026ce, 0x007a}, // z + {0xa73199c0, 0x05bb}, // qubutshebrew + {0xa731e944, 0x0411}, // afii10018 + {0xa7320cb3, 0x3139}, // rieulkorean + {0xa74014fc, 0x003f}, // question + {0xa745be27, 0x2308}, // ceilingleftbig + {0xa74cd67a, 0x025f}, // jdotlessstroke + {0xa756caf5, 0x04d2}, // Adieresiscyrillic + {0xa7769b7a, 0x22c1}, // logicalortext + {0xa7895d88, 0x252c}, // SF060000 + {0xa796d5bb, 0x0267}, // henghook + {0xa7bff3d5, 0x032c}, // caronbelowcmb + {0xa7dcd836, 0xfb68}, // ttehinitialarabic + {0xa7e01c26, 0x01a7}, // Tonetwo + {0xa7e7d702, 0x05b8}, // qamats1a + {0xa7edca33, 0x25b7}, // whiterightpointingtriangle + {0xa7fb6ee6, 0x226f}, // notgreater + {0xa7fe97d8, 0x3166}, // nieuntikeutkorean + {0xa815fa8a, 0x309e}, // voicediterationhiragana + {0xa819fe3e, 0x315e}, // wekorean + {0xa81ee743, 0x0542}, // Ghadarmenian + {0xa826b713, 0xfeb6}, // sheenfinalarabic + {0xa842618b, 0x025b}, // eopen + {0xa84fdde5, 0x0340}, // gravetonecmb + {0xa851c76f, 0x05a5}, // merkhahebrew + {0xa8547bdd, 0x0455}, // afii10102 + {0xa8665e8d, 0x05b1}, // afii57801 + {0xa877e561, 0x2642}, // male + {0xa87899cd, 0xf6e6}, // hyphensuperior + {0xa8982f3b, 0x09b2}, // labengali + {0xa8a24959, 0x00d0}, // Eth + {0xa8b6c7f5, 0x0a2e}, // magurmukhi + {0xa8b7f35e, 0x06c1}, // haaltonearabic + {0xa8bb13d5, 0x0a70}, // tippigurmukhi + {0xa8ccc65c, 0x3316}, // kiromeetorusquare + {0xa8db2b93, 0x017e}, // zcaron + {0xa93204a5, 0x03a6}, // Phi + {0xa9350b3f, 0x20a1}, // colonmonetary + {0xa93a2a4f, 0x1e47}, // ndotbelow + {0xa94e0303, 0x33ab}, // mpasquare + {0xa94eeaee, 0x01aa}, // eshreversedloop + {0xa95e2711, 0x1e21}, // gmacron + {0xa96cef91, 0x3169}, // rieulkiyeoksioskorean + {0xa981562d, 0x0668}, // eightarabic + {0xa98e771c, 0x0634}, // sheenarabic + {0xa9985803, 0x30dc}, // bokatakana + {0xa99c94c2, 0x01be}, // glottalinvertedstroke + {0xa9a0932f, 0x2077}, // sevensuperior + {0xa9af18f2, 0x30b4}, // gokatakana + {0xa9c0b182, 0x2264}, // lessequal + {0xa9dc390a, 0x05da}, // finalkafqamatshebrew + {0xa9e88297, 0x2053}, // a58 + {0xaa13efde, 0x007d}, // braceright + {0xaa245bb8, 0x0028}, // parenleftBig + {0xaa4e278b, 0x0967}, // onedeva + {0xaa51d75f, 0x2476}, // threeparen + {0xaa69d0f1, 0x256c}, // SF440000 + {0xaa863ce3, 0x0629}, // tehmarbutaarabic + {0xaa8c5eeb, 0x03e5}, // feicoptic + {0xaa96b9dc, 0x0665}, // fivearabic + {0xaaabcf5c, 0x04b9}, // cheverticalstrokecyrillic + {0xaab6b9a5, 0x0211}, // rdblgrave + {0xaabfed05, 0xff85}, // nakatakanahalfwidth + {0xaac3a76a, 0x0559}, // ringhalfleftarmenian + {0xaac3adf0, 0x3121}, // oubopomofo + {0xaacaffc4, 0x2162}, // Threeroman + {0xaad54f7c, 0x3002}, // ideographicperiod + {0xaaf6eb21, 0x01ce}, // acaron + {0xab0b499a, 0x099c}, // jabengali + {0xab126f69, 0x5344}, // twentyhangzhou + {0xab1f1bb7, 0x05df}, // afii57679 + {0xab24577f, 0x0667}, // sevenarabic + {0xab2b4200, 0x2105}, // careof + {0xab3b4b27, 0x24e2}, // scircle + {0xab52e61f, 0x05d3}, // dalethatafpatah + {0xab808d1e, 0x2087}, // seveninferior + {0xab8a6656, 0x01d0}, // icaron + {0xaba55a59, 0xfb32}, // gimeldageshhebrew + {0xabb7eb8f, 0x2081}, // oneinferior + {0xabd373e8, 0x055e}, // questionarmenian + {0xac05d874, 0x1e84}, // Wdieresis + {0xac259f58, 0x0448}, // afii10090 + {0xac2c323e, 0x0191}, // Fhook + {0xac32a034, 0x316f}, // mieumsioskorean + {0xac483cb3, 0x338c}, // mufsquare + {0xac4f1094, 0x059c}, // gereshaccenthebrew + {0xac50a082, 0x33a3}, // mmcubedsquare + {0xac5faca7, 0x230b}, // floorrightbig + {0xac67aca2, 0x045b}, // tshecyrillic + {0xacac7818, 0x219d}, // a59 + {0xacb92bab, 0x0691}, // rreharabic + {0xacd00f05, 0x21c6}, // arrowleftoverright + {0xacd11e18, 0x2010}, // hyphentwo + {0xace7d07a, 0x0921}, // ddadeva + {0xacfcbdb9, 0x3042}, // ahiragana + {0xad01f787, 0xff1d}, // equalmonospace + {0xad1b58f9, 0x0595}, // zaqefgadolhebrew + {0xad29738f, 0x05f4}, // gershayimhebrew + {0xad33f4b3, 0x04c1}, // Zhebrevecyrillic + {0xad37f8e0, 0x0a24}, // tagurmukhi + {0xad38bc31, 0x2194}, // arrowboth + {0xad45a65c, 0xf6cc}, // DieresisAcute + {0xad5fe438, 0x0924}, // tadeva + {0xad781e89, 0x200c}, // afii61664 + {0xad8ff38a, 0x0a21}, // ddagurmukhi + {0xadb1b19e, 0x0206}, // Einvertedbreve + {0xadb53f6b, 0xfbaf}, // yehbarreefinalarabic + {0xadbea3e4, 0x20aa}, // afii57636 + {0xadc3ff5e, 0x0649}, // afii57449 + {0xadf402a9, 0x0989}, // ubengali + {0xadf4d422, 0x0625}, // alefhamzabelowarabic + {0xae04e5ad, 0x0a15}, // kagurmukhi + {0xae06976c, 0xf6d5}, // cyrflex + {0xae1f7b0a, 0x2076}, // sixsuperior + {0xae23dd7b, 0x1eaf}, // abreveacute + {0xae30147f, 0x0908}, // iideva + {0xae346d0d, 0x05e8}, // reshsheva + {0xae56317c, 0x24ae}, // sparen + {0xae6f7e74, 0x031b}, // horncmb + {0xae7c975f, 0x249a}, // nineteenperiod + {0xae8f4e4c, 0x0406}, // afii10055 + {0xaeac4f55, 0xf7e9}, // Eacutesmall + {0xaeb06274, 0x0423}, // Ucyrillic + {0xaec173e8, 0x03b8}, // theta + {0xaee16fb6, 0xfe4f}, // underscorewavy + {0xaef4b475, 0x1edf}, // ohornhookabove + {0xaef8393d, 0x0664}, // fourarabic + {0xaf01f370, 0x278e}, // fivecircleinversesansserif + {0xaf0ebb84, 0xf6d6}, // dblgrave + {0xaf2073fd, 0x2103}, // centigrade + {0xaf3552ce, 0x3072}, // hihiragana + {0xaf36c6b1, 0x30cd}, // nekatakana + {0xaf499180, 0x2309}, // ceilingrightBig + {0xaf4df0df, 0xfc0e}, // tehmeemisolatedarabic + {0xaf5710c9, 0x00c0}, // Agrave + {0xaf5b123d, 0x032d}, // circumflexbelowcmb + {0xaf5ce08f, 0x00e0}, // agrave + {0xaf788850, 0x00fc}, // udieresis + {0xaf7abcb1, 0x05b9}, // holam + {0xaf8a8524, 0x0455}, // dzecyrillic + {0xafa14924, 0x33d3}, // lxsquare + {0xafaa365c, 0x30be}, // zokatakana + {0xafb28009, 0x03e2}, // Sheicoptic + {0xafb8e89a, 0x0a68}, // twogurmukhi + {0xafbbfcac, 0xff71}, // akatakanahalfwidth + {0xafbd0738, 0x305d}, // sohiragana + {0xafc9b657, 0x0e17}, // thothahanthai + {0xaff892ca, 0x05d3}, // dalettserehebrew + {0xb000150a, 0xfe96}, // tehfinalarabic + {0xb01f8020, 0x0666}, // sixarabic + {0xb026a3ef, 0x30b3}, // kokatakana + {0xb0309f24, 0xfee3}, // meeminitialarabic + {0xb032be97, 0x047b}, // omegaroundcyrillic + {0xb033a837, 0x0079}, // y + {0xb03640f2, 0x2252}, // approxequalorimage + {0xb0522c01, 0x278f}, // sixcircleinversesansserif + {0xb0791aaf, 0x09f3}, // rupeesignbengali + {0xb0a20aff, 0x22db}, // greaterequalorless + {0xb0c33454, 0x028a}, // upsilonlatin + {0xb0efaba6, 0x0a97}, // gagujarati + {0xb107bdf6, 0x304b}, // kahiragana + {0xb1240d86, 0x0474}, // afii10148 + {0xb145d406, 0x327b}, // hieuhacirclekorean + {0xb169c9ac, 0x1eed}, // uhornhookabove + {0xb1722e49, 0x3006}, // ideographicclose + {0xb199f9f3, 0x314a}, // chieuchkorean + {0xb1a83745, 0x246e}, // fifteencircle + {0xb1a9eaa4, 0x1eb7}, // abrevedotbelow + {0xb1b08c26, 0x2020}, // dagger + {0xb1b2e578, 0xff13}, // threemonospace + {0xb1c3eac2, 0x1e8c}, // Xdieresis + {0xb1e18633, 0x0e2d}, // oangthai + {0xb1eda93c, 0x09e2}, // lvocalicvowelsignbengali + {0xb1fa6226, 0x0a9a}, // cagujarati + {0xb225a8bc, 0x0947}, // evowelsigndeva + {0xb243894e, 0x21d1}, // arrowdblup + {0xb25639c1, 0x2534}, // SF070000 + {0xb2566e08, 0x064d}, // afii57453 + {0xb256786e, 0x03f2}, // sigmalunatesymbolgreek + {0xb25b34dc, 0x0e1a}, // bobaimaithai + {0xb26943db, 0x0420}, // afii10034 + {0xb27e91f4, 0x01bb}, // twostroke + {0xb290d64a, 0xfe88}, // alefhamzabelowfinalarabic + {0xb2bbd0d4, 0xfeb0}, // zainfinalarabic + {0xb2cc02c2, 0x1e38}, // Ldotbelowmacron + {0xb2d79f3e, 0x00f9}, // ugrave + {0xb2d7f27b, 0x0652}, // afii57458 + {0xb2d95c63, 0x2518}, // SF040000 + {0xb2f3aff0, 0x0946}, // eshortvowelsigndeva + {0xb311c284, 0x05e7}, // qoftsere + {0xb3178333, 0x00da}, // Uacute + {0xb321fe9c, 0x21e3}, // arrowdashdown + {0xb327a481, 0x2290}, // a61 + {0xb32daf91, 0xf6c6}, // afii10192 + {0xb32e268f, 0xf6fe}, // Tildesmall + {0xb3329e90, 0x313e}, // rieulthieuthkorean + {0xb33c41bc, 0x018c}, // dtopbar + {0xb340e2fe, 0x04a5}, // enghecyrillic + {0xb341da2f, 0x1e36}, // Ldotbelow + {0xb345c512, 0xfea4}, // hahmedialarabic + {0xb369c9bd, 0x2423}, // blank + {0xb36f3f4e, 0x054d}, // Seharmenian + {0xb3880287, 0x05d6}, // zayinhebrew + {0xb38b59bc, 0x0ac0}, // iivowelsigngujarati + {0xb3a3592e, 0x21e5}, // arrowtabright + {0xb3dbcf55, 0x323d}, // ideographicenterpriseparen + {0xb3e6b497, 0x03c9}, // omega + {0xb3ed41be, 0x328f}, // ideographearthcircle + {0xb40169ac, 0x05b0}, // sheva22 + {0xb405e3e3, 0x0439}, // afii10075 + {0xb40aff3d, 0xf730}, // zerooldstyle + {0xb41baecc, 0x2487}, // twentyparen + {0xb427632e, 0x05b3}, // hatafqamats1b + {0xb4344c30, 0x090f}, // edeva + {0xb43bb55a, 0x3263}, // rieulcirclekorean + {0xb448d464, 0x0391}, // Alpha + {0xb45a5763, 0x201b}, // quoteleftreversed + {0xb45ef9b7, 0x03c0}, // pi + {0xb47a6410, 0x230a}, // floorleftBigg + {0xb497903a, 0x01dd}, // eturned + {0xb4a55071, 0x1e7d}, // vtilde + {0xb4a6b289, 0x2235}, // because + {0xb4a7f99d, 0x0954}, // acutedeva + {0xb4a9d27d, 0x05d2}, // afii57666 + {0xb4c0dc86, 0x0e48}, // maiekthai + {0xb4c2484c, 0x05dc}, // lamed + {0xb4c667bc, 0xff61}, // periodhalfwidth + {0xb4c72b2a, 0x0215}, // udblgrave + {0xb4e21f31, 0x2198}, // arrowdownright + {0xb4fef2ed, 0x05d3}, // dalettsere + {0xb500deca, 0x1e41}, // mdotaccent + {0xb510d684, 0x1e80}, // Wgrave + {0xb526b685, 0x22bf}, // righttriangle + {0xb52e7c1d, 0x091e}, // nyadeva + {0xb53ca7e2, 0x326c}, // phieuphcirclekorean + {0xb5866d85, 0x005c}, // backslashbig + {0xb58e59d7, 0x24ad}, // rparen + {0xb5af274f, 0x064a}, // afii57450 + {0xb5b94593, 0x010d}, // ccaron + {0xb5c458a3, 0x05b8}, // qamatsqatanwidehebrew + {0xb5f24e31, 0xff5a}, // zmonospace + {0xb600bed1, 0x3024}, // fourhangzhou + {0xb6052cdb, 0x010b}, // cdotaccent + {0xb61c54b4, 0x24e4}, // ucircle + {0xb64312f2, 0x00a2}, // cent + {0xb6443d26, 0x0622}, // afii57410 + {0xb647ed9e, 0x01d7}, // Udieresisacute + {0xb652184e, 0x0e4b}, // maichattawathai + {0xb6588f1c, 0x247c}, // nineparen + {0xb66bf9b9, 0x33dc}, // svsquare + {0xb673fbb5, 0x038e}, // Upsilontonos + {0xb67e35c8, 0x0121}, // gdotaccent + {0xb6951f83, 0x2210}, // coproductdisplay + {0xb6bb2a6b, 0x0116}, // Edot + {0xb6d45c54, 0xff7a}, // kokatakanahalfwidth + {0xb6f322b3, 0x05e5}, // afii57685 + {0xb6f9554e, 0x3205}, // pieupparenkorean + {0xb6f9c67c, 0x0464}, // Eiotifiedcyrillic + {0xb6fea9e7, 0xff3f}, // underscoremonospace + {0xb70f3f60, 0xff4e}, // nmonospace + {0xb711b601, 0x039d}, // Nu + {0xb7124c93, 0xf770}, // Psmall + {0xb719922a, 0x067e}, // afii57506 + {0xb71d84e2, 0x3167}, // nieunsioskorean + {0xb726c42e, 0xfb49}, // shindageshhebrew + {0xb72e5846, 0x1edb}, // ohornacute + {0xb73606f5, 0x0463}, // afii10194 + {0xb7400632, 0x33aa}, // kpasquare + {0xb747ebc8, 0x2310}, // revlogicalnot + {0xb755a24e, 0x310e}, // kbopomofo + {0xb7934eea, 0x01c5}, // Dzcaron + {0xb7affc1f, 0x0418}, // afii10026 + {0xb7b78fdd, 0x2463}, // fourcircle + {0xb7bd89d3, 0x0491}, // gheupturncyrillic + {0xb7d20c6c, 0x215c}, // threeeighths + {0xb7e9bb2b, 0x30fe}, // voicediterationkatakana + {0xb80991a9, 0x04d6}, // Iebrevecyrillic + {0xb81d8e8c, 0xfb31}, // betdagesh + {0xb855cda8, 0x3397}, // dlsquare + {0xb85a6427, 0x0650}, // kasraarabic + {0xb8632720, 0x0e07}, // ngonguthai + {0xb879d78f, 0xfe32}, // endashvertical + {0xb894f4d6, 0x01a0}, // Ohorn + {0xb8972176, 0x04bb}, // shhacyrillic + {0xb89948ac, 0x0a93}, // ogujarati + {0xb8be7e03, 0x2039}, // guilsinglleft + {0xb8fa96e6, 0x0110}, // Dslash + {0xb8ff412c, 0xfef8}, // lamalefhamzaabovefinalarabic + {0xb902d285, 0x053a}, // Zhearmenian + {0xb90dcf8c, 0xff6a}, // esmallkatakanahalfwidth + {0xb910864a, 0x2032}, // minute + {0xb921c241, 0xfeca}, // ainfinalarabic + {0xb92ccc5d, 0x2469}, // tencircle + {0xb9305b2b, 0x3174}, // pieupsioskiyeokkorean + {0xb96268cb, 0x00de}, // Thorn + {0xb9808b18, 0x09c1}, // uvowelsignbengali + {0xb9927e88, 0x3382}, // muasquare + {0xb99f8f9e, 0xfeeb}, // hehinitialarabic + {0xb9b2e314, 0x0498}, // Zedescendercyrillic + {0xb9b4563d, 0x24b3}, // xparen + {0xb9c5eece, 0x05bc}, // dageshhebrew + {0xb9d8b5d9, 0xfba4}, // hehhamzaaboveisolatedarabic + {0xb9dbedd2, 0x317b}, // siosnieunkorean + {0xb9e5ea71, 0x314c}, // thieuthkorean + {0xb9e8b13e, 0x25a0}, // filledbox + {0xb9ebf396, 0xf764}, // Dsmall + {0xb9f42560, 0x0964}, // danda + {0xb9f5b462, 0x0990}, // aibengali + {0xba1bcecd, 0x0176}, // Ycircumflex + {0xba1f80d6, 0x21e1}, // arrowdashup + {0xba21ad27, 0xfb3a}, // finalkafdagesh + {0xba3aaf1e, 0x27e9}, // angbracketrightBig + {0xba4eb5f9, 0x0055}, // U + {0xba544632, 0x05db}, // afii57675 + {0xba5871eb, 0x033e}, // tildeverticalcmb + {0xba60a3b8, 0x0902}, // anusvaradeva + {0xba7e1049, 0x01d9}, // Udieresiscaron + {0xba8d69d2, 0x232a}, // angleright + {0xbaa24d97, 0x05e0}, // afii57680 + {0xbaa7aa4c, 0xfedc}, // kafmedialarabic + {0xbab8d5ec, 0xf771}, // Qsmall + {0xbabbf0c0, 0x05e8}, // reshhiriqhebrew + {0xbac7de75, 0x1ed3}, // ocircumflexgrave + {0xbad44ddc, 0x004f}, // O + {0xbad7d685, 0x04b8}, // Cheverticalstrokecyrillic + {0xbad97612, 0x03af}, // iotatonos + {0xbadf80e2, 0x06f5}, // fivepersian + {0xbae37657, 0x0621}, // hamzalowkasratanarabic + {0xbafeb301, 0x0422}, // Tecyrillic + {0xbb28e2ea, 0x1eb2}, // Abrevehookabove + {0xbb30f37e, 0x0218}, // Scommaaccent + {0xbb6353b2, 0x0332}, // lowlinecmb + {0xbb66e953, 0x22c8}, // a49 + {0xbb72d76e, 0x0139}, // Lacute + {0xbb89235d, 0xf6e0}, // centsuperior + {0xbb906e01, 0x3266}, // sioscirclekorean + {0xbb970588, 0x266f}, // musicsharpsign + {0xbba252f7, 0x0106}, // Cacute + {0xbba2c6f4, 0x27e9}, // angbracketrightbigg + {0xbbae7b40, 0x3172}, // pieupkiyeokkorean + {0xbbb9d0f4, 0x0934}, // llladeva + {0xbbd8677b, 0x330d}, // karoriisquare + {0xbbdbcb55, 0x0a6f}, // ninegurmukhi + {0xbbdc86be, 0xfb2b}, // shinsindot + {0xbc041d93, 0x05da}, // finalkafqamats + {0xbc0d2781, 0x0a1f}, // ttagurmukhi + {0xbc1b1166, 0x2558}, // SF500000 + {0xbc280da2, 0x1e79}, // utildeacute + {0xbc3510eb, 0x317f}, // pansioskorean + {0xbc45cf9a, 0x02a4}, // dezh + {0xbc75336c, 0x21a9}, // arrowhookright + {0xbc78e14f, 0x24b0}, // uparen + {0xbcd2c61b, 0x064c}, // dammatanarabic + {0xbcf16b16, 0x0621}, // hamzadammatanarabic + {0xbd0f6f71, 0x004c}, // L + {0xbd1a9441, 0x3235}, // ideographicspecialparen + {0xbd1abdb6, 0x0184}, // Tonesix + {0xbd2d2e5f, 0x054e}, // Vewarmenian + {0xbd30ce0c, 0x2641}, // earth + {0xbd4d0860, 0x320a}, // khieukhparenkorean + {0xbd54bd2d, 0x3208}, // cieucparenkorean + {0xbd569183, 0x0182}, // Btopbar + {0xbd5dbcc1, 0x0151}, // odblacute + {0xbd5ee257, 0x01b7}, // Ezh + {0xbd85b57b, 0x21a8}, // arrowupdownbase + {0xbd8f8d24, 0x064b}, // fathatanarabic + {0xbd906fab, 0x041f}, // Pecyrillic + {0xbd98b80f, 0x25c8}, // whitediamondcontainingblacksmalldiamond + {0xbdc1280a, 0x24be}, // Icircle + {0xbdd372da, 0x318b}, // yuyekorean + {0xbde8281d, 0x3276}, // cieucacirclekorean + {0xbe1bc796, 0xfb7c}, // tchehmeeminitialarabic + {0xbe3e45cf, 0xfb58}, // pehinitialarabic + {0xbe663ca6, 0x2470}, // seventeencircle + {0xbe7a58ae, 0x3203}, // rieulparenkorean + {0xbea937fd, 0x25bc}, // blackdownpointingtriangle + {0xbec6916e, 0x011c}, // Gcircumflex + {0xbedd6640, 0x00d9}, // Ugrave + {0xbee1ad99, 0xed79}, // vextenddouble + {0xbf12496a, 0x0985}, // abengali + {0xbf156070, 0x04e2}, // Imacroncyrillic + {0xbf26dc61, 0x041d}, // Encyrillic + {0xbf2dca30, 0x3082}, // mohiragana + {0xbf3cff90, 0x0425}, // afii10039 + {0xbf5cef43, 0x01ee}, // Ezhcaron + {0xbf673175, 0x01fd}, // aeacute + {0xbf87a284, 0x00bf}, // questiondown + {0xbf897387, 0x2273}, // greaterorequivalent + {0xbf8f3598, 0x25a6}, // squareorthogonalcrosshatchfill + {0xbf934ed3, 0x04e0}, // Dzeabkhasiancyrillic + {0xbf97194e, 0x010a}, // Cdot + {0xbf9bc7bd, 0xfb59}, // pehmedialarabic + {0xbf9c1926, 0x0627}, // alefarabic + {0xbfc69ab7, 0xff18}, // eightmonospace + {0xbfd3ede4, 0x0396}, // Zeta + {0xbfe44580, 0x05d3}, // dalethiriq + {0xbffa52a3, 0x33c7}, // cosquare + {0xc006a810, 0x062a}, // teharabic + {0xc008508a, 0xff1c}, // lessmonospace + {0xc00a3b07, 0x24bc}, // Gcircle + {0xc0126352, 0x0661}, // onearabic + {0xc03e102c, 0x3012}, // postalmark + {0xc059a094, 0x0626}, // yehhamzaabovearabic + {0xc0668ba8, 0x202e}, // afii61575 + {0xc07e7e42, 0x24a6}, // kparen + {0xc084bd84, 0x1e29}, // hcedilla + {0xc092fb91, 0x1e95}, // zlinebelow + {0xc09823db, 0x016f}, // uring + {0xc09889a1, 0x1e11}, // dcedilla + {0xc09e394d, 0x2211}, // summationtext + {0xc0a2bc69, 0x2564}, // SF470000 + {0xc0a93f4f, 0x0e2c}, // lochulathai + {0xc0bd9f90, 0x094a}, // oshortvowelsigndeva + {0xc0c043bd, 0x3008}, // anglebracketleft + {0xc0c1496c, 0x029e}, // kturned + {0xc0cbe66a, 0x33b7}, // mvsquare + {0xc0d444a4, 0x3220}, // oneideographicparen + {0xc0dcb90f, 0x062e}, // khaharabic + {0xc0efe98c, 0x2191}, // arrowup + {0xc0f7b81d, 0xf888}, // saraueeleftthai + {0xc0fb3832, 0x25ab}, // H18551 + {0xc131664b, 0x30e4}, // yakatakana + {0xc1425417, 0x317a}, // sioskiyeokkorean + {0xc1641f79, 0xfe4d}, // lowlinedashed + {0xc1835ca2, 0x02d3}, // ringhalfleftcentered + {0xc191ae65, 0x0470}, // Psicyrillic + {0xc1aa3399, 0x2a06}, // unionsqtext + {0xc1c1cd87, 0xff2e}, // Nmonospace + {0xc1d325d6, 0x05d8}, // tet + {0xc1e02cdd, 0x0594}, // zaqefqatanhebrew + {0xc1e3fd2d, 0x05d5}, // vav + {0xc1e4c743, 0x3057}, // sihiragana + {0xc1e7aebd, 0xf779}, // Ysmall + {0xc1ec1451, 0x03c3}, // sigma + {0xc1f9ede7, 0x05a3}, // munahhebrew + {0xc2089a04, 0x05b7}, // patah1d + {0xc21675c5, 0x0317}, // acutebelowcmb + {0xc21e92b6, 0x2265}, // greaterequal + {0xc2352e98, 0x0554}, // Keharmenian + {0xc25217c2, 0xfeff}, // zerowidthjoiner + {0xc25a58a0, 0x0a28}, // nagurmukhi + {0xc25a7d39, 0x2663}, // club + {0xc2658d7c, 0x3395}, // mulsquare + {0xc26d6fce, 0x20a9}, // won + {0xc283f2c3, 0x03bc}, // mugreek + {0xc29c269a, 0x326d}, // hieuhcirclekorean + {0xc2c391b3, 0x25b2}, // triagup + {0xc2d0d165, 0x0137}, // kcommaaccent + {0xc2db7e0f, 0x04a0}, // Kabashkircyrillic + {0xc327f9ff, 0xf8eb}, // parenlefttp + {0xc32ea721, 0x061f}, // afii57407 + {0xc347a5d5, 0x22c1}, // logicalordisplay + {0xc36634d0, 0x09f9}, // sixteencurrencydenominatorbengali + {0xc3722d19, 0x23ad}, // bracerightbt + {0xc3751bae, 0x25ab}, // whitesmallsquare + {0xc375a046, 0x05b0}, // shevahebrew + {0xc391e9a8, 0xfe50}, // commasmall + {0xc3a63833, 0x0621}, // hamzasukunarabic + {0xc3c94bba, 0x306a}, // nahiragana + {0xc3d9dd70, 0xfe43}, // whitecornerbracketleftvertical + {0xc3df4586, 0x0903}, // visargadeva + {0xc3eb9abd, 0x02c6}, // circumflex + {0xc3edb597, 0x24bb}, // Fcircle + {0xc3f1c1ff, 0x00e3}, // atilde + {0xc3f76044, 0xff7c}, // sikatakanahalfwidth + {0xc3f8f5bb, 0x04e3}, // imacroncyrillic + {0xc3fbb2ce, 0x025e}, // eopenreversedclosed + {0xc4004762, 0x328a}, // ideographmooncircle + {0xc4289b41, 0x25a5}, // squareverticalfill + {0xc43e9d0c, 0x1e26}, // Hdieresis + {0xc4494fb1, 0x098b}, // rvocalicbengali + {0xc459127a, 0x2174}, // fiveroman + {0xc460226d, 0xfb34}, // hedagesh + {0xc4607843, 0x25ca}, // lozenge + {0xc4991f6f, 0x03d0}, // betasymbolgreek + {0xc49bedba, 0x1e22}, // Hdotaccent + {0xc4bd396f, 0xff98}, // rikatakanahalfwidth + {0xc4cf0400, 0x0ac3}, // rvocalicvowelsigngujarati + {0xc4d48fb7, 0x0a06}, // aagurmukhi + {0xc510ccfb, 0x0327}, // cedillacmb + {0xc51e03d1, 0x0e2a}, // sosuathai + {0xc5233a99, 0xff41}, // amonospace + {0xc52d9608, 0x0409}, // afii10058 + {0xc541abe3, 0x0409}, // Ljecyrillic + {0xc560e83e, 0x1e4c}, // Otildeacute + {0xc575fbd8, 0x3303}, // aarusquare + {0xc577ce75, 0xff5d}, // bracerightmonospace + {0xc579feb1, 0x03bf}, // omicron + {0xc5904240, 0x1ee9}, // uhornacute + {0xc594a84a, 0x0a85}, // agujarati + {0xc5a57fbd, 0x0178}, // Ydieresis + {0xc5b52809, 0x25ac}, // filledrect + {0xc5c558c0, 0x2593}, // dkshade + {0xc5df0b88, 0x0aae}, // magujarati + {0xc5e2935b, 0x30bf}, // takatakana + {0xc616ce34, 0x1e83}, // wacute + {0xc618c356, 0x005f}, // underscore + {0xc6231f67, 0x3117}, // zbopomofo + {0xc62d494f, 0x042b}, // afii10045 + {0xc65b9029, 0x0012}, // controlDC2 + {0xc65e4473, 0x0300}, // gravecomb + {0xc6649ea6, 0x263b}, // blacksmilingface + {0xc6730a47, 0x3230}, // ideographicsunparen + {0xc6a18663, 0x2173}, // fourroman + {0xc6a33bcf, 0xf8f9}, // bracketrighttp + {0xc6bb9cde, 0x03c1}, // rho + {0xc6c2ca67, 0x0537}, // Eharmenian + {0xc6db1db1, 0x0a94}, // augujarati + {0xc6ddc5a6, 0x0334}, // tildeoverlaycmb + {0xc6e9fa39, 0x064a}, // yeharabic + {0xc6fbfdac, 0x025a}, // schwahook + {0xc6fedf58, 0xf731}, // oneoldstyle + {0xc703d8e7, 0x33b8}, // kvsquare + {0xc7199c26, 0xf763}, // Csmall + {0xc71e49b3, 0xf8fa}, // bracketrightex + {0xc74688aa, 0x24dc}, // mcircle + {0xc74a8cc7, 0x05b5}, // tserequarterhebrew + {0xc74f4c99, 0x0298}, // bilabialclick + {0xc7515b37, 0x0132}, // IJ + {0xc755c80f, 0xff67}, // asmallkatakanahalfwidth + {0xc75bc6a7, 0x01e8}, // Kcaron + {0xc7618f62, 0x05b3}, // hatafqamats28 + {0xc76816e4, 0x0566}, // zaarmenian + {0xc76c439e, 0x0115}, // ebreve + {0xc76ec8b2, 0x0e1c}, // phophungthai + {0xc77c2828, 0x2206}, // Delta + {0xc7855795, 0xf894}, // maichattawalowrightthai + {0xc786ef31, 0x095b}, // zadeva + {0xc78887c7, 0x1e08}, // Ccedillaacute + {0xc78fe323, 0x0698}, // afii57508 + {0xc798936b, 0xfc73}, // tehnoonfinalarabic + {0xc7b3573a, 0x1e2f}, // idieresisacute + {0xc7daee30, 0x09b7}, // ssabengali + {0xc7e20869, 0x0aee}, // eightgujarati + {0xc7ed01af, 0x33a5}, // mcubedsquare + {0xc7f07bcf, 0x248f}, // eightperiod + {0xc7f0b4c8, 0x0406}, // Icyrillic + {0xc7fb5fe5, 0x05b2}, // afii57800 + {0xc808d8ed, 0xf8f5}, // integralex + {0xc812d1b7, 0x041b}, // afii10029 + {0xc82c0a32, 0x026f}, // mturned + {0xc834804d, 0x2475}, // twoparen + {0xc8488aa4, 0x05b0}, // shevawidehebrew + {0xc84db89c, 0x2013}, // endash + {0xc85fce80, 0x0901}, // candrabindudeva + {0xc86d3a57, 0xff31}, // Qmonospace + {0xc875e6fd, 0x040c}, // afii10061 + {0xc88f7d57, 0x05b3}, // hatafqamatsnarrowhebrew + {0xc89d4f1f, 0x0006}, // controlACK + {0xc8ae6fb2, 0x0e26}, // luthai + {0xc8b50d48, 0x21d4}, // dblarrowleft + {0xc8c2c42c, 0x0162}, // Tcedilla + {0xc8c687a4, 0xfb4b}, // vavholamhebrew + {0xc8cf912e, 0xfe59}, // parenleftsmall + {0xc8fcce82, 0x0424}, // Efcyrillic + {0xc8fdfe4b, 0x0914}, // audeva + {0xc9033cb3, 0x05e7}, // qofhatafpatahhebrew + {0xc905dac2, 0xf7e0}, // Agravesmall + {0xc9315b90, 0x0338}, // soliduslongoverlaycmb + {0xc93304ec, 0x2176}, // sevenroman + {0xc9366418, 0x1e7e}, // Vdotbelow + {0xc948d9f2, 0x01fe}, // Oslashacute + {0xc948dd49, 0x0417}, // Zecyrillic + {0xc94ac55a, 0xfb4e}, // perafehebrew + {0xc94ceb7c, 0x1eca}, // Idotbelow + {0xc956ff7e, 0x1e7b}, // umacrondieresis + {0xc997284d, 0x03d3}, // Upsilonacutehooksymbolgreek + {0xc997d626, 0xfe3d}, // dblanglebracketleftvertical + {0xc9d02325, 0x2283}, // propersuperset + {0xc9d7e9b6, 0x064c}, // afii57452 + {0xc9d96803, 0x3278}, // khieukhacirclekorean + {0xc9e8cf5f, 0xfebf}, // dadinitialarabic + {0xc9ea8b89, 0x305b}, // sehiragana + {0xc9eb1227, 0x321c}, // cieucuparenkorean + {0xca07e9ca, 0x02dd}, // hungarumlaut + {0xca0b3331, 0x1e5f}, // rlinebelow + {0xca0f9f38, 0xf887}, // saraueleftthai + {0xca2dd9fa, 0x2590}, // rtblock + {0xca5ed753, 0x0269}, // iotalatin + {0xca65e972, 0x0646}, // noonarabic + {0xcab40374, 0x1e1f}, // fdotaccent + {0xcabe62a6, 0x0e16}, // thothungthai + {0xcac3bcb6, 0x33a8}, // moverssquaredsquare + {0xcac4b1a9, 0x32a8}, // ideographicrightcircle + {0xcad1f345, 0x01bd}, // tonefive + {0xcae44cee, 0x0013}, // controlDC3 + {0xcaf66d1c, 0x33b4}, // pvsquare + {0xcb1a38a0, 0x226b}, // muchgreater + {0xcb1b6c03, 0x0a5e}, // fagurmukhi + {0xcb1e3324, 0x042d}, // afii10047 + {0xcb267db3, 0x3221}, // twoideographicparen + {0xcb281438, 0x33ae}, // radoverssquare + {0xcb2edf2d, 0x220f}, // product + {0xcb4fc444, 0x03f0}, // kappasymbolgreek + {0xcb56efb7, 0x015c}, // Scircumflex + {0xcb5b537a, 0x0412}, // afii10019 + {0xcb669b9c, 0x1ee2}, // Ohorndotbelow + {0xcb72660a, 0xff1e}, // greatermonospace + {0xcb75245d, 0x1e48}, // Nlinebelow + {0xcb88e590, 0x013c}, // lcedilla + {0xcb8bc7f1, 0x002b}, // plus + {0xcbada403, 0x0429}, // Shchacyrillic + {0xcc11d7b0, 0x000c}, // controlFF + {0xcc261604, 0x04a2}, // Endescendercyrillic + {0xcc2b60a5, 0x05e7}, // qofhiriq + {0xcc3139de, 0x33d1}, // squareln + {0xcc334bff, 0xf766}, // Fsmall + {0xcc3accb9, 0x05d8}, // tethebrew + {0xcc3b7b5c, 0x0649}, // alefmaksuraarabic + {0xcc447b1d, 0x0296}, // glottalstopinverted + {0xcc8c13e9, 0x25c0}, // blackleftpointingtriangle + {0xcc993e5c, 0x025c}, // eopenreversed + {0xcca8fd16, 0x09e3}, // llvocalicvowelsignbengali + {0xccaa74e1, 0xfb7d}, // tchehmedialarabic + {0xccac0ec6, 0x300b}, // dblanglebracketright + {0xccc389ea, 0xfb30}, // alefdageshhebrew + {0xccc85a27, 0x0a81}, // candrabindugujarati + {0xcd07b41d, 0x05bc}, // dagesh + {0xcd30953c, 0x203c}, // exclamdbl + {0xcd37d58c, 0x24e3}, // tcircle + {0xcd415c99, 0x0e55}, // fivethai + {0xcd499038, 0x33a2}, // kmsquaredsquare + {0xcd54eec2, 0x06f4}, // fourpersian + {0xcd5fb77d, 0x0185}, // tonesix + {0xcd64e087, 0x266b}, // musicalnotedbl + {0xcd75d5eb, 0x2551}, // SF240000 + {0xcd7ce3d0, 0x24a7}, // lparen + {0xcd85d846, 0x1eec}, // Uhornhookabove + {0xcd9d27ad, 0x24c7}, // Rcircle + {0xcd9f5a2c, 0x0028}, // parenleft + {0xcda0c667, 0x2018}, // quoteleft + {0xcdab3631, 0xf7ff}, // Ydieresissmall + {0xcdae6ea2, 0xff59}, // ymonospace + {0xcdbb64f4, 0x2105}, // afii61248 + {0xcdd2cfab, 0x24b4}, // yparen + {0xcdd44c7f, 0x33a4}, // cmcubedsquare + {0xcde56fe0, 0x05b6}, // segol + {0xcdea4ff0, 0x03d4}, // Upsilondieresishooksymbolgreek + {0xcdf0bcd8, 0x0e1e}, // phophanthai + {0xcdfd40ec, 0x0180}, // bstroke + {0xce074882, 0x0668}, // afii57400 + {0xce4d2d1e, 0x2563}, // SF230000 + {0xce63250d, 0x005d}, // bracketrightBigg + {0xce6d06c6, 0x0aab}, // phagujarati + {0xce6f0d59, 0x3272}, // mieumacirclekorean + {0xce79a056, 0x3339}, // herutusquare + {0xce8dac39, 0x25a8}, // squareupperrighttolowerleftfill + {0xce942ad9, 0x09a6}, // dabengali + {0xcea39f20, 0x02d5}, // downtackmod + {0xced82ba6, 0xed19}, // bracehtipupleft + {0xcedf2a68, 0x0157}, // rcedilla + {0xcee9759d, 0x043a}, // afii10076 + {0xcef01870, 0x0171}, // udblacute + {0xcef10e83, 0x046a}, // Yusbigcyrillic + {0xcef67881, 0x200c}, // zerowidthnonjoiner + {0xcf235874, 0x030c}, // caroncmb + {0xcf4c6b71, 0x02d4}, // uptackmod + {0xcf6550b0, 0xfb4a}, // tavdageshhebrew + {0xcf6a5e7c, 0x323e}, // ideographicresourceparen + {0xcf738908, 0x011d}, // gcircumflex + {0xcf848334, 0x0453}, // afii10100 + {0xcf8cbf6b, 0x0195}, // hv + {0xcf9b96b5, 0x03bd}, // nu + {0xcfb1da5d, 0xff89}, // nokatakanahalfwidth + {0xcfc386a6, 0x00db}, // Ucircumflex + {0xcfc400d6, 0x06d2}, // yehbarreearabic + {0xcfd8a703, 0xfe61}, // asterisksmall + {0xcfe519cb, 0x309b}, // voicedmarkkana + {0xcfe64e44, 0x0668}, // eighthackarabic + {0xcff88b7d, 0x05b8}, // qamatsqatannarrowhebrew + {0xd009507e, 0x05d3}, // daletqamatshebrew + {0xd0096386, 0x25b3}, // whiteuppointingtriangle + {0xd0227bd1, 0x0199}, // khook + {0xd02a9cfe, 0x0105}, // aogonek + {0xd031b297, 0x24e9}, // zcircle + {0xd03ef2b0, 0x316b}, // rieulpieupsioskorean + {0xd0417b9a, 0x0494}, // Ghemiddlehookcyrillic + {0xd044dddd, 0x0a9d}, // jhagujarati + {0xd04ad0f0, 0x263c}, // sun + {0xd04cc01e, 0x0561}, // aybarmenian + {0xd0511b87, 0x0e4c}, // thanthakhatthai + {0xd056aca3, 0xff9a}, // rekatakanahalfwidth + {0xd06b6bb7, 0x096a}, // fourdeva + {0xd07a803b, 0x09aa}, // pabengali + {0xd07f3aad, 0xf768}, // Hsmall + {0xd0847e20, 0x05c4}, // upperdothebrew + {0xd087e60f, 0x0158}, // Rcaron + {0xd0897bb6, 0x0579}, // chaarmenian + {0xd0c5df61, 0x05b4}, // hiriq14 + {0xd0ce4edc, 0x09e9}, // threebengali + {0xd0d6e6c0, 0xff6c}, // yasmallkatakanahalfwidth + {0xd0e3648a, 0xfd3e}, // parenleftaltonearabic + {0xd133ff70, 0x01a1}, // ohorn + {0xd1373ca2, 0x0648}, // wawarabic + {0xd13d9bf5, 0xfe37}, // braceleftvertical + {0xd13faec5, 0x05e1}, // samekh + {0xd14fc185, 0x045b}, // afii10108 + {0xd17987dd, 0x0543}, // Cheharmenian + {0xd180d934, 0x0621}, // hamzalowkasraarabic + {0xd18447d8, 0x0663}, // threearabic + {0xd18961af, 0xf7fa}, // Uacutesmall + {0xd18966b1, 0x0a82}, // anusvaragujarati + {0xd18d83de, 0x0aa3}, // nnagujarati + {0xd190d310, 0x0a35}, // vagurmukhi + {0xd191827c, 0x0e39}, // sarauuthai + {0xd1acdf44, 0xfb94}, // gafinitialarabic + {0xd1d7231f, 0x04bc}, // Cheabkhasiancyrillic + {0xd1d9da71, 0x30ea}, // rikatakana + {0xd2337241, 0x05b6}, // segol1f + {0xd24297bf, 0xf889}, // maitaikhuleftthai + {0xd247ef8b, 0x3243}, // ideographicreachparen + {0xd254c368, 0x0443}, // ucyrillic + {0xd2658bcb, 0x05b9}, // holamquarterhebrew + {0xd26b0e16, 0x2321}, // integralbt + {0xd26ef570, 0x310f}, // hbopomofo + {0xd293868c, 0x019b}, // lambdastroke + {0xd297cb79, 0x30b7}, // sikatakana + {0xd2b4c516, 0x30da}, // pekatakana + {0xd2c0e1bc, 0x0150}, // Odblacute + {0xd2cbfc99, 0x05b7}, // patahhebrew + {0xd2e2a716, 0x03ec}, // Shimacoptic + {0xd2eaddf5, 0x0633}, // seenarabic + {0xd2f253f5, 0xfe40}, // anglebracketrightvertical + {0xd2f3cdf3, 0x1e0e}, // Dlinebelow + {0xd304784a, 0x05d3}, // dalet + {0xd308b167, 0x1e5b}, // rdotbelow + {0xd310b973, 0x25a1}, // a50 + {0xd310fcc1, 0x04e9}, // obarredcyrillic + {0xd3145153, 0xfeec}, // hehmedialarabic + {0xd326ec6d, 0x2237}, // proportion + {0xd3342503, 0x30bd}, // sokatakana + {0xd33cb244, 0x02cd}, // macronlowmod + {0xd35ba6fb, 0x04be}, // Chedescenderabkhasiancyrillic + {0xd3730282, 0xff64}, // ideographiccommaleft + {0xd3777d75, 0x05d3}, // daletsegolhebrew + {0xd3797e0f, 0x24db}, // lcircle + {0xd37b4bcb, 0x041c}, // afii10030 + {0xd3a5ba29, 0x062e}, // afii57422 + {0xd3c22da1, 0x01b5}, // Zstroke + {0xd3c6a66e, 0x05e4}, // pe + {0xd3cfef4c, 0x0427}, // afii10041 + {0xd3e84c23, 0x201c}, // quotedblleft + {0xd421361f, 0x067e}, // peharabic + {0xd4273f62, 0x30fd}, // iterationkatakana + {0xd44f2d4c, 0xff9b}, // rokatakanahalfwidth + {0xd45c6c89, 0x3079}, // behiragana + {0xd467b0a3, 0x0131}, // dotlessi + {0xd46989dc, 0x05e7}, // qofholam + {0xd48c064b, 0x0599}, // pashtahebrew + {0xd48dad4d, 0x01e2}, // AEmacron + {0xd4b2bb68, 0x0145}, // Ncedilla + {0xd4ce7b9e, 0x0621}, // hamzadammaarabic + {0xd4d3eb56, 0x255e}, // SF360000 + {0xd4e86e58, 0x1ef7}, // yhookabove + {0xd4e92fa8, 0x0623}, // alefhamzaabovearabic + {0xd514a0e0, 0x318c}, // yuikorean + {0xd5189135, 0x1e73}, // udieresisbelow + {0xd52f1d8f, 0x24cb}, // Vcircle + {0xd54b71bd, 0x0a6e}, // eightgurmukhi + {0xd574af4c, 0x318e}, // araeaekorean + {0xd57a206a, 0x00f2}, // ograve + {0xd58ee561, 0x04f3}, // uhungarumlautcyrillic + {0xd5b6f4bf, 0x3163}, // ikorean + {0xd5b7a706, 0x1e13}, // dcircumflexbelow + {0xd5da03ab, 0x0123}, // gcommaaccent + {0xd5da183e, 0xf76e}, // Nsmall + {0xd5dc1f0e, 0x24a5}, // jparen + {0xd5e6a2b4, 0x200f}, // afii300 + {0xd6067104, 0x05bd}, // siluqlefthebrew + {0xd6180af1, 0x0023}, // numbersign + {0xd6191adc, 0x02ce}, // gravelowmod + {0xd6480a61, 0x0e46}, // maiyamokthai + {0xd65815d1, 0x04f5}, // chedieresiscyrillic + {0xd6674587, 0xfea8}, // khahmedialarabic + {0xd66f3b98, 0x1ebd}, // etilde + {0xd67d357f, 0x0e23}, // roruathai + {0xd67dc19d, 0x1e05}, // bdotbelow + {0xd682be7e, 0xfe54}, // semicolonsmall + {0xd689f58d, 0x0024}, // dollar + {0xd68be98a, 0xff8f}, // makatakanahalfwidth + {0xd6a99b0e, 0x05aa}, // yerahbenyomolefthebrew + {0xd6c4c66e, 0x3262}, // tikeutcirclekorean + {0xd6c7e5a6, 0x03b0}, // upsilondieresistonos + {0xd6df6252, 0xfef4}, // yehmedialarabic + {0xd6e234de, 0x044d}, // afii10095 + {0xd7151c8a, 0x040b}, // afii10060 + {0xd71970f6, 0x05d3}, // daletsegol + {0xd71af0cf, 0x00af}, // overscore + {0xd72c6112, 0x0036}, // six + {0xd7363d15, 0x05d3}, // daletholamhebrew + {0xd73b3901, 0x02da}, // ring + {0xd7425de1, 0x0a1d}, // jhagurmukhi + {0xd771b953, 0x3107}, // mbopomofo + {0xd7a40cc3, 0x315c}, // ukorean + {0xd7b7f8a3, 0x3094}, // vuhiragana + {0xd7b8c7af, 0x05b8}, // qamatsquarterhebrew + {0xd7bc737d, 0x230b}, // floorrightBig + {0xd7bf0d2a, 0x308b}, // ruhiragana + {0xd7cebade, 0x01b1}, // Upsilonafrican + {0xd7d268b5, 0x314e}, // hieuhkorean + {0xd7ece605, 0x2553}, // SF520000 + {0xd813ab1a, 0x3176}, // pieupcieuckorean + {0xd816387d, 0x2178}, // nineroman + {0xd8171429, 0x013e}, // lcaron + {0xd817c39d, 0x0664}, // fourhackarabic + {0xd824acfb, 0x05de}, // memhebrew + {0xd82c0976, 0x05e8}, // reshsegolhebrew + {0xd849e14d, 0x3052}, // gehiragana + {0xd84afb0a, 0x00d1}, // Ntilde + {0xd85534fc, 0x02ca}, // secondtonechinese + {0xd8708805, 0x01ba}, // ezhtail + {0xd890928b, 0x0053}, // S + {0xd893adf8, 0x0580}, // reharmenian + {0xd8964f73, 0x043d}, // encyrillic + {0xd89879e8, 0x2116}, // afii61352 + {0xd8a1ab6d, 0x03ab}, // Upsilondieresis + {0xd8b1d2bf, 0x0177}, // ycircumflex + {0xd8faed0d, 0x30ef}, // wakatakana + {0xd9038cdb, 0x32a4}, // ideographichighcircle + {0xd90a7039, 0x06af}, // afii57509 + {0xd91584cd, 0xfe31}, // emdashvertical + {0xd92072b9, 0x0493}, // ghestrokecyrillic + {0xd92d9608, 0x0acd}, // viramagujarati + {0xd932c15c, 0x30ac}, // gakatakana + {0xd93c2940, 0x33cf}, // ktsquare + {0xd94d846e, 0x321a}, // phieuphaparenkorean + {0xd94faf13, 0x0188}, // chook + {0xd95c2f59, 0x04bd}, // cheabkhasiancyrillic + {0xd9697a13, 0x328b}, // ideographfirecircle + {0xd98cc91f, 0x0307}, // dotaccentcmb + {0xd98dcef9, 0xf8ff}, // apple + {0xd991004f, 0x0e4f}, // fongmanthai + {0xd99e3976, 0x249f}, // dparen + {0xd9ba695c, 0xff70}, // katahiraprolongmarkhalfwidth + {0xd9d63664, 0x0189}, // Dafrican + {0xd9e83df4, 0x096b}, // fivedeva + {0xd9eba56d, 0x03b3}, // gamma + {0xda15411c, 0x0304}, // macroncmb + {0xda2037e1, 0x1e01}, // aringbelow + {0xda3670ae, 0x3347}, // mansyonsquare + {0xda38804a, 0xf738}, // eightoldstyle + {0xda39b9df, 0x013d}, // Lcaron + {0xda48ff7e, 0x00bb}, // guillemotright + {0xda4e1891, 0x228b}, // supersetnotequal + {0xda55d0f3, 0x0a69}, // threegurmukhi + {0xda620e6e, 0xfca2}, // tehhahinitialarabic + {0xda734cc8, 0x232b}, // deleteleft + {0xda85eaa3, 0x2070}, // zerosuperior + {0xda94576a, 0x0999}, // ngabengali + {0xda94a677, 0x0634}, // afii57428 + {0xda99b3d7, 0x30d1}, // pakatakana + {0xda9d5f69, 0xf6c8}, // afii10832 + {0xdab46527, 0x21e9}, // arrowdownwhite + {0xdac4a95a, 0x002f}, // slash + {0xdac8670b, 0x011e}, // Gbreve + {0xdace8a4c, 0xed17}, // bracehtipdownleft + {0xdad5813e, 0x24bf}, // Jcircle + {0xdaf9ae21, 0x03e7}, // kheicoptic + {0xdb00acb2, 0x04dc}, // Zhedieresiscyrillic + {0xdb07430c, 0x1eac}, // Acircumflexdotbelow + {0xdb15243d, 0xfb38}, // tetdagesh + {0xdb180684, 0x059d}, // gereshmuqdamhebrew + {0xdb19f222, 0x1e30}, // Kacute + {0xdb215045, 0xf76f}, // Osmall + {0xdb36c0cb, 0x00c1}, // Aacute + {0xdb46a061, 0x044f}, // afii10097 + {0xdb4843d8, 0x0140}, // ldotaccent + {0xdb491e12, 0x3201}, // nieunparenkorean + {0xdb4ecb82, 0x06a4}, // afii57505 + {0xdb5fdfb2, 0x09cd}, // viramabengali + {0xdb7c2cdb, 0xf88f}, // maitholowleftthai + {0xdb8ff30c, 0xf6f5}, // Caronsmall + {0xdb9c2f74, 0x3063}, // tusmallhiragana + {0xdb9dda85, 0xfb3b}, // kafdageshhebrew + {0xdba170e8, 0x0998}, // ghabengali + {0xdbae2c8c, 0x2277}, // greaterorless + {0xdbc3c473, 0x001a}, // controlSUB + {0xdbc6ef9a, 0x05b2}, // hatafpatah23 + {0xdbc71338, 0xff01}, // exclammonospace + {0xdbcb0069, 0x338a}, // pfsquare + {0xdbf12380, 0x2460}, // onecircle + {0xdc0071a3, 0xfb46}, // tsadidageshhebrew + {0xdc05ec50, 0x30f5}, // kasmallkatakana + {0xdc0ac9c6, 0x0028}, // parenleftBigg + {0xdc0ad3ae, 0x012d}, // ibreve + {0xdc0c240d, 0xff9e}, // voicedmarkkanahalfwidth + {0xdc0c9e85, 0xff9f}, // semivoicedmarkkanahalfwidth + {0xdc3d7ac8, 0x04a7}, // pemiddlehookcyrillic + {0xdc41d3b3, 0x05ab}, // olehebrew + {0xdc54447c, 0x307c}, // bohiragana + {0xdc6ca9b3, 0x0584}, // keharmenian + {0xdc7650d9, 0xf73f}, // questionsmall + {0xdc7756d1, 0x0077}, // w + {0xdc7d1de8, 0xfba9}, // hehmedialaltonearabic + {0xdc7f6ca5, 0x0624}, // wawhamzaabovearabic + {0xdcc5c006, 0x055a}, // apostrophearmenian + {0xdce03f6b, 0x261e}, // pointingindexrightwhite + {0xdcefaeeb, 0x228a}, // subsetnotequal + {0xdd07775c, 0x3223}, // fourideographicparen + {0xdd07a474, 0x00b3}, // threesuperior + {0xdd21d4c1, 0x039b}, // Lambda + {0xdd2fee63, 0x0aad}, // bhagujarati + {0xdd4e62a4, 0x0a96}, // khagujarati + {0xdd55f861, 0x2560}, // SF420000 + {0xdd64bab7, 0x3080}, // muhiragana + {0xdd68d3ef, 0x00a5}, // yen + {0xdd8a8538, 0x0a26}, // dagurmukhi + {0xdd9a009b, 0x2016}, // dblverticalbar + {0xdda2fef7, 0x33db}, // srsquare + {0xdda8f1e0, 0x33d4}, // mbsquare + {0xddd89deb, 0xff4d}, // mmonospace + {0xdde406ed, 0x23a8}, // braceleftmid + {0xddfdd08a, 0x30a7}, // esmallkatakana + {0xddfea657, 0x0049}, // I + {0xddffcb32, 0x1e60}, // Sdotaccent + {0xde111430, 0x2271}, // notgreaternorequal + {0xde159412, 0x2605}, // blackstar + {0xde3de1bb, 0xfede}, // lamfinalarabic + {0xde4643cf, 0x0ac5}, // ecandravowelsigngujarati + {0xde5450d1, 0xff88}, // nekatakanahalfwidth + {0xde6c8dd1, 0x2223}, // divides + {0xde91c7ac, 0xfb35}, // vavdagesh + {0xdea63325, 0x0e0c}, // chochoethai + {0xdea93241, 0x0385}, // dieresistonos + {0xdeab4b8b, 0x05ad}, // dehihebrew + {0xdebc4010, 0xfcd5}, // noonmeeminitialarabic + {0xdebf0df4, 0x05f0}, // afii57716 + {0xdecde878, 0x1e52}, // Omacronacute + {0xdee80462, 0xffe5}, // yenmonospace + {0xdee969b3, 0x3001}, // ideographiccomma + {0xdef14eee, 0x020e}, // Oinvertedbreve + {0xdef351c2, 0x020c}, // Odblgrave + {0xdef92b6a, 0x3349}, // mirisquare + {0xdf08e8b4, 0xff15}, // fivemonospace + {0xdf09c757, 0x0186}, // Oopen + {0xdf1ee74b, 0xff81}, // tikatakanahalfwidth + {0xdf243dad, 0x044c}, // softsigncyrillic + {0xdf46fba9, 0x01a4}, // Phook + {0xdf5e1052, 0x221a}, // radicalbig + {0xdf80589a, 0x3217}, // chieuchaparenkorean + {0xdf8c6402, 0x0e45}, // lakkhangyaothai + {0xdf8fbdeb, 0x05e7}, // qofsheva + {0xdf9eaf7a, 0x33bc}, // muwsquare + {0xdfad5d93, 0x22c0}, // logicalandtext + {0xdfaf476d, 0x0167}, // tbar + {0xdfb9632c, 0x3144}, // pieupsioskorean + {0xdfe8c3dc, 0xf7fc}, // Udieresissmall + {0xdff819d0, 0xfe8c}, // yehhamzaabovemedialarabic + {0xdffe3761, 0x1e14}, // Emacrongrave + {0xe0061dae, 0x05d3}, // daletpatah + {0xe0130535, 0x316c}, // rieulpansioskorean + {0xe019189f, 0x0994}, // aubengali + {0xe0197d92, 0x0a4b}, // oomatragurmukhi + {0xe02aebf6, 0xf6e3}, // dollarinferior + {0xe0343a59, 0x0323}, // dotbelowcomb + {0xe03a2368, 0x019f}, // Ocenteredtilde + {0xe0489c79, 0x017f}, // longs + {0xe0513bea, 0xf6ff}, // Zcaronsmall + {0xe0560cdf, 0x1e19}, // ecircumflexbelow + {0xe065671a, 0x1e0a}, // Ddotaccent + {0xe07dfee5, 0x04f4}, // Chedieresiscyrillic + {0xe0800244, 0xfb69}, // ttehmedialarabic + {0xe0831234, 0x007b}, // braceleftBig + {0xe0987417, 0x24dd}, // ncircle + {0xe0ab68f9, 0xf6dc}, // onefitted + {0xe0ac4869, 0x3225}, // sixideographicparen + {0xe0c42e1f, 0x3357}, // wattosquare + {0xe0cf3aca, 0x1e1d}, // ecedillabreve + {0xe0d114bf, 0x04b6}, // Chedescendercyrillic + {0xe0dbd3b5, 0x2494}, // thirteenperiod + {0xe0ec0106, 0x05a6}, // merkhakefulahebrew + {0xe0ec7a9f, 0x01a6}, // yr + {0xe0f957bb, 0x0644}, // afii57444 + {0xe10a53c6, 0x0aa8}, // nagujarati + {0xe13f2d93, 0x3026}, // sixhangzhou + {0xe173c1f2, 0x1e12}, // Dcircumflexbelow + {0xe180ca73, 0x1e43}, // mdotbelow + {0xe1b37094, 0x0629}, // afii57417 + {0xe1bbda55, 0x040e}, // Ushortcyrillic + {0xe1bf1035, 0x0536}, // Zaarmenian + {0xe20234a2, 0x012c}, // Ibreve + {0xe20c937f, 0x041a}, // Kacyrillic + {0xe20deadd, 0x047c}, // Omegatitlocyrillic + {0xe222a727, 0x02dc}, // tildewide + {0xe2234dec, 0xff52}, // rmonospace + {0xe2256c16, 0x05d3}, // daletqamats + {0xe22682ea, 0x3260}, // kiyeokcirclekorean + {0xe22a6510, 0x1e8e}, // Ydotaccent + {0xe23968a4, 0x04b3}, // hadescendercyrillic + {0xe25773d9, 0x04d3}, // adieresiscyrillic + {0xe259edda, 0x0628}, // afii57416 + {0xe25f57e9, 0xfe9a}, // thehfinalarabic + {0xe26168f6, 0x1e82}, // Wacute + {0xe28a564c, 0x044f}, // iacyrillic + {0xe28eea2e, 0x1e51}, // omacrongrave + {0xe2924f7e, 0x0a67}, // onegurmukhi + {0xe2948e05, 0xf6f6}, // Circumflexsmall + {0xe2a7b092, 0x3213}, // pieupaparenkorean + {0xe2b99909, 0x0e14}, // dodekthai + {0xe2cfeeb5, 0x0301}, // acutecomb + {0xe2eccaa5, 0x0059}, // Y + {0xe2ef1bbf, 0x2197}, // arrowupright + {0xe2fc74df, 0x0533}, // Gimarmenian + {0xe2ff3ec5, 0xfb8d}, // rrehfinalarabic + {0xe2ffc4d4, 0x2661}, // heartsuitwhite + {0xe3356dd7, 0x1e54}, // Pacute + {0xe35f1369, 0xfe5c}, // bracerightsmall + {0xe3708e14, 0xfed3}, // fehinitialarabic + {0xe37c75f9, 0x03c7}, // chi + {0xe38423f1, 0x01ab}, // tpalatalhook + {0xe387ebf8, 0xff94}, // yakatakanahalfwidth + {0xe39adf52, 0x05b7}, // patahnarrowhebrew + {0xe39bb5ba, 0x0258}, // ereversed + {0xe3a00fb0, 0x0aa2}, // ddhagujarati + {0xe3a0394c, 0x05b3}, // afii57802 + {0xe3bf40b5, 0x21c5}, // arrowupleftofdown + {0xe3c68591, 0x005d}, // bracketrightBig + {0xe3cbb73f, 0x0459}, // afii10106 + {0xe3cddac1, 0x0621}, // hamzalowarabic + {0xe3d5ad06, 0x1ec0}, // Ecircumflexgrave + {0xe3dd99f7, 0x0596}, // tipehahebrew + {0xe3fae787, 0x0587}, // echyiwnarmenian + {0xe3fe00d6, 0x2170}, // oneroman + {0xe401701f, 0x3016}, // whitelenticularbracketleft + {0xe41d9109, 0x3089}, // rahiragana + {0xe424f4cb, 0x0969}, // threedeva + {0xe42a588e, 0x0e27}, // wowaenthai + {0xe42a6647, 0x0a71}, // addakgurmukhi + {0xe433c6bf, 0x042c}, // afii10046 + {0xe44aea0b, 0x0219}, // scommaaccent + {0xe44ed7aa, 0x2481}, // fourteenparen + {0xe468e60e, 0x33bd}, // mwsquare + {0xe47b4b2e, 0xfecb}, // aininitialarabic + {0xe4896ee4, 0x09c0}, // iivowelsignbengali + {0xe4924345, 0xff63}, // cornerbracketrighthalfwidth + {0xe49ba568, 0x090c}, // lvocalicdeva + {0xe4a8920f, 0x0014}, // controlDC4 + {0xe4c6b94a, 0x0550}, // Reharmenian + {0xe4c91eec, 0x1ea7}, // acircumflexgrave + {0xe4ce70c5, 0xfedf}, // lammeemkhahinitialarabic + {0xe4d0a5c5, 0x2171}, // tworoman + {0xe4de0824, 0x090b}, // rvocalicdeva + {0xe4e78bbf, 0x0e33}, // saraamthai + {0xe4e90251, 0xfb41}, // samekhdagesh + {0xe4f1acea, 0x24d7}, // hcircle + {0xe5034999, 0xff55}, // umonospace + {0xe504c22f, 0x01a9}, // Esh + {0xe506e1eb, 0x2493}, // twelveperiod + {0xe5107e85, 0xff92}, // mekatakanahalfwidth + {0xe5116fc8, 0x2472}, // nineteencircle + {0xe514f37f, 0x03be}, // xi + {0xe51bd3a3, 0x0163}, // tcedilla + {0xe5287de7, 0x3173}, // pieuptikeutkorean + {0xe5322bbf, 0x25b2}, // blackuppointingtriangle + {0xe5431590, 0x2296}, // minuscircle + {0xe54a2cdd, 0x201e}, // quotedblbase + {0xe5694805, 0x3161}, // eukorean + {0xe56f3e08, 0x1e9b}, // slongdotaccent + {0xe5779de7, 0x0666}, // afii57398 + {0xe578bf9d, 0x066d}, // asteriskaltonearabic + {0xe5850206, 0x2226}, // notparallel + {0xe59889e5, 0x014b}, // eng + {0xe59f1c1d, 0x2664}, // spadesuitwhite + {0xe59f1f71, 0x2203}, // thereexists + {0xe5dca65a, 0x04aa}, // Esdescendercyrillic + {0xe5e0ac19, 0x0a74}, // ekonkargurmukhi + {0xe5eb1828, 0x25e6}, // openbullet + {0xe5f403ac, 0x0981}, // candrabindubengali + {0xe5f51e2d, 0x0156}, // Rcedilla + {0xe61a323e, 0x21d2}, // arrowdblright + {0xe61dad29, 0x017b}, // Zdotaccent + {0xe62fb889, 0x2524}, // SF090000 + {0xe65602bc, 0x05d3}, // daletqubuts + {0xe6699f03, 0x025d}, // eopenreversedhook + {0xe6743f55, 0x011a}, // Ecaron + {0xe6861695, 0x018a}, // Dhook + {0xe68d35b4, 0x0436}, // afii10072 + {0xe68e2cfd, 0x306b}, // nihiragana + {0xe6910141, 0x06f1}, // onepersian + {0xe6936418, 0xfb2f}, // alefqamatshebrew + {0xe6a0587d, 0x3222}, // threeideographicparen + {0xe6a445c8, 0xfcd2}, // noonjeeminitialarabic + {0xe6b00dbd, 0x060c}, // commaarabic + {0xe6bd7d55, 0x04f0}, // Udieresiscyrillic + {0xe6beeaab, 0x2667}, // clubsuitwhite + {0xe6d26878, 0x0663}, // threehackarabic + {0xe6eee43a, 0x031a}, // leftangleabovecmb + {0xe70bdf5d, 0x1e85}, // wdieresis + {0xe72762a6, 0x3127}, // ibopomofo + {0xe74e8d5b, 0x02d0}, // colontriangularmod + {0xe75de72d, 0x0a4d}, // halantgurmukhi + {0xe79030f9, 0xf6cf}, // Hungarumlaut + {0xe796e6c1, 0x032f}, // breveinvertedbelowcmb + {0xe7a9201c, 0x24e5}, // vcircle + {0xe7abb869, 0x05b0}, // sheva115 + {0xe7f3b395, 0x24d8}, // icircle + {0xe80a2426, 0x3116}, // rbopomofo + {0xe80eec90, 0x0942}, // uuvowelsigndeva + {0xe832e25c, 0x03ef}, // deicoptic + {0xe836846a, 0x20a1}, // colonsign + {0xe8445eb9, 0x05e5}, // finaltsadihebrew + {0xe84e29b1, 0xfef5}, // lamalefmaddaaboveisolatedarabic + {0xe853fc35, 0x3177}, // pieupthieuthkorean + {0xe871a9d4, 0x03e3}, // sheicoptic + {0xe872f83d, 0x02a0}, // qhook + {0xe87409fd, 0xfe8b}, // yehhamzaaboveinitialarabic + {0xe885d69b, 0x1e58}, // Rdotaccent + {0xe893423b, 0x202c}, // afii61573 + {0xe894f25c, 0x03a1}, // Rho + {0xe89d944f, 0x043a}, // kacyrillic + {0xe8aff9ae, 0x24b7}, // Bcircle + {0xe8d4db79, 0x2320}, // integraltp + {0xe8d6bd29, 0x0621}, // afii57409 + {0xe8ec3154, 0x2490}, // nineperiod + {0xe8ef5782, 0x3092}, // wohiragana + {0xe8f0c584, 0x05d1}, // afii57665 + {0xe8f5ca9b, 0x05b1}, // hatafsegolnarrowhebrew + {0xe8f7e9bf, 0x320f}, // nieunaparenkorean + {0xe903bc23, 0xfb36}, // zayindageshhebrew + {0xe90424fe, 0x2479}, // sixparen + {0xe927829f, 0x0953}, // gravedeva + {0xe92a9522, 0x0060}, // grave + {0xe93b2c93, 0x09c8}, // aivowelsignbengali + {0xe9544ae6, 0x2308}, // ceilingleftbigg + {0xe9598c36, 0x018e}, // Ereversed + {0xe96c43a5, 0x00d4}, // Ocircumflex + {0xe977a63b, 0x0591}, // etnahtalefthebrew + {0xe9860674, 0x2467}, // eightcircle + {0xe994ec07, 0x1e88}, // Wdotbelow + {0xe9955c1b, 0x2109}, // fahrenheit + {0xe997ce80, 0x03d6}, // pisymbolgreek + {0xe9b8fb39, 0x256a}, // SF540000 + {0xe9c5c9e3, 0x0928}, // nadeva + {0xe9dc1b2b, 0x3162}, // yikorean + {0xe9f5bb0b, 0x1e40}, // Mdotaccent + {0xe9fd5bd7, 0x02d1}, // colontriangularhalfmod + {0xe9fe0986, 0xfe91}, // behinitialarabic + {0xea0e9b0d, 0x3077}, // puhiragana + {0xea11b5f2, 0x05d7}, // hethebrew + {0xea281c50, 0xfb3b}, // kafdagesh + {0xea281f0f, 0xfb43}, // pefinaldageshhebrew + {0xea4521ba, 0x1e99}, // yring + {0xea469ad4, 0x0641}, // feharabic + {0xea4bf6ca, 0x25b5}, // whiteuppointingsmalltriangle + {0xea505c24, 0x006b}, // k + {0xea723c32, 0x05b7}, // patahwidehebrew + {0xea828d24, 0x0ac4}, // rrvocalicvowelsigngujarati + {0xea8df8fe, 0xff09}, // parenrightmonospace + {0xeaaa8586, 0x05b6}, // segolhebrew + {0xeabb8dad, 0xfeb3}, // seeninitialarabic + {0xeabdd2cd, 0xff02}, // quotedblmonospace + {0xeacd0b4a, 0xfb1f}, // doubleyodpatah + {0xeade9ba5, 0x2113}, // afii61289 + {0xeb0445d5, 0x043f}, // afii10081 + {0xeb095515, 0x0452}, // afii10099 + {0xeb4a0523, 0x056a}, // zhearmenian + {0xeb4fdea3, 0xfc08}, // behmeemisolatedarabic + {0xeb576d94, 0x21de}, // pageup + {0xeb6b92be, 0x2191}, // arrowtp + {0xeb701704, 0x2014}, // emdash + {0xeb71d801, 0x30f3}, // nkatakana + {0xebeccb02, 0x00dd}, // Yacute + {0xec20a331, 0x096c}, // sixdeva + {0xec450aad, 0x3211}, // rieulaparenkorean + {0xec4fc0c5, 0x0173}, // uogonek + {0xec78ec45, 0x05a4}, // mahapakhhebrew + {0xec820a21, 0x05b4}, // hiriqquarterhebrew + {0xec8ae366, 0x0987}, // ibengali + {0xec967081, 0x040a}, // Njecyrillic + {0xecad584f, 0x01a8}, // tonetwo + {0xecc21039, 0x0a98}, // ghagujarati + {0xecce5cae, 0x056b}, // iniarmenian + {0xecd385c5, 0x03a8}, // Psi + {0xecda4c6b, 0x0622}, // alefmaddaabovearabic + {0xecddb27b, 0x23d0}, // vextendsingle + {0xecddb519, 0x05db}, // kaf + {0xecef01e0, 0x1e59}, // rdotaccent + {0xed102125, 0x24c0}, // Kcircle + {0xed1afc7c, 0x05b2}, // hatafpatah2f + {0xed2b4a43, 0x00aa}, // ordfeminine + {0xed4bb321, 0x313f}, // rieulphieuphkorean + {0xed65d1e6, 0x05e7}, // qofqubutshebrew + {0xed65e3bb, 0x057a}, // peharmenian + {0xed729d82, 0x049e}, // Kastrokecyrillic + {0xed796a9e, 0x0407}, // afii10056 + {0xed8b66db, 0x040b}, // Tshecyrillic + {0xed9bf511, 0x063a}, // afii57434 + {0xedfaec74, 0xfe69}, // dollarsmall + {0xee22e47f, 0x00bd}, // onehalf + {0xee3352d3, 0x05b0}, // afii57799 + {0xee339d2e, 0x2025}, // twodotenleader + {0xee421e32, 0x0660}, // zeroarabic + {0xee6c8858, 0x3168}, // nieunpansioskorean + {0xee7a31f8, 0x220b}, // suchthat + {0xee8d09d6, 0xff12}, // twomonospace + {0xee900f0f, 0x0462}, // afii10146 + {0xee9f1e99, 0x02b7}, // wsuperior + {0xeeb00f1b, 0x0063}, // c + {0xeeb5ef47, 0x24c2}, // Mcircle + {0xeeda5b48, 0x00a6}, // brokenbar + {0xeeeef128, 0x062f}, // afii57423 + {0xeeef7f7c, 0x01b6}, // zstroke + {0xef03e03f, 0x32a3}, // ideographiccorrectcircle + {0xef22f61a, 0x06f0}, // zeropersian + {0xef24cf3c, 0x00a8}, // dieresis + {0xef2800a0, 0x00cc}, // Igrave + {0xef33d78e, 0x25a1}, // H22073 + {0xef3a179c, 0x020a}, // Iinvertedbreve + {0xef636ee0, 0x05da}, // finalkaf + {0xef7afe15, 0x007d}, // bracerightbigg + {0xefa03eab, 0x00c6}, // AE + {0xefc57067, 0x0260}, // ghook + {0xefd65ddd, 0x2033}, // second + {0xefd69119, 0x044e}, // iucyrillic + {0xefd88572, 0x1ecb}, // idotbelow + {0xefe0e3fd, 0xfb01}, // fi + {0xeff59b38, 0x0397}, // Eta + {0xeff843d0, 0x25a3}, // squarewhitewithsmallblack + {0xf00181f3, 0x305c}, // zehiragana + {0xf00455e8, 0x1e86}, // Wdotaccent + {0xf0045976, 0x3178}, // kapyeounpieupkorean + {0xf0213847, 0x3383}, // masquare + {0xf0248bca, 0x0640}, // tatweelarabic + {0xf029041c, 0x3017}, // whitelenticularbracketright + {0xf0412bb8, 0x04d0}, // Abrevecyrillic + {0xf04a093b, 0xff66}, // wokatakanahalfwidth + {0xf04c3677, 0xfe62}, // plussmall + {0xf04d9cf4, 0x308c}, // rehiragana + {0xf064a013, 0x047e}, // Otcyrillic + {0xf0673e49, 0x096f}, // ninedeva + {0xf0757f39, 0x030a}, // ringcmb + {0xf08334d5, 0x05d3}, // dalethatafpatahhebrew + {0xf08a28a9, 0xfe4e}, // lowlinecenterline + {0xf09092b0, 0x3185}, // ssanghieuhkorean + {0xf091911a, 0x223d}, // reversedtilde + {0xf098620b, 0x066a}, // percentarabic + {0xf0a5507a, 0x03d5}, // phisymbolgreek + {0xf0ac995b, 0x337c}, // syouwaerasquare + {0xf0b806fd, 0xfb7c}, // tchehinitialarabic + {0xf0c10455, 0x0645}, // meemarabic + {0xf0d79471, 0x0201}, // adblgrave + {0xf0e2f076, 0x04cb}, // Chekhakassiancyrillic + {0xf0ec6a42, 0x0302}, // circumflexcmb + {0xf0f2a82b, 0x1e8a}, // Xdotaccent + {0xf0fcc511, 0x3398}, // klsquare + {0xf1116d2e, 0xfe41}, // cornerbracketleftvertical + {0xf1200f87, 0x05e6}, // tsadi + {0xf13a2d0d, 0x0119}, // eogonek + {0xf1410096, 0x1e1a}, // Etildebelow + {0xf144c7a3, 0x249d}, // bparen + {0xf15ab600, 0x05bb}, // qubuts18 + {0xf16238a6, 0x04de}, // Zedieresiscyrillic + {0xf1aad12e, 0x0638}, // afii57432 + {0xf1b08e52, 0x20ab}, // dong + {0xf1b0be56, 0x20a2}, // cruzeiro + {0xf1b5f5d1, 0x05b5}, // tserehebrew + {0xf1dd7830, 0x033d}, // xabovecmb + {0xf1ddaa7d, 0x0995}, // kabengali + {0xf1e94d64, 0x064e}, // fathaarabic + {0xf1eb4f66, 0x0116}, // Edotaccent + {0xf1f2ec50, 0x05e7}, // qofhatafsegol + {0xf1f78ce7, 0x226a}, // muchless + {0xf2118c6c, 0x0635}, // sadarabic + {0xf232181a, 0x2640}, // venus + {0xf237f0f1, 0xff29}, // Imonospace + {0xf23a5b68, 0x0130}, // Idot + {0xf24a3a6b, 0x05b8}, // qamats1c + {0xf2558e7a, 0x230a}, // floorleftbig + {0xf2620ee8, 0x1e07}, // blinebelow + {0xf26e5910, 0x045e}, // ushortcyrillic + {0xf2b4963c, 0x09b0}, // rabengali + {0xf2b826ec, 0x0449}, // shchacyrillic + {0xf2c1d44e, 0x05be}, // maqafhebrew + {0xf2c69081, 0x016e}, // Uring + {0xf2dd8deb, 0x248d}, // sixperiod + {0xf2e23a0c, 0xfb57}, // pehfinalarabic + {0xf2e7f536, 0x0329}, // verticallinebelowcmb + {0xf2efdad2, 0x05e8}, // reshqamats + {0xf2f52e6c, 0x00ce}, // Icircumflex + {0xf2f6e905, 0x24cd}, // Xcircle + {0xf3086f4b, 0x2030}, // perthousand + {0xf311fe21, 0xfece}, // ghainfinalarabic + {0xf315dbae, 0xfe3c}, // blacklenticularbracketrightvertical + {0xf31fc2c2, 0xf76d}, // Msmall + {0xf336d994, 0xfef3}, // yehinitialarabic + {0xf3527249, 0xfb67}, // ttehfinalarabic + {0xf365ee1e, 0xf6f8}, // Hungarumlautsmall + {0xf3935843, 0xff26}, // Fmonospace + {0xf399cd14, 0x0074}, // t + {0xf3ab1b0a, 0x05d3}, // dalethatafsegol + {0xf3c08521, 0x0431}, // afii10066 + {0xf3ce4ef0, 0x014a}, // Eng + {0xf3cfe996, 0x05b8}, // qamatsde + {0xf3ef0654, 0x2160}, // Oneroman + {0xf41c3e87, 0x3182}, // yesieungsioskorean + {0xf4266df0, 0x2253}, // imageorapproximatelyequal + {0xf4584280, 0x05ea}, // tav + {0xf4637345, 0x207a}, // plussuperior + {0xf467a09a, 0x3066}, // tehiragana + {0xf4728f62, 0x06f9}, // ninepersian + {0xf47778a3, 0x0958}, // qadeva + {0xf47c7f06, 0x05a5}, // merkhalefthebrew + {0xf4970a5b, 0x222b}, // integraldisplay + {0xf498c20b, 0xfb2c}, // shindageshshindothebrew + {0xf4a0d900, 0xf7e6}, // AEsmall + {0xf4a2e6c9, 0xff8e}, // hokatakanahalfwidth + {0xf4c721dd, 0x0415}, // afii10022 + {0xf4d1afd1, 0x015b}, // sacute + {0xf4d731e8, 0x0e2b}, // hohipthai + {0xf4d7dcfe, 0x05b0}, // sheva + {0xf4ea5918, 0x0423}, // afii10037 + {0xf4f5b85f, 0x05bd}, // afii57839 + {0xf4fec4c5, 0x2026}, // ellipsis + {0xf4fecbee, 0x3152}, // yaekorean + {0xf521dc0d, 0xf777}, // Wsmall + {0xf526b2bc, 0x09f5}, // twonumeratorbengali + {0xf53d898f, 0x0122}, // Gcedilla + {0xf54df907, 0x02e8}, // tonebarlowmod + {0xf573def2, 0x25ba}, // blackrightpointingpointer + {0xf573f1ec, 0x24a4}, // iparen + {0xf59704d9, 0xff4f}, // omonospace + {0xf59943f5, 0x01d4}, // ucaron + {0xf59f95da, 0x0399}, // Iota + {0xf5a6729d, 0x247e}, // elevenparen + {0xf5ab4f6d, 0x0458}, // afii10105 + {0xf5c2a87b, 0x0a14}, // augurmukhi + {0xf5c40812, 0x2019}, // quoteright + {0xf5cad972, 0x1ea6}, // Acircumflexgrave + {0xf5e83826, 0x0986}, // aabengali + {0xf5f606a8, 0x316e}, // mieumpieupkorean + {0xf5f79af6, 0x23a3}, // bracketleftbt + {0xf5fe99ee, 0x2017}, // underscoredbl + {0xf61328eb, 0x2580}, // upblock + {0xf61a2336, 0x0157}, // rcommaaccent + {0xf6228c58, 0x20a3}, // franc + {0xf6271ec7, 0x0429}, // afii10043 + {0xf630815e, 0x0577}, // shaarmenian + {0xf643d64b, 0xf774}, // Tsmall + {0xf64f0a5d, 0x30f9}, // vekatakana + {0xf64f6666, 0xff44}, // dmonospace + {0xf6545660, 0x3333}, // huiitosquare + {0xf655e1cb, 0x316a}, // rieultikeutkorean + {0xf66aa028, 0x215d}, // fiveeighths + {0xf67e1ed1, 0x01a3}, // oi + {0xf6886180, 0x3216}, // cieucaparenkorean + {0xf68c8679, 0x3043}, // ismallhiragana + {0xf68fb68d, 0x215b}, // oneeighth + {0xf6909b76, 0x24a1}, // fparen + {0xf69fb673, 0xf7e4}, // Adieresissmall + {0xf6b386e5, 0x1e3c}, // Lcircumflexbelow + {0xf6c0ec85, 0x1e5c}, // Rdotbelowmacron + {0xf6ea45f8, 0xf6fa}, // OEsmall + {0xf6f2a8b6, 0x0289}, // ubar + {0xf7114d7b, 0x2502}, // SF110000 + {0xf7440454, 0x045e}, // afii10110 + {0xf757213f, 0x01d6}, // udieresismacron + {0xf779fd74, 0x1ea0}, // Adotbelow + {0xf7887f64, 0x24ba}, // Ecircle + {0xf7994ed0, 0x0a6d}, // sevengurmukhi + {0xf7c65164, 0x266d}, // musicflatsign + {0xf7d4f2e3, 0x1e1e}, // Fdotaccent + {0xf7ddf3cd, 0x0a17}, // gagurmukhi + {0xf7de3a36, 0x3086}, // yuhiragana + {0xf7edf1a3, 0x0403}, // Gjecyrillic + {0xf7fe7207, 0x279e}, // arrowrightheavy + {0xf7fec616, 0x1ec4}, // Ecircumflextilde + {0xf81e4626, 0x0a02}, // bindigurmukhi + {0xf8245f14, 0x30e6}, // yukatakana + {0xf82ad190, 0x05e4}, // pehebrew + {0xf8376f18, 0x0410}, // afii10017 + {0xf885c738, 0x30d3}, // bikatakana + {0xf8868f94, 0xff8c}, // hukatakanahalfwidth + {0xf8892150, 0x04a8}, // Haabkhasiancyrillic + {0xf89a4fca, 0x05d3}, // daletholam + {0xf89be814, 0x0abc}, // nuktagujarati + {0xf8e483f7, 0x1eb5}, // abrevetilde + {0xf8ef289b, 0x21df}, // pagedown + {0xf90377b2, 0x3151}, // yakorean + {0xf90f516b, 0x0a5b}, // zagurmukhi + {0xf9190810, 0x0203}, // ainvertedbreve + {0xf929be43, 0x0ab6}, // shagujarati + {0xf93a01ea, 0xfe6a}, // percentsmall + {0xf952cde5, 0x1eae}, // Abreveacute + {0xf95ad1c7, 0x0065}, // e + {0xf95b34b0, 0x0660}, // afii57392 + {0xf976011b, 0x3399}, // fmsquare + {0xf99ebcf4, 0x25c1}, // whiteleftpointingtriangle + {0xf9bdabb3, 0x00e2}, // acircumflex + {0xf9d67642, 0x00c8}, // Egrave + {0xf9e5170b, 0x1eb6}, // Abrevedotbelow + {0xf9e8161d, 0x3206}, // siosparenkorean + {0xf9eeaebc, 0x002c}, // comma + {0xf9f4a348, 0x2279}, // notgreaternorless + {0xf9f6f2fe, 0xfe84}, // alefhamzaabovefinalarabic + {0xf9f909db, 0x09f1}, // ralowerdiagonalbengali + {0xfa1f37f7, 0x207d}, // parenleftsuperior + {0xfa3ebdeb, 0xfb8b}, // jehfinalarabic + {0xfa46e08a, 0x010a}, // Cdotaccent + {0xfa6e953f, 0x0e13}, // nonenthai + {0xfa7aad8b, 0x0e34}, // saraithai + {0xfa85b29d, 0x0ae6}, // zerogujarati + {0xfa8f771c, 0xfe82}, // alefmaddaabovefinalarabic + {0xfa932832, 0x1ec9}, // ihookabove + {0xfa9cd43f, 0x2488}, // oneperiod + {0xfa9f7510, 0x1e6a}, // Tdotaccent + {0xfaa7f693, 0xff1b}, // semicolonmonospace + {0xfab3dba6, 0x3138}, // ssangtikeutkorean + {0xfac03db8, 0x015e}, // Scedilla + {0xfac092ef, 0x24de}, // ocircle + {0xfad44b21, 0x278d}, // fourcircleinversesansserif + {0xfadde282, 0x0539}, // Toarmenian + {0xfaf8abd4, 0x05bb}, // qubuts25 + {0xfb0a35fb, 0xfb2b}, // afii57695 + {0xfb0e1bad, 0x2567}, // SF450000 + {0xfb1373b2, 0x30b9}, // sukatakana + {0xfb161300, 0x049f}, // kastrokecyrillic + {0xfb206015, 0x30b1}, // kekatakana + {0xfb2465d5, 0x0468}, // Yuslittleiotifiedcyrillic + {0xfb3e0b48, 0x01fc}, // AEacute + {0xfb4678bc, 0xfe90}, // behfinalarabic + {0xfb5bf4b4, 0x02cf}, // acutelowmod + {0xfb5cfdc8, 0x095c}, // dddhadeva + {0xfb6edad4, 0xf6c9}, // Acute + {0xfb764dd2, 0x21d3}, // arrowdbldown + {0xfb7c1fd7, 0x0485}, // dasiapneumatacyrilliccmb + {0xfbcf44c4, 0x018d}, // deltaturned + {0xfbd1b93f, 0x33c4}, // squarecc + {0xfbd50511, 0x04e8}, // Obarredcyrillic + {0xfbf1fcde, 0x03e9}, // horicoptic + {0xfc161b2f, 0x2499}, // eighteenperiod + {0xfc18556b, 0x02bd}, // commareversedmod + {0xfc1a2c97, 0x046c}, // Yusbigiotifiedcyrillic + {0xfc2caf5c, 0x2285}, // notsuperset + {0xfc3393bc, 0x0124}, // Hcircumflex + {0xfc3a32c2, 0x0a8d}, // ecandragujarati + {0xfc75d31c, 0x1ec6}, // Ecircumflexdotbelow + {0xfc7e1ef8, 0x0952}, // anudattadeva + {0xfc7ea01a, 0x04e6}, // Odieresiscyrillic + {0xfc8020b6, 0xfb39}, // yoddageshhebrew + {0xfc828b2d, 0x1ee4}, // Udotbelow + {0xfc9cf271, 0x020d}, // odblgrave + {0xfcd52169, 0xf7ed}, // Iacutesmall + {0xfce47bc6, 0x05b7}, // patah + {0xfce8ddc1, 0x1e0f}, // dlinebelow + {0xfce9ddb5, 0x05aa}, // yerahbenyomohebrew + {0xfcf6e2a9, 0x21ea}, // capslock + {0xfd00e31a, 0x0303}, // tildecomb + {0xfd0eac29, 0x0261}, // gscript + {0xfd1397ce, 0x0412}, // Vecyrillic + {0xfd166ead, 0x05e0}, // nunhebrew + {0xfd2c8feb, 0x1ea4}, // Acircumflexacute + {0xfd5ace9a, 0x057b}, // jheharmenian + {0xfd6ac237, 0x221d}, // proportional + {0xfd77296d, 0x04af}, // ustraightcyrillic + {0xfd891a4c, 0x0948}, // aivowelsigndeva + {0xfd8944f5, 0x0309}, // hookabovecomb + {0xfd89977d, 0x0e50}, // zerothai + {0xfd93a170, 0xf8ec}, // parenleftex + {0xfd99bb06, 0xfb3c}, // lameddagesh + {0xfdb6c57c, 0x2215}, // divisionslash + {0xfdbbbec8, 0x090d}, // ecandradeva + {0xfdc83f1f, 0x028d}, // wturned + {0xfdd37935, 0x0422}, // afii10036 + {0xfdec640d, 0x0640}, // kashidaautoarabic + {0xfdf32442, 0x3390}, // Hzsquare + {0xfdf4c83e, 0x026e}, // lezh + {0xfe3d55df, 0x064f}, // dammaarabic + {0xfe407199, 0x2276}, // lessorgreater + {0xfe7515f3, 0x03a9}, // Omegagreek + {0xfe779a6a, 0x045a}, // afii10107 + {0xfea7088a, 0x0628}, // beharabic + {0xfeb66fd9, 0xfec7}, // zahinitialarabic + {0xfeb7f263, 0x0556}, // Feharmenian + {0xfec7bc3b, 0x0651}, // shaddaarabic + {0xfee2004d, 0x01fe}, // Ostrokeacute + {0xfee5f25e, 0x2126}, // Omega + {0xfee9d86c, 0x2295}, // pluscircle + {0xfef651f8, 0x0688}, // afii57512 + {0xff5dadf4, 0x0193}, // Ghook + {0xff7d5e86, 0x05e7}, // qoftserehebrew + {0xff81c116, 0x21cd}, // arrowleftdblstroke + {0xff8c00d8, 0x3386}, // MBsquare + {0xff8f2931, 0x30ae}, // gikatakana + {0xff90fc92, 0x0923}, // nnadeva + {0xff94689d, 0x04c0}, // palochkacyrillic + {0xffce1162, 0xf734}, // fouroldstyle + {0xffe38169, 0x043f}, // pecyrillic + {0xfffadc30, 0x2568}, // SF460000 +}; + + +/** Returns the Unicode point for a given PostScript character name. + * @param psname PostScript name of the character to look up + * @return codepoint of the character */ +Int32 Unicode::psNameToCodepoint (const string &psname) { + UInt32 hash = XXH32(&psname[0], psname.length(), 0); + int left=0; + int right=sizeof(hash2unicode)/sizeof(Hash2Unicode)-1; + while (left <= right) { + int mid = left+(right-left)/2; + if (hash == hash2unicode[mid].hash) + return hash2unicode[mid].codepoint; + if (hash < hash2unicode[mid].hash) + right = mid-1; + else + left = mid+1; + } + return 0; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h new file mode 100644 index 00000000000..738f38a6e3a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Unicode.h @@ -0,0 +1,35 @@ +/************************************************************************* +** Unicode.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_UNICODE_H +#define DVISVGM_UNICODE_H + +#include +#include "types.h" + +struct Unicode +{ + static bool isValidCodepoint (UInt32 code); + static UInt32 charToCodepoint (UInt32 c); + static std::string utf8 (Int32 c); + static Int32 psNameToCodepoint (const std::string &psname); +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h new file mode 100644 index 00000000000..886771e75a7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFActions.h @@ -0,0 +1,38 @@ +/************************************************************************* +** VFActions.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_VFACTIONS_H +#define DVISVGM_VFACTIONS_H + +#include +#include +#include "types.h" + + +struct VFActions +{ + virtual ~VFActions () {} + virtual void preamble (std::string comment, UInt32 checksum, double dsize) {} + virtual void postamble () {} + virtual void defineVFFont (UInt32 fontnum, std::string path, std::string name, UInt32 checksum, double dsize, double ssize) {} + virtual void defineVFChar (UInt32 c, std::vector *dvi) {} +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp new file mode 100644 index 00000000000..f17a82c02f7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.cpp @@ -0,0 +1,192 @@ +/************************************************************************* +** VFReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include "Font.h" +#include "VFActions.h" +#include "VFReader.h" +#include "macros.h" + +using namespace std; + + +/** Converts a TFM fix point value to double (PS point units). */ +static inline double fix2double (FixWord fix) { + const double pt2bp = 72/72.27; + return double(fix)/(1 << 20)*pt2bp; +} + + +VFReader::VFReader (istream &is) + : StreamReader(is), _actions(0), _designSize(0) { +} + + +VFReader::~VFReader () { +} + + +VFActions* VFReader::replaceActions (VFActions *a) { + VFActions *ret = _actions; + _actions = a; + return ret; +} + + +/** Reads a single VF command from the current position of the input stream and calls the + * corresponding cmdFOO method. The execution can be influenced by a function of type ApproveOpcode. + * It takes an opcode and returns true if the command is supposed to be executed. + * @param[in] approve function to approve invocation of the action assigned to command + * @return opcode of the executed command */ +int VFReader::executeCommand (ApproveAction approve) { + int opcode = readByte(); + if (!isStreamValid() || opcode < 0) // at end of file? + throw VFException("invalid VF file"); + + bool approved = !approve || approve(opcode); + VFActions *actions = _actions; + if (!approved) + replaceActions(0); // disable actions + + if (opcode <= 241) // short character definition? + cmdShortChar(opcode); + else if (opcode >= 243 && opcode <= 246) // font definition? + cmdFontDef(opcode-243+1); + else { + switch (opcode) { + case 242: cmdLongChar(); break; // long character definition + case 247: cmdPre(); break; // preamble + case 248: cmdPost(); break; // postamble + default : { // invalid opcode + replaceActions(actions); // reenable actions + ostringstream oss; + oss << "undefined VF command (opcode " << opcode << ')'; + throw VFException(oss.str()); + } + } + } + replaceActions(actions); // reenable actions + return opcode; +} + + +bool VFReader::executeAll () { + clearStream(); // reset all status bits + if (!isStreamValid()) + return false; + seek(0); // move file pointer to first byte of the input stream + while (!eof() && executeCommand() != 248); // stop reading after post (248) + return true; +} + + +/// Returns true if op indicates the preamble or a font definition +static bool is_pre_or_fontdef (int op) {return op > 242;} +static bool is_chardef (int op) {return op < 243;} + + +bool VFReader::executePreambleAndFontDefs () { + clearStream(); + if (!isStreamValid()) + return false; + seek(0); // move file pointer to first byte of the input stream + while (!eof() && executeCommand(is_pre_or_fontdef) > 242); // stop reading after last font definition + return true; +} + + +bool VFReader::executeCharDefs () { + clearStream(); + if (!isStreamValid()) + return false; + seek(0); + while (!eof() && executeCommand(is_chardef) < 243); // stop reading after last char definition + return true; +} + +////////////////////////////////////////////////////////////////////////////// + +/** Reads and executes DVI preamble command. */ +void VFReader::cmdPre () { + UInt32 i = readUnsigned(1); // identification number (should be 2) + UInt32 k = readUnsigned(1); // length of following comment + string cmt = readString(k); // comment + UInt32 cs = readUnsigned(4); // check sum to be compared with TFM cecksum + UInt32 ds = readUnsigned(4); // design size (same as TFM design size) (fix_word) + _designSize = fix2double(ds); + if (i != 202) + throw VFException("invalid identification value in preamble"); + if (_actions) + _actions->preamble(cmt, cs, ds); +} + + +void VFReader::cmdPost () { + while ((readUnsigned(1)) == 248); // skip fill bytes + if (_actions) + _actions->postamble(); +} + + +void VFReader::cmdLongChar () { + UInt32 pl = readUnsigned(4); // packet length (length of DVI subroutine) + if (!_actions) + seek(8+pl, ios::cur); // skip remaining char definition bytes + else { + UInt32 cc = readUnsigned(4); // character code + readUnsigned(4); // character width from corresponding TFM file + vector *dvi = new vector(pl); // DVI subroutine + readBytes(pl, *dvi); + _actions->defineVFChar(cc, dvi); // call template method for user actions + } +} + + +/** Reads and executes short_char_x command. + * @param[in] pl packet length (length of DVI subroutine) */ +void VFReader::cmdShortChar (int pl) { + if (!_actions) + seek(4+pl, ios::cur); // skip char definition bytes + else { + UInt32 cc = readUnsigned(1); // character code + readUnsigned(3); // character width from corresponding TFM file + vector *dvi = new vector(pl); // DVI subroutine + readBytes(pl, *dvi); + _actions->defineVFChar(cc, dvi); // call template method for user actions + } +} + + +void VFReader::cmdFontDef (int len) { + UInt32 fontnum = readUnsigned(len); // font number + UInt32 checksum = readUnsigned(4); // font checksum (to be compared with corresponding TFM checksum) + UInt32 ssize = readUnsigned(4); // scaled size of font relative to design size (fix_word) + UInt32 dsize = readUnsigned(4); // design size of font (same as TFM design size) (fix_word) + UInt32 pathlen = readUnsigned(1); // length of font path + UInt32 namelen = readUnsigned(1); // length of font name + string fontpath = readString(pathlen); + string fontname = readString(namelen); + if (_actions) { + double ss = fix2double(ssize); + double ds = fix2double(dsize); + _actions->defineVFFont(fontnum, fontpath, fontname, checksum, ds, ss*_designSize); + } +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h new file mode 100644 index 00000000000..00467f5746a --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VFReader.h @@ -0,0 +1,65 @@ +/************************************************************************* +** VFReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_VFREADER_H +#define DVISVGM_VFREADER_H + +#include "MessageException.h" +#include "StreamReader.h" +#include "types.h" + + +struct VFException : public MessageException +{ + VFException (const std::string &msg) : MessageException(msg) {} +}; + + +struct VFActions; + + +class VFReader : public StreamReader +{ + typedef bool (*ApproveAction)(int); + public: + VFReader (std::istream &is); + virtual ~VFReader (); + VFActions* replaceActions (VFActions *a); + bool executeAll (); + bool executePreambleAndFontDefs (); + bool executeCharDefs (); + + protected: + int executeCommand (ApproveAction approve=0); + + // the following methods represent the VF commands + // they are called by executeCommand and should not be used directly + void cmdPre (); + void cmdPost (); + void cmdShortChar (int pl); + void cmdLongChar (); + void cmdFontDef (int len); + + private: + VFActions *_actions; ///< actions to execute when reading a VF command + double _designSize; ///< design size of currently read VF +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h new file mode 100644 index 00000000000..dc27327a60c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorIterator.h @@ -0,0 +1,109 @@ +/************************************************************************* +** VectorIterator.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef VECTORITERATOR_H +#define VECTORITERATOR_H + +#include +#include "MessageException.h" + + +struct IteratorException : public MessageException +{ + IteratorException (const std::string &msg) : MessageException(msg) {} +}; + + +template +class VectorIterator +{ + public: + VectorIterator (std::vector &vec) : _vector(vec), _pos(0) {} + + VectorIterator operator ++ () { + _pos++; + return *this; + } + + VectorIterator operator ++ (int) { + VectorIterator it = *this; + _pos++; + return it; + } + + VectorIterator operator -- () { + _pos--; + return *this; + } + + VectorIterator operator -- (int) { + VectorIterator it = *this; + _pos--; + return it; + } + + VectorIterator operator += (int n) { + _pos += n; + return *this; + } + + VectorIterator operator -= (int n) { + _pos -= n; + return *this; + } + + VectorIterator operator + (int n) { + return VectorIterator(_vector, _pos+n); + } + + VectorIterator operator - (int n) { + return VectorIterator(_vector, _pos-n); + } + + T& operator * () { + if (valid()) + return _vector[_pos]; + throw IteratorException("invalid access"); + } + + T* operator -> () { + if (valid()) + return &_vector[_pos]; + throw IteratorException("invalid access"); + } + + 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 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();} + void invalidate () {_pos = _vector.size();} + + protected: + VectorIterator (std::vector &vec, size_t pos) : _vector(vec), _pos(pos) {} + + private: + std::vector &_vector; + size_t _pos; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h new file mode 100644 index 00000000000..f3043943669 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/VectorStream.h @@ -0,0 +1,46 @@ +/************************************************************************* +** VectorStream.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_VECTORSTREAM_H +#define DVISVGM_VECTORSTREAM_H + +#include +#include + + +template +struct VectorStreamBuffer : public std::streambuf +{ + VectorStreamBuffer (std::vector &source) { + setg((char*)&source[0], (char*)&source[0], (char*)&source[0]+source.size()); + } +}; + + +template +class VectorInputStream : public std::istream +{ + public: + VectorInputStream (std::vector &source) : std::istream(&_buf), _buf(source) {} + private: + VectorStreamBuffer _buf; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp new file mode 100644 index 00000000000..6b73f7cd436 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.cpp @@ -0,0 +1,74 @@ +/************************************************************************* +** XMLDocument.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include "macros.h" +#include "XMLDocument.h" + +using namespace std; + +XMLDocument::XMLDocument (XMLElementNode *root) + : _rootElement(root) +{ +} + + +XMLDocument::~XMLDocument () { + clear(); +} + + +void XMLDocument::clear () { + delete _rootElement; + _rootElement = 0; + FORALL(_nodes, list::iterator, i) + delete *i; + _nodes.clear(); +} + + +void XMLDocument::append (XMLNode *node) { + if (!node) + return; + XMLElementNode *newRoot = dynamic_cast(node); + if (newRoot) { // there can only be one root element node in the document + delete _rootElement; // so if there is already one... + _rootElement = newRoot; // ...we replace it + } + else + _nodes.push_back(node); +} + + +void XMLDocument::setRootNode (XMLElementNode *root) { + delete _rootElement; + _rootElement = root; +} + + +ostream& XMLDocument::write (ostream &os) const { + if (_rootElement) { // no root element => no output + os << "\n"; + FORALL(_nodes, list::const_iterator, i) + (*i)->write(os); + _rootElement->write(os); + } + return os; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h new file mode 100644 index 00000000000..e3b2727dfd9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLDocument.h @@ -0,0 +1,42 @@ +/************************************************************************* +** XMLDocument.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_XMLDOCUMENT_H +#define DVISVGM_XMLDOCUMENT_H + +#include "XMLNode.h" + +class XMLDocument +{ + public: + XMLDocument (XMLElementNode *root=0); + ~XMLDocument (); + void clear (); + void append (XMLNode *node); + void setRootNode (XMLElementNode *root); + const XMLElementNode* getRootElement () const {return _rootElement;} + std::ostream& write (std::ostream &os) const; + + private: + std::list _nodes; + XMLElementNode *_rootElement; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp new file mode 100644 index 00000000000..4fd3b997391 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.cpp @@ -0,0 +1,254 @@ +/************************************************************************* +** XMLNode.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include "macros.h" +#include "XMLNode.h" +#include "XMLString.h" + +using namespace std; + + +XMLElementNode::XMLElementNode (const string &n) : _name(n) { +} + + +XMLElementNode::XMLElementNode (const XMLElementNode &node) + : _name(node._name), _attributes(node._attributes) +{ + FORALL(node._children, ChildList::const_iterator, it) + _children.push_back((*it)->clone()); +} + + +XMLElementNode::~XMLElementNode () { + while (!_children.empty()) { + delete _children.back(); + _children.pop_back(); + } +} + + +void XMLElementNode::clear () { + _attributes.clear(); + while (!_children.empty()) { + delete _children.back(); + _children.pop_back(); + } +} + + +void XMLElementNode::addAttribute (const string &name, const string &value) { + _attributes[name] = value; +} + + +void XMLElementNode::addAttribute (const string &name, double value) { + _attributes[name] = XMLString(value); +} + + +void XMLElementNode::append (XMLNode *child) { + if (!child) + return; + XMLTextNode *textNode1 = dynamic_cast(child); + if (!textNode1 || _children.empty()) + _children.push_back(child); + else { + if (XMLTextNode *textNode2 = dynamic_cast(_children.back())) + textNode2->append(textNode1); // merge two consecutive text nodes + else + _children.push_back(child); + } +} + + +void XMLElementNode::append (const string &str) { + if (_children.empty() || !dynamic_cast(_children.back())) + _children.push_back(new XMLTextNode(str)); + else + static_cast(_children.back())->append(str); +} + + +void XMLElementNode::prepend (XMLNode *child) { + if (!child) + return; + XMLTextNode *textNode1 = dynamic_cast(child); + if (!textNode1 || _children.empty()) + _children.push_front(child); + else { + if (XMLTextNode *textNode2 = dynamic_cast(_children.front())) + textNode2->prepend(textNode1); // merge two consecutive text nodes + else + _children.push_front(child); + } +} + + +/** Inserts a new child node before a given child node already present. The latter + * will be the following sibling of the node to be inserted. If there's no such + * node present, nothing is inserted. + * @param[in] child node to be inserted + * @param[in] sibling following sibling of 'child' + * @return true on success */ +bool XMLElementNode::insertBefore (XMLNode *child, XMLNode *sibling) { + ChildList::iterator it = _children.begin(); + while (it != _children.end() && *it != sibling) + ++it; + if (it == _children.end()) + return false; + _children.insert(it, child); + return true; +} + + +/** Inserts a new child node after a given child node already present. The latter + * will be the preceding sibling of the node to be inserted. If there's no such + * node present, nothing is inserted. + * @param[in] child node to be inserted + * @param[in] sibling preceding sibling of 'child' + * @return true on success */ +bool XMLElementNode::insertAfter (XMLNode *child, XMLNode *sibling) { + ChildList::iterator it = _children.begin(); + while (it != _children.end() && *it != sibling) + ++it; + if (it == _children.end()) + return false; + _children.insert(++it, child); + return true; +} + + +/** Gets all descendant elements with a given name and given attribute. + * @param[in] name name of elements to find + * @param[in] attrName name of attribute to find + * @param[out] descendants all elements found + * @return true if at least one element was found */ +bool XMLElementNode::getDescendants (const char *name, const char *attrName, vector &descendants) const { + FORALL(_children, ChildList::const_iterator, it) { + if (XMLElementNode *elem = dynamic_cast(*it)) { + if ((!name || elem->getName() == name) && (!attrName || elem->hasAttribute(attrName))) + descendants.push_back(elem); + elem->getDescendants(name, attrName, descendants); + } + } + return !descendants.empty(); +} + + +/** Returns the first descendant element that matches the given properties in depth first order. + * @param[in] name element name; if 0, all elements are taken into account + * @param[in] attrName if not 0, only elements with an attribute of this name are considered + * @param[in] attrValue if not 0, only elements with attribute attrName="attrValue" are considered + * @return pointer to the found element or 0 */ +XMLElementNode* XMLElementNode::getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const { + FORALL(_children, ChildList::const_iterator, it) { + if (XMLElementNode *elem = dynamic_cast(*it)) { + if (!name || elem->getName() == name) { + const char *value; + if (!attrName || (((value = elem->getAttributeValue(attrName)) != 0) && (!attrValue || string(value) == attrValue))) + return elem; + } + if (XMLElementNode *descendant = elem->getFirstDescendant(name, attrName, attrValue)) + return descendant; + } + } + return 0; +} + + +ostream& XMLElementNode::write (ostream &os) const { + os << '<' << _name; + FORALL(_attributes, AttribMap::const_iterator, i) + os << ' ' << i->first << "='" << i->second << '\''; + if (_children.empty()) + os << "/>\n"; + else { + os << '>'; + if (dynamic_cast(_children.front())) + os << '\n'; + FORALL(_children, ChildList::const_iterator, i) + (*i)->write(os); + os << "\n"; + } + return os; +} + + +/** Returns true if this element has an attribute of given name. */ +bool XMLElementNode::hasAttribute (const string &name) const { + return _attributes.find(name) != _attributes.end(); +} + + +/** Returns the value of an attribute. + * @param[in] name name of attribute + * @return attribute value or 0 if attribute doesn't exist */ +const char* XMLElementNode::getAttributeValue(const std::string& name) const { + AttribMap::const_iterator it = _attributes.find(name); + if (it != _attributes.end()) + return it->second.c_str(); + return 0; +} + + +////////////////////// + +void XMLTextNode::append (XMLNode *node) { + if (XMLTextNode *tn = dynamic_cast(node)) + append(tn); + else + delete node; +} + + +void XMLTextNode::append (XMLTextNode *node) { + if (node) + _text += node->_text; + delete node; +} + + +void XMLTextNode::append (const string &str) { + _text += str; +} + + +void XMLTextNode::prepend (XMLNode *node) { + if (XMLTextNode *tn = dynamic_cast(node)) + _text = tn->_text + _text; + else + delete node; +} + + +////////////////////// + + +ostream& XMLCDataNode::write (ostream &os) const { + if (!_data.empty()) + os << "\n"; + return os; +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h new file mode 100644 index 00000000000..71bd5a8ada9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLNode.h @@ -0,0 +1,118 @@ +/************************************************************************* +** XMLNode.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_XMLNODE_H +#define DVISVGM_XMLNODE_H + +#include +#include +#include +#include + +#include "SpecialActions.h" + + +struct XMLNode +{ + virtual ~XMLNode () {} + virtual XMLNode* clone () const =0; + virtual void clear () =0; + virtual std::ostream& write (std::ostream &os) const =0; +}; + + +class XMLElementNode : public XMLNode +{ + typedef std::map AttribMap; + typedef std::list ChildList; + public: + XMLElementNode (const std::string &name); + XMLElementNode (const XMLElementNode &node); + ~XMLElementNode (); + XMLElementNode* clone () const {return new XMLElementNode(*this);} + void clear (); + void addAttribute (const std::string &name, const std::string &value); + void addAttribute (const std::string &name, double value); + void append (XMLNode *child); + void append (const std::string &str); + void prepend (XMLNode *child); + void remove (XMLNode *child) {_children.remove(child);} + bool insertAfter (XMLNode *child, XMLNode *sibling); + bool insertBefore (XMLNode *child, XMLNode *sibling); + bool hasAttribute (const std::string &name) const; + const char* getAttributeValue (const std::string &name) const; + bool getDescendants (const char *name, const char *attrName, std::vector &descendants) const; + XMLElementNode* getFirstDescendant (const char *name, const char *attrName, const char *attrValue) const; + std::ostream& write (std::ostream &os) const; + bool empty () const {return _children.empty();} + const std::list& children () const {return _children;} + const std::string& getName () const {return _name;} + + private: + std::string _name; // element name (...) + AttribMap _attributes; + ChildList _children; // child nodes +}; + + +class XMLTextNode : public XMLNode +{ + public: + XMLTextNode (const std::string &str) : _text(str) {} + XMLTextNode* clone () const {return new XMLTextNode(*this);} + void clear () {_text.clear();} + void append (XMLNode *node); + void append (XMLTextNode *node); + void append (const std::string &str); + void prepend (XMLNode *child); + std::ostream& write (std::ostream &os) const {return os << _text;} + const std::string& getText () const {return _text;} + + private: + std::string _text; +}; + + +class XMLCommentNode : public XMLNode +{ + public: + XMLCommentNode (const std::string &str) : _text(str) {} + XMLCommentNode* clone () const {return new XMLCommentNode(*this);} + void clear () {_text.clear();} + std::ostream& write (std::ostream &os) const {return os << "\n";} + + private: + std::string _text; +}; + + +class XMLCDataNode : public XMLNode +{ + public: + XMLCDataNode (const std::string &d) : _data(d) {} + XMLCDataNode* clone () const {return new XMLCDataNode(*this);} + void clear () {_data.clear();} + std::ostream& write (std::ostream &os) const; + + private: + std::string _data; +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp new file mode 100644 index 00000000000..97aa91ee4ab --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.cpp @@ -0,0 +1,104 @@ +/************************************************************************* +** XMLString.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include "macros.h" +#include "types.h" +#include "Unicode.h" +#include "XMLString.h" + +using namespace std; + +int XMLString::DECIMAL_PLACES = 0; + + +static string translate (UInt32 c) { + switch (c) { + case '<' : return "<"; + case '&' : return "&"; + case '"' : return """; + case '\'': return "'"; + } + return Unicode::utf8(c); +} + + +XMLString::XMLString (const string &str, bool plain) { + if (plain) + assign(str); + else { + FORALL(str, string::const_iterator, i) + *this += translate(*i); + } +} + + +XMLString::XMLString (const char *str, bool plain) { + if (str) { + if (plain) + assign(str); + else { + while (*str) + *this += translate(*str++); + } + } +} + + +XMLString::XMLString (int n, bool cast) { + if (cast) { + stringstream ss; + ss << n; + ss >> *this; + } + else + *this += translate(n); +} + + +/** Rounds a floating point value to a given number of decimal places. + * @param[in] x number to round + * @param[in] n number of decimal places (must be between 1 and 6) + * @return rounded value */ +static inline double round (double x, int n) { + const long pow10[] = {10L, 100L, 1000L, 10000L, 100000L, 1000000L}; + const double eps = 1e-7; + n--; + if (x >= 0) + return floor(x*pow10[n]+0.5+eps)/pow10[n]; + return ceil(x*pow10[n]-0.5-eps)/pow10[n]; +} + + +XMLString::XMLString (double x) { + stringstream ss; + if (fabs(x) < 1e-8) + x = 0; + if (DECIMAL_PLACES > 0) + x = round(x, DECIMAL_PLACES); + // don't use fixed and setprecision() manipulators here to avoid + // banker's rounding applied in some STL implementations + ss << x; + ss >> *this; +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h new file mode 100644 index 00000000000..f160c4427a4 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/XMLString.h @@ -0,0 +1,40 @@ +/************************************************************************* +** XMLString.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_XMLSTRING_H +#define DVISVGM_XMLSTRING_H + +#include + + +class XMLString : public std::string +{ + public: + XMLString () : std::string() {} + XMLString (const char *str, bool plain=false); + XMLString (const std::string &str, bool plain=false); + XMLString (int n, bool cast=true); + XMLString (double x); + + static int DECIMAL_PLACES; ///< number of decimal places applied to floating point values (0-6) +}; + + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp new file mode 100644 index 00000000000..db0dd86fd69 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -0,0 +1,335 @@ +/************************************************************************* +** dvisvgm.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "gzstream.h" +#include "CommandLine.h" +#include "DVIToSVG.h" +#include "DVIToSVGActions.h" +#include "EPSToSVG.h" +#include "FileFinder.h" +#include "FilePath.h" +#include "FileSystem.h" +#include "Font.h" +#include "FontCache.h" +#include "FontEngine.h" +#include "FontMap.h" +#include "Ghostscript.h" +#include "HtmlSpecialHandler.h" +#include "InputReader.h" +#include "Message.h" +#include "PageSize.h" +#include "PSInterpreter.h" +#include "PsSpecialHandler.h" +#include "SignalHandler.h" +#include "SpecialManager.h" +#include "SVGOutput.h" +#include "System.h" + +#ifdef __MSVC__ +#include +#else +extern "C" { +#include +} +#endif + +using namespace std; + + +//////////////////////////////////////////////////////////////////////////////// + +static void show_help (const CommandLine &cmd) { + cout << PACKAGE_STRING "\n\n"; + cmd.help(cmd.help_arg()); + cout << "\nCopyright (C) 2005-2015 Martin Gieseking \n\n"; +} + + +static string remove_path (string fname) { + fname = FileSystem::adaptPathSeperators(fname); + size_t slashpos = fname.rfind('/'); + if (slashpos == string::npos) + return fname; + return fname.substr(slashpos+1); +} + + +static string ensure_suffix (string fname, bool eps) { + size_t dotpos = remove_path(fname).rfind('.'); + if (dotpos == string::npos) + fname += (eps ? ".eps" : ".dvi"); + return fname; +} + + +static string get_transformation_string (const CommandLine &args) { + ostringstream oss; + if (args.rotate_given()) + oss << 'R' << args.rotate_arg() << ",w/2,h/2"; + if (args.translate_given()) + oss << 'T' << args.translate_arg(); + if (args.scale_given()) + oss << 'S' << args.scale_arg(); + if (args.transform_given()) + oss << args.transform_arg(); + return oss.str(); +} + + +static void set_libgs (CommandLine &args) { +#if !defined(DISABLE_GS) && !defined(HAVE_LIBGS) + if (args.libgs_given()) + Ghostscript::LIBGS_NAME = args.libgs_arg(); + else if (getenv("LIBGS")) + Ghostscript::LIBGS_NAME = getenv("LIBGS"); +#endif +} + + +static bool set_cache_dir (const CommandLine &args) { + if (args.cache_given() && !args.cache_arg().empty()) { + if (args.cache_arg() == "none") + PhysicalFont::CACHE_PATH = 0; + else if (FileSystem::exists(args.cache_arg().c_str())) + PhysicalFont::CACHE_PATH = args.cache_arg().c_str(); + else + Message::wstream(true) << "cache directory '" << args.cache_arg() << "' does not exist (caching disabled)\n"; + } + else if (const char *userdir = FileSystem::userdir()) { + static string cachepath = userdir + string("/.dvisvgm/cache"); + if (!FileSystem::exists(cachepath.c_str())) + FileSystem::mkdir(cachepath.c_str()); + PhysicalFont::CACHE_PATH = cachepath.c_str(); + } + if (args.cache_given() && args.cache_arg().empty()) { + cout << "cache directory: " << (PhysicalFont::CACHE_PATH ? PhysicalFont::CACHE_PATH : "(none)") << '\n'; + FontCache::fontinfo(PhysicalFont::CACHE_PATH, cout, true); + return false; + } + return true; +} + + +static bool check_bbox (const string &bboxstr) { + const char *formats[] = {"none", "min", "dvi", 0}; + for (const char **p=formats; *p; ++p) + if (bboxstr == *p) + return true; + if (isalpha(bboxstr[0])) { + try { + PageSize size(bboxstr); + return true; + } + catch (const PageSizeException &e) { + Message::estream(true) << "invalid bounding box format '" << bboxstr << "'\n"; + return false; + } + } + try { + BoundingBox bbox; + bbox.set(bboxstr); + return true; + } + catch (const MessageException &e) { + Message::estream(true) << e.what() << '\n'; + return false; + } +} + + +static void print_version (bool extended) { + ostringstream oss; + oss << PACKAGE_STRING; + if (extended) { + if (strlen(TARGET_SYSTEM) > 0) + oss << " (" TARGET_SYSTEM ")"; + int len = oss.str().length(); + oss << "\n" << string(len, '-') << "\n" + "clipper: " << CLIPPER_VERSION "\n" + "freetype: " << FontEngine::version() << "\n"; + + Ghostscript gs; + string gsver = gs.revision(true); + if (!gsver.empty()) + oss << "Ghostscript: " << gsver + "\n"; + oss << +#ifdef MIKTEX + "MiKTeX: " << FileFinder::version() << "\n" +#else + "kpathsea: " << FileFinder::version() << "\n" +#endif + "potrace: " << (strchr(potrace_version(), ' ') ? strchr(potrace_version(), ' ')+1 : "unknown") << "\n" + "zlib: " << zlibVersion(); + } + cout << oss.str() << endl; +} + + +static void init_fontmap (const CommandLine &args) { + const char *mapseq = args.fontmap_given() ? args.fontmap_arg().c_str() : 0; + bool additional = mapseq && strchr("+-=", *mapseq); + if (!mapseq || additional) { + const char *mapfiles[] = {"ps2pk.map", "dvipdfm.map", "psfonts.map", 0}; + bool found = false; + for (const char **p=mapfiles; *p && !found; p++) + found = FontMap::instance().read(*p); + if (!found) + Message::wstream(true) << "none of the default map files could be found"; + } + if (mapseq) + FontMap::instance().read(mapseq); +} + + +int main (int argc, char *argv[]) { + CommandLine args; + args.parse(argc, argv); + if (args.error()) + return 1; + + if (argc == 1 || args.help_given()) { + show_help(args); + return 0; + } + + Message::COLORIZE = args.color_given(); + + try { + FileFinder::init(argv[0], "dvisvgm", !args.no_mktexmf_given()); + } + catch (MessageException &e) { + Message::estream(true) << e.what() << '\n'; + return 0; + } + + set_libgs(args); + if (args.version_given()) { + print_version(args.version_arg()); + return 0; + } + if (args.list_specials_given()) { + DVIToSVG::setProcessSpecials(); + SpecialManager::instance().writeHandlerInfo(cout); + return 0; + } + + if (!set_cache_dir(args)) + return 0; + + if (argc > 1 && args.numFiles() < 1) { + Message::estream(true) << "no input file given\n"; + return 1; + } + + if (args.stdout_given() && args.zip_given()) { + Message::estream(true) << "writing SVGZ files to stdout is not supported\n"; + return 1; + } + + if (!check_bbox(args.bbox_arg())) + return 1; + + if (args.progress_given()) { + DVIReader::COMPUTE_PROGRESS = args.progress_given(); + SpecialActions::PROGRESSBAR_DELAY = args.progress_arg(); + } + Color::SUPPRESS_COLOR_NAMES = !args.colornames_given(); + SVGTree::CREATE_STYLE = !args.no_styles_given(); + SVGTree::USE_FONTS = !args.no_fonts_given(); + SVGTree::CREATE_USE_ELEMENTS = args.no_fonts_arg() < 1; + SVGTree::ZOOM_FACTOR = args.zoom_arg(); + SVGTree::RELATIVE_PATH_CMDS = args.relative_given(); + SVGTree::MERGE_CHARS = !args.no_merge_given(); + DVIToSVG::TRACE_MODE = args.trace_all_given() ? (args.trace_all_arg() ? 'a' : 'm') : 0; + Message::LEVEL = args.verbosity_arg(); + PhysicalFont::EXACT_BBOX = args.exact_given(); + PhysicalFont::KEEP_TEMP_FILES = args.keep_given(); + PhysicalFont::METAFONT_MAG = max(1.0, args.mag_arg()); + XMLString::DECIMAL_PLACES = max(0, min(6, args.precision_arg())); + if (!HtmlSpecialHandler::setLinkMarker(args.linkmark_arg())) + Message::wstream(true) << "invalid argument '"+args.linkmark_arg()+"' supplied for option --linkmark\n"; + double start_time = System::time(); + bool eps_given=false; +#ifndef DISABLE_GS + eps_given = args.eps_given(); + PsSpecialHandler::COMPUTE_CLIPPATHS_INTERSECTIONS = args.clipjoin_given(); + PsSpecialHandler::SHADING_SEGMENT_OVERLAP = args.grad_overlap_given(); + PsSpecialHandler::SHADING_SEGMENT_SIZE = max(1, args.grad_segments_arg()); + PsSpecialHandler::SHADING_SIMPLIFY_DELTA = args.grad_simplify_arg(); +#endif + string inputfile = ensure_suffix(args.file(0), eps_given); + ifstream ifs(inputfile.c_str(), ios::binary|ios::in); + if (!ifs) { + Message::estream(true) << "can't open file '" << inputfile << "' for reading\n"; + return 0; + } + try { + SVGOutput out(args.stdout_given() ? 0 : inputfile.c_str(), args.output_arg(), args.zip_given() ? args.zip_arg() : 0); + SignalHandler::instance().start(); +#ifndef DISABLE_GS + if (args.eps_given()) { + EPSToSVG eps2svg(inputfile, out); + eps2svg.convert(); + Message::mstream().indent(0); + Message::mstream(false, Message::MC_PAGE_NUMBER) + << "file converted in " << (System::time()-start_time) << " seconds\n"; + } + else +#endif + { + init_fontmap(args); + DVIToSVG dvi2svg(ifs, out); + const char *ignore_specials = args.no_specials_given() ? (args.no_specials_arg().empty() ? "*" : args.no_specials_arg().c_str()) : 0; + dvi2svg.setProcessSpecials(ignore_specials, true); + dvi2svg.setPageTransformation(get_transformation_string(args)); + dvi2svg.setPageSize(args.bbox_arg()); + + pair pageinfo; + dvi2svg.convert(args.page_arg(), &pageinfo); + Message::mstream().indent(0); + Message::mstream(false, Message::MC_PAGE_NUMBER) << "\n" << pageinfo.first << " of " << pageinfo.second << " page"; + if (pageinfo.second > 1) + Message::mstream(false, Message::MC_PAGE_NUMBER) << 's'; + Message::mstream(false, Message::MC_PAGE_NUMBER) << " converted in " << (System::time()-start_time) << " seconds\n"; + } + } + catch (DVIException &e) { + Message::estream() << "\nDVI error: " << e.what() << '\n'; + } + catch (PSException &e) { + Message::estream() << "\nPostScript error: " << e.what() << '\n'; + } + catch (SignalException &e) { + Message::wstream().clearline(); + Message::wstream(true) << "execution interrupted by user\n"; + } + catch (MessageException &e) { + Message::estream(true) << e.what() << '\n'; + } + FileFinder::finish(); + return 0; +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp new file mode 100644 index 00000000000..2893c299891 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.cpp @@ -0,0 +1,172 @@ +// ============================================================================ +// gzstream, C++ iostream classes wrapping the zlib compression library. +// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// ============================================================================ +// +// File : gzstream.C +// Revision : $Revision: 1.3 $ +// Revision_date : $Date: 2006/01/05 16:22:35 $ +// Author(s) : Deepak Bandyopadhyay, Lutz Kettner +// +// Standard streambuf implementation following Nicolai Josuttis, "The +// Standard C++ Library". +// ============================================================================ + +#include "gzstream.h" +#include +#include // for memcpy + +#ifdef GZSTREAM_NAMESPACE +namespace GZSTREAM_NAMESPACE { +#endif + +const int gzstreambuf::bufferSize = 47+256; // size of data buff + +// ---------------------------------------------------------------------------- +// Internal classes to implement gzstream. See header file for user classes. +// ---------------------------------------------------------------------------- + +// -------------------------------------- +// class gzstreambuf: +// -------------------------------------- + +gzstreambuf* gzstreambuf::open(const char* name, int compression_level, int open_mode) { + if ( is_open()) + return (gzstreambuf*)0; + mode = open_mode; + // no append nor read/write mode + if ((mode & std::ios::ate) || (mode & std::ios::app) + || ((mode & std::ios::in) && (mode & std::ios::out))) + return (gzstreambuf*)0; + if (compression_level < 1) + compression_level = 1; + else if (compression_level > 9) + compression_level = 9; + char fmode[10]; + char* fmodeptr = fmode; + if ( mode & std::ios::in) + *fmodeptr++ = 'r'; + else if ( mode & std::ios::out) + *fmodeptr++ = 'w'; + *fmodeptr++ = 'b'; + *fmodeptr++ = '0'+compression_level; + *fmodeptr = '\0'; + file = gzopen( name, fmode); + if (file == 0) + return (gzstreambuf*)0; + opened = 1; + return this; +} + +gzstreambuf * gzstreambuf::close() { + if ( is_open()) { + sync(); + opened = 0; + if ( gzclose( file) == Z_OK) + return this; + } + return (gzstreambuf*)0; +} + +int gzstreambuf::underflow() { // used for input buffer only + if ( gptr() && ( gptr() < egptr())) + return * reinterpret_cast( gptr()); + + if ( ! (mode & std::ios::in) || ! opened) + return EOF; + // Josuttis' implementation of inbuf + int n_putback = gptr() - eback(); + if ( n_putback > 4) + n_putback = 4; + memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback); + + int num = gzread( file, buffer+4, bufferSize-4); + if (num <= 0) // ERROR or EOF + return EOF; + + // reset buffer pointers + setg( buffer + (4 - n_putback), // beginning of putback area + buffer + 4, // read position + buffer + 4 + num); // end of buffer + + // return next character + return * reinterpret_cast( gptr()); +} + +int gzstreambuf::flush_buffer() { + // Separate the writing of the buffer from overflow() and + // sync() operation. + int w = pptr() - pbase(); + if ( gzwrite( file, pbase(), w) != w) + return EOF; + pbump( -w); + return w; +} + +int gzstreambuf::overflow( int c) { // used for output buffer only + if ( ! ( mode & std::ios::out) || ! opened) + return EOF; + if (c != EOF) { + *pptr() = c; + pbump(1); + } + if ( flush_buffer() == EOF) + return EOF; + return c; +} + +int gzstreambuf::sync() { + // Changed to use flush_buffer() instead of overflow( EOF) + // which caused improper behavior with std::endl and flush(), + // bug reported by Vincent Ricard. + if ( pptr() && pptr() > pbase()) { + if ( flush_buffer() == EOF) + return -1; + } + return 0; +} + +// -------------------------------------- +// class gzstreambase: +// -------------------------------------- + +gzstreambase::gzstreambase( const char* name, int compression_level, int mode) { + init( &buf); + open( name, compression_level, mode); +} + +gzstreambase::~gzstreambase() { + buf.close(); +} + +void gzstreambase::open( const char* name, int compression_level, int open_mode) { + if ( ! buf.open( name, compression_level, open_mode)) + clear( rdstate() | std::ios::badbit); +} + +void gzstreambase::close() { + if ( buf.is_open()) + if ( ! buf.close()) + clear( rdstate() | std::ios::badbit); +} + +#ifdef GZSTREAM_NAMESPACE +} // namespace GZSTREAM_NAMESPACE +#endif + +// ============================================================================ +// EOF // diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h new file mode 100644 index 00000000000..60f38c4fac7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/gzstream.h @@ -0,0 +1,121 @@ +// ============================================================================ +// gzstream, C++ iostream classes wrapping the zlib compression library. +// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// ============================================================================ +// +// File : gzstream.h +// Revision : $Revision: 1.3 $ +// Revision_date : $Date: 2006/01/05 16:22:35 $ +// Author(s) : Deepak Bandyopadhyay, Lutz Kettner +// +// Standard streambuf implementation following Nicolai Josuttis, "The +// Standard C++ Library". +// ============================================================================ + +#ifndef GZSTREAM_H +#define GZSTREAM_H 1 + +// standard C++ with new header file names and std:: namespace +#include +#include +#include + +#ifdef GZSTREAM_NAMESPACE +namespace GZSTREAM_NAMESPACE { +#endif + +// ---------------------------------------------------------------------------- +// Internal classes to implement gzstream. See below for user classes. +// ---------------------------------------------------------------------------- + +class gzstreambuf : public std::streambuf { +private: + static const int bufferSize; // size of data buff + // totals 512 bytes under g++ for igzstream at the end. + + gzFile file; // file handle for compressed file + char buffer[47+256]; // data buffer + char opened; // open/close state of stream + int mode; // I/O mode + + int flush_buffer(); +public: + gzstreambuf() : opened(0) { + setp( buffer, buffer + (bufferSize-1)); + setg( buffer + 4, // beginning of putback area + buffer + 4, // read position + buffer + 4); // end position + // ASSERT: both input & output capabilities will not be used together + } + int is_open() { return opened; } + gzstreambuf* open(const char* name, int compression_level, int open_mode); + gzstreambuf* close(); + ~gzstreambuf() { close(); } + + virtual int overflow( int c = EOF); + virtual int underflow(); + virtual int sync(); +}; + +class gzstreambase : virtual public std::ios { +protected: + gzstreambuf buf; +public: + gzstreambase() { init(&buf); } + gzstreambase( const char* name, int compression_level, int open_mode); + ~gzstreambase(); + void open( const char* name, int compression_level, int open_mode); + void close(); + gzstreambuf* rdbuf() { return &buf; } +}; + +// ---------------------------------------------------------------------------- +// User classes. Use igzstream and ogzstream analogously to ifstream and +// ofstream respectively. They read and write files based on the gz* +// function interface of the zlib. Files are compatible with gzip compression. +// ---------------------------------------------------------------------------- + +class igzstream : public gzstreambase, public std::istream { +public: + igzstream() : std::istream( &buf) {} + igzstream( const char* name, int compression_level, int open_mode = std::ios::in) + : gzstreambase(name, compression_level, open_mode), std::istream( &buf) {} + gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } + void open( const char* name, int compression_level, int open_mode = std::ios::in) { + gzstreambase::open( name, compression_level, open_mode); + } +}; + +class ogzstream : public gzstreambase, public std::ostream { +public: + ogzstream() : std::ostream( &buf) {} + ogzstream( const char* name, int compression_level, int mode = std::ios::out) + : gzstreambase(name, compression_level, mode), std::ostream( &buf) {} + gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } + void open( const char* name, int compression_level, int open_mode = std::ios::out) { + gzstreambase::open(name, compression_level, open_mode); + } +}; + +#ifdef GZSTREAM_NAMESPACE +} // namespace GZSTREAM_NAMESPACE +#endif + +#endif // GZSTREAM_H +// ============================================================================ +// EOF // + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/iapi.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/iapi.h new file mode 100644 index 00000000000..8e29d938d03 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/iapi.h @@ -0,0 +1,300 @@ +/* Copyright (C) 2001-2006 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* $Id: iapi.h 9043 2008-08-28 22:48:19Z giles $ */ + +/* + * Public API for Ghostscript interpreter + * for use both as DLL and for static linking. + * + * Should work for Windows, OS/2, Linux, Mac. + * + * DLL exported functions should be as similar as possible to imain.c + * You will need to include "ierrors.h". + * + * Current problems: + * 1. Ghostscript does not support multiple instances. + * 2. Global variables in gs_main_instance_default() + * and gsapi_instance_counter + */ + +/* Exported functions may need different prefix + * GSDLLEXPORT marks functions as exported + * GSDLLAPI is the calling convention used on functions exported + * by Ghostscript + * GSDLLCALL is used on callback functions called by Ghostscript + * When you include this header file in the caller, you may + * need to change the definitions by defining these + * before including this header file. + * Make sure you get the calling convention correct, otherwise your + * program will crash either during callbacks or soon after returning + * due to stack corruption. + */ + +#ifndef iapi_INCLUDED +# define iapi_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WINDOWS_) || defined(__WINDOWS__) +# ifndef _Windows +# define _Windows +# endif +#endif + +#ifdef _Windows +# ifndef GSDLLEXPORT +# define GSDLLEXPORT __declspec(dllexport) +# endif +# ifndef GSDLLAPI +# define GSDLLAPI __stdcall +# endif +# ifndef GSDLLCALL +# define GSDLLCALL __stdcall +# endif +#endif /* _Windows */ + +#if defined(OS2) && defined(__IBMC__) +# ifndef GSDLLAPI +# define GSDLLAPI _System +# endif +# ifndef GSDLLCALL +# define GSDLLCALL _System +# endif +#endif /* OS2 && __IBMC */ + +#ifdef __MACOS__ +# pragma export on +#endif + +#ifndef GSDLLEXPORT +# define GSDLLEXPORT +#endif +#ifndef GSDLLAPI +# define GSDLLAPI +#endif +#ifndef GSDLLCALL +# define GSDLLCALL +#endif + +#if defined(__IBMC__) +# define GSDLLAPIPTR * GSDLLAPI +# define GSDLLCALLPTR * GSDLLCALL +#else +# define GSDLLAPIPTR GSDLLAPI * +# define GSDLLCALLPTR GSDLLCALL * +#endif + +#ifndef display_callback_DEFINED +# define display_callback_DEFINED +typedef struct display_callback_s display_callback; +#endif + +typedef struct gsapi_revision_s { + const char *product; + const char *copyright; + long revision; + long revisiondate; +} gsapi_revision_t; + + +/* Get version numbers and strings. + * This is safe to call at any time. + * You should call this first to make sure that the correct version + * of the Ghostscript is being used. + * pr is a pointer to a revision structure. + * len is the size of this structure in bytes. + * Returns 0 if OK, or if len too small (additional parameters + * have been added to the structure) it will return the required + * size of the structure. + */ +GSDLLEXPORT int GSDLLAPI +gsapi_revision(gsapi_revision_t *pr, int len); + +/* + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * Ghostscript supports only one instance. + * The current implementation uses a global static instance + * counter to make sure that only a single instance is used. + * If you try to create two instances, the second attempt + * will return < 0 and set pinstance to NULL. + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ +/* Create a new instance of Ghostscript. + * This instance is passed to most other API functions. + * The caller_handle will be provided to callback functions. + */ + +GSDLLEXPORT int GSDLLAPI +gsapi_new_instance(void **pinstance, void *caller_handle); + +/* + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * Ghostscript supports only one instance. + * The current implementation uses a global static instance + * counter to make sure that only a single instance is used. + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ +/* Destroy an instance of Ghostscript + * Before you call this, Ghostscript must have finished. + * If Ghostscript has been initialised, you must call gsapi_exit() + * before gsapi_delete_instance. + */ +GSDLLEXPORT void GSDLLAPI +gsapi_delete_instance(void *instance); + +/* Set the callback functions for stdio + * The stdin callback function should return the number of + * characters read, 0 for EOF, or -1 for error. + * The stdout and stderr callback functions should return + * the number of characters written. + * If a callback address is NULL, the real stdio will be used. + */ +GSDLLEXPORT int GSDLLAPI +gsapi_set_stdio(void *instance, + int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len), + int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len), + int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len)); + +/* Set the callback function for polling. + * This is used for handling window events or cooperative + * multitasking. This function will only be called if + * Ghostscript was compiled with CHECK_INTERRUPTS + * as described in gpcheck.h. + * The polling function should return 0 if all is well, + * and negative if it wants ghostscript to abort. + * The polling function must be fast. + */ +GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance, + int (GSDLLCALLPTR poll_fn)(void *caller_handle)); + +/* Set the display device callback structure. + * If the display device is used, this must be called + * after gsapi_new_instance() and before gsapi_init_with_args(). + * See gdevdisp.h for more details. + */ +GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback( + void *instance, display_callback *callback); + + +/* Initialise the interpreter. + * This calls gs_main_init_with_args() in imainarg.c + * 1. If quit or EOF occur during gsapi_init_with_args(), + * the return value will be e_Quit. This is not an error. + * You must call gsapi_exit() and must not call any other + * gsapi_XXX functions. + * 2. If usage info should be displayed, the return value will be e_Info + * which is not an error. Do not call gsapi_exit(). + * 3. Under normal conditions this returns 0. You would then + * call one or more gsapi_run_*() functions and then finish + * with gsapi_exit(). + */ +GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance, + int argc, char **argv); + +/* + * The gsapi_run_* functions are like gs_main_run_* except + * that the error_object is omitted. + * If these functions return <= -100, either quit or a fatal + * error has occured. You then call gsapi_exit() next. + * The only exception is gsapi_run_string_continue() + * which will return e_NeedInput if all is well. + */ + +GSDLLEXPORT int GSDLLAPI +gsapi_run_string_begin(void *instance, + int user_errors, int *pexit_code); + +GSDLLEXPORT int GSDLLAPI +gsapi_run_string_continue(void *instance, + const char *str, unsigned int length, int user_errors, int *pexit_code); + +GSDLLEXPORT int GSDLLAPI +gsapi_run_string_end(void *instance, + int user_errors, int *pexit_code); + +GSDLLEXPORT int GSDLLAPI +gsapi_run_string_with_length(void *instance, + const char *str, unsigned int length, int user_errors, int *pexit_code); + +GSDLLEXPORT int GSDLLAPI +gsapi_run_string(void *instance, + const char *str, int user_errors, int *pexit_code); + +GSDLLEXPORT int GSDLLAPI +gsapi_run_file(void *instance, + const char *file_name, int user_errors, int *pexit_code); + + +/* Exit the interpreter. + * This must be called on shutdown if gsapi_init_with_args() + * has been called, and just before gsapi_delete_instance(). + */ +GSDLLEXPORT int GSDLLAPI +gsapi_exit(void *instance); + +/* Visual Tracer */ +/* This function is only for debug purpose clients */ +struct vd_trace_interface_s; +GSDLLEXPORT void GSDLLAPI +gsapi_set_visual_tracer(struct vd_trace_interface_s *I); + + +/* function prototypes */ +typedef int (GSDLLAPIPTR PFN_gsapi_revision)( + gsapi_revision_t *pr, int len); +typedef int (GSDLLAPIPTR PFN_gsapi_new_instance)( + void **pinstance, void *caller_handle); +typedef void (GSDLLAPIPTR PFN_gsapi_delete_instance)( + void *instance); +typedef int (GSDLLAPIPTR PFN_gsapi_set_stdio)(void *instance, + int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len), + int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len), + int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len)); +typedef int (GSDLLAPIPTR PFN_gsapi_set_poll)(void *instance, + int(GSDLLCALLPTR poll_fn)(void *caller_handle)); +typedef int (GSDLLAPIPTR PFN_gsapi_set_display_callback)( + void *instance, display_callback *callback); +typedef int (GSDLLAPIPTR PFN_gsapi_init_with_args)( + void *instance, int argc, char **argv); +typedef int (GSDLLAPIPTR PFN_gsapi_run_string_begin)( + void *instance, int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_run_string_continue)( + void *instance, const char *str, unsigned int length, + int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_run_string_end)( + void *instance, int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)( + void *instance, const char *str, unsigned int length, + int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_run_string)( + void *instance, const char *str, + int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance, + const char *file_name, int user_errors, int *pexit_code); +typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance); +typedef void (GSDLLAPIPTR PFN_gsapi_set_visual_tracer) + (struct vd_trace_interface_s *I); + + +#ifdef __MACOS__ +#pragma export off +#endif + +#ifdef __cplusplus +} /* extern 'C' protection */ +#endif + +#endif /* iapi_INCLUDED */ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ierrors.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ierrors.h new file mode 100644 index 00000000000..3184341177e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ierrors.h @@ -0,0 +1,153 @@ +/* Copyright (C) 2001-2006 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* $Id: ierrors.h 8022 2007-06-05 22:23:38Z giles $ */ +/* Definition of error codes */ + +#ifndef ierrors_INCLUDED +# define ierrors_INCLUDED + +/* + * DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY. + * THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER. + * USE gserrors.h IN THE LIBRARY. + */ + +/* + * A procedure that may return an error always returns + * a non-negative value (zero, unless otherwise noted) for success, + * or negative for failure. + * We use ints rather than an enum to avoid a lot of casting. + */ + +/* Define the error name table */ +extern const char *const gs_error_names[]; + + /* ------ PostScript Level 1 errors ------ */ + +#define e_unknownerror (-1) /* unknown error */ +#define e_dictfull (-2) +#define e_dictstackoverflow (-3) +#define e_dictstackunderflow (-4) +#define e_execstackoverflow (-5) +#define e_interrupt (-6) +#define e_invalidaccess (-7) +#define e_invalidexit (-8) +#define e_invalidfileaccess (-9) +#define e_invalidfont (-10) +#define e_invalidrestore (-11) +#define e_ioerror (-12) +#define e_limitcheck (-13) +#define e_nocurrentpoint (-14) +#define e_rangecheck (-15) +#define e_stackoverflow (-16) +#define e_stackunderflow (-17) +#define e_syntaxerror (-18) +#define e_timeout (-19) +#define e_typecheck (-20) +#define e_undefined (-21) +#define e_undefinedfilename (-22) +#define e_undefinedresult (-23) +#define e_unmatchedmark (-24) +#define e_VMerror (-25) /* must be the last Level 1 error */ + +#define LEVEL1_ERROR_NAMES\ + "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\ + "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\ + "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\ + "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\ + "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\ + "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror" + + /* ------ Additional Level 2 errors (also in DPS) ------ */ + +#define e_configurationerror (-26) +#define e_undefinedresource (-27) +#define e_unregistered (-28) + +#define LEVEL2_ERROR_NAMES\ + "configurationerror", "undefinedresource", "unregistered" + + /* ------ Additional DPS errors ------ */ + +#define e_invalidcontext (-29) +/* invalidid is for the NeXT DPS extension. */ +#define e_invalidid (-30) + +#define DPS_ERROR_NAMES\ + "invalidcontext", "invalidid" + +#define ERROR_NAMES\ + LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_ERROR_NAMES + + /* ------ Pseudo-errors used internally ------ */ + +/* + * Internal code for a fatal error. + * gs_interpret also returns this for a .quit with a positive exit code. + */ +#define e_Fatal (-100) + +/* + * Internal code for the .quit operator. + * The real quit code is an integer on the operand stack. + * gs_interpret returns this only for a .quit with a zero exit code. + */ +#define e_Quit (-101) + +/* + * Internal code for a normal exit from the interpreter. + * Do not use outside of interp.c. + */ +#define e_InterpreterExit (-102) + +/* + * Internal code that indicates that a procedure has been stored in the + * remap_proc of the graphics state, and should be called before retrying + * the current token. This is used for color remapping involving a call + * back into the interpreter -- inelegant, but effective. + */ +#define e_RemapColor (-103) + +/* + * Internal code to indicate we have underflowed the top block + * of the e-stack. + */ +#define e_ExecStackUnderflow (-104) + +/* + * Internal code for the vmreclaim operator with a positive operand. + * We need to handle this as an error because otherwise the interpreter + * won't reload enough of its state when the operator returns. + */ +#define e_VMreclaim (-105) + +/* + * Internal code for requesting more input from run_string. + */ +#define e_NeedInput (-106) + +/* + * Internal code for a normal exit when usage info is displayed. + * This allows Window versions of Ghostscript to pause until + * the message can be read. + */ +#define e_Info (-110) + +/* + * Define which error codes require re-executing the current object. + */ +#define ERROR_IS_INTERRUPT(ecode)\ + ((ecode) == e_interrupt || (ecode) == e_timeout) + +#endif /* ierrors_INCLUDED */ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h new file mode 100644 index 00000000000..50deb9417c1 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/macros.h @@ -0,0 +1,42 @@ +/************************************************************************* +** macros.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_MACROS_H +#define DVISVGM_MACROS_H + +#define FORALL(container, itertype, itervar) \ + for (itertype itervar=(container).begin(); itervar != (container).end(); ++itervar) + +#define IMPLEMENT_ARITHMETIC_OPERATOR(class, op) \ + inline class operator op (class a, const class &b) { \ + return a op##= b; \ + } + +#define IMPLEMENT_ARITHMETIC_OPERATOR2(class, scalar, op) \ + inline class operator op (class a, scalar b) { \ + return a op##= b; \ + } + +#define IMPLEMENT_OUTPUT_OPERATOR(class) \ + inline std::ostream& operator << (std::ostream &os, class obj) { \ + return obj.write(os); \ + } + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd new file mode 100644 index 00000000000..c5321e3444b --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.dtd @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml new file mode 100644 index 00000000000..f56f219a0a8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml @@ -0,0 +1,178 @@ + + + + + + + dvisvgm + [options] dvifile + -E [options] epsfile + This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG. + + +
+ + + +
+
+ + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ + + + + + + + +
+
+ + + + + + +
+
+
+ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp new file mode 100644 index 00000000000..a9a818a3fe7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/psdefs.cpp @@ -0,0 +1,95 @@ +/************************************************************************* +** psdefs.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#include "PSInterpreter.h" + +const char *PSInterpreter::PSDEFS = +"3 dict dup begin/Install{matrix setmatrix}def/HWResolution[72 72]def/PageSize[" +"10000 10000]def end setpagedevice/@dodraw true store/@patcnt 0 store/@SD syste" +"mdict def/@UD userdict def true setglobal @SD/:save @SD/save get put @SD/:rest" +"ore @SD/restore get put @SD/:gsave @SD/gsave get put @SD/:grestore @SD/grestor" +"e get put @SD/:grestoreall @SD/grestoreall get put @SD/:newpath @SD/newpath ge" +"t put @SD/:stroke @SD/stroke get put @SD/:fill @SD/fill get put @SD/:eofill @S" +"D/eofill get put @SD/:clip @SD/clip get put @SD/:eoclip @SD/eoclip get put @SD" +"/:charpath @SD/charpath get put @SD/:show @SD/show get put @SD/.setopacityalph" +"a known not{@SD/.setopacityalpha{pop}put}if @SD/prseq{-1 1{-1 roll =only( )pri" +"nt}for(\\n)print}put @SD/prcmd{( )exch(\\ndvi.)3{print}repeat prseq}put @SD/cv" +"xall{{cvx}forall}put @SD/defpr{[exch[/copy @SD]cvxall 5 -1 roll dup 6 1 roll[/" +"get/exec]cvxall 6 -1 roll dup 7 1 roll 4 -1 roll dup 5 1 roll dup length strin" +"g cvs/prcmd cvx]cvx def}put @SD/querypos{{currentpoint}stopped{$error/newerror" +" false put}{2(querypos)prcmd}ifelse}put @SD/applyscalevals{1 0 transform 0 0 t" +"ransform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 0 1 transform 0 0" +" transform 3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 1 0 transform d" +"up mul exch dup dup mul 3 -1 roll add sqrt div 3(applyscalevals)prcmd}put @SD/" +"prpath{{2(moveto)prcmd}{2(lineto)prcmd}{6(curveto)prcmd}{0(closepath)prcmd}pat" +"hforall}put @SD/charpath{/@dodraw false store :charpath/@dodraw true store}put" +" @SD/show{@dodraw{dup :gsave currentpoint :newpath moveto true charpath eofill" +" :grestore/@dodraw false store :show/@dodraw true store}if}put @SD/newpath{:ne" +"wpath 0 1(newpath)prcmd}put @SD/stroke{@dodraw{1 1(newpath)prcmd prpath 0(stro" +"ke)prcmd :newpath}{:stroke}ifelse}put @SD/fill{@dodraw{1 1(newpath)prcmd prpat" +"h 0(fill)prcmd :newpath}{:fill}ifelse}put @SD/eofill{@dodraw{1 1(newpath)prcmd" +" prpath 0(eofill)prcmd :newpath}{:eofill}ifelse}put @SD/clip{:clip 0 1(newpath" +")prcmd prpath 0(clip)prcmd}put @SD/eoclip{:eoclip 1 1(newpath)prcmd prpath 0(e" +"oclip)prcmd}put @SD/shfill{begin currentdict/ShadingType known currentdict/Col" +"orSpace known and currentdict/DataSource known and currentdict/Function known " +"not and ShadingType 4 ge and DataSource type/arraytype eq and{<>begin currentdict ColorSpace known{ShadingType ColorSpace load" +" bgknown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}ifelse S" +"hadingType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown{ColorS" +"pace load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcmd}if en" +"d}if end}put/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlineto neg" +" 0 rlineto closepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0 lt x" +"or{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto ex" +"ch 0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:newpat" +"h dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse cli" +"p :newpath}put @SD/rectfill{gsave :newpath dup type/arraytype eq{aload length " +"4 idiv{@rectcc}repeat}{@rectcc}ifelse fill grestore}put @SD/rectstroke{gsave :" +"newpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ifelse s" +"troke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/clippath " +"0 defpr/sysexec{@SD exch get exec}def/adddot{dup length 1 add string dup 0 46 " +"put dup 3 -1 roll 1 exch putinterval}def/setlinewidth{dup/setlinewidth sysexec" +" applyscalevals 1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defp" +"r/setmiterlimit 1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec applyscal" +"evals exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}def/setgst" +"ate{currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(setlinecap)prcmd cu" +"rrentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiterlimit)prcmd curr" +"entrgbcolor 3(setrgbcolor)prcmd 6 array currentmatrix aload pop 6(setmatrix)pr" +"cmd currentdash mark 3 1 roll exch aload length 1 add -1 roll counttomark(setd" +"ash)prcmd pop}def/save{@UD begin/@saveID vmstatus pop pop def end :save @saveI" +"D 1(save)prcmd}def/restore{:restore setgstate @UD/@saveID known{@UD begin @sav" +"eID end}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore setgsta" +"te 0(grestore)prcmd}def/grestoreall{:grestoreall setstate 0(grestoreall)prcmd}" +"def/rotate{dup type/arraytype ne{dup 1(rotate)prcmd}if/rotate sysexec}def/scal" +"e{dup type/arraytype ne{2 copy 2(scale)prcmd}if/scale sysexec}def/translate{du" +"p type/arraytype ne{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatri" +"x{dup/setmatrix sysexec aload pop 6(setmatrix)prcmd}def/initmatrix{matrix setm" +"atrix}def/concat{matrix currentmatrix matrix concatmatrix setmatrix}def/makepa" +"ttern{gsave<>begin dup/XUID[1000000 @patcnt]put mx/makepattern " +"sysexec dup dup begin PatternType @patcnt BBox aload pop XStep YStep PaintType" +" mx aload pop 15(makepattern)prcmd :newpath matrix setmatrix PaintProc 0 1(mak" +"epattern)prcmd end/@patcnt @patcnt 1 add store end grestore}def/setpattern{beg" +"in PatternType 1 eq{PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[currentco" +"lorspace aload length -1 roll pop]setcolorspace/setcolor sysexec XUID aload po" +"p exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd}{/setpattern sy" +"sexec}ifelse end}def/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysex" +"ec}ifelse}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbc" +"olor 3 defpr/.setopacityalpha{dup/.setopacityalpha sysexec 1(setopacityalpha)p" +"rcmd}def "; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h new file mode 100644 index 00000000000..54a028fe085 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/types.h @@ -0,0 +1,84 @@ +/************************************************************************* +** types.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2015 Martin Gieseking ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** 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 . ** +*************************************************************************/ + +#ifndef DVISVGM_TYPES_H +#define DVISVGM_TYPES_H + +namespace internal { + template + class ERROR_inttype_not_available + { + ERROR_inttype_not_available(); + }; + + template + struct select + { + typedef A T; + }; + + template + struct select + { + typedef B T; + }; +} + + +// Retrieves a signed integer type with sizeof(T) == BYTES +template +struct int_t +{ + typedef typename internal::select >::T>::T>::T>::T>::T T; +}; + + +// Retrieves an unsigned integer type with sizeof(T) == BYTES +template +struct int_t +{ + typedef typename internal::select >::T>::T>::T>::T>::T T; +}; + + +// Machine independent definition of sized integer types +typedef int_t<1, true>::T Int8; +typedef int_t<2, true>::T Int16; +typedef int_t<4, true>::T Int32; +typedef int_t<8, true>::T Int64; +typedef int_t<1, false>::T UInt8; +typedef int_t<2, false>::T UInt16; +typedef int_t<4, false>::T UInt32; +typedef int_t<8, false>::T UInt64; + +typedef Int32 FixWord; +typedef UInt32 ScaledInt; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/Makefile.am new file mode 100644 index 00000000000..df0a4c53238 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/Makefile.am @@ -0,0 +1,10 @@ +noinst_LIBRARIES = libxxhash.a +libxxhash_a_SOURCES = xxhash.c xxhash.h +AM_CXXFLAGS = -Wall + +xxhash.c: xxhash.h + +@CODE_COVERAGE_RULES@ + +CLEANFILES = *.gcda *.gcno + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c new file mode 100644 index 00000000000..e6fb8f149a5 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c @@ -0,0 +1,915 @@ +/* +xxHash - Fast Hash algorithm +Copyright (C) 2012-2015, Yann Collet + +BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You can contact the author at : +- xxHash source repository : https://github.com/Cyan4973/xxHash +*/ + + +/************************************** +* Tuning parameters +**************************************/ +/* Unaligned memory access is automatically enabled for "common" CPU, such as x86. + * For others CPU, the compiler will be more cautious, and insert extra code to ensure aligned access is respected. + * If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance. + * You can also enable this parameter if you know your input data will always be aligned (boundaries of 4, for U32). + */ +#if defined(__ARM_FEATURE_UNALIGNED) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) +# define XXH_USE_UNALIGNED_ACCESS 1 +#endif + +/* XXH_ACCEPT_NULL_INPUT_POINTER : + * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. + * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. + * By default, this option is disabled. To enable it, uncomment below define : + */ +/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ + +/* XXH_FORCE_NATIVE_FORMAT : + * By default, xxHash library provides endian-independant Hash values, based on little-endian convention. + * Results are therefore identical for little-endian and big-endian CPU. + * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. + * Should endian-independance be of no importance for your application, you may set the #define below to 1. + * It will improve speed for Big-endian CPU. + * This option has no impact on Little_Endian CPU. + */ +#define XXH_FORCE_NATIVE_FORMAT 0 + + +/************************************** +* Compiler Specific Options +***************************************/ +#ifdef _MSC_VER /* Visual Studio */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +# define FORCE_INLINE static __forceinline +#else +# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# ifdef __GNUC__ +# define FORCE_INLINE static inline __attribute__((always_inline)) +# else +# define FORCE_INLINE static inline +# endif +# else +# define FORCE_INLINE static +# endif /* __STDC_VERSION__ */ +#endif + + +/************************************** +* Includes & Memory related functions +***************************************/ +#include "xxhash.h" +/* Modify the local functions below should you wish to use some other memory routines */ +/* for malloc(), free() */ +#include +static void* XXH_malloc(size_t s) { return malloc(s); } +static void XXH_free (void* p) { free(p); } +/* for memcpy() */ +#include +static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } + + +/************************************** +* Basic Types +***************************************/ +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# include + typedef uint8_t BYTE; + typedef uint16_t U16; + typedef uint32_t U32; + typedef int32_t S32; + typedef uint64_t U64; +#else + typedef unsigned char BYTE; + typedef unsigned short U16; + typedef unsigned int U32; + typedef signed int S32; + typedef unsigned long long U64; +#endif + +static U32 XXH_read32(const void* memPtr) +{ + U32 val32; + memcpy(&val32, memPtr, 4); + return val32; +} + +static U64 XXH_read64(const void* memPtr) +{ + U64 val64; + memcpy(&val64, memPtr, 8); + return val64; +} + + + +/****************************************** +* Compiler-specific Functions and Macros +******************************************/ +#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ +#if defined(_MSC_VER) +# define XXH_rotl32(x,r) _rotl(x,r) +# define XXH_rotl64(x,r) _rotl64(x,r) +#else +# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) +# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) +#endif + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap32 _byteswap_ulong +# define XXH_swap64 _byteswap_uint64 +#elif GCC_VERSION >= 403 +# define XXH_swap32 __builtin_bswap32 +# define XXH_swap64 __builtin_bswap64 +#else +static U32 XXH_swap32 (U32 x) +{ + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff ); +} +static U64 XXH_swap64 (U64 x) +{ + return ((x << 56) & 0xff00000000000000ULL) | + ((x << 40) & 0x00ff000000000000ULL) | + ((x << 24) & 0x0000ff0000000000ULL) | + ((x << 8) & 0x000000ff00000000ULL) | + ((x >> 8) & 0x00000000ff000000ULL) | + ((x >> 24) & 0x0000000000ff0000ULL) | + ((x >> 40) & 0x000000000000ff00ULL) | + ((x >> 56) & 0x00000000000000ffULL); +} +#endif + + +/*************************************** +* Architecture Macros +***************************************/ +typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; +#ifndef XXH_CPU_LITTLE_ENDIAN /* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example using a compiler switch */ +static const int one = 1; +# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one)) +#endif + + +/***************************** +* Memory reads +*****************************/ +typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; + +FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align) +{ + if (align==XXH_unaligned) + return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); + else + return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr); +} + +FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) +{ + return XXH_readLE32_align(ptr, endian, XXH_unaligned); +} + +FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) +{ + if (align==XXH_unaligned) + return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); + else + return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr); +} + +FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) +{ + return XXH_readLE64_align(ptr, endian, XXH_unaligned); +} + + +/*************************************** +* Macros +***************************************/ +#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */ + + +/*************************************** +* Constants +***************************************/ +#define PRIME32_1 2654435761U +#define PRIME32_2 2246822519U +#define PRIME32_3 3266489917U +#define PRIME32_4 668265263U +#define PRIME32_5 374761393U + +#define PRIME64_1 11400714785074694791ULL +#define PRIME64_2 14029467366897019727ULL +#define PRIME64_3 1609587929392839161ULL +#define PRIME64_4 9650029242287828579ULL +#define PRIME64_5 2870177450012600261ULL + + +/***************************** +* Simple Hash Functions +*****************************/ +FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) +{ + const BYTE* p = (const BYTE*)input; + const BYTE* bEnd = p + len; + U32 h32; +#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (p==NULL) + { + len=0; + bEnd=p=(const BYTE*)(size_t)16; + } +#endif + + if (len>=16) + { + const BYTE* const limit = bEnd - 16; + U32 v1 = seed + PRIME32_1 + PRIME32_2; + U32 v2 = seed + PRIME32_2; + U32 v3 = seed + 0; + U32 v4 = seed - PRIME32_1; + + do + { + v1 += XXH_get32bits(p) * PRIME32_2; + v1 = XXH_rotl32(v1, 13); + v1 *= PRIME32_1; + p+=4; + v2 += XXH_get32bits(p) * PRIME32_2; + v2 = XXH_rotl32(v2, 13); + v2 *= PRIME32_1; + p+=4; + v3 += XXH_get32bits(p) * PRIME32_2; + v3 = XXH_rotl32(v3, 13); + v3 *= PRIME32_1; + p+=4; + v4 += XXH_get32bits(p) * PRIME32_2; + v4 = XXH_rotl32(v4, 13); + v4 *= PRIME32_1; + p+=4; + } + while (p<=limit); + + h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + } + else + { + h32 = seed + PRIME32_5; + } + + h32 += (U32) len; + + while (p+4<=bEnd) + { + h32 += XXH_get32bits(p) * PRIME32_3; + h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; + p+=4; + } + + while (p> 15; + h32 *= PRIME32_2; + h32 ^= h32 >> 13; + h32 *= PRIME32_3; + h32 ^= h32 >> 16; + + return h32; +} + + +unsigned XXH32 (const void* input, size_t len, unsigned seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH32_state_t state; + XXH32_reset(&state, seed); + XXH32_update(&state, input, len); + return XXH32_digest(&state); +#else + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + +# if !defined(XXH_USE_UNALIGNED_ACCESS) + if ((((size_t)input) & 3) == 0) /* Input is 4-bytes aligned, leverage the speed benefit */ + { + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); + else + return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); + } +# endif + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); + else + return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); +#endif +} + +FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align) +{ + const BYTE* p = (const BYTE*)input; + const BYTE* bEnd = p + len; + U64 h64; +#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (p==NULL) + { + len=0; + bEnd=p=(const BYTE*)(size_t)32; + } +#endif + + if (len>=32) + { + const BYTE* const limit = bEnd - 32; + U64 v1 = seed + PRIME64_1 + PRIME64_2; + U64 v2 = seed + PRIME64_2; + U64 v3 = seed + 0; + U64 v4 = seed - PRIME64_1; + + do + { + v1 += XXH_get64bits(p) * PRIME64_2; + p+=8; + v1 = XXH_rotl64(v1, 31); + v1 *= PRIME64_1; + v2 += XXH_get64bits(p) * PRIME64_2; + p+=8; + v2 = XXH_rotl64(v2, 31); + v2 *= PRIME64_1; + v3 += XXH_get64bits(p) * PRIME64_2; + p+=8; + v3 = XXH_rotl64(v3, 31); + v3 *= PRIME64_1; + v4 += XXH_get64bits(p) * PRIME64_2; + p+=8; + v4 = XXH_rotl64(v4, 31); + v4 *= PRIME64_1; + } + while (p<=limit); + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + + v1 *= PRIME64_2; + v1 = XXH_rotl64(v1, 31); + v1 *= PRIME64_1; + h64 ^= v1; + h64 = h64 * PRIME64_1 + PRIME64_4; + + v2 *= PRIME64_2; + v2 = XXH_rotl64(v2, 31); + v2 *= PRIME64_1; + h64 ^= v2; + h64 = h64 * PRIME64_1 + PRIME64_4; + + v3 *= PRIME64_2; + v3 = XXH_rotl64(v3, 31); + v3 *= PRIME64_1; + h64 ^= v3; + h64 = h64 * PRIME64_1 + PRIME64_4; + + v4 *= PRIME64_2; + v4 = XXH_rotl64(v4, 31); + v4 *= PRIME64_1; + h64 ^= v4; + h64 = h64 * PRIME64_1 + PRIME64_4; + } + else + { + h64 = seed + PRIME64_5; + } + + h64 += (U64) len; + + while (p+8<=bEnd) + { + U64 k1 = XXH_get64bits(p); + k1 *= PRIME64_2; + k1 = XXH_rotl64(k1,31); + k1 *= PRIME64_1; + h64 ^= k1; + h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; + p+=8; + } + + if (p+4<=bEnd) + { + h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; + h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; + p+=4; + } + + while (p> 33; + h64 *= PRIME64_2; + h64 ^= h64 >> 29; + h64 *= PRIME64_3; + h64 ^= h64 >> 32; + + return h64; +} + + +unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH64_state_t state; + XXH64_reset(&state, seed); + XXH64_update(&state, input, len); + return XXH64_digest(&state); +#else + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + +# if !defined(XXH_USE_UNALIGNED_ACCESS) + if ((((size_t)input) & 7)==0) /* Input is aligned, let's leverage the speed advantage */ + { + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); + else + return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); + } +# endif + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); + else + return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); +#endif +} + +/**************************************************** +* Advanced Hash Functions +****************************************************/ + +/*** Allocation ***/ +typedef struct +{ + U64 total_len; + U32 seed; + U32 v1; + U32 v2; + U32 v3; + U32 v4; + U32 mem32[4]; /* defined as U32 for alignment */ + U32 memsize; +} XXH_istate32_t; + +typedef struct +{ + U64 total_len; + U64 seed; + U64 v1; + U64 v2; + U64 v3; + U64 v4; + U64 mem64[4]; /* defined as U64 for alignment */ + U32 memsize; +} XXH_istate64_t; + + +XXH32_state_t* XXH32_createState(void) +{ + XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); /* A compilation error here means XXH32_state_t is not large enough */ + return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); +} +XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +XXH64_state_t* XXH64_createState(void) +{ + XXH_STATIC_ASSERT(sizeof(XXH64_state_t) >= sizeof(XXH_istate64_t)); /* A compilation error here means XXH64_state_t is not large enough */ + return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); +} +XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + + +/*** Hash feed ***/ + +XXH_errorcode XXH32_reset(XXH32_state_t* state_in, U32 seed) +{ + XXH_istate32_t* state = (XXH_istate32_t*) state_in; + state->seed = seed; + state->v1 = seed + PRIME32_1 + PRIME32_2; + state->v2 = seed + PRIME32_2; + state->v3 = seed + 0; + state->v4 = seed - PRIME32_1; + state->total_len = 0; + state->memsize = 0; + return XXH_OK; +} + +XXH_errorcode XXH64_reset(XXH64_state_t* state_in, unsigned long long seed) +{ + XXH_istate64_t* state = (XXH_istate64_t*) state_in; + state->seed = seed; + state->v1 = seed + PRIME64_1 + PRIME64_2; + state->v2 = seed + PRIME64_2; + state->v3 = seed + 0; + state->v4 = seed - PRIME64_1; + state->total_len = 0; + state->memsize = 0; + return XXH_OK; +} + + +FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const void* input, size_t len, XXH_endianess endian) +{ + XXH_istate32_t* state = (XXH_istate32_t *) state_in; + const BYTE* p = (const BYTE*)input; + const BYTE* const bEnd = p + len; + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (input==NULL) return XXH_ERROR; +#endif + + state->total_len += len; + + if (state->memsize + len < 16) /* fill in tmp buffer */ + { + XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len); + state->memsize += (U32)len; + return XXH_OK; + } + + if (state->memsize) /* some data left from previous update */ + { + XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize); + { + const U32* p32 = state->mem32; + state->v1 += XXH_readLE32(p32, endian) * PRIME32_2; + state->v1 = XXH_rotl32(state->v1, 13); + state->v1 *= PRIME32_1; + p32++; + state->v2 += XXH_readLE32(p32, endian) * PRIME32_2; + state->v2 = XXH_rotl32(state->v2, 13); + state->v2 *= PRIME32_1; + p32++; + state->v3 += XXH_readLE32(p32, endian) * PRIME32_2; + state->v3 = XXH_rotl32(state->v3, 13); + state->v3 *= PRIME32_1; + p32++; + state->v4 += XXH_readLE32(p32, endian) * PRIME32_2; + state->v4 = XXH_rotl32(state->v4, 13); + state->v4 *= PRIME32_1; + p32++; + } + p += 16-state->memsize; + state->memsize = 0; + } + + if (p <= bEnd-16) + { + const BYTE* const limit = bEnd - 16; + U32 v1 = state->v1; + U32 v2 = state->v2; + U32 v3 = state->v3; + U32 v4 = state->v4; + + do + { + v1 += XXH_readLE32(p, endian) * PRIME32_2; + v1 = XXH_rotl32(v1, 13); + v1 *= PRIME32_1; + p+=4; + v2 += XXH_readLE32(p, endian) * PRIME32_2; + v2 = XXH_rotl32(v2, 13); + v2 *= PRIME32_1; + p+=4; + v3 += XXH_readLE32(p, endian) * PRIME32_2; + v3 = XXH_rotl32(v3, 13); + v3 *= PRIME32_1; + p+=4; + v4 += XXH_readLE32(p, endian) * PRIME32_2; + v4 = XXH_rotl32(v4, 13); + v4 *= PRIME32_1; + p+=4; + } + while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) + { + XXH_memcpy(state->mem32, p, bEnd-p); + state->memsize = (int)(bEnd-p); + } + + return XXH_OK; +} + +XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_update_endian(state_in, input, len, XXH_littleEndian); + else + return XXH32_update_endian(state_in, input, len, XXH_bigEndian); +} + + + +FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endianess endian) +{ + const XXH_istate32_t* state = (const XXH_istate32_t*) state_in; + const BYTE * p = (const BYTE*)state->mem32; + const BYTE* bEnd = (const BYTE*)(state->mem32) + state->memsize; + U32 h32; + + if (state->total_len >= 16) + { + h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); + } + else + { + h32 = state->seed + PRIME32_5; + } + + h32 += (U32) state->total_len; + + while (p+4<=bEnd) + { + h32 += XXH_readLE32(p, endian) * PRIME32_3; + h32 = XXH_rotl32(h32, 17) * PRIME32_4; + p+=4; + } + + while (p> 15; + h32 *= PRIME32_2; + h32 ^= h32 >> 13; + h32 *= PRIME32_3; + h32 ^= h32 >> 16; + + return h32; +} + + +U32 XXH32_digest (const XXH32_state_t* state_in) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_digest_endian(state_in, XXH_littleEndian); + else + return XXH32_digest_endian(state_in, XXH_bigEndian); +} + + +FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const void* input, size_t len, XXH_endianess endian) +{ + XXH_istate64_t * state = (XXH_istate64_t *) state_in; + const BYTE* p = (const BYTE*)input; + const BYTE* const bEnd = p + len; + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (input==NULL) return XXH_ERROR; +#endif + + state->total_len += len; + + if (state->memsize + len < 32) /* fill in tmp buffer */ + { + XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len); + state->memsize += (U32)len; + return XXH_OK; + } + + if (state->memsize) /* some data left from previous update */ + { + XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize); + { + const U64* p64 = state->mem64; + state->v1 += XXH_readLE64(p64, endian) * PRIME64_2; + state->v1 = XXH_rotl64(state->v1, 31); + state->v1 *= PRIME64_1; + p64++; + state->v2 += XXH_readLE64(p64, endian) * PRIME64_2; + state->v2 = XXH_rotl64(state->v2, 31); + state->v2 *= PRIME64_1; + p64++; + state->v3 += XXH_readLE64(p64, endian) * PRIME64_2; + state->v3 = XXH_rotl64(state->v3, 31); + state->v3 *= PRIME64_1; + p64++; + state->v4 += XXH_readLE64(p64, endian) * PRIME64_2; + state->v4 = XXH_rotl64(state->v4, 31); + state->v4 *= PRIME64_1; + p64++; + } + p += 32-state->memsize; + state->memsize = 0; + } + + if (p+32 <= bEnd) + { + const BYTE* const limit = bEnd - 32; + U64 v1 = state->v1; + U64 v2 = state->v2; + U64 v3 = state->v3; + U64 v4 = state->v4; + + do + { + v1 += XXH_readLE64(p, endian) * PRIME64_2; + v1 = XXH_rotl64(v1, 31); + v1 *= PRIME64_1; + p+=8; + v2 += XXH_readLE64(p, endian) * PRIME64_2; + v2 = XXH_rotl64(v2, 31); + v2 *= PRIME64_1; + p+=8; + v3 += XXH_readLE64(p, endian) * PRIME64_2; + v3 = XXH_rotl64(v3, 31); + v3 *= PRIME64_1; + p+=8; + v4 += XXH_readLE64(p, endian) * PRIME64_2; + v4 = XXH_rotl64(v4, 31); + v4 *= PRIME64_1; + p+=8; + } + while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) + { + XXH_memcpy(state->mem64, p, bEnd-p); + state->memsize = (int)(bEnd-p); + } + + return XXH_OK; +} + +XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH64_update_endian(state_in, input, len, XXH_littleEndian); + else + return XXH64_update_endian(state_in, input, len, XXH_bigEndian); +} + + + +FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endianess endian) +{ + const XXH_istate64_t * state = (const XXH_istate64_t *) state_in; + const BYTE * p = (const BYTE*)state->mem64; + const BYTE* bEnd = (const BYTE*)state->mem64 + state->memsize; + U64 h64; + + if (state->total_len >= 32) + { + U64 v1 = state->v1; + U64 v2 = state->v2; + U64 v3 = state->v3; + U64 v4 = state->v4; + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + + v1 *= PRIME64_2; + v1 = XXH_rotl64(v1, 31); + v1 *= PRIME64_1; + h64 ^= v1; + h64 = h64*PRIME64_1 + PRIME64_4; + + v2 *= PRIME64_2; + v2 = XXH_rotl64(v2, 31); + v2 *= PRIME64_1; + h64 ^= v2; + h64 = h64*PRIME64_1 + PRIME64_4; + + v3 *= PRIME64_2; + v3 = XXH_rotl64(v3, 31); + v3 *= PRIME64_1; + h64 ^= v3; + h64 = h64*PRIME64_1 + PRIME64_4; + + v4 *= PRIME64_2; + v4 = XXH_rotl64(v4, 31); + v4 *= PRIME64_1; + h64 ^= v4; + h64 = h64*PRIME64_1 + PRIME64_4; + } + else + { + h64 = state->seed + PRIME64_5; + } + + h64 += (U64) state->total_len; + + while (p+8<=bEnd) + { + U64 k1 = XXH_readLE64(p, endian); + k1 *= PRIME64_2; + k1 = XXH_rotl64(k1,31); + k1 *= PRIME64_1; + h64 ^= k1; + h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; + p+=8; + } + + if (p+4<=bEnd) + { + h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1; + h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; + p+=4; + } + + while (p> 33; + h64 *= PRIME64_2; + h64 ^= h64 >> 29; + h64 *= PRIME64_3; + h64 ^= h64 >> 32; + + return h64; +} + + +unsigned long long XXH64_digest (const XXH64_state_t* state_in) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH64_digest_endian(state_in, XXH_littleEndian); + else + return XXH64_digest_endian(state_in, XXH_bigEndian); +} + + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h new file mode 100644 index 00000000000..c60aa61571c --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h @@ -0,0 +1,192 @@ +/* + xxHash - Extremely Fast Hash algorithm + Header File + Copyright (C) 2012-2015, Yann Collet. + + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - xxHash source repository : https://github.com/Cyan4973/xxHash +*/ + +/* Notice extracted from xxHash homepage : + +xxHash is an extremely fast Hash algorithm, running at RAM speed limits. +It also successfully passes all tests from the SMHasher suite. + +Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) + +Name Speed Q.Score Author +xxHash 5.4 GB/s 10 +CrapWow 3.2 GB/s 2 Andrew +MumurHash 3a 2.7 GB/s 10 Austin Appleby +SpookyHash 2.0 GB/s 10 Bob Jenkins +SBox 1.4 GB/s 9 Bret Mulvey +Lookup3 1.2 GB/s 9 Bob Jenkins +SuperFastHash 1.2 GB/s 1 Paul Hsieh +CityHash64 1.05 GB/s 10 Pike & Alakuijala +FNV 0.55 GB/s 5 Fowler, Noll, Vo +CRC32 0.43 GB/s 9 +MD5-32 0.33 GB/s 10 Ronald L. Rivest +SHA1-32 0.28 GB/s 10 + +Q.Score is a measure of quality of the hash function. +It depends on successfully passing SMHasher test set. +10 is a perfect score. + +A 64-bits version, named XXH64, is available since r35. +It offers much better speed, but for 64-bits applications only. +Name Speed on 64 bits Speed on 32 bits +XXH64 13.8 GB/s 1.9 GB/s +XXH32 6.8 GB/s 6.0 GB/s +*/ + +#pragma once + +#if defined (__cplusplus) +extern "C" { +#endif + + +/***************************** +* Definitions +*****************************/ +#include /* size_t */ +typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; + + +/***************************** +* Namespace Emulation +*****************************/ +/* Motivations : + +If you need to include xxHash into your library, +but wish to avoid xxHash symbols to be present on your library interface +in an effort to avoid potential name collision if another library also includes xxHash, + +you can use XXH_NAMESPACE, which will automatically prefix any symbol from xxHash +with the value of XXH_NAMESPACE (so avoid to keep it NULL, and avoid numeric values). + +Note that no change is required within the calling program : +it can still call xxHash functions using their regular name. +They will be automatically translated by this header. +*/ +#ifdef XXH_NAMESPACE +# define XXH_CAT(A,B) A##B +# define XXH_NAME2(A,B) XXH_CAT(A,B) +# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) +# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) +# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) +# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) +# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) +# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) +# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) +# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) +# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) +# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) +# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) +# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) +#endif + + +/***************************** +* Simple Hash Functions +*****************************/ + +unsigned int XXH32 (const void* input, size_t length, unsigned seed); +unsigned long long XXH64 (const void* input, size_t length, unsigned long long seed); + +/* +XXH32() : + Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". + The memory between input & input+length must be valid (allocated and read-accessible). + "seed" can be used to alter the result predictably. + This function successfully passes all SMHasher tests. + Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s +XXH64() : + Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". + Faster on 64-bits systems. Slower on 32-bits systems. +*/ + + + +/***************************** +* Advanced Hash Functions +*****************************/ +typedef struct { long long ll[ 6]; } XXH32_state_t; +typedef struct { long long ll[11]; } XXH64_state_t; + +/* +These structures allow static allocation of XXH states. +States must then be initialized using XXHnn_reset() before first use. + +If you prefer dynamic allocation, please refer to functions below. +*/ + +XXH32_state_t* XXH32_createState(void); +XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); + +XXH64_state_t* XXH64_createState(void); +XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); + +/* +These functions create and release memory for XXH state. +States must then be initialized using XXHnn_reset() before first use. +*/ + + +XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned seed); +XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); +unsigned int XXH32_digest (const XXH32_state_t* statePtr); + +XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); +XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); +unsigned long long XXH64_digest (const XXH64_state_t* statePtr); + +/* +These functions calculate the xxHash of an input provided in multiple smaller packets, +as opposed to an input provided as a single block. + +XXH state space must first be allocated, using either static or dynamic method provided above. + +Start a new hash by initializing state with a seed, using XXHnn_reset(). + +Then, feed the hash state by calling XXHnn_update() as many times as necessary. +Obviously, input must be valid, meaning allocated and read accessible. +The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. + +Finally, you can produce a hash anytime, by using XXHnn_digest(). +This function returns the final nn-bits hash. +You can nonetheless continue feeding the hash state with more input, +and therefore get some new hashes, by calling again XXHnn_digest(). + +When you are done, don't forget to free XXH state space, using typically XXHnn_freeState(). +*/ + + +#if defined (__cplusplus) +} +#endif diff --git a/Build/source/texk/dvisvgm/version.ac b/Build/source/texk/dvisvgm/version.ac index 68ed2dd9df5..c48fac49e88 100644 --- a/Build/source/texk/dvisvgm/version.ac +++ b/Build/source/texk/dvisvgm/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current dvisvgm version -m4_define([dvisvgm_version], [1.11]) +m4_define([dvisvgm_version], [1.12]) -- cgit v1.2.3