diff options
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/README | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/Makefile.am | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/Makefile.in | 43 | ||||
-rwxr-xr-x | Build/source/texk/dvisvgm/configure | 26 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.cpp | 316 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.h | 174 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.6/src/DvisvgmSpecialHandler.cpp | 208 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.6/src/Makefile.am | 53 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/ChangeLog (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/ChangeLog) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/TL-Changes (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/TL-Changes) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/AUTHORS (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/AUTHORS) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/COPYING (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/COPYING) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/ChangeLog (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/ChangeLog) | 205 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/INSTALL (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/INSTALL) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/LGPL-2.1.txt (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/LGPL-2.1.txt) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/Makefile.am (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/Makefile.am) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/NEWS (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/NEWS) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/README (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/README) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/config.h.in (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/config.h.in) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/configure.ac (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/configure.ac) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/doc/Makefile.am (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/doc/Makefile.am) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.1 (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.1) | 84 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.txt.in (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.txt.in) | 46 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.cpp | 291 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.h | 105 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.h) | 10 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.cpp | 75 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMap.h) | 46 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.cpp) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.cpp) | 70 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.h) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.cpp) | 1 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.h) | 1 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Character.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Character.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.cpp) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.cpp) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.cpp | 316 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.h | 173 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DLLoader.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DLLoader.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIActions.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIActions.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.cpp) | 411 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.h) | 41 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVG.cpp) | 98 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVG.h) | 20 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.cpp) | 35 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.h) | 37 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.cpp | 354 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.h | 67 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSFile.cpp) | 14 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSFile.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.cpp) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.cpp) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.cpp) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.cpp) | 62 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.h) | 37 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.h) | 12 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.cpp) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.cpp) | 59 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.h) | 11 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.cpp) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.h) | 12 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.cpp) | 50 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontStyle.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontStyle.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.cpp) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.h) | 26 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.cpp) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.cpp) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Glyph.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Glyph.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GlyphTracerMessages.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GlyphTracerMessages.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/GraphicPath.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/GraphicPath.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.cpp) | 95 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.h) | 24 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.cpp) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.h) | 10 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.cpp) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.h) | 1 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.cpp) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Makefile.am | 201 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.cpp) | 264 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.h) | 34 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.cpp) | 80 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.h) | 10 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MessageException.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MessageException.h) | 10 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.cpp) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/NumericRanges.h | 110 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSFilter.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSFilter.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.cpp) | 54 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.h) | 19 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Pair.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Pair.h) | 12 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.cpp) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.h) | 6 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMap.cpp) | 41 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/DvisvgmSpecialHandler.h) | 28 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Process.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Process.h) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PsSpecialHandler.cpp) | 58 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/PsSpecialHandler.h) | 13 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMap.cpp) | 206 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.h | 87 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGOutputBase.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGOutputBase.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.cpp) | 5 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.h) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.h) | 26 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialActions.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialActions.h) | 11 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialHandler.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.cpp) | 28 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.h) | 24 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.cpp) | 7 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.h) | 18 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.cpp) | 30 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.h) | 34 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.cpp | 106 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMap.h) | 31 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.cpp) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.cpp | 76 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.h | 33 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFActions.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFActions.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.cpp) | 62 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/VectorStream.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/VectorStream.h) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.h) | 8 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.cpp) | 16 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.h) | 13 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.cpp) | 35 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.h) | 4 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/dvisvgm.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/dvisvgm.cpp) | 9 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/iapi.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/iapi.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/ierrors.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/ierrors.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/macros.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/macros.h) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.dtd | 51 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.xml (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/options.xml) | 2 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/psdefs.cpp (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/psdefs.cpp) | 0 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-1.7/src/types.h (renamed from Build/source/texk/dvisvgm/dvisvgm-1.6/src/types.h) | 40 | ||||
-rw-r--r-- | Build/source/texk/dvisvgm/version.ac | 2 |
201 files changed, 3662 insertions, 2317 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README index 9457bcfbe7a..8e3f82e726c 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -61,7 +61,7 @@ dvipos - ? dvipsk - maintained here, by us -dvisvgm 1.6 - checked 29apr14 +dvisvgm 1.7 - checked 20jun14 http://downloads.sourceforge.net/dvisvgm/ gsftopk - from Paul Vojta's xdvi? diff --git a/Build/source/texk/dvisvgm/ChangeLog b/Build/source/texk/dvisvgm/ChangeLog index 2abc1cc80ac..e500d48557a 100644 --- a/Build/source/texk/dvisvgm/ChangeLog +++ b/Build/source/texk/dvisvgm/ChangeLog @@ -1,3 +1,9 @@ +2014-06-20 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Imported release 1.7. + * version.ac: Adapted. + * Makefile.am: Adjusted. + 2014-06-16 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/dvisvgm/Makefile.am b/Build/source/texk/dvisvgm/Makefile.am index 6c35a6ce3b8..c4c89a85209 100644 --- a/Build/source/texk/dvisvgm/Makefile.am +++ b/Build/source/texk/dvisvgm/Makefile.am @@ -50,6 +50,7 @@ LDADD += $(ZLIB_LIBS) $(LIBGS_LIBS) noinst_LIBRARIES = libdvisvgm.a nodist_libdvisvgm_a_SOURCES = \ + @DVISVGM_TREE@/src/BasicDVIReader.cpp \ @DVISVGM_TREE@/src/BgColorSpecialHandler.cpp \ @DVISVGM_TREE@/src/Bitmap.cpp \ @DVISVGM_TREE@/src/BoundingBox.cpp \ @@ -58,7 +59,6 @@ nodist_libdvisvgm_a_SOURCES = \ @DVISVGM_TREE@/src/CMapReader.cpp \ @DVISVGM_TREE@/src/CRC32.cpp \ @DVISVGM_TREE@/src/Calculator.cpp \ - @DVISVGM_TREE@/src/CharMap.cpp \ @DVISVGM_TREE@/src/CharMapID.cpp \ @DVISVGM_TREE@/src/CmdLineParserBase.cpp \ @DVISVGM_TREE@/src/Color.cpp \ @@ -103,9 +103,11 @@ nodist_libdvisvgm_a_SOURCES = \ @DVISVGM_TREE@/src/PdfSpecialHandler.cpp \ @DVISVGM_TREE@/src/PageRanges.cpp \ @DVISVGM_TREE@/src/PageSize.cpp \ + @DVISVGM_TREE@/src/PreScanDVIReader.cpp \ @DVISVGM_TREE@/src/Process.cpp \ @DVISVGM_TREE@/src/PsSpecialHandler.cpp \ @DVISVGM_TREE@/src/psdefs.cpp \ + @DVISVGM_TREE@/src/RangeMap.cpp \ @DVISVGM_TREE@/src/SVGTree.cpp \ @DVISVGM_TREE@/src/SignalHandler.cpp \ @DVISVGM_TREE@/src/SpecialManager.cpp \ @@ -115,7 +117,9 @@ nodist_libdvisvgm_a_SOURCES = \ @DVISVGM_TREE@/src/System.cpp \ @DVISVGM_TREE@/src/TFM.cpp \ @DVISVGM_TREE@/src/Terminal.cpp \ + @DVISVGM_TREE@/src/ToUnicodeMap.cpp \ @DVISVGM_TREE@/src/TpicSpecialHandler.cpp \ + @DVISVGM_TREE@/src/Unicode.cpp \ @DVISVGM_TREE@/src/VFReader.cpp \ @DVISVGM_TREE@/src/XMLDocument.cpp \ @DVISVGM_TREE@/src/XMLNode.cpp \ diff --git a/Build/source/texk/dvisvgm/Makefile.in b/Build/source/texk/dvisvgm/Makefile.in index 53bf2579461..a4a077df8a7 100644 --- a/Build/source/texk/dvisvgm/Makefile.in +++ b/Build/source/texk/dvisvgm/Makefile.in @@ -135,6 +135,7 @@ libdvisvgm_a_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp @dlloader_TRUE@am__objects_1 = @DVISVGM_TREE@/src/DLLoader.$(OBJEXT) nodist_libdvisvgm_a_OBJECTS = \ + @DVISVGM_TREE@/src/BasicDVIReader.$(OBJEXT) \ @DVISVGM_TREE@/src/BgColorSpecialHandler.$(OBJEXT) \ @DVISVGM_TREE@/src/Bitmap.$(OBJEXT) \ @DVISVGM_TREE@/src/BoundingBox.$(OBJEXT) \ @@ -143,7 +144,6 @@ nodist_libdvisvgm_a_OBJECTS = \ @DVISVGM_TREE@/src/CMapReader.$(OBJEXT) \ @DVISVGM_TREE@/src/CRC32.$(OBJEXT) \ @DVISVGM_TREE@/src/Calculator.$(OBJEXT) \ - @DVISVGM_TREE@/src/CharMap.$(OBJEXT) \ @DVISVGM_TREE@/src/CharMapID.$(OBJEXT) \ @DVISVGM_TREE@/src/CmdLineParserBase.$(OBJEXT) \ @DVISVGM_TREE@/src/Color.$(OBJEXT) \ @@ -188,9 +188,11 @@ nodist_libdvisvgm_a_OBJECTS = \ @DVISVGM_TREE@/src/PdfSpecialHandler.$(OBJEXT) \ @DVISVGM_TREE@/src/PageRanges.$(OBJEXT) \ @DVISVGM_TREE@/src/PageSize.$(OBJEXT) \ + @DVISVGM_TREE@/src/PreScanDVIReader.$(OBJEXT) \ @DVISVGM_TREE@/src/Process.$(OBJEXT) \ @DVISVGM_TREE@/src/PsSpecialHandler.$(OBJEXT) \ @DVISVGM_TREE@/src/psdefs.$(OBJEXT) \ + @DVISVGM_TREE@/src/RangeMap.$(OBJEXT) \ @DVISVGM_TREE@/src/SVGTree.$(OBJEXT) \ @DVISVGM_TREE@/src/SignalHandler.$(OBJEXT) \ @DVISVGM_TREE@/src/SpecialManager.$(OBJEXT) \ @@ -200,7 +202,9 @@ nodist_libdvisvgm_a_OBJECTS = \ @DVISVGM_TREE@/src/System.$(OBJEXT) \ @DVISVGM_TREE@/src/TFM.$(OBJEXT) \ @DVISVGM_TREE@/src/Terminal.$(OBJEXT) \ + @DVISVGM_TREE@/src/ToUnicodeMap.$(OBJEXT) \ @DVISVGM_TREE@/src/TpicSpecialHandler.$(OBJEXT) \ + @DVISVGM_TREE@/src/Unicode.$(OBJEXT) \ @DVISVGM_TREE@/src/VFReader.$(OBJEXT) \ @DVISVGM_TREE@/src/XMLDocument.$(OBJEXT) \ @DVISVGM_TREE@/src/XMLNode.$(OBJEXT) \ @@ -669,14 +673,13 @@ dvisvgm_dependencies = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) $(FREETYPE2_DEPEND) LDADD = $(noinst_LIBRARIES) $(KPATHSEA_LIBS) $(POTRACE_LIBS) \ $(FREETYPE2_LIBS) $(ZLIB_LIBS) $(LIBGS_LIBS) noinst_LIBRARIES = libdvisvgm.a -nodist_libdvisvgm_a_SOURCES = \ +nodist_libdvisvgm_a_SOURCES = @DVISVGM_TREE@/src/BasicDVIReader.cpp \ @DVISVGM_TREE@/src/BgColorSpecialHandler.cpp \ @DVISVGM_TREE@/src/Bitmap.cpp \ @DVISVGM_TREE@/src/BoundingBox.cpp @DVISVGM_TREE@/src/CMap.cpp \ @DVISVGM_TREE@/src/CMapManager.cpp \ @DVISVGM_TREE@/src/CMapReader.cpp @DVISVGM_TREE@/src/CRC32.cpp \ @DVISVGM_TREE@/src/Calculator.cpp \ - @DVISVGM_TREE@/src/CharMap.cpp \ @DVISVGM_TREE@/src/CharMapID.cpp \ @DVISVGM_TREE@/src/CmdLineParserBase.cpp \ @DVISVGM_TREE@/src/Color.cpp \ @@ -715,17 +718,21 @@ nodist_libdvisvgm_a_SOURCES = \ @DVISVGM_TREE@/src/PSPreviewFilter.cpp \ @DVISVGM_TREE@/src/PdfSpecialHandler.cpp \ @DVISVGM_TREE@/src/PageRanges.cpp \ - @DVISVGM_TREE@/src/PageSize.cpp @DVISVGM_TREE@/src/Process.cpp \ + @DVISVGM_TREE@/src/PageSize.cpp \ + @DVISVGM_TREE@/src/PreScanDVIReader.cpp \ + @DVISVGM_TREE@/src/Process.cpp \ @DVISVGM_TREE@/src/PsSpecialHandler.cpp \ - @DVISVGM_TREE@/src/psdefs.cpp @DVISVGM_TREE@/src/SVGTree.cpp \ + @DVISVGM_TREE@/src/psdefs.cpp @DVISVGM_TREE@/src/RangeMap.cpp \ + @DVISVGM_TREE@/src/SVGTree.cpp \ @DVISVGM_TREE@/src/SignalHandler.cpp \ @DVISVGM_TREE@/src/SpecialManager.cpp \ @DVISVGM_TREE@/src/StreamReader.cpp \ @DVISVGM_TREE@/src/StreamWriter.cpp \ @DVISVGM_TREE@/src/Subfont.cpp @DVISVGM_TREE@/src/System.cpp \ @DVISVGM_TREE@/src/TFM.cpp @DVISVGM_TREE@/src/Terminal.cpp \ + @DVISVGM_TREE@/src/ToUnicodeMap.cpp \ @DVISVGM_TREE@/src/TpicSpecialHandler.cpp \ - @DVISVGM_TREE@/src/VFReader.cpp \ + @DVISVGM_TREE@/src/Unicode.cpp @DVISVGM_TREE@/src/VFReader.cpp \ @DVISVGM_TREE@/src/XMLDocument.cpp \ @DVISVGM_TREE@/src/XMLNode.cpp \ @DVISVGM_TREE@/src/XMLString.cpp $(am__append_2) @@ -794,6 +801,9 @@ clean-noinstLIBRARIES: @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) @DVISVGM_TREE@/src/$(DEPDIR) @: > @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@DVISVGM_TREE@/src/BasicDVIReader.$(OBJEXT): \ + @DVISVGM_TREE@/src/$(am__dirstamp) \ + @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/BgColorSpecialHandler.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -817,9 +827,6 @@ clean-noinstLIBRARIES: @DVISVGM_TREE@/src/Calculator.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) -@DVISVGM_TREE@/src/CharMap.$(OBJEXT): \ - @DVISVGM_TREE@/src/$(am__dirstamp) \ - @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/CharMapID.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -950,6 +957,9 @@ clean-noinstLIBRARIES: @DVISVGM_TREE@/src/PageSize.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@DVISVGM_TREE@/src/PreScanDVIReader.$(OBJEXT): \ + @DVISVGM_TREE@/src/$(am__dirstamp) \ + @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/Process.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -959,6 +969,9 @@ clean-noinstLIBRARIES: @DVISVGM_TREE@/src/psdefs.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@DVISVGM_TREE@/src/RangeMap.$(OBJEXT): \ + @DVISVGM_TREE@/src/$(am__dirstamp) \ + @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/SVGTree.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -985,9 +998,15 @@ clean-noinstLIBRARIES: @DVISVGM_TREE@/src/Terminal.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@DVISVGM_TREE@/src/ToUnicodeMap.$(OBJEXT): \ + @DVISVGM_TREE@/src/$(am__dirstamp) \ + @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/TpicSpecialHandler.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@DVISVGM_TREE@/src/Unicode.$(OBJEXT): \ + @DVISVGM_TREE@/src/$(am__dirstamp) \ + @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @DVISVGM_TREE@/src/VFReader.$(OBJEXT): \ @DVISVGM_TREE@/src/$(am__dirstamp) \ @DVISVGM_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -1075,6 +1094,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/BasicDVIReader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/BgColorSpecialHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Bitmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/BoundingBox.Po@am__quote@ @@ -1083,7 +1103,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/CMapReader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/CRC32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Calculator.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/CharMap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/CharMapID.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/CmdLineParserBase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Color.Po@am__quote@ @@ -1129,8 +1148,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/PageRanges.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/PageSize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/PdfSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/PreScanDVIReader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Process.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/PsSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/RangeMap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/SVGTree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/SignalHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/SpecialManager.Po@am__quote@ @@ -1140,7 +1161,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/System.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/TFM.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Terminal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/ToUnicodeMap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/TpicSpecialHandler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/Unicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/VFReader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/XMLDocument.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@DVISVGM_TREE@/src/$(DEPDIR)/XMLNode.Po@am__quote@ diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure index b7fd09480cf..2ccd01dda60 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.6. +# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 1.7. # # Report bugs to <tex-k@tug.org>. # @@ -590,12 +590,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvisvgm (TeX Live)' PACKAGE_TARNAME='dvisvgm--tex-live-' -PACKAGE_VERSION='1.6' -PACKAGE_STRING='dvisvgm (TeX Live) 1.6' +PACKAGE_VERSION='1.7' +PACKAGE_STRING='dvisvgm (TeX Live) 1.7' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="dvisvgm-1.6/src/dvisvgm.cpp" +ac_unique_file="dvisvgm-1.7/src/dvisvgm.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -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.6 to adapt to many kinds of systems. +\`configure' configures dvisvgm (TeX Live) 1.7 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.6:";; + short | recursive ) echo "Configuration of dvisvgm (TeX Live) 1.7:";; esac cat <<\_ACEOF @@ -1581,7 +1581,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvisvgm (TeX Live) configure 1.6 +dvisvgm (TeX Live) configure 1.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2403,7 +2403,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.6, which was +It was created by dvisvgm (TeX Live) $as_me 1.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -7894,7 +7894,7 @@ fi # Define the identity of the package. PACKAGE='dvisvgm--tex-live-' - VERSION='1.6' + VERSION='1.7' cat >>confdefs.h <<_ACEOF @@ -17755,7 +17755,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -dvisvgm (TeX Live) config.lt 1.6 +dvisvgm (TeX Live) config.lt 1.7 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -19566,7 +19566,7 @@ $as_echo "#define KPSE_CXX_UNSAFE 1" >>confdefs.h fi -DVISVGM_TREE=dvisvgm-1.6 +DVISVGM_TREE=dvisvgm-1.7 ac_config_files="$ac_config_files Makefile" @@ -20118,7 +20118,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.6, which was +This file was extended by dvisvgm (TeX Live) $as_me 1.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20184,7 +20184,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.6 +dvisvgm (TeX Live) config.status 1.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.cpp deleted file mode 100644 index 7a50191229f..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.cpp +++ /dev/null @@ -1,316 +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-2014 Martin Gieseking <martin.gieseking@uos.de> - -#include <config.h> -#include <cstdio> -#include <iostream> -#include <iomanip> -#include "InputReader.h" -#include "CommandLine.h" - -using namespace std; - -const CmdLineParserBase::Option CommandLine::_options[] = { - {'b', "bbox", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_bbox)}, - {'C', "cache", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_cache)}, - {'\0', "color", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_color)}, -#if !defined(DISABLE_GS) - {'E', "eps", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_eps)}, -#endif - {'e', "exact", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_exact)}, - {'m', "fontmap", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_fontmap)}, - {'h', "help", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_help)}, - {'\0', "keep", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_keep)}, -#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) - {'\0', "libgs", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_libgs)}, -#endif - {'L', "linkmark", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_linkmark)}, - {'l', "list-specials", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_list_specials)}, - {'M', "mag", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_mag)}, - {'n', "no-fonts", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_fonts)}, - {'\0', "no-mktexmf", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_mktexmf)}, - {'S', "no-specials", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_specials)}, - {'\0', "no-styles", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_styles)}, - {'o', "output", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_output)}, - {'p', "page", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_page)}, - {'d', "precision", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_precision)}, - {'P', "progress", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_progress)}, - {'r', "rotate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_rotate)}, - {'c', "scale", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_scale)}, - {'s', "stdout", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_stdout)}, - {'a', "trace-all", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_trace_all)}, - {'T', "transform", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_transform)}, - {'t', "translate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_translate)}, - {'v', "verbosity", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_verbosity)}, - {'V', "version", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_version)}, - {'z', "zip", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_zip)}, - {'Z', "zoom", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&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; - _color_given = false; -#if !defined(DISABLE_GS) - _eps_given = false; -#endif - _exact_given = false; - _fontmap_given = false; - _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_mktexmf_given = false; - _no_specials_given = false; - _no_styles_given = false; - _output_given = false; - _page_given = false; - _precision_given = false; - _progress_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(); - _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]", - "o-L, --linkmark=type 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-s, --stdout write SVG output to stdout", - "o-n, --no-fonts[=variant] draw glyphs by using path elements [0]", - "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; -} - -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; -} - -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_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_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.6/src/CommandLine.h b/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.h deleted file mode 100644 index 20a991b0e1e..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CommandLine.h +++ /dev/null @@ -1,174 +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-2014 Martin Gieseking <martin.gieseking@uos.de> - -#ifndef COMMANDLINE_H -#define COMMANDLINE_H - -#include <config.h> -#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;} - 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;} - 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_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 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); - 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); - 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_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_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; - bool _color_given; -#if !defined(DISABLE_GS) - bool _eps_given; -#endif - bool _exact_given; - bool _fontmap_given; - std::string _fontmap_arg; - 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_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 _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.6/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DvisvgmSpecialHandler.cpp deleted file mode 100644 index 58f6a6e7ca1..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DvisvgmSpecialHandler.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************* -** DvisvgmSpecialHandler.cpp ** -** ** -** This file is part of dvisvgm -- the DVI to SVG converter ** -** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** -** ** -** This program is free software; you can redistribute it and/or ** -** modify it under the terms of the GNU General Public License as ** -** published by the Free Software Foundation; either version 3 of ** -** the License, or (at your option) any later version. ** -** ** -** This program is distributed in the hope that it will be useful, but ** -** WITHOUT ANY WARRANTY; without even the implied warranty of ** -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** -** GNU General Public License for more details. ** -** ** -** You should have received a copy of the GNU General Public License ** -** along with this program; if not, see <http://www.gnu.org/licenses/>. ** -*************************************************************************/ - -#include <config.h> -#include <cstring> -#include "DvisvgmSpecialHandler.h" -#include "InputBuffer.h" -#include "InputReader.h" -#include "SpecialActions.h" -#include "XMLNode.h" -#include "XMLString.h" - -using namespace std; - - -/** 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 - } - } -} - - -/** 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)); -} - - -/** Inserts raw text into the SVG tree. - * @param[in,out] in the raw text is read from this input buffer - * @param[in] actions interfcae to the world outside the special handler - * @param[in] group true if the text should be wrapped by a group element */ -static void raw (InputReader &in, SpecialActions *actions, bool group=false) { - string str; - while (!in.eof()) { - int c = in.get(); - if (isprint(c)) - str += char(c); - } - expand_constants(str, actions); - if (!str.empty()) { - XMLNode *node = new XMLTextNode(str); - if (group) { - XMLElementNode *g = new XMLElementNode("g"); - g->addAttribute("x", actions->getX()); - g->addAttribute("y", actions->getY()); - if (actions->getColor() != Color::BLACK) - g->addAttribute("fill", actions->getColor().rgbString()); - g->append(node); - node = g; - } - actions->appendToPage(node); - } -} - - -/** Evaluates the special dvisvgm:bbox. - * variant 1: dvisvgm:bbox [r[el]] <width> <height> [<depth>] - * variant 2: dvisvgm:bbox a[bs] <x1> <y1> <x2> <y2> - * variant 3: dvisvgm:bbox f[ix] <x1> <y1> <x2> <y2> - * variant 4: dvisvgm:bbox n[ew] <name> */ -static void bbox (InputReader &in, SpecialActions *actions) { - const double pt2bp = 72/72.27; - in.skipSpace(); - int c = in.peek(); - if (isalpha(c)) { - while (!isspace(in.peek())) // skip trailing characters - in.get(); - if (c == 'n') { - in.skipSpace(); - string name; - while (isalnum(in.peek())) - name += char(in.get()); - in.skipSpace(); - if (!name.empty() && in.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] = in.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 = in.getDouble()*pt2bp; - double h = in.getDouble()*pt2bp; - double d = in.getDouble()*pt2bp; - update_bbox(w, h, d, actions); - } -} - - -static void img (InputReader &in, SpecialActions *actions) { - if (actions) { - const double pt2bp = 72/72.27; - double w = in.getDouble()*pt2bp; - double h = in.getDouble()*pt2bp; - string f = in.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); - } -} - - -/** 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) { - StreamInputBuffer ib(is); - BufferInputReader in(ib); - string cmd = in.getWord(); - if (cmd == "raw") // raw <text> - raw(in, actions); - else if (cmd == "bbox") // bbox [r] <width> <height> <depth> or bbox a <x1> <y1> <x2> <y2> - bbox(in, actions); - else if (cmd == "img") { // img <width> <height> <file> - img(in, actions); - } - } - return true; -} - - -const char** DvisvgmSpecialHandler::prefixes () const { - static const char *pfx[] = {"dvisvgm:", 0}; - return pfx; -} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Makefile.am deleted file mode 100644 index b504093a3bf..00000000000 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -:## This file is part of dvisvgm -## Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> -## -## Process this file with automake. - -bin_PROGRAMS = dvisvgm -noinst_LIBRARIES = libdvisvgm.a - -dvisvgm_SOURCES = gzstream.h \ - dvisvgm.cpp gzstream.cpp - -dvisvgm_LDADD = $(noinst_LIBRARIES) @EXTRA_LIBS@ -dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) @EXTRA_LIBS@ - -libdvisvgm_a_SOURCES = Bitmap.h BoundingBox.h BgColorSpecialHandler.h Calculator.h Character.h CharMap.h CharMapID.h CMap.h \ - CMapManager.h CMapReader.h CmdLineParserBase.h Color.h CRC32.h ColorSpecialHandler.h CommandLine.h Directory.h DLLoader.h \ - DVIActions.h DVIReader.h DvisvgmSpecialHandler.h DVIToSVG.h DVIToSVGActions.h EncFile.h EmSpecialHandler.h EPSFile.h EPSToSVG.h \ - FileFinder.h FilePath.h FileSystem.h Font.h FontCache.h FontEncoding.h FontEngine.h FontManager.h FontMap.h FontMetrics.h \ - FontStyle.h GFReader.h GFTracer.h GFGlyphTracer.h Ghostscript.h Glyph.h GlyphTracerMessages.h GraphicPath.h HtmlSpecialHandler.h \ - InputBuffer.h InputReader.h JFM.h Length.h macros.h MapLine.h Matrix.h Message.h MessageException.h MetafontWrapper.h \ - NoPsSpecialHandler.h PageRanges.h PageSize.h Pair.h PdfSpecialHandler.h Process.h PSFilter.h PSInterpreter.h PSPattern.h \ - PSPreviewFilter.h PsSpecialHandler.h SignalHandler.h SpecialActions.h SpecialHandler.h SpecialManager.h StreamReader.h \ - StreamWriter.h Subfont.h SVGOutputBase.h SVGTree.h System.h Terminal.h TpicSpecialHandler.h TFM.h types.h VectorStream.h \ - VFActions.h VFReader.h XMLDocument.h XMLNode.h XMLString.h \ - BgColorSpecialHandler.cpp Bitmap.cpp BoundingBox.cpp Calculator.cpp CharMap.cpp CharMapID.cpp CMap.cpp CMapManager.cpp \ - CMapReader.cpp CmdLineParserBase.cpp Color.cpp ColorSpecialHandler.cpp CommandLine.cpp CRC32.cpp Directory.cpp DLLoader.cpp \ - DVIReader.cpp DvisvgmSpecialHandler.cpp DVIToSVG.cpp DVIToSVGActions.cpp EmSpecialHandler.cpp EncFile.cpp \ - EPSFile.cpp EPSToSVG.cpp FileFinder.cpp FilePath.cpp FileSystem.cpp Font.cpp FontCache.cpp FontEncoding.cpp FontEngine.cpp \ - FontManager.cpp FontMap.cpp FontMetrics.cpp GFReader.cpp GFGlyphTracer.cpp GFTracer.cpp Ghostscript.cpp HtmlSpecialHandler.cpp \ - InputBuffer.cpp InputReader.cpp JFM.cpp Length.cpp MapLine.cpp Matrix.cpp Message.cpp MetafontWrapper.cpp NoPsSpecialHandler.cpp \ - PageRanges.cpp PageSize.cpp PdfSpecialHandler.cpp Process.cpp psdefs.cpp PSInterpreter.cpp PSPattern.cpp PSPreviewFilter.cpp \ - PsSpecialHandler.cpp SignalHandler.cpp SpecialManager.cpp StreamReader.cpp StreamWriter.cpp Subfont.cpp SVGTree.cpp System.cpp \ - Terminal.cpp TFM.cpp TpicSpecialHandler.cpp VFReader.cpp XMLDocument.cpp XMLNode.cpp XMLString.cpp - -EXTRA_DIST = options.xml iapi.h ierrors.h MiKTeXCom.h MiKTeXCom.cpp - -AM_CXXFLAGS = -Wall -Wnon-virtual-dtor - -# the command-line parser is generated from options.xml by opt2cpp -CommandLine.cpp: options.xml - if test -f opt2cpp.xsl; then \ - rm -f $@ $*.h; \ - xsltproc opt2cpp.xsl $<; \ - 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: ; - diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/ChangeLog index 8e6ce1832cf..08018be1a7f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/ChangeLog +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/ChangeLog @@ -1,3 +1,7 @@ +2014-06-20 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Import release 1.7. + 2014-04-29 Peter Breitenlohner <peb@mppmu.mpg.de> * Import release 1.6. diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/TL-Changes b/Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/TL-Changes index f102fe4d733..f42f746ea91 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6-PATCHES/TL-Changes +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the dvisvgm-1.6 tree as obtained from: +Changes applied to the dvisvgm-1.7 tree as obtained from: http://downloads.sourceforge.net/dvisvgm/ Removed: diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/AUTHORS b/Build/source/texk/dvisvgm/dvisvgm-1.7/AUTHORS index d9b6468421e..d9b6468421e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/AUTHORS +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/AUTHORS diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/COPYING b/Build/source/texk/dvisvgm/dvisvgm-1.7/COPYING index 94a9ed024d3..94a9ed024d3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/COPYING +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/COPYING diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-1.7/ChangeLog index 67663e1a0d7..c601847210e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/ChangeLog +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/ChangeLog @@ -1,3 +1,208 @@ +2014-06-17 Martin Gieseking <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * src/XMLNode.cpp, src/XMLNode.h: + added clear() to XMLNode classes; added XMLTextNode::getText() + +2014-06-11 Martin Gieseking <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * src/SpecialActions.h, tests/ColorSpecialTest.cpp: + renamed class SpecialEmptyActions to EmptySpecialActions + +2014-06-09 Martin Gieseking <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * 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 <martin.gieseking@uos.de> + + * src/SVGTree.cpp: + don't add unnecessary element 'missing-glyph' to SVG files + +2014-04-24 Martin Gieseking <martin.gieseking@uos.de> + + * doc/dvisvgm.txt.in, src/CommandLine.cpp, src/options.xml: + renamed argument of option --linkmark from 'type' to 'style' + 2014-04-22 Martin Gieseking <martin.gieseking@uos.de> * configure.ac, src/Doxyfile: diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/INSTALL b/Build/source/texk/dvisvgm/dvisvgm-1.7/INSTALL index a4b34144dcf..a4b34144dcf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/INSTALL +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/INSTALL diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/LGPL-2.1.txt b/Build/source/texk/dvisvgm/dvisvgm-1.7/LGPL-2.1.txt index 602bfc94635..602bfc94635 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/LGPL-2.1.txt +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/LGPL-2.1.txt diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.7/Makefile.am index b73dbf588f8..b73dbf588f8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/Makefile.am diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/NEWS b/Build/source/texk/dvisvgm/dvisvgm-1.7/NEWS index 45104994435..34228a9dbb9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/NEWS +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/NEWS @@ -1,3 +1,19 @@ +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 <defs> 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 <missing-glyph> 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 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/README b/Build/source/texk/dvisvgm/dvisvgm-1.7/README index 2454a2a23f4..2454a2a23f4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/README +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/README diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/config.h.in b/Build/source/texk/dvisvgm/dvisvgm-1.7/config.h.in index fcd8cf41872..fcd8cf41872 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/config.h.in +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/config.h.in diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-1.7/configure.ac index 934dffccbb0..95df7c0c223 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/configure.ac +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/configure.ac @@ -4,8 +4,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([dvisvgm],[1.6],[martin.gieseking@uos.de]) -DATE="April 2014" +AC_INIT([dvisvgm],[1.7],[martin.gieseking@uos.de]) +DATE="June 2014" AC_CONFIG_SRCDIR(src) AC_CONFIG_HEADER(config.h) AC_CANONICAL_HOST diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/Makefile.am index 13254cb773a..13254cb773a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/Makefile.am diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.1 index 0c65adf919a..bcacdfcd0c8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.1 +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.1 @@ -2,12 +2,12 @@ .\" Title: dvisvgm .\" Author: Martin Gieseking <martin.gieseking@uos.de> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 04/23/2014 +.\" Date: 06/18/2014 .\" Manual: dvisvgm Manual -.\" Source: dvisvgm 1.6 +.\" Source: dvisvgm 1.7 .\" Language: English .\" -.TH "DVISVGM" "1" "04/23/2014" "dvisvgm 1\&.6" "dvisvgm Manual" +.TH "DVISVGM" "1" "06/18/2014" "dvisvgm 1\&.7" "dvisvgm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -279,10 +279,10 @@ can be used to give a different name\&. Alternatively, it\(cqs also possible to LIBGS\&. The latter has less precedence than the command\-line option\&. .RE .PP -\fB\-L, \-\-linkmark\fR=\fItype\fR +\fB\-L, \-\-linkmark\fR=\fIstyle\fR .RS 4 Selects the method how to mark hyperlinked areas\&. The -\fItype\fR +\fIstyle\fR argument can take one of the values \fInone\fR, \fIbox\fR, and @@ -290,18 +290,18 @@ argument can take one of the values \fIbox\fR is the default, i\&.e\&. a rectangle is drawn around the linked region if option \fB\-\-linkmark\fR -is omitted\&. Type +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 type string\&. A +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 as listed here: http://en\&.wikibooks\&.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips .sp Moreover, argument -\fItype\fR +\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: @@ -708,7 +708,7 @@ attributes are omitted\&. .RE .SH "SUPPORT OF 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 various 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\&. +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 @@ -726,21 +726,75 @@ dvisvgm offers its own small set of specials\&. The following list gives a brief .PP \fBdvisvgm:raw\fR \fItext\fR .RS 4 -Adds an arbitrary sequence of characters to the SVG output\&. dvisvgm does not perform any validation here, thus the user has to ensure that the resulting SVG is still valid\&. Parameter +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 macros +may contain the expressions \fB{?x}\fR, \fB{?y}\fR, and \fB{?color}\fR -that are expanded to the current +that expand to the current \fIx\fR or \fIy\fR -coordinate and the current color, respectively\&. Also, macro +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 <defs> 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)\&. +\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 <defs> 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 @@ -819,8 +873,8 @@ These specials were introduced with the emTeX distribution by Eberhard Mattes\&. .PP \fBhtml\fR .RS 4 -The hyperref specials allow the definition of hyperlinks inside DVI files in various flavors\&. dvisvgm supports the plain HyperTeX special constructs as created with hyperref package option -\fIhypertex\fR\&. Internal links, i\&.e\&. references to other parts of the same document, are only converted if the link and the corresponding link target are located on the same page\&. Links between different pages are not supported yet\&. By default, all linked areas of the document are marked by a rectangle\&. Option +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 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.txt.in b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.txt.in index 7d942066d3b..29c4ce750b0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/doc/dvisvgm.txt.in +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/dvisvgm.txt.in @@ -217,17 +217,17 @@ Alternatively, it's also possible to set the GS library name by the environment The latter has less precedence than the command-line option. -*-L, --linkmark*='type':: -Selects the method how to mark hyperlinked areas. The 'type' argument can take one of the values +*-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. Type 'line' just draws the lower edge of +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 type string. A 'color specifier' is either +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 dvips color name as listed here: http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips + -Moreover, argument 'type' can take a single color specifier to highlight the linked region by +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. + @@ -446,7 +446,7 @@ accordingly. If a negative zoom factor is given, the 'width' and 'height' attrib SUPPORT OF 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 various +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. @@ -465,11 +465,31 @@ 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 SVG output. 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 macros *{?x}*, *{?y}*, and *{?color}* that are expanded to the current 'x' or 'y' coordinate - and the current color, respectively. Also, macro *{?nl}* expands to a newline character. + 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 <defs> 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). + *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 + <defs> 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' @@ -523,10 +543,8 @@ dvisvgm supports only the line drawing statements and ignores all other em speci A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN). *html*:: -The hyperref specials allow the definition of hyperlinks inside DVI files in various flavors. dvisvgm supports -the plain HyperTeX special constructs as created with hyperref package option 'hypertex'. Internal links, i.e. -references to other parts of the same document, are only converted if the link and the corresponding link target -are located on the same page. Links between different pages are not supported yet. +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. diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.cpp new file mode 100644 index 00000000000..155e729c2e9 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.cpp @@ -0,0 +1,291 @@ +/************************************************************************* +** BasicDVIReader.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <config.h> +#include <algorithm> +#include <sstream> +#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}, + {&BasicDVIReader::cmdSetChar, 3}, {&BasicDVIReader::cmdSetChar, 4}, // 128-131 + {&BasicDVIReader::cmdSetRule, 8}, // 132 + {&BasicDVIReader::cmdPutChar, 1}, {&BasicDVIReader::cmdPutChar, 2}, + {&BasicDVIReader::cmdPutChar, 3}, {&BasicDVIReader::cmdPutChar, 4}, // 133-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}, + {&BasicDVIReader::cmdRight, 3}, {&BasicDVIReader::cmdRight, 4}, // 143-146 + {&BasicDVIReader::cmdW0, 0}, // 147 + {&BasicDVIReader::cmdW, 1}, {&BasicDVIReader::cmdW, 2}, + {&BasicDVIReader::cmdW, 3}, {&BasicDVIReader::cmdW, 4}, // 148-151 + {&BasicDVIReader::cmdX0, 0}, // 152 + {&BasicDVIReader::cmdX, 1}, {&BasicDVIReader::cmdX, 2}, + {&BasicDVIReader::cmdX, 3}, {&BasicDVIReader::cmdX, 4}, // 153-156 + {&BasicDVIReader::cmdDown, 1}, {&BasicDVIReader::cmdDown, 2}, + {&BasicDVIReader::cmdDown, 3}, {&BasicDVIReader::cmdDown, 4}, // 157-160 + {&BasicDVIReader::cmdY0, 0}, // 161 + {&BasicDVIReader::cmdY, 1}, {&BasicDVIReader::cmdY, 2}, + {&BasicDVIReader::cmdY, 3}, {&BasicDVIReader::cmdY, 4}, // 162-165 + {&BasicDVIReader::cmdZ0, 0}, // 166 + {&BasicDVIReader::cmdZ, 1}, {&BasicDVIReader::cmdZ, 2}, + {&BasicDVIReader::cmdZ, 3}, {&BasicDVIReader::cmdZ, 4}, // 167-170 + {&BasicDVIReader::cmdFontNum, 1}, {&BasicDVIReader::cmdFontNum, 2}, + {&BasicDVIReader::cmdFontNum, 3}, {&BasicDVIReader::cmdFontNum, 4}, // 235-238 + {&BasicDVIReader::cmdXXX, 1}, {&BasicDVIReader::cmdXXX, 2}, + {&BasicDVIReader::cmdXXX, 3}, {&BasicDVIReader::cmdXXX, 4}, // 239-242 + {&BasicDVIReader::cmdFontDef, 1}, {&BasicDVIReader::cmdFontDef, 2}, + {&BasicDVIReader::cmdFontDef, 3}, {&BasicDVIReader::cmdFontDef, 4}, // 243-246 + {&BasicDVIReader::cmdPre, 0}, {&BasicDVIReader::cmdPost, 0}, + {&BasicDVIReader::cmdPostPost, 0}, // 247-249 + {&BasicDVIReader::cmdXPic, 0}, {&BasicDVIReader::cmdXFontDef, 0}, + {&BasicDVIReader::cmdXGlyphA, 0}, {&BasicDVIReader::cmdXGlyphS, 0} // 251-254 + }; + + 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_XDV && opcode >= 251 && opcode <= 254) { // XDV command? + static const CommandHandler handlers[] = { + &BasicDVIReader::cmdXPic, + &BasicDVIReader::cmdXFontDef, + &BasicDVIReader::cmdXGlyphA, + &BasicDVIReader::cmdXGlyphS + }; + 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_base::end); // stream pointer to last byte + int count=0; + while (peek() == 223) { // count trailing fill bytes + seek(-1, ios_base::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_XDV: + 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_base::cur); // skip numerator, denominator, and mag factor + UInt32 k = readUnsigned(1); // length of following comment + seek(k, ios_base::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_base::cur); +} + + +/** Executes postpost command. + * Format: postpost q[4] i[1] 223’s[>= 4] */ +void BasicDVIReader::cmdPostPost (int) { + seek(4, ios_base::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_base::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_base::cur);} +void BasicDVIReader::cmdPutChar (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdSetRule (int) {seek(8, ios_base::cur);} +void BasicDVIReader::cmdPutRule (int) {seek(8, ios_base::cur);} +void BasicDVIReader::cmdRight (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdDown (int len) {seek(len, ios_base::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_base::cur);} +void BasicDVIReader::cmdY (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdW (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdZ (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdNop (int) {} +void BasicDVIReader::cmdDir (int) {seek(1, ios_base::cur);} +void BasicDVIReader::cmdFontNum0 (int) {} +void BasicDVIReader::cmdFontNum (int len) {seek(len, ios_base::cur);} +void BasicDVIReader::cmdXXX (int len) {seek(readUnsigned(len), ios_base::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_base::cur); // skip font number + UInt32 pathlen = readUnsigned(1); // length of font path + UInt32 namelen = readUnsigned(1); // length of font name + seek(pathlen+namelen, ios_base::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_base::cur); + UInt16 len = readUnsigned(2); + seek(len, ios_base::cur); +} + + +void BasicDVIReader::cmdXFontDef (int) { + seek(4+4, ios_base::cur); + UInt16 flags = readUnsigned(2); + UInt8 psname_len = readUnsigned(1); + UInt8 fmname_len = readUnsigned(1); + UInt8 stname_len = readUnsigned(1); + seek(psname_len+fmname_len+stname_len, ios_base::cur); + if (flags & 0x0200) // colored? + seek(4, ios_base::cur); + if (flags & 0x1000) // extend? + seek(4, ios_base::cur); + if (flags & 0x2000) // slant? + seek(4, ios_base::cur); + if (flags & 0x4000) // embolden? + seek(4, ios_base::cur); + if (flags & 0x0800) { // variations? + UInt16 num_variations = readSigned(2); + seek(4*num_variations, ios_base::cur); + } +} + + +void BasicDVIReader::cmdXGlyphA (int) { + seek(4, ios_base::cur); + UInt16 num_glyphs = readUnsigned(2); + seek(10*num_glyphs, ios_base::cur); +} + + +void BasicDVIReader::cmdXGlyphS (int) { + seek(4, ios_base::cur); + UInt16 num_glyphs = readUnsigned(2); + seek(6*num_glyphs, ios_base::cur); +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.h new file mode 100644 index 00000000000..0b810f6c1cd --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BasicDVIReader.h @@ -0,0 +1,105 @@ +/************************************************************************* +** BasicDVIReader.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef 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_XDV=5}; + + 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 cmdXPic (int len); + virtual void cmdXFontDef (int len); + virtual void cmdXGlyphA (int len); + virtual void cmdXGlyphS (int len); + + private: + DVIFormat _dviFormat; ///< format of DVI file being processed +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.cpp index dd19e4b5f53..dd19e4b5f53 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.h index edd764e86b2..edd764e86b2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BgColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BgColorSpecialHandler.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.cpp index 265533b1ef5..265533b1ef5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.h index af03597be33..0883688bd9a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Bitmap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Bitmap.h @@ -35,8 +35,8 @@ class Bitmap virtual void pixel (int x, int y, bool set, const Bitmap &bm) {} }; - public: - Bitmap (); + public: + Bitmap (); Bitmap (int minx, int maxx, int miny , int maxy); void resize (int minx, int maxx, int miny , int maxy); void setBits(int r, int c, int n); @@ -58,7 +58,7 @@ class Bitmap std::ostream& write (std::ostream &os) const; - private: + private: int _rows, _cols; ///< number of rows, columns int _xshift, _yshift; ///< horizontal/vertical shift int _bpr; ///< number of bytes per row diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.cpp index f6c5d0b3b9b..f6c5d0b3b9b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.h index 1996973d42d..6d38edf6e3b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/BoundingBox.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/BoundingBox.h @@ -42,8 +42,8 @@ struct BoundingBoxException : MessageException class BoundingBox { - public: - 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); @@ -55,7 +55,7 @@ class BoundingBox void embed (const DPair &c, double r); template <typename T> - void embed (const Pair<T> &p) {embed(p.x(), p.y());} + void embed (const Pair<T> &p) {embed(p.x(), p.y());} void expand (double m); bool intersect (const BoundingBox &bbox); @@ -68,13 +68,13 @@ class BoundingBox void lock () {_locked = true;} void unlock () {_locked = false;} void operator += (const BoundingBox &bb); - void scale (double sx, double sy); + void scale (double sx, double sy); void transform (const Matrix &tm); std::string toSVGViewBox () const; std::ostream& write (std::ostream &os) const; XMLElementNode* toSVGRect () const; - private: + 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 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.cpp new file mode 100644 index 00000000000..6b940300f8e --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.cpp @@ -0,0 +1,75 @@ +/************************************************************************* +** CMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <config.h> +#include <algorithm> +#include <sstream> +#include <set> +#include <vector> +#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.6/src/CMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.h index 2a3e9c7dbbb..324c51800fa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMap.h @@ -25,6 +25,7 @@ #include <ostream> #include <vector> #include "FontEncoding.h" +#include "RangeMap.h" #include "types.h" @@ -87,41 +88,13 @@ class SegmentedCMap : public CMap { friend class CMapReader; - class Range { - friend class SegmentedCMap; - - public: - Range () : _min(0), _max(0), _cid(0) {} - - Range (UInt32 min, UInt32 max, UInt32 cid) : _min(min), _max(max), _cid(cid) { - if (_min > _max) - std::swap(_min, _max); - } - - UInt32 min () const {return _min;} - UInt32 max () const {return _max;} - UInt32 cid () const {return _cid;} - UInt32 decode (UInt32 c) const {return c-_min+_cid;} - bool operator < (const Range &r) const {return _min < r._min;} - - protected: - bool join (const Range &r); - void setMinAndAdaptCID (UInt32 c) {_cid = decode(c); _min = c;} - - private: - UInt32 _min, _max; - UInt32 _cid; - }; - - typedef std::vector<Range> Ranges; - - public: + 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) {addRange(_cidranges, first, last, cid);} - void addBFRange (UInt32 first, UInt32 last, UInt32 chrcode) {addRange(_bfranges, first, last, chrcode);} + 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;} @@ -129,20 +102,15 @@ class SegmentedCMap : public CMap size_t numBFRanges () const {return _bfranges.size();} std::string getROString () const; - protected: - void addRange (Ranges &ranges, UInt32 first, UInt32 last, UInt32 cid); - void adaptNeighbors (Ranges &ranges, Ranges::iterator it); - int lookup (const Ranges &ranges, UInt32 c) const; - - private: + private: std::string _name; std::string _registry; std::string _ordering; CMap *_basemap; bool _vertical; bool _mapsToCID; // true: chrcode->CID, false: CID->charcode - Ranges _cidranges; - Ranges _bfranges; + RangeMap _cidranges; + RangeMap _bfranges; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.cpp index cbad12746c9..eb73d72f3c4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.cpp @@ -136,7 +136,7 @@ const CMap* CMapManager::findCompatibleBaseFontMap (const PhysicalFont *font, co } } } - } + } return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.h index fb71886753c..6918ed93e98 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapManager.h @@ -34,8 +34,8 @@ class FontEncodingPair; class CMapManager { typedef std::map<std::string, CMap*> CMaps; - public: - ~CMapManager (); + public: + ~CMapManager (); CMap* lookup (const std::string &name); const CMap* findCompatibleBaseFontMap (const PhysicalFont *font, const CMap *cmap, CharMapID &charmapID); static CMapManager& instance (); @@ -43,7 +43,7 @@ class CMapManager protected: CMapManager () : _level(0) {} - private: + private: CMaps _cmaps; ///< loaded cmaps int _level; ///< current inclusion depth; >0 if a cmap loaded by "usecmap" is being processed std::set<std::string> _includedCMaps; ///< names of cmaps loaded by "usecmap" diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.cpp index 502e42ef2e0..502e42ef2e0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.h index 5986e92b13d..d9567e79433 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMapReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CMapReader.h @@ -50,8 +50,8 @@ class CMapReader std::string _value; }; - public: - CMapReader (); + public: + CMapReader (); CMap* read (const std::string &fname); CMap* read (std::istream &is, const std::string &name); @@ -65,7 +65,7 @@ class CMapReader void op_endcmap (InputReader &ir); void op_usecmap (InputReader &ir); - private: + private: SegmentedCMap *_cmap; ///< CMap being read std::vector<Token> _tokens; ///< stack of tokens to be processed bool _inCMap; ///< operator begincmap has been executed diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.cpp index 3f85710c6b7..3f85710c6b7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.h index 4376b192077..35cd4d4399a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CRC32.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CRC32.h @@ -27,8 +27,8 @@ class CRC32 { - public: - CRC32 (); + public: + CRC32 (); void update (const UInt8 *bytes, size_t len); void update (UInt32 n, int bytes=4); void update (const char *str); @@ -42,7 +42,7 @@ class CRC32 protected: CRC32 (const CRC32 &crc32) {} - private: + private: UInt32 _crc32; UInt32 _tab[256]; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.cpp index 2e0bb06a361..12a35a35edd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.cpp @@ -42,7 +42,7 @@ double Calculator::eval (istream &is) { double ret = expr(is, false); if (lookAhead(is) > 0) throw CalculatorException("expression syntax error"); - return ret; + return ret; } @@ -58,22 +58,22 @@ double Calculator::eval (const string &expr) { /** Evaluates the root rule of the expression grammar. */ double Calculator::expr (istream &is, bool skip) { // expr: - double left = term(is, skip); - while (1) - 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 left = term(is, skip); + while (1) + 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); - while (1) - switch (lookAhead(is)) { - case '*': left *= prim(is, true); break; // prim '*' prim => $1 * $3 - case '/': { // prim '/' prim => $1 / $3 + double left = prim(is, skip); + while (1) + 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"); @@ -87,16 +87,16 @@ double Calculator::term (istream &is, bool skip) { // term: left -= denom*floor(left/denom); break; } - default: // prim => $1 + default: // prim => $1 return left; - } + } } double Calculator::prim (istream &is, bool skip) { // prim: - if (skip) - lex(is); - switch (lookAhead(is)) { + if (skip) + lex(is); + switch (lookAhead(is)) { case NUMBER: { // NUMBER => $1 lex(is); double ret = _numValue; @@ -112,32 +112,32 @@ double Calculator::prim (istream &is, bool skip) { // prim: } case '-': // '-' prim => -$2 return -prim(is, true); - case '(': { // '(' expr ')' => $2 - double e = expr(is, true); - if (lookAhead(is) != ')') + case '(': { // '(' expr ')' => $2 + double e = expr(is, true); + if (lookAhead(is) != ')') throw CalculatorException("')' expected"); - lex(is); - return e; - } + 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); + 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); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.h index 89d2c08560d..fdd4ed177d5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Calculator.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Calculator.h @@ -34,21 +34,21 @@ struct CalculatorException : public MessageException class Calculator { - public: + 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); + 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: + private: std::map<std::string,double> _variables; double _numValue; std::string _strValue; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.cpp index 2c6e1cd8a59..4c15abde98f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.cpp @@ -20,6 +20,7 @@ #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); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.h index ea30d50d266..acc1a8482de 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMapID.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CharMapID.h @@ -38,6 +38,7 @@ struct CharMapID { 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; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Character.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Character.h index a9d0f6a2d6d..a9d0f6a2d6d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Character.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Character.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.cpp index 2c8d133cc97..2c8d133cc97 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.h index 87e740feaf3..855186f9d4b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CmdLineParserBase.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CmdLineParserBase.h @@ -85,8 +85,8 @@ class CmdLineParserBase 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; + 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; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.cpp index 7e8d9d56069..94514c292a7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.cpp @@ -69,7 +69,7 @@ bool Color::set (string name, bool case_sensitive) { if (name[0] == '#') { char *p=0; _rgb = UInt32(strtol(name.c_str()+1, &p, 16)); - while (isspace(*p)) + while (isspace(*p)) p++; return (*p == 0 && _rgb <= 0xFFFFFF); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.h index 99d847560e0..99d847560e0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Color.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Color.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.cpp index 31b9de68c01..937c0f42877 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.cpp @@ -109,7 +109,7 @@ bool ColorSpecialHandler::process (const char *prefix, istream &is, SpecialActio _colorStack.push(color); } if (actions) { - if (_colorStack.empty()) + if (_colorStack.empty()) actions->setColor(Color::BLACK); else actions->setColor(_colorStack.top()); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.h index 27dfe984a00..6e7b0edf0f3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ColorSpecialHandler.h @@ -29,7 +29,7 @@ class ColorSpecialHandler : public SpecialHandler { - public: + 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";} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.cpp new file mode 100644 index 00000000000..3147ea61c49 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.cpp @@ -0,0 +1,316 @@ +// 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-2014 Martin Gieseking <martin.gieseking@uos.de> + +#include <config.h> +#include <cstdio> +#include <iostream> +#include <iomanip> +#include "InputReader.h" +#include "CommandLine.h" + +using namespace std; + +const CmdLineParserBase::Option CommandLine::_options[] = { + {'b', "bbox", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_bbox)}, + {'C', "cache", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_cache)}, + {'\0', "color", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_color)}, +#if !defined(DISABLE_GS) + {'E', "eps", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_eps)}, +#endif + {'e', "exact", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_exact)}, + {'m', "fontmap", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_fontmap)}, + {'h', "help", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_help)}, + {'\0', "keep", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_keep)}, +#if !defined(HAVE_LIBGS) && !defined(DISABLE_GS) + {'\0', "libgs", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_libgs)}, +#endif + {'L', "linkmark", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_linkmark)}, + {'l', "list-specials", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_list_specials)}, + {'M', "mag", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_mag)}, + {'n', "no-fonts", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_fonts)}, + {'\0', "no-mktexmf", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_mktexmf)}, + {'S', "no-specials", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_specials)}, + {'\0', "no-styles", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_no_styles)}, + {'o', "output", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_output)}, + {'p', "page", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_page)}, + {'d', "precision", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_precision)}, + {'P', "progress", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_progress)}, + {'r', "rotate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_rotate)}, + {'c', "scale", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_scale)}, + {'s', "stdout", ARG_NONE, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_stdout)}, + {'a', "trace-all", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_trace_all)}, + {'T', "transform", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_transform)}, + {'t', "translate", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_translate)}, + {'v', "verbosity", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_verbosity)}, + {'V', "version", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_version)}, + {'z', "zip", ARG_OPTIONAL, new OptionHandlerImpl<CommandLine>(&CommandLine::handle_zip)}, + {'Z', "zoom", ARG_REQUIRED, new OptionHandlerImpl<CommandLine>(&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; + _color_given = false; +#if !defined(DISABLE_GS) + _eps_given = false; +#endif + _exact_given = false; + _fontmap_given = false; + _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_mktexmf_given = false; + _no_specials_given = false; + _no_styles_given = false; + _output_given = false; + _page_given = false; + _precision_given = false; + _progress_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(); + _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]", + "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-s, --stdout write SVG output to stdout", + "o-n, --no-fonts[=variant] draw glyphs by using path elements [0]", + "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; +} + +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; +} + +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_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_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.7/src/CommandLine.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.h new file mode 100644 index 00000000000..3ec040a6d88 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/CommandLine.h @@ -0,0 +1,173 @@ +// 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-2014 Martin Gieseking <martin.gieseking@uos.de> + +#ifndef COMMANDLINE_H +#define COMMANDLINE_H + +#include <config.h> +#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;} + 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;} + 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_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 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); + 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); + 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_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_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; + bool _color_given; +#if !defined(DISABLE_GS) + bool _eps_given; +#endif + bool _exact_given; + bool _fontmap_given; + std::string _fontmap_arg; + 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_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 _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.6/src/DLLoader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.cpp index 8f03d1a0b83..8f03d1a0b83 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DLLoader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DLLoader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.h index e699fa219db..de14be50495 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DLLoader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DLLoader.h @@ -30,16 +30,16 @@ class DLLoader { - public: - DLLoader (const char *dlname); - virtual ~DLLoader (); + public: + DLLoader (const char *dlname); + virtual ~DLLoader (); bool loaded () const {return _handle != 0;} protected: DLLoader () : _handle(0) {} void* loadSymbol (const char *name); - private: + private: #ifdef __WIN32__ HINSTANCE _handle; #else diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIActions.h index 613be5365d6..7a82d4456f1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIActions.h @@ -38,16 +38,14 @@ struct DVIActions virtual void setTextOrientation (bool vertical) {} virtual void moveToX (double x) {} virtual void moveToY (double y) {} - virtual bool fontProcessingEnabled () const {return true;} 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) {} + 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 const SpecialManager* setProcessSpecials (const char *ignorelist) {return 0;} virtual void progress (size_t current, size_t total, const char *id=0) {} }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.cpp index f9edfd0536d..925efe0407b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.cpp @@ -19,6 +19,7 @@ *************************************************************************/ #include <config.h> +#include <algorithm> #include <cstdarg> #include <fstream> #include <iostream> @@ -37,10 +38,10 @@ using namespace std; -bool DVIReader::COMPUTE_PAGE_LENGTH = false; +bool DVIReader::COMPUTE_PROGRESS = false; -DVIReader::DVIReader (istream &is, DVIActions *a) : StreamReader(is), _dviFormat(DVI_NONE), _actions(a) +DVIReader::DVIReader (istream &is, DVIActions *a) : BasicDVIReader(is), _actions(a) { _inPage = false; _pageHeight = _pageWidth = 0; @@ -48,13 +49,13 @@ DVIReader::DVIReader (istream &is, DVIActions *a) : StreamReader(is), _dviFormat _tx = _ty = 0; // no cursor translation _prevYPos = numeric_limits<double>::min(); _inPostamble = false; - _totalPages = 0; // we don't know the correct value yet _currFontNum = 0; _currPageNum = 0; - _pageLength = 0; _pagePos = 0; - _prevBop = 0; _mag = 1; + collectBopOffsets(); + executePreamble(); + executePostamble(); } @@ -65,136 +66,31 @@ DVIActions* DVIReader::replaceActions (DVIActions *a) { } -/** Evaluates the next DVI command, and computes the corresponding handler. - * @param[in] compute_size if true, the size of variable-length parameters is computed - * @param[out] handler handler for current DVI command - * @param[out] length number of parameter bytes - * @param[out] param the handler must be called with this parameter - * @return opcode of current DVI command */ -int DVIReader::evalCommand (bool compute_size, CommandHandler &handler, int &length, 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[] = { - {&DVIReader::cmdSetChar, 1}, {&DVIReader::cmdSetChar, 2}, {&DVIReader::cmdSetChar, 3}, {&DVIReader::cmdSetChar, 4}, // 128-131 - {&DVIReader::cmdSetRule, 8}, // 132 - {&DVIReader::cmdPutChar, 1}, {&DVIReader::cmdPutChar, 2}, {&DVIReader::cmdPutChar, 3}, {&DVIReader::cmdPutChar, 4}, // 133-136 - {&DVIReader::cmdPutRule, 8}, // 137 - {&DVIReader::cmdNop, 0}, // 138 - {&DVIReader::cmdBop, 44}, {&DVIReader::cmdEop, 0}, // 139-140 - {&DVIReader::cmdPush, 0}, {&DVIReader::cmdPop, 0}, // 141-142 - {&DVIReader::cmdRight, 1}, {&DVIReader::cmdRight, 2}, {&DVIReader::cmdRight, 3}, {&DVIReader::cmdRight, 4}, // 143-146 - {&DVIReader::cmdW0, 0}, // 147 - {&DVIReader::cmdW, 1}, {&DVIReader::cmdW, 2}, {&DVIReader::cmdW, 3}, {&DVIReader::cmdW, 4}, // 148-151 - {&DVIReader::cmdX0, 0}, // 152 - {&DVIReader::cmdX, 1}, {&DVIReader::cmdX, 2}, {&DVIReader::cmdX, 3}, {&DVIReader::cmdX, 4}, // 153-156 - {&DVIReader::cmdDown, 1}, {&DVIReader::cmdDown, 2}, {&DVIReader::cmdDown, 3}, {&DVIReader::cmdDown, 4}, // 157-160 - {&DVIReader::cmdY0, 0}, // 161 - {&DVIReader::cmdY, 1}, {&DVIReader::cmdY, 2}, {&DVIReader::cmdY, 3}, {&DVIReader::cmdY, 4}, // 162-165 - {&DVIReader::cmdZ0, 0}, // 166 - {&DVIReader::cmdZ, 1}, {&DVIReader::cmdZ, 2}, {&DVIReader::cmdZ, 3}, {&DVIReader::cmdZ, 4}, // 167-170 - {&DVIReader::cmdFontNum, 1}, {&DVIReader::cmdFontNum, 2}, {&DVIReader::cmdFontNum, 3}, {&DVIReader::cmdFontNum, 4}, // 235-238 - {&DVIReader::cmdXXX, 1}, {&DVIReader::cmdXXX, 2}, {&DVIReader::cmdXXX, 3}, {&DVIReader::cmdXXX, 4}, // 239-242 - {&DVIReader::cmdFontDef, 1}, {&DVIReader::cmdFontDef, 2}, {&DVIReader::cmdFontDef, 3}, {&DVIReader::cmdFontDef, 4}, // 243-246 - {&DVIReader::cmdPre, 0}, {&DVIReader::cmdPost, 0}, {&DVIReader::cmdPostPost, 0}, // 247-249 - {&DVIReader::cmdXPic, 0}, {&DVIReader::cmdXFontDef, 0},{&DVIReader::cmdXGlyphA, 0}, {&DVIReader::cmdXGlyphS, 0} // 251-254 - }; - - const int opcode = in().get(); - if (!in() || opcode < 0) // at end of file - throw InvalidDVIFileException("invalid file"); - - param = -1; - if (opcode >= 0 && opcode <= 127) { - handler = &DVIReader::cmdSetChar0; - length = 0; - param = opcode; - } - else if (opcode >= 171 && opcode <= 234) { - handler = &DVIReader::cmdFontNum0; - length = 0; - param = opcode-171; - } - else if (opcode >= 251 && opcode <= 254 && _dviFormat == DVI_XDV) { // XDV command? - static const CommandHandler handlers[] = { - &DVIReader::cmdXPic, - &DVIReader::cmdXFontDef, - &DVIReader::cmdXGlyphA, - &DVIReader::cmdXGlyphS - }; - handler = handlers[opcode-251]; - param = 0; - } - else if (opcode == 255 && _dviFormat == DVI_PTEX) { // direction command set by pTeX? - handler = &DVIReader::cmdDir; - length = 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; - if (!compute_size) - length = commands[opcode-offset].length; - else { - if (opcode >= 239 && opcode <= 242) { // specials - int len = opcode-238; - UInt32 bytes = readUnsigned(len); - in().seekg(-len, ios_base::cur); - length = len+bytes; - } - else if (opcode >= 243 && opcode <= 246) { // fontdefs - int len = opcode-242; - len += 12; - in().seekg(len, ios_base::cur); // skip fontnum, checksum, ssize, dsize - UInt32 bytes = readUnsigned(1); // length of font path - bytes += readUnsigned(1); // length of font name - in().seekg(-len-2, ios_base::cur); - length = len+bytes; - } - else - length = commands[opcode-offset].length; - } - } - if (param < 0) - param = length; - 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 */ + * @return opcode of the command executed */ int DVIReader::executeCommand () { SignalHandler::instance().check(); CommandHandler handler; - int len; // number of parameter bytes int param; // parameter of handler - streampos pos = in().tellg(); - int opcode = evalCommand(false, handler, len, param); + 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_PAGE_LENGTH && _inPage && _actions) { + if (COMPUTE_PROGRESS && _inPage && _actions) { + size_t pagelen = numberOfPageBytes(_currPageNum-1); // ensure progress() is called at 0% - if (opcode == 139) // bop? - _actions->progress(0, _pageLength); + if (opcode == 139) // bop? + _actions->progress(0, pagelen); // ensure progress() is called at 100% - if (in().peek() == 140) // eop reached? - _pagePos = _pageLength; + if (peek() == 140) // eop reached? + _pagePos = pagelen; else - _pagePos += in().tellg()-pos; - _actions->progress(_pagePos, _pageLength); + _pagePos += tell()-cmdpos; + _actions->progress(_pagePos, pagelen); } return opcode; } @@ -203,7 +99,7 @@ int DVIReader::executeCommand () { /** Executes all DVI commands read from the input stream. */ void DVIReader::executeAll () { int opcode = 0; - while (!in().eof() && opcode >= 0) { + while (!eof() && opcode >= 0) { try { opcode = executeCommand(); } @@ -220,89 +116,73 @@ void DVIReader::executeAll () { * @param[in] n number of page to be executed * @returns true if page was read successfully */ bool DVIReader::executePage (unsigned n) { - in().clear(); // reset all status bits - if (!in()) + clearStream(); // reset all status bits + if (!isStreamValid()) throw DVIException("invalid DVI file"); - in().seekg(-1, ios_base::end); // stream pointer to last byte - while (in().peek() == 223) - in().seekg(-1, ios_base::cur); // skip fill bytes - in().seekg(-4, ios_base::cur); // now on first byte of q (pointer to begin of postamble) - UInt32 q = readUnsigned(4); // pointer to begin of postamble - in().seekg(q, ios_base::beg); // now on begin of postamble - if (executeCommand() != 248) // execute postamble command but not the fontdefs + if (n < 1 || n > numberOfPages()) return false; - if (n < 1 || n > _totalPages) - return false; - in().seekg(_prevBop, ios_base::beg); // now on last bop - _inPostamble = false; // we jumped out of the postamble - unsigned pageCount = _totalPages; - for (; pageCount > n && _prevBop > 0; pageCount--) { - in().seekg(41, ios_base::cur); // skip bop and 10*4 \count bytes => now on pointer to prev bop - _prevBop = readSigned(4); - in().seekg(_prevBop, ios_base::beg); - } + + seek(_bopOffsets[n-1]); // goto bop of n-th page + _inPostamble = false; // not in postamble _currPageNum = n; - while (pageCount == n && executeCommand() != 140); // 140 == eop + while (executeCommand() != 140); // 140 == eop return true; } -bool DVIReader::executePages (unsigned first, unsigned last) { - in().clear(); - if (!in()) - throw DVIException("invalid DVI file"); - if (first > last) - swap(first, last); - in().seekg(-1, ios_base::end); // stream pointer to last byte - while (in().peek() == 223) - in().seekg(-1, ios_base::cur); // skip fill bytes - in().seekg(-4, ios_base::cur); // now on first byte of q (pointer to begin of postamble) - UInt32 q = readUnsigned(4); // pointer to begin of postamble - in().seekg(q, ios_base::beg); // now on begin of postamble - if (executeCommand() != 248) // execute postamble command but not the fontdefs - return false; - first = max(1u, min(first, _totalPages)); - last = max(1u, min(last, _totalPages)); - in().seekg(_prevBop, ios_base::beg); // now on last bop - _inPostamble = false; // we jumped out of the postamble - unsigned count = _totalPages; - for (; count > first && _prevBop > 0; count--) { - in().seekg(41, ios_base::cur); // skip bop and 10*4 \count bytes => now on pointer to prev bop - _prevBop = readSigned(4); - in().seekg(_prevBop, ios_base::beg); - } - while (first <= last) { - _currPageNum = first++; - while (executeCommand () != 140); // 140 == eop +void DVIReader::executePreamble () { + clearStream(); + if (isStreamValid()) { + seek(0); + if (readByte() == 247) { + cmdPre(0); + return; + } } - return true; + throw DVIException("invalid DVI file"); } -void DVIReader::executePreamble () { - in().clear(); - if (!in()) +/** Moves stream pointer to begin of postamble */ +static void to_postamble (StreamReader &reader) { + reader.clearStream(); + if (!reader.isStreamValid()) throw DVIException("invalid DVI file"); - in().seekg(0, ios_base::beg); - if (in().get() != 247) - throw DVIException("invalid DVI file"); - cmdPre(0); + + reader.seek(-1, ios_base::end); // stream pointer to last byte + int count=0; + while (reader.peek() == 223) { + reader.seek(-1, ios_base::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_base::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 () { - in().clear(); // reset all status bits - if (!in()) - throw DVIException("invalid DVI file"); - in().seekg(-1, ios_base::end); // stream pointer to last byte - while (in().peek() == 223) - in().seekg(-1, ios_base::cur); // skip fill bytes + to_postamble(*this); + while (executeCommand() != 249); // executes all commands until post_post (= 249) is reached +} + - in().seekg(-4, ios_base::cur); // now on first byte of q (pointer to begin of postamble) - UInt32 q = readUnsigned(4); // pointer to begin of postamble - in().seekg(q, ios_base::beg); // now on begin of postamble - while (executeCommand() != 249); // read all commands until postpost (= 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()); } @@ -320,35 +200,12 @@ double DVIReader::getYPos () const { } -double DVIReader::getPageHeight () const { - return _pageHeight; -} - - -double DVIReader::getPageWidth () const { - return _pageWidth; -} - - -void DVIReader::verifyDVIFormat (int id) const { - switch (id) { - case DVI_STANDARD: - case DVI_PTEX: - case DVI_XDV: - break; - default: - ostringstream oss; - oss << "DVI format version " << id << " not supported"; - throw DVIException(oss.str()); - } -} - ///////////////////////////////////// -/** Reads and executes DVI preamble command. */ +/** Reads and executes DVI preamble command. + * Format: pre ver[1] num[4] den[4] mag[4] cmtlen[1] cmt[cmtlen] */ void DVIReader::cmdPre (int) { - _dviFormat = max(_dviFormat, (DVIFormat)readUnsigned(1)); // identification number - verifyDVIFormat(_dviFormat); + 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) @@ -364,9 +221,10 @@ void DVIReader::cmdPre (int) { } -/** Reads and executes DVI postamble command. */ +/** 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) { - _prevBop = readUnsigned(4); // pointer to previous bop + readUnsigned(4); // skip pointer to previous bop UInt32 num = readUnsigned(4); UInt32 den = readUnsigned(4); if (den == 0) @@ -374,8 +232,10 @@ void DVIReader::cmdPost (int) { _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); // max. stack depth - _totalPages = readUnsigned(2); // total number of pages + 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; @@ -387,42 +247,29 @@ void DVIReader::cmdPost (int) { } -/** Reads and executes DVI postpost command. */ +/** 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 - _dviFormat = max(_dviFormat, (DVIFormat)readUnsigned(1)); // identification byte - verifyDVIFormat(_dviFormat); + 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. */ +/** 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 + _dviState.reset(); // set all DVI registers to 0 while (!_stateStack.empty()) _stateStack.pop(); _currFontNum = 0; _inPage = true; - _pageLength = 0; _pagePos = 0; - if (COMPUTE_PAGE_LENGTH) { - // compute number of bytes in current page - int length, param; - CommandHandler handler; - // read all commands until eop is found - while (evalCommand(true, handler, length, param) != 140) { - in().seekg(length, ios_base::cur); - _pageLength += length+1; // parameter length + opcode length (1 byte) - } - ++_pageLength; // add length of eop command (1 byte) - in().seekg(-int(_pageLength), ios_base::cur); // go back to first command following bop - _pageLength += 45; // add length of bop command - } beginPage(_currPageNum, c); if (_actions) _actions->beginPage(_currPageNum, c); @@ -473,10 +320,7 @@ void DVIReader::cmdPop (int) { * @throw DVIException if method is called ouside a bop/eop pair */ void DVIReader::putChar (UInt32 c, bool moveCursor) { if (!_inPage) - throw DVIException("set_char or put_char outside of page"); - - if (_actions && !_actions->fontProcessingEnabled()) - return; + throw DVIException("set_char/put_char outside of page"); FontManager &fm = FontManager::instance(); Font *font = fm.getFont(_currFontNum); @@ -504,7 +348,7 @@ void DVIReader::putChar (UInt32 c, bool moveCursor) { // Message::estream(true) << "invalid dvi in vf: " << e.getMessage() << endl; // @@ } replaceStream(is); // restore previous input stream - _dvi2bp = save_scale; // restore previous scale factor + _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 @@ -538,8 +382,8 @@ void DVIReader::cmdSetChar0 (int c) { * @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... + // 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); } @@ -550,8 +394,8 @@ void DVIReader::cmdSetChar (int len) { * @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... + // 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); } @@ -559,32 +403,30 @@ void DVIReader::cmdPutChar (int len) { /** 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) { - 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); - } - else + 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) { - 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); - } - else + 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); } @@ -649,14 +491,12 @@ void DVIReader::cmdDir (int) { void DVIReader::cmdXXX (int len) { - if (_inPage) { - UInt32 numBytes = readUnsigned(len); - string s = readString(numBytes); - if (_actions) - _actions->special(s, _dvi2bp); - } - else + if (!_inPage) throw DVIException("special outside of page"); + UInt32 numBytes = readUnsigned(len); + string s = readString(numBytes); + if (_actions) + _actions->special(s, _dvi2bp); } @@ -664,9 +504,6 @@ void DVIReader::cmdXXX (int len) { * @param[in] num font number * @throw DVIException if font number is undefined */ void DVIReader::cmdFontNum0 (int num) { - if (_actions && !_actions->fontProcessingEnabled()) - return; - if (Font *font = FontManager::instance().getFont(num)) { _currFontNum = num; if (_actions && !dynamic_cast<VirtualFont*>(font)) @@ -696,8 +533,9 @@ void DVIReader::cmdFontNum (int len) { * @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 (_actions && !_actions->fontProcessingEnabled()) + 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); @@ -711,7 +549,7 @@ void DVIReader::defineFont (UInt32 fontnum, const string &name, UInt32 cs, doubl fm.leaveVF(); } if (_actions) - _actions->defineFont(id, font); + _actions->defineFont(id, font); } @@ -724,10 +562,9 @@ void DVIReader::cmdFontDef (int len) { 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 - string fontpath = readString(pathlen); + readString(pathlen); // skip font path string fontname = readString(namelen); - // @@ TODO: avoid processing the font definitions in the postamble defineFont(fontnum, fontname, checksum, dsize*_dvi2bp, ssize*_dvi2bp); } @@ -753,7 +590,7 @@ void DVIReader::defineVFChar (UInt32 c, vector<UInt8> *dvi) { } -/** XDV extension: include image or pdf file. +/** 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 @@ -766,6 +603,7 @@ void DVIReader::cmdXPic (int) { } +/** XDV extension: defines a native font */ void DVIReader::cmdXFontDef (int) { Int32 fontnum = readSigned(4); double ptsize = _dvi2bp*readUnsigned(4); @@ -782,8 +620,8 @@ void DVIReader::cmdXFontDef (int) { } 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 font have a fixed color - // that can't be changed by colors specials. + // 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.set(UInt8(rgba >> 24), UInt8((rgba >> 16) & 0xff), UInt8((rgba >> 8) & 0xff)); } @@ -798,21 +636,28 @@ void DVIReader::cmdXFontDef (int) { for (int i=0; i < num_variations; i++) readUnsigned(4); } - if (_inPage && _actions && _actions->fontProcessingEnabled()) + if (_inPage) FontManager::instance().registerFont(fontnum, fontname, 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::cmdXGlyphA (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::cmdXGlyphS (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); @@ -822,7 +667,9 @@ void DVIReader::putGlyphArray (bool xonly) { x[i] = readSigned(4); y[i] = xonly ? 0 : readSigned(4); } - if (_actions && _actions->fontProcessingEnabled()) { + 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); @@ -832,9 +679,5 @@ void DVIReader::putGlyphArray (bool xonly) { } } } - else { - for (int i=0; i < num_glyphs; i++) - readUnsigned(2); - } moveRight(strwidth); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.h index d57250295b8..366a110f531 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIReader.h @@ -25,29 +25,17 @@ #include <map> #include <stack> #include <string> +#include "BasicDVIReader.h" #include "MessageException.h" #include "StreamReader.h" #include "VFActions.h" #include "types.h" -struct DVIException : public MessageException -{ - DVIException (const std::string &msg) : MessageException(msg) {} -}; - -struct InvalidDVIFileException : public DVIException -{ - InvalidDVIFileException(const std::string &msg) : DVIException(msg) {} -}; - struct DVIActions; -struct FileFinder; -class DVIReader : public StreamReader, protected VFActions +class DVIReader : public BasicDVIReader, protected VFActions { - typedef void (DVIReader::*CommandHandler)(int); - enum DVIFormat {DVI_NONE=0, DVI_STANDARD=2, DVI_PTEX=3, DVI_XDV=5}; enum WritingMode {WMODE_LR=0, WMODE_TB=1, WMODE_BT=3}; struct DVIState @@ -64,30 +52,28 @@ class DVIReader : public StreamReader, protected VFActions bool executeDocument (); void executeAll (); - bool executeAllPages (); void executePreamble (); void executePostamble (); bool executePage (unsigned n); - bool executePages (unsigned first, unsigned last); bool inPostamble () const {return _inPostamble;} double getXPos () const; double getYPos () const; void finishLine () {_prevYPos = std::numeric_limits<double>::min();} - void translateToX (double x) {_tx=x-_dviState.h-_tx;} - void translateToY (double y) {_ty=y-_dviState.v-_ty;} - double getPageWidth () const; - double getPageHeight () const; + 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 getTotalPages () const {return _totalPages;} + unsigned numberOfPages () const {return _bopOffsets.empty() ? 0 : _bopOffsets.size()-1;} DVIActions* getActions () const {return _actions;} DVIActions* replaceActions (DVIActions *a); protected: - void verifyDVIFormat (int id) const; + void collectBopOffsets (); + size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} int executeCommand (); - int evalCommand (bool compute_size, CommandHandler &handler, int &length, int ¶m); void moveRight (double dx); void moveDown (double dy); void putChar (UInt32 c, bool moveCursor); @@ -136,26 +122,23 @@ class DVIReader : public StreamReader, protected VFActions void cmdXGlyphS (int len); private: - DVIFormat _dviFormat; ///< format of DVI file currently processed DVIActions *_actions; ///< actions to be performed on various DVI events bool _inPage; ///< true if between bop and eop - unsigned _totalPages; ///< total number of pages in dvi file - unsigned _currPageNum; ///< current page number + 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 - Int32 _prevBop; ///< pointer to previous bop double _pageHeight, _pageWidth; ///< page height and width in PS points DVIState _dviState; ///< current cursor position std::stack<DVIState> _stateStack; + std::vector<UInt32> _bopOffsets; double _prevYPos; ///< previous vertical cursor position double _tx, _ty; ///< tranlation of cursor position - size_t _pageLength; ///< number of bytes between current bop end eop std::streampos _pagePos; ///< distance of current DVI command from bop (in bytes) public: - static bool COMPUTE_PAGE_LENGTH; ///< if true, the bop handler computes the number of bytes of the current page + 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.6/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.cpp index 8f9bb1f63a3..d4252961b11 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.cpp @@ -54,40 +54,13 @@ #include "PsSpecialHandler.h" #endif #include "TpicSpecialHandler.h" +#include "PreScanDVIReader.h" /////////////////////////////////// - using namespace std; -class PSHeaderActions : public DVIActions -{ - public : - PSHeaderActions (DVIToSVG &dvisvg) : _dvisvg(dvisvg) {} - - void special (const std::string &str, double dvi2bp) { - // execute PS headers only - if (!str.empty() && (str[0] == '!' || str.substr(0, 7) == "header=")) - _dvisvg.specialManager().process(str, dvi2bp, 0); - } - - bool fontProcessingEnabled () const { - return false; - } - - void endPage (unsigned) { - _dvisvg.specialManager().leavePSHeaderSection(); - } - - BoundingBox& bbox () {return _bbox;} - - private: - DVIToSVG &_dvisvg; - BoundingBox _bbox; -}; - - /** '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 */ @@ -110,48 +83,29 @@ DVIToSVG::~DVIToSVG () { * @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<int,int> *pageinfo) { - if (getTotalPages() == 0) { - executePreamble(); - executePostamble(); // collect scaling information - } if (first > last) swap(first, last); - if (first > getTotalPages()) { + if (first > numberOfPages()) { ostringstream oss; - oss << "file contains only " << getTotalPages() << " page"; - if (getTotalPages() > 1) + oss << "file contains only " << numberOfPages() << " page"; + if (numberOfPages() > 1) oss << 's'; throw DVIException(oss.str()); } - last = min(last, getTotalPages()); - -#ifndef DISABLE_GS - // ensure loading of PostScript prologues given at the beginning of the first page - // (prologue files are always referenced in first page) - PSHeaderActions headerActions(*this); - DVIActions *save = replaceActions(&headerActions); - try { - executePage(1); - replaceActions(save); - } - catch (PSException &e) { - replaceActions(save); - throw; - } -#endif + last = min(last, numberOfPages()); for (unsigned i=first; i <= last; ++i) { executePage(i); embedFonts(_svg.rootNode()); - _svg.write(_out.getPageStream(getCurrentPageNumber(), getTotalPages())); - string fname = _out.filename(i, getTotalPages()); + _svg.write(_out.getPageStream(getCurrentPageNumber(), numberOfPages())); + string fname = _out.filename(i, numberOfPages()); Message::mstream(false, Message::MC_PAGE_WRITTEN) << "\npage written to " << (fname.empty() ? "<stdout>" : fname) << '\n'; _svg.reset(); static_cast<DVIToSVGActions*>(getActions())->reset(); } if (pageinfo) { pageinfo->first = last-first+1; - pageinfo->second = getTotalPages(); + pageinfo->second = numberOfPages(); } } @@ -160,18 +114,24 @@ void DVIToSVG::convert (unsigned first, unsigned last, pair<int,int> *pageinfo) * @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<int,int> *pageinfo) { - if (getTotalPages() == 0) { - executePreamble(); - executePostamble(); // collect scaling information - } PageRanges ranges; - if (!ranges.parse(rangestr, getTotalPages())) + 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<DVIToSVGActions*>(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.pages(); - pageinfo->second = getTotalPages(); + pageinfo->first = ranges.numberOfPages(); + pageinfo->second = numberOfPages(); } } @@ -198,7 +158,7 @@ void DVIToSVG::endPage (unsigned pageno) { if (!dynamic_cast<DVIToSVGActions*>(getActions())) return; - _specialManager.notifyEndPage(pageno); + SpecialManager::instance().notifyEndPage(pageno); // set bounding box and apply page transformations BoundingBox &bbox = getActions()->bbox(); bbox.unlock(); @@ -328,9 +288,9 @@ void DVIToSVG::embedFonts (XMLElementNode *svgElement) { * @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 */ -const SpecialManager* DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) { +void DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) { if (ignorelist && strcmp(ignorelist, "*") == 0) { // ignore all specials? - _specialManager.unregisterHandlers(); + SpecialManager::instance().unregisterHandlers(); } else { // add special handlers @@ -363,8 +323,12 @@ const SpecialManager* DVIToSVG::setProcessSpecials (const char *ignorelist, bool } #endif } - _specialManager.unregisterHandlers(); - _specialManager.registerHandlers(p, ignorelist); + SpecialManager::instance().unregisterHandlers(); + SpecialManager::instance().registerHandlers(p, ignorelist); } - return &_specialManager; } + + +string DVIToSVG::getSVGFilename (unsigned pageno) const { + return _out.filename(pageno, numberOfPages()); +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.h index 626e27c568a..297aa5a1620 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVG.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVG.h @@ -33,33 +33,31 @@ struct SVGOutputBase; class DVIToSVG : public DVIReader { - public: - DVIToSVG (std::istream &is, SVGOutputBase &out); + public: + DVIToSVG (std::istream &is, SVGOutputBase &out); ~DVIToSVG (); - void convert (unsigned firstPage, unsigned lastPage, std::pair<int,int> *pageinfo=0); - void convert (const std::string &range, std::pair<int,int> *pageinfo=0); - const SpecialManager* setProcessSpecials (const char *ignorelist=0, bool pswarning=false); - const SpecialManager& specialManager () const {return _specialManager;} + void convert (const std::string &range, std::pair<int,int> *pageinfo=0); + void setProcessSpecials (const char *ignorelist=0, bool pswarning=false); 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; - public: - static char TRACE_MODE; + public: + static char TRACE_MODE; protected: DVIToSVG (const DVIToSVG &); - DVIToSVG operator = (const DVIToSVG &); + void convert (unsigned firstPage, unsigned lastPage, std::pair<int,int> *pageinfo=0); void beginPage (unsigned pageno, Int32 *c); void endPage (unsigned pageno); void embedFonts (XMLElementNode *svgElement); - private: + private: SVGTree _svg; SVGOutputBase &_out; std::string _bboxString; std::string _transCmds; - SpecialManager _specialManager; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.cpp index 7d25678d227..ca716bf88f5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.cpp @@ -40,7 +40,7 @@ double DVIToSVGActions::PROGRESSBAR_DELAY=1000; // initial delay in seconds (va DVIToSVGActions::DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg) - : _svg(svg), _dvisvg(dvisvg), _pageMatrix(0), _bgcolor(Color::TRANSPARENT), _boxes(0) + : _svg(svg), _dvireader(&dvisvg), _pageMatrix(0), _bgcolor(Color::TRANSPARENT), _boxes(0) { _currentFontNum = -1; _pageCount = 0; @@ -69,17 +69,24 @@ void DVIToSVGActions::setPageMatrix (const Matrix &matrix) { void DVIToSVGActions::moveToX (double x) { - _dvisvg.specialManager().notifyPositionChange(getX(), getY()); + SpecialManager::instance().notifyPositionChange(getX(), getY()); _svg.setX(x); } void DVIToSVGActions::moveToY (double y) { - _dvisvg.specialManager().notifyPositionChange(getX(), getY()); + SpecialManager::instance().notifyPositionChange(getX(), getY()); _svg.setY(y); } +string DVIToSVGActions::getSVGFilename (unsigned pageno) const { + if (DVIToSVG *dvi2svg = dynamic_cast<DVIToSVG*>(_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 @@ -194,27 +201,23 @@ void DVIToSVGActions::setFont (int num, const Font *font) { /** This method is called when a "special" command was found in the DVI file. - * @param[in] s the special expression - * @param[in] dvi2bp factor to scale DVI units to PS points */ -void DVIToSVGActions::special (const string &s, double dvi2bp) { + * @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 { - _dvisvg.specialManager().process(s, dvi2bp, this, this); + 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 '" << s << "': " << e.what() << '\n'; + Message::estream(true) << "error in special: " << e.what() << '\n'; } } -void DVIToSVGActions::beginSpecial (const char *prefix) { -} - - -void DVIToSVGActions::endSpecial (const char *) { -} - - /** This method is called when the DVI preamble was read * @param[in] cmt preamble comment text. */ void DVIToSVGActions::preamble (const string &cmt) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.h index 9b18209904b..72b61f7f0e2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DVIToSVGActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DVIToSVGActions.h @@ -37,25 +37,26 @@ struct FileFinder; struct Font; struct XMLNode; -class DVIToSVGActions : public DVIActions, public SpecialActions, public SpecialManager::Listener +class DVIToSVGActions : public DVIActions, public SpecialActions { typedef std::map<const Font*, std::set<int> > CharMap; typedef std::set<const Font*> FontSet; - typedef std::map<std::string,BoundingBox> BoxMap; + typedef std::map<std::string,BoundingBox> BoxMap; public: DVIToSVGActions (DVIToSVG &dvisvg, SVGTree &svg); ~DVIToSVGActions (); - void reset (); + 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 {_dvisvg.getPageTransformation(matrix);} + void getPageTransform (Matrix &matrix) const {_dvireader->getPageTransformation(matrix);} Color getColor () const {return _svg.getColor();} - int getDVIStackDepth() const {return _dvisvg.getStackDepth();} + 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);} @@ -65,34 +66,34 @@ class DVIToSVGActions : public DVIActions, public SpecialActions, public Special void moveToX (double x); void moveToY (double y); void setFont (int num, const Font *font); - void special (const std::string &s, double dvi2bp); + void special (const std::string &s, double dvi2bp, bool preprocessing=false); void preamble (const std::string &cmt); void postamble (); void beginPage (unsigned pageno, Int32 *c); void endPage (unsigned pageno); - void beginSpecial (const char *prefix); - void endSpecial (const char *prefix); 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 _dvisvg.getXPos();} - double getY() const {return _dvisvg.getYPos();} - void setX (double x) {_dvisvg.translateToX(x); _svg.setX(x);} - void setY (double y) {_dvisvg.translateToY(y); _svg.setY(y);} - void finishLine () {_dvisvg.finishLine();} + 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); + 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; public: static double PROGRESSBAR_DELAY; ///< progress bar doesn't appear before this time has elapsed (in sec) private: SVGTree &_svg; - DVIToSVG &_dvisvg; + BasicDVIReader *_dvireader; BoundingBox _bbox; int _pageCount; int _currentFontNum; @@ -100,7 +101,7 @@ class DVIToSVGActions : public DVIActions, public SpecialActions, public Special FontSet _usedFonts; Matrix *_pageMatrix; // transformation of whole page Color _bgcolor; - BoxMap *_boxes; + BoxMap *_boxes; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.cpp index 925b3065c8d..925b3065c8d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.h index 0d1e9406b4e..a10a26bd39c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Directory.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Directory.h @@ -33,15 +33,15 @@ class Directory public: enum EntryType {ET_FILE, ET_DIR, ET_FILE_OR_DIR}; - public: + public: Directory (); - Directory (std::string path); + Directory (std::string path); ~Directory (); bool open (std::string path); void close (); const char* read (EntryType type=ET_FILE_OR_DIR); - private: + private: std::string _dirname; #ifdef __WIN32__ bool firstread; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.cpp new file mode 100644 index 00000000000..a3b2233e5b2 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.cpp @@ -0,0 +1,354 @@ +/************************************************************************* +** DvisvgmSpecialHandler.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <config.h> +#include <cstring> +#include <utility> +#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<string, StringVector> entry(id, StringVector()); + pair<MacroMap::iterator, bool> 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]] <width> <height> [<depth>] + * variant 2: dvisvgm:bbox a[bs] <x1> <y1> <x2> <y2> + * variant 3: dvisvgm:bbox f[ix] <x1> <y1> <x2> <y2> + * variant 4: dvisvgm:bbox n[ew] <name> */ +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.7/src/DvisvgmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.h new file mode 100644 index 00000000000..13c52718011 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/DvisvgmSpecialHandler.h @@ -0,0 +1,67 @@ +/************************************************************************* +** DvisvgmSpecialHandler.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef DVISVGM_DVISVGMSPECIALHANDLER_H +#define DVISVGM_DVISVGMSPECIALHANDLER_H + +#include <map> +#include <string> +#include <vector> +#include "SpecialHandler.h" + +class InputReader; +struct SpecialActions; + +class DvisvgmSpecialHandler : public SpecialHandler, public DVIPreprocessingListener, public DVIEndPageListener +{ + typedef std::vector<std::string> StringVector; + typedef std::map<std::string, StringVector> 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.6/src/EPSFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.cpp index d3def37dc68..aea2c9114c9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.cpp @@ -60,18 +60,18 @@ static size_t getline (istream &is, char *line, size_t n) { 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, ios_base::beg); // go back to the first byte + 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, ios_base::beg); // continue reading at the beginning of the PS section + _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, ios_base::beg); + _ifs.seekg(0); } } @@ -80,7 +80,7 @@ EPSFile::EPSFile (const std::string& fname) : _ifs(fname.c_str(), ios::binary), * to the beginning of the ASCII (PostScript) part of the file. */ istream& EPSFile::istream () const { _ifs.clear(); - _ifs.seekg(_offset, ios_base::beg); + _ifs.seekg(_offset); return _ifs; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSFile.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.h index 19b60a42797..19b60a42797 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSFile.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSFile.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.cpp index 417dde90f48..6e0188d1d6f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.cpp @@ -72,3 +72,9 @@ void EPSToSVG::convert () { Message::mstream(false, Message::MC_PAGE_WRITTEN) << "graphic written to " << (svgfname.empty() ? "<stdout>" : svgfname) << '\n'; } + +string EPSToSVG::getSVGFilename (unsigned pageno) const { + if (pageno == 1) + return _out.filename(1, 1); + return ""; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.h index e3ea67ca87d..e6d654f595f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EPSToSVG.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EPSToSVG.h @@ -55,8 +55,10 @@ class EPSToSVG : protected SpecialActions 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);} + 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 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.cpp index cc06289464c..2d944e9433d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.cpp @@ -95,9 +95,9 @@ static void create_line (const DPair &p1, const DPair &p2, char c1, char c2, dou 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()); + << 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()); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.h index 17e84a3e6e2..000277f6909 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EmSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EmSpecialHandler.h @@ -36,8 +36,8 @@ class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener double width; ///< line width }; - public: - EmSpecialHandler (); + 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; @@ -46,7 +46,7 @@ class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener protected: void dviEndPage (unsigned pageno); - private: + private: std::map<int, DPair> _points; ///< points defined by special em:point std::list<Line> _lines; ///< list of lines with undefined end points double _linewidth; ///< global line width diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.cpp index 103090bc3e3..103090bc3e3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.h index 10b21c15547..5d15a48cfff 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/EncFile.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/EncFile.h @@ -31,8 +31,8 @@ class EncFile : public NamedFontEncoding { - public: - EncFile (const std::string &name); + public: + EncFile (const std::string &name); void read (); void read (std::istream &is); int size () const {return _table.size();} @@ -42,7 +42,7 @@ class EncFile : public NamedFontEncoding bool mapsToCharIndex () const {return false;} const char* path () const; - private: + private: std::string _encname; std::vector<std::string> _table; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.cpp index e8269991053..e8269991053 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.h index 5057e9b2593..e4a59c2346a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileFinder.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileFinder.h @@ -25,7 +25,7 @@ struct FileFinder { - static void init (const char *argv0, const char *progname, bool enable_mktexmf); + 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); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.cpp index 92922d99354..92922d99354 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.h index c1c1bab7064..c1c1bab7064 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FilePath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FilePath.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.cpp index e938e65a207..398878853cd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.cpp @@ -35,16 +35,16 @@ using namespace std; #ifdef __WIN32__ #include <direct.h> #include <windows.h> - const char *FileSystem::DEVNULL = "nul"; - const char FileSystem::PATHSEP = '\\'; + const char *FileSystem::DEVNULL = "nul"; + const char FileSystem::PATHSEP = '\\'; #define unlink _unlink #else #include <dirent.h> #include <pwd.h> - #include <sys/stat.h> - #include <sys/types.h> - const char *FileSystem::DEVNULL = "/dev/null"; - const char FileSystem::PATHSEP = '/'; + #include <sys/stat.h> + #include <sys/types.h> + const char *FileSystem::DEVNULL = "/dev/null"; + const char FileSystem::PATHSEP = '/'; #endif @@ -68,7 +68,7 @@ bool FileSystem::copy (const string &src, const string &dest, bool remove_src) { ifs.close(); return remove(src); } - else + else return !remove_src; } return false; @@ -238,7 +238,7 @@ bool FileSystem::rmdir (const char *dirname) { const char *fname = ent->d_name; string path = string(fname) + "/" + fname; if (isDirectory(path.c_str())) { - if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) + if (strcmp(fname, ".") != 0 && strcmp(fname, "..") != 0) ok = rmdir(path.c_str()) && s_rmdir(path.c_str()); } else if (isFile(path.c_str())) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.h index f60fcd0ac86..f60fcd0ac86 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FileSystem.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FileSystem.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.cpp index a7f78e80427..00d6b7fda9b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.cpp @@ -38,37 +38,16 @@ #include "SignalHandler.h" #include "Subfont.h" #include "SVGTree.h" +#include "Unicode.h" #include "macros.h" using namespace std; -/** Returns true if 'unicode' is a valid unicode value in XML documents. - * XML version 1.0 doesn't allow various unicode character references - * ( for example). */ -static bool valid_unicode (UInt32 unicode) { - if ((unicode & 0xffff) == 0xfffe || (unicode & 0xffff) == 0xffff) - return false; - - UInt32 ranges[] = { - 0x0000, 0x0020, - 0x007f, 0x0084, - 0x0086, 0x009f, - 0x202a, 0x202e, // bidi control characters - 0xd800, 0xdfff, - 0xfdd0, 0xfdef, - }; - for (size_t i=0; i < sizeof(ranges)/sizeof(UInt32)/2; i++) - if (unicode >= ranges[2*i] && unicode <= ranges[2*i+1]) - return false; - return true; -} - - UInt32 Font::unicode (UInt32 c) const { // @@ this should be optimized :-) - return valid_unicode(c) ? c : 0x3400+c; + return Unicode::isValidCodepoint(c) ? c : 0x3400+c; } @@ -119,6 +98,13 @@ void Font::getGlyphMetrics (int c, bool vertical, GlyphMetrics &metrics) const { } +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) @@ -524,16 +510,16 @@ UInt32 PhysicalFontImpl::unicode (UInt32 c) const { return Font::unicode(c); if (_localCharMap) { - if (UInt32 mapped_char = (*_localCharMap)[chr.number()]) + if (UInt32 mapped_char = _localCharMap->valueAt(chr.number())) return mapped_char; // No unicode equivalent found in font file. // Now we should look for a smart alternative but at the moment // it's sufficient to simply choose a valid unused unicode value... // Can we use the charcode itself as a unicode replacement? - if (!_localCharMap->valueExists(chr.number()) && valid_unicode(chr.number())) + if (!_localCharMap->valueExists(chr.number()) && Unicode::isValidCodepoint(chr.number())) return chr.number(); } - if (valid_unicode(chr.number())) + if (Unicode::isValidCodepoint(chr.number())) return chr.number(); return Font::unicode(chr.number()); } @@ -541,13 +527,13 @@ UInt32 PhysicalFontImpl::unicode (UInt32 c) const { /** Delete all temporary font files created by Metafont. */ void PhysicalFontImpl::tidy () const { - if (type() == MF) { + 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)); } - } + } } ////////////////////////////////////////////////////////////////////////////// @@ -612,23 +598,25 @@ double NativeFont::charDepth (int c) const { } -UInt32 NativeFont::unicode (UInt32 c) const { - UInt32 ucode = decodeChar(c).number(); - return valid_unicode(ucode) ? ucode : 0x3400+ucode; -} - - bool NativeFontImpl::findAndAssignBaseFontMap () { FontEngine &fe = FontEngine::instance(); fe.setFont(*this); - fe.buildCharMap(true, _toUnicodeMap); - _charmapID = fe.setUnicodeCharMap(); + 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::CHRCODE, _toUnicodeMap[c]); + return Character(Character::INDEX, c); +} + + +UInt32 NativeFontImpl::unicode (UInt32 c) const { + UInt32 ucode = _toUnicodeMap.valueAt(c); + return Unicode::isValidCodepoint(ucode) ? ucode : 0x3400+ucode; } ////////////////////////////////////////////////////////////////////////////// diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.h index bc33f630004..beba335793a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Font.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Font.h @@ -25,7 +25,6 @@ #include <string> #include <vector> #include "Character.h" -#include "CharMap.h" #include "CharMapID.h" #include "Color.h" #include "FontCache.h" @@ -36,10 +35,11 @@ #include "Glyph.h" #include "GraphicPath.h" #include "MessageException.h" +#include "RangeMap.h" +#include "ToUnicodeMap.h" #include "VFActions.h" #include "VFReader.h" #include "types.h" -#include "CharMap.h" struct FontStyle; @@ -68,11 +68,12 @@ struct Font { 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 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;} @@ -111,8 +112,8 @@ struct EmptyFont : public Font /** Interface for all physical fonts. */ class PhysicalFont : public virtual Font { - public: - enum Type {MF, OTF, PFB, TTC, TTF, UNKNOWN}; + 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); @@ -136,16 +137,16 @@ class PhysicalFont : public virtual Font virtual Character decodeChar (UInt32 c) const; const char* path () const; - protected: + protected: bool createGF (std::string &gfname) const; - public: + 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: + protected: static FontCache _cache; }; @@ -229,17 +230,17 @@ class PhysicalFontImpl : public PhysicalFont, public TFMFont { friend class PhysicalFont; public: - ~PhysicalFontImpl(); + ~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;} + 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; + UInt32 unicode (UInt32 c) const; bool findAndAssignBaseFontMap (); - void tidy () const; + void tidy () const; CharMapID getCharMapID () const {return _charmapID;} protected: @@ -251,7 +252,7 @@ class PhysicalFontImpl : public PhysicalFont, public TFMFont const FontMap::Entry *_fontMapEntry; FontEncodingPair _encodingPair; CharMapID _charmapID; ///< ID of the font's charmap to use - const CharMap *_localCharMap; + const RangeMap *_localCharMap; }; @@ -262,7 +263,6 @@ class NativeFont : public PhysicalFont virtual Font* clone (double ds, double sc) const =0; std::string name () const; Type type () const; - UInt32 unicode (UInt32 c) const; double designSize () const {return _ptsize;} double scaledSize () const {return _ptsize;} double charWidth (int c) const; @@ -297,6 +297,7 @@ class NativeFontProxy : public NativeFont const Font* uniqueFont () const {return _nfont;} const char* path () const {return _nfont->path();} 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: @@ -322,13 +323,13 @@ class NativeFontImpl : public NativeFont const Font* uniqueFont () const {return this;} const char* path () const {return _path.c_str();} bool findAndAssignBaseFontMap (); - CharMapID getCharMapID () const {return _charmapID;} + CharMapID getCharMapID () const {return CharMapID::NONE;} Character decodeChar (UInt32 c) const; + UInt32 unicode (UInt32 c) const; private: std::string _path; - CharMap _toUnicodeMap; ///< maps from char indexes to unicode point - CharMapID _charmapID; ///< unicode charmap ID + ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.cpp index e617bc9fd34..e617bc9fd34 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.h index c6c868edf49..3afed5485a2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontCache.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontCache.h @@ -43,26 +43,26 @@ class FontCache UInt32 numcmds; // number of path commands }; - public: + public: FontCache (); - ~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 *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;} + const std::string& fontname () const {return _fontname;} static bool fontinfo (const char *dirname, std::vector<FontInfo> &infos, std::vector<std::string> &invalid); static bool fontinfo (std::istream &is, FontInfo &info); static void fontinfo (const char *dirname, std::ostream &os, bool purge=false); - private: + private: static const UInt8 FORMAT_VERSION; - std::string _fontname; + std::string _fontname; GlyphMap _glyphs; bool _changed; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.cpp index dfa5b6c750e..a0fca850a98 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.cpp @@ -75,7 +75,7 @@ Character FontEncodingPair::decode (UInt32 c) const { bool FontEncodingPair::mapsToCharIndex () const { if (_enc2) return _enc2->mapsToCharIndex(); - if (_enc1) + if (_enc1) return _enc1->mapsToCharIndex(); return false; } @@ -84,7 +84,7 @@ bool FontEncodingPair::mapsToCharIndex () const { const FontEncoding* FontEncodingPair::findCompatibleBaseFontMap (const PhysicalFont *font, CharMapID &charmapID) const { if (_enc2) return _enc2->findCompatibleBaseFontMap(font, charmapID); - if (_enc1) + if (_enc1) return _enc1->findCompatibleBaseFontMap(font, charmapID); return 0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.h index 4c366182632..4c366182632 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEncoding.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEncoding.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.cpp index 5bfeba236d2..b1c6bee0c2d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.cpp @@ -69,16 +69,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"; + 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"; + 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"; } @@ -112,8 +112,8 @@ void FontEngine::setDeviceResolution (int x, int y) { bool FontEngine::setFont (const string &fname, int fontindex, const CharMapID &charMapID) { if (FT_New_Face(_library, fname.c_str(), fontindex, &_currentFace)) { Message::estream(true) << "FontEngine: error reading file " << fname << '\n'; - return false; - } + return false; + } if (charMapID.valid()) setCharMap(charMapID); return true; @@ -148,43 +148,38 @@ bool FontEngine::setCharMap (const CharMapID &charMapID) { } -/** Returns a character map that maps from character codes of the current - * encoding to character indexes, or vice versa. - * @param[in] invert if true, the resulting charmap maps from char indexes to char codes - * @param[out] charmap the resultig charmap */ -void FontEngine::buildCharMap (bool invert, CharMap &charmap) { +/** 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) { - if (invert) - charmap.append(glyph_index, charcode); - else - charmap.append(charcode, glyph_index); + charmap.addRange(glyph_index, glyph_index, charcode); charcode = FT_Get_Next_Char(_currentFace, charcode, &glyph_index); } - charmap.sort(); } /** Creates a charmap that maps from the custom character encoding to unicode. - * @return pointer to charmap if is could be created, 0 otherwise */ -const CharMap* FontEngine::createCustomToUnicodeMap () { + * @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; - CharMap index_to_source_chrcode; - buildCharMap(true, index_to_source_chrcode); + RangeMap index_to_source_chrcode; + buildCharMap(index_to_source_chrcode); if (FT_Select_Charmap(_currentFace, FT_ENCODING_UNICODE) != 0) return 0; - CharMap *charmap = new CharMap; + RangeMap *charmap = new RangeMap; FT_UInt glyph_index; - UInt32 charcode = FT_Get_First_Char(_currentFace, &glyph_index); + UInt32 unicode_point = FT_Get_First_Char(_currentFace, &glyph_index); while (glyph_index) { - charmap->append(index_to_source_chrcode[glyph_index], charcode); - charcode = FT_Get_Next_Char(_currentFace, charcode, &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); } - charmap->sort(); FT_Set_Charmap(_currentFace, ftcharmap); return charmap; } @@ -284,6 +279,12 @@ int FontEngine::getNextChar () const { } +/** 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 */ @@ -388,8 +389,8 @@ static bool trace_outline (FT_Face face, const Font *font, int index, Glyph &gly 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; - } + return false; + } if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) { Message::estream(true) << "no outlines found in glyph " << int(index) << '\n'; return false; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.h index 353613a40ef..79a0916d04d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontEngine.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontEngine.h @@ -28,10 +28,10 @@ #include <string> #include <vector> #include "Character.h" -#include "CharMap.h" #include "CharMapID.h" #include "Font.h" #include "Glyph.h" +#include "RangeMap.h" #include "types.h" @@ -39,7 +39,7 @@ * It's a wrapper for the Freetype font library. */ class FontEngine { - public: + public: ~FontEngine (); static FontEngine& instance (); static std::string version (); @@ -59,21 +59,22 @@ class FontEngine int getFirstChar () const; int getNextChar () const; int getCharMapIDs (std::vector<CharMapID> &charmapIDs) const; + int getNumGlyphs () const; CharMapID setUnicodeCharMap (); CharMapID setCustomCharMap (); std::vector<int> getPanose () const; std::string getGlyphName (const Character &c) const; int getCharByGlyphName (const char *name) const; bool setCharMap (const CharMapID &charMapID); - void buildCharMap (bool invert, CharMap &charmap); - const CharMap* createCustomToUnicodeMap (); + 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: + private: int _horDeviceRes, _vertDeviceRes; mutable unsigned int _currentChar, _currentGlyphIndex; FT_Face _currentFace; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.cpp index 7db9bad13bb..bb4288c57a4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.cpp @@ -44,8 +44,8 @@ FontManager::~FontManager () { /** Returns the singleton instance */ FontManager& FontManager::instance () { - static FontManager fm; - return fm; + static FontManager fm; + return fm; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.h index 24402f5ae5e..c5ed1a35a97 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontManager.h @@ -49,9 +49,9 @@ class FontManager typedef std::map<VirtualFont*, UInt32> VfFirstFontMap; typedef std::stack<VirtualFont*> VfStack; - public: - ~FontManager (); - static FontManager& instance (); + 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); Font* getFont (int n) const; @@ -69,10 +69,10 @@ class FontManager const std::vector<Font*>& getFonts () const {return _fonts;} std::ostream& write (std::ostream &os, Font *font=0, int level=0); - protected: - FontManager () {} + protected: + FontManager () {} - private: + private: std::vector<Font*> _fonts; ///< all registered Fonts Num2IdMap _num2id; ///< DVI font number -> fontID Name2IdMap _name2id; ///< fontname -> fontID diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.cpp index a094093b2f1..e885e0a38fa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.cpp @@ -55,8 +55,8 @@ FontMap& FontMap::instance() { * @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; + if (!ifs) + return false; int line_number = 1; while (ifs) { @@ -78,7 +78,7 @@ bool FontMap::read (const string &fname, FontMap::Mode mode) { Message::wstream(false) << e.what() << '\n'; } } - line_number++; + line_number++; } return true; } @@ -146,12 +146,12 @@ bool FontMap::read (const string &fname_seq) { 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"; - } + 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; } @@ -165,7 +165,7 @@ bool FontMap::read (const string &fname_seq) { * @return true if data has been appended */ bool FontMap::append (const MapLine &mapline) { bool ret = false; - if (!mapline.texname().empty()) { + if (!mapline.texname().empty()) { if (!mapline.fontfname().empty() || !mapline.encname().empty()) { vector<Subfont*> subfonts; if (mapline.sfd()) @@ -191,7 +191,7 @@ bool FontMap::append (const MapLine &mapline) { * @param[in] mapline parsed font data * @return true if data has been replaced */ bool FontMap::replace (const MapLine &mapline) { - if (mapline.texname().empty()) + if (mapline.texname().empty()) return false; if (mapline.fontfname().empty() && mapline.encname().empty()) return remove(mapline); @@ -219,7 +219,7 @@ bool FontMap::replace (const MapLine &mapline) { * @return true if entry has been removed */ bool FontMap::remove (const MapLine &mapline) { bool ret = false; - if (!mapline.texname().empty()) { + if (!mapline.texname().empty()) { vector<Subfont*> subfonts; if (mapline.sfd()) mapline.sfd()->subfonts(subfonts); @@ -233,8 +233,8 @@ bool FontMap::remove (const MapLine &mapline) { ret = true; } } - } - return ret; + } + return ret; } @@ -281,19 +281,19 @@ void FontMap::lockFont (const string& fontname) { /** 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 { + 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++); + _entries.erase(it++); } - } - } + } + } } ///////////////////////////////////////////////// diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.h index 8bd2f712340..bee44d8e6e7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMap.h @@ -71,7 +71,7 @@ class FontMap protected: FontMap () {} - private: + private: std::map<std::string,Entry*> _entries; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.cpp index 3920e4e6e76..3920e4e6e76 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.h index 50207211d2c..50207211d2c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontMetrics.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontMetrics.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontStyle.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontStyle.h index 932c09291cc..932c09291cc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/FontStyle.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/FontStyle.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.cpp index 4eff0912d42..58de265e740 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.cpp @@ -32,7 +32,7 @@ GFGlyphTracer::GFGlyphTracer () : GFTracer(_ifs, 0), _glyph(0), _callback(0) * @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) + : GFTracer(_ifs, upp), _glyph(0), _callback(cb) { if (_callback) _callback->setFont(fname); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.h index 84063a994b5..57ed0362cc0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFGlyphTracer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFGlyphTracer.h @@ -28,20 +28,20 @@ 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: + 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: + public: GFGlyphTracer (); - GFGlyphTracer (std::string &fname, double upp, Callback *cb=0); + GFGlyphTracer (std::string &fname, double upp, Callback *cb=0); void reset (std::string &fname, double upp); - void setCallback (Callback *cb) {_callback = cb;} + void setCallback (Callback *cb) {_callback = cb;} bool executeChar (UInt8 c); void moveTo (double x, double y); void lineTo (double x, double y); @@ -51,10 +51,10 @@ class GFGlyphTracer : public GFTracer void setGlyph (Glyph &glyph) {_glyph = &glyph;} const Glyph& getGlyph () const {return *_glyph;} - private: + private: std::ifstream _ifs; Glyph *_glyph; - Callback *_callback; + Callback *_callback; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.cpp index 0c0238b5766..9b0a319733b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.cpp @@ -89,8 +89,8 @@ string GFReader::readString (int bytes) { * @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 + /* 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 @@ -134,7 +134,7 @@ bool GFReader::executeChar (UInt8 c) { _in.clear(); Iterator it = _charInfoMap.find(c); if (_in && it != _charInfoMap.end()) { - _in.seekg(it->second.location, ios_base::beg); + _in.seekg(it->second.location); while (executeCommand() != 69); // execute all commands until eoc is reached return true; } @@ -165,7 +165,7 @@ bool GFReader::executePostamble () { _in.seekg(-1, ios_base::cur); _in.seekg(-4, ios_base::cur); UInt32 q = readUnsigned(4); // pointer to begin of postamble - _in.seekg(q, ios_base::beg); // now on begin of postamble + _in.seekg(q); // now on begin of postamble while (executeCommand() != 249); // execute all commands until postpost is reached return true; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.h index 62c36a0498b..1706acea126 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFReader.h @@ -52,9 +52,9 @@ class GFReader typedef std::map<UInt8,CharInfo>::iterator Iterator; typedef std::map<UInt8,CharInfo>::const_iterator ConstIterator; - public: - GFReader (std::istream &is); - virtual ~GFReader () {} + public: + GFReader (std::istream &is); + virtual ~GFReader () {} bool executeChar (UInt8 c); bool executeAllChars (); bool executePostamble (); @@ -94,7 +94,7 @@ class GFReader void cmdCharLoc0 (int); void cmdCharLoc (int); - private: + private: std::istream &_in; Int32 _minX, _maxX, _minY, _maxY; Int32 _x, _y; // current pen location (pixel units) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.cpp index 89ff4359fda..89ff4359fda 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.h index 7171ac1e3aa..617580636f0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GFTracer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GFTracer.h @@ -26,10 +26,10 @@ class GFTracer : public GFReader { - public: - GFTracer (std::istream &is); - GFTracer (std::istream &is, double upp); - virtual ~GFTracer () {} + public: + GFTracer (std::istream &is); + GFTracer (std::istream &is, double upp); + virtual ~GFTracer () {} virtual void moveTo (double x, double y) {} virtual void lineTo (double x, double y) {} virtual void curveTo (double c1x, double c1y, double c2x, double c2y, double x, double y) {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.cpp index 5a872960774..35d11ac4ad2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.cpp @@ -25,9 +25,9 @@ #include <iomanip> #include <sstream> #if defined(HAVE_LIBGS) - #include <ghostscript/ierrors.h> + #include <ghostscript/ierrors.h> #else - #include "ierrors.h" + #include "ierrors.h" #include "FileFinder.h" #endif @@ -103,7 +103,7 @@ Ghostscript::Ghostscript (int argc, const char **argv, void *caller) /** Exits Ghostscript and unloads the dynamic library. */ Ghostscript::~Ghostscript () { if (_inst) { - exit(); + this->exit(); delete_instance(); } } @@ -172,7 +172,7 @@ int Ghostscript::new_instance (void **psinst, void *caller) { #else if (PFN_gsapi_new_instance fn = (PFN_gsapi_new_instance)loadSymbol("gsapi_new_instance")) return fn(psinst, caller); - *psinst = 0; + *psinst = 0; return 0; #endif } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.h index d223ad04edf..6200fa8d0a1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Ghostscript.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Ghostscript.h @@ -25,12 +25,12 @@ #include <string> #if defined(DISABLE_GS) - #include "iapi.h" + #include "iapi.h" #elif defined(HAVE_LIBGS) - #include <ghostscript/iapi.h> + #include <ghostscript/iapi.h> #else - #include "DLLoader.h" - #include "iapi.h" + #include "DLLoader.h" + #include "iapi.h" #endif #if defined(__WIN32__) && !defined(_Windows) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Glyph.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Glyph.h index 5a003a2196b..5a003a2196b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Glyph.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Glyph.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GlyphTracerMessages.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GlyphTracerMessages.h index 6256bb843a0..6256bb843a0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GlyphTracerMessages.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GlyphTracerMessages.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GraphicPath.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GraphicPath.h index e1bd457d554..9e0d935acc6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/GraphicPath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/GraphicPath.h @@ -96,7 +96,7 @@ class GraphicPath typedef typename std::vector<Command>::const_iterator ConstIterator; typedef typename std::vector<Command>::const_reverse_iterator ConstRevIterator; - public: + public: void newpath () { _commands.clear(); } @@ -253,7 +253,7 @@ class GraphicPath void iterate (Actions &actions, bool optimize) const; - private: + private: std::vector<Command> _commands; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.cpp index 29ae75b5821..dc419e8ebb8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.cpp @@ -19,6 +19,7 @@ *************************************************************************/ #include <config.h> +#include <cassert> #include <sstream> #include "HtmlSpecialHandler.h" #include "InputReader.h" @@ -35,6 +36,53 @@ 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<string,string> attribs; + if (ir.check("<a ") && ir.parseAttributes(attribs, '"') > 0) { + map<string,string>::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; @@ -45,9 +93,9 @@ bool HtmlSpecialHandler::process (const char *prefix, istream &is, SpecialAction map<string,string>::iterator it; if (ir.check("<a ") && ir.parseAttributes(attribs, '"') > 0) { if ((it = attribs.find("href")) != attribs.end()) // <a href="URI"> - hrefAnchor(it->second); + processHrefAnchor(it->second); else if ((it = attribs.find("name")) != attribs.end()) // <a name="ID"> - nameAnchor(it->second); + processNameAnchor(it->second); else return false; // none or only invalid attributes } @@ -63,15 +111,22 @@ bool HtmlSpecialHandler::process (const char *prefix, istream &is, SpecialAction /** Handles anchors with href attribute: <a href="URI">...</a> * @param uri value of href attribute */ -void HtmlSpecialHandler::hrefAnchor (string uri) { +void HtmlSpecialHandler::processHrefAnchor (string uri) { closeAnchor(); - int id=0; + string name; if (uri[0] == '#') { // reference to named anchor? - string name = uri.substr(1); + name = uri.substr(1); NamedAnchors::iterator it = _namedAnchors.find(name); - if (it == _namedAnchors.end()) { - id = _namedAnchors.size()+1; - _namedAnchors[name] = NamedAnchor(-id, 0); + 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) { @@ -80,8 +135,8 @@ void HtmlSpecialHandler::hrefAnchor (string uri) { uri = _base + uri; } XMLElementNode *anchor = new XMLElementNode("a"); - anchor->addAttribute("xlink:href", id ? "#loc"+XMLString(id) : uri); - anchor->addAttribute("xlink:title", uri); + anchor->addAttribute("xlink:href", uri); + anchor->addAttribute("xlink:title", name.empty() ? uri : name); _actions->pushContextElement(anchor); _actions->bbox("{anchor}", true); // start computing the bounding box of the linked area _depthThreshold = _actions->getDVIStackDepth(); @@ -91,20 +146,11 @@ void HtmlSpecialHandler::hrefAnchor (string uri) { /** Handles anchors with name attribute: <a name="NAME">...</a> * @param name value of name attribute */ -void HtmlSpecialHandler::nameAnchor (const string &name) { +void HtmlSpecialHandler::processNameAnchor (const string &name) { closeAnchor(); - _anchorName = name; NamedAnchors::iterator it = _namedAnchors.find(name); - if (it == _namedAnchors.end()) { // first occurrence of this anchor - int id = _namedAnchors.size()+1; - _namedAnchors[name] = NamedAnchor(id, _actions->getY()); - } - else if (it->second.id < 0) { // anchor referenced but not defined yet - it->second.id *= -1; - it->second.pos = _actions->getY(); - } - else - Message::wstream(true) << "named hyperref anchor '" << name << "' redefined\n"; + assert(it != _namedAnchors.end()); + it->second.pos = _actions->getY(); _anchorType = AT_NAME; } @@ -116,8 +162,6 @@ void HtmlSpecialHandler::closeAnchor () { _actions->popContextElement(); _depthThreshold = 0; } - else if (_anchorType == AT_NAME) - _anchorName.clear(); _anchorType = AT_NONE; } @@ -206,7 +250,7 @@ void HtmlSpecialHandler::dviEndPage (unsigned pageno) { // 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.id > 0) { // current anchor referenced? + if (it->second.pageno == pageno && it->second.referenced) { // current anchor referenced? ostringstream oss; oss << pagebox.minX() << ' ' << it->second.pos << ' ' << pagebox.width() << ' ' << pagebox.height(); @@ -217,7 +261,6 @@ void HtmlSpecialHandler::dviEndPage (unsigned pageno) { } } closeAnchor(); - _namedAnchors.clear(); _actions = 0; } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.h index e94b3800e1d..f1c3466bdaa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/HtmlSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/HtmlSpecialHandler.h @@ -31,18 +31,21 @@ struct SpecialActions; class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, public DVIPositionListener { struct NamedAnchor { - NamedAnchor () : id(0), pos(0) {} - NamedAnchor (int i, double p) : id(i), pos(p) {} - int id; ///< unique numerical ID (< 0 if anchor is unreferenced) - double pos; ///< vertical position of named anchor (in PS point units) + 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<std::string, NamedAnchor> NamedAnchors; - public: + public: HtmlSpecialHandler () : _actions(0), _anchorType(AT_NONE), _depthThreshold(0) {} - bool process (const char *prefix, std::istream &in, SpecialActions *actions); + 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; @@ -50,15 +53,17 @@ class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, pub static bool setLinkMarker (const std::string &type); protected: - void hrefAnchor (std::string uri); - void nameAnchor (const std::string &name); + 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 linked areas are marked + 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 @@ -67,7 +72,6 @@ class HtmlSpecialHandler : public SpecialHandler, public DVIEndPageListener, pub SpecialActions *_actions; AnchorType _anchorType; ///< type of active anchor int _depthThreshold; ///< break anchor box if the DVI stack depth underruns this threshold - std::string _anchorName; ///< name of currently active named anchor std::string _base; ///< base URL that is prepended to all relative targets NamedAnchors _namedAnchors; ///< information about all named anchors processed }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.cpp index 79e0dcf39c7..154c60511bd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.cpp @@ -91,7 +91,7 @@ SplittedCharInputBuffer::SplittedCharInputBuffer (const char *buf1, size_t s1, c _buf[0] = buf1; _buf[1] = buf2; _size[0] = buf1 ? s1 : 0; - _size[1] = buf2 ? s2 : 0; + _size[1] = buf2 ? s2 : 0; _index = _size[0] ? 0 : 1; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.h index c29a943a7e7..efcbc36ed74 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputBuffer.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputBuffer.h @@ -35,7 +35,7 @@ struct InputBuffer virtual int peek () const =0; virtual int peek (size_t n) const =0; virtual bool eof () const =0; - virtual void invalidate () =0; + virtual void invalidate () =0; }; @@ -48,7 +48,7 @@ class StreamInputBuffer : public InputBuffer int peek () const; int peek (size_t n) const; bool eof () const {return pos() == _size1 && _size2 == 0;} - void invalidate () {_bufptr = _buf1+_size1; _size2 = 0;} + void invalidate () {_bufptr = _buf1+_size1; _size2 = 0;} protected: int fillBuffer (UInt8 *buf); @@ -73,7 +73,7 @@ class StringInputBuffer : public InputBuffer 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();} + void invalidate () {_pos = _str.length();} private: const std::string &_str; @@ -105,7 +105,7 @@ class CharInputBuffer : public InputBuffer 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;} + void invalidate () {_size = 0;} private: const char *_pos; @@ -121,7 +121,7 @@ class SplittedCharInputBuffer : public InputBuffer int peek () const; int peek (size_t n) const; bool eof () const {return _size[_index] == 0;} - void invalidate () {_size[_index] = 0;} + void invalidate () {_size[_index] = 0;} private: const char *_buf[2]; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.cpp index b2f01f5ea1e..f90bae04f8c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.cpp @@ -20,6 +20,7 @@ #include <config.h> #include <cmath> +#include <functional> #include <vector> #include "InputReader.h" @@ -225,6 +226,8 @@ double InputReader::getDouble () { } +/** 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(); @@ -234,6 +237,8 @@ string InputReader::getWord () { } +/** 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())) @@ -291,6 +296,17 @@ string InputReader::getString (size_t n) { } +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<int, int>(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 diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.h index c0d726424f6..d2eb5703211 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/InputReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/InputReader.h @@ -53,6 +53,7 @@ class InputReader 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<std::string,std::string> &attr, char quotechar=0); virtual operator bool () const {return !eof();} }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.cpp index 89c4796616c..89c4796616c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.h index 86585477f74..297ad6df710 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/JFM.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/JFM.h @@ -27,15 +27,15 @@ class JFM : public TFM { - public: - JFM (std::istream &is); + 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: + private: UInt16 _minchar; ///< character code of first entry in character type table bool _vertical; ///< true if metrics refer to vertical text layout std::vector<UInt16> _charTypeTable; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.cpp index 63d1509d3fd..09951489ff6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.cpp @@ -30,8 +30,8 @@ using namespace std; void Length::set (const string &len) { switch (len.length()) { - case 0: - _pt = 0; + case 0: + _pt = 0; break; case 1: if (isdigit(len[0])) @@ -42,7 +42,7 @@ void Length::set (const string &len) { default: istringstream iss(len); StreamInputReader ir(iss); - double val; + double val; if (!ir.parseDouble(val)) throw UnitException("invalid length: "+len); string unit = ir.getWord(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.h index f2e4f5d4114..109cc2d2898 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Length.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Length.h @@ -39,11 +39,11 @@ class Length public: enum Unit {PT, BP, CM, MM, IN, PC}; - public: + 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);} + 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); @@ -55,7 +55,7 @@ class Length double mm () const {return cm()*10;} double pc () const {return in()*12;} - private: + private: double _pt; // length in TeX point units }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Makefile.am new file mode 100644 index 00000000000..97f6a88d0bb --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Makefile.am @@ -0,0 +1,201 @@ +:## This file is part of dvisvgm +## Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> +## +## Process this file with automake. + +bin_PROGRAMS = dvisvgm +noinst_LIBRARIES = libdvisvgm.a + +dvisvgm_SOURCES = gzstream.h \ + dvisvgm.cpp gzstream.cpp + +dvisvgm_LDADD = $(noinst_LIBRARIES) @EXTRA_LIBS@ +dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) @EXTRA_LIBS@ + +libdvisvgm_a_SOURCES = \ + BasicDVIReader.cpp \ + BasicDVIReader.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 \ + 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 \ + 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 \ + SignalHandler.cpp \ + SignalHandler.h \ + SpecialActions.h \ + SpecialHandler.h \ + SpecialManager.cpp \ + SpecialManager.h \ + StreamReader.cpp \ + StreamReader.h \ + StreamWriter.cpp \ + StreamWriter.h \ + Subfont.cpp \ + Subfont.h \ + SVGOutputBase.h \ + SVGTree.cpp \ + SVGTree.h \ + System.cpp \ + System.h \ + Terminal.cpp \ + Terminal.h \ + TFM.cpp \ + TFM.h \ + ToUnicodeMap.cpp \ + ToUnicodeMap.h \ + TpicSpecialHandler.cpp \ + TpicSpecialHandler.h \ + types.h \ + Unicode.cpp \ + Unicode.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 + +# the command-line parser is generated from options.xml by opt2cpp +CommandLine.cpp: options.xml + if test -f opt2cpp.xsl; then \ + rm -f $@ $*.h; \ + xsltproc opt2cpp.xsl $<; \ + 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: ; + diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.cpp index b225b0ba4fd..d571d094890 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.cpp @@ -33,9 +33,9 @@ using namespace std; MapLine::MapLine (istream &is) : _sfd(0), _fontindex(0), _slant(0), _bold(0), _extend(1) { - char buf[256]; - is.getline(buf, 256); - parse(buf); + char buf[256]; + is.getline(buf, 256); + parse(buf); } @@ -44,23 +44,23 @@ MapLine::MapLine (istream &is) /** 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 */ + @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; + 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; } @@ -87,154 +87,154 @@ static bool split_fontname (string &fontname, string &sfdname) { * 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(); + 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); + 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(); + 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()); + 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(); + 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()) { + 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.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(); - } + 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; + _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() == ':') + ir.get(); + else + _fontindex = 0; } if (ir.peek() == '!') // no embedding ir.get(); @@ -263,7 +263,7 @@ void MapLine::parseFilenameOptions (string fname) { ir.getString(); // charcoll } if (style_given) { - ir.get(); // skip ',' + ir.get(); // skip ',' if (ir.check("BoldItalic")) { } else if (ir.check("Bold")) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.h index 16ee9687ae3..2c1a53518fa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MapLine.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MapLine.h @@ -32,40 +32,40 @@ class SubfontDefinition; struct MapLineException : MessageException { - MapLineException (const std::string &msg) : MessageException(msg) {} + MapLineException (const std::string &msg) : MessageException(msg) {} }; class MapLine { - public: - MapLine (std::istream &is); + 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;} + 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; + 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); + 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") + 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; + int _fontindex; ///< font index of file with multiple fonts (e.g. ttc files) + double _slant, _bold, _extend; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.cpp index 9eb956f0529..e0e301d281d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.cpp @@ -36,7 +36,7 @@ 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]; + - m._values[0][2-i] * m._values[1][(4-i)%3] * m._values[2][(3-i)%3]; } return sum; } @@ -55,13 +55,13 @@ double det (const Matrix &m, int row, int col) { if (r1 > r2) swap(r1, r2); return m._values[r1][c1] * m._values[r2][c2] - - m._values[r1][c2] * m._values[r2][c1]; + - m._values[r1][c2] * m._values[r2][c1]; } static inline double deg2rad (double deg) { - const double PI = acos(-1.0); - return PI*deg/180.0; + const double PI = acos(-1.0); + return PI*deg/180.0; } @@ -257,27 +257,27 @@ Matrix& Matrix::invert () { Matrix& Matrix::operator *= (double c) { - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) + 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]; + 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++) + 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; @@ -286,8 +286,8 @@ bool Matrix::operator == (const Matrix &m) const { /** 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++) + 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; @@ -296,8 +296,8 @@ bool Matrix::operator != (const Matrix &m) const { /** 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++) { + 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; @@ -314,8 +314,8 @@ bool Matrix::isIdentity() const { 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++) { + 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; @@ -336,18 +336,18 @@ static double getArgument (istream &is, Calculator &calc, double def, bool optio is.get(); if (!optional && leadingComma && is.peek() != ',') throw ParserException("',' expected"); - if (is.peek() == ',') { - is.get(); // skip comma - optional = false; // now we expect a parameter - } + 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"); + if (expr.length() == 0) { + if (optional) + return def; + else + throw ParserException("parameter expected"); } return calc.eval(expr); } @@ -356,21 +356,21 @@ static double getArgument (istream &is, Calculator &calc, double def, bool optio Matrix& Matrix::parse (istream &is, Calculator &calc) { *this = Matrix(1); while (is) { - while (isspace(is.peek())) - is.get(); + 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; + break; } case 'S': { double sx = getArgument(is, calc, 1, false, false); double sy = getArgument(is, calc, sx, true, true ); scale(sx, sy); - break; + break; } case 'R': { double a = getArgument(is, calc, 0, false, false); @@ -379,7 +379,7 @@ Matrix& Matrix::parse (istream &is, Calculator &calc) { translate(-x, -y); rotate(a); translate(x, y); - break; + break; } case 'F': { int c = is.get(); @@ -403,7 +403,7 @@ Matrix& Matrix::parse (istream &is, Calculator &calc) { xskewByAngle(a); else yskewByAngle(a); - break; + break; } case 'M': { double v[9]; @@ -414,12 +414,12 @@ Matrix& Matrix::parse (istream &is, Calculator &calc) { v[8] = 1; Matrix tm(v); rmultiply(tm); - break; + break; } - default: + default: ostringstream oss; oss << "transformation command expected (found '" << cmd << "' instead)"; - throw ParserException(oss.str()); + throw ParserException(oss.str()); } } return *this; @@ -427,9 +427,9 @@ Matrix& Matrix::parse (istream &is, Calculator &calc) { Matrix& Matrix::parse (const string &cmds, Calculator &calc) { - istringstream iss; - iss.str(cmds); - return parse(iss, calc); + istringstream iss; + iss.str(cmds); + return parse(iss, calc); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.h index 1da461d99a0..bcff8a57bad 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Matrix.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Matrix.h @@ -40,14 +40,14 @@ class Matrix friend double det (const Matrix &m); friend double det (const Matrix &m, int row, int col); - public: + public: Matrix (const std::string &cmds, Calculator &calc); Matrix (double d=0); - Matrix (double v[], unsigned size=9); - Matrix (const std::vector<double> &v, int start=0); + Matrix (double v[], unsigned size=9); + Matrix (const std::vector<double> &v, int start=0); Matrix& set (double d); Matrix& set (double v[], unsigned size); - Matrix& set (const std::vector<double> &v, int start=0); + Matrix& set (const std::vector<double> &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 (); @@ -73,7 +73,7 @@ class Matrix std::string getSVG () const; std::ostream& write (std::ostream &os) const; - private: + private: double _values[3][3]; // row x col }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.cpp index c875109633f..c875109633f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.h index 7c39127dbd4..7c39127dbd4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Message.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Message.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MessageException.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MessageException.h index 48ae4b5bb4c..446c2e1282f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MessageException.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MessageException.h @@ -27,12 +27,12 @@ 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();} + public: + MessageException (const std::string &msg) : _message(msg) {} + virtual ~MessageException () throw() {} + const char* what () const throw() {return _message.c_str();} - private: + private: std::string _message; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.cpp index d7922b1825b..6e955faeec5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.cpp @@ -66,9 +66,9 @@ bool MetafontWrapper::call (const string &mode, double mag) { #endif ostringstream oss; oss << "\"\\mode=" << mode << ";" - "mag:=" << mag << ";" - "batchmode;" - "input " << _fontname << "\""; + "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(); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.h index 3b2485122d0..8a59dc9d5d7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MetafontWrapper.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MetafontWrapper.h @@ -28,15 +28,15 @@ struct FileFinder; class MetafontWrapper { - public: - MetafontWrapper (const std::string &fontname); + 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: + private: std::string _fontname; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.cpp index bb4353f8ee4..bb4353f8ee4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.h index dcb6271a4bc..dcb6271a4bc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/MiKTeXCom.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/MiKTeXCom.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.cpp index 0a5119f6938..0a5119f6938 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.h index 7a017fecb06..8af05f889a3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/NoPsSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NoPsSpecialHandler.h @@ -25,8 +25,8 @@ class NoPsSpecialHandler : public SpecialHandler, public DVIEndPageListener { - public: - NoPsSpecialHandler () : _count(0) {} + 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;} @@ -35,7 +35,7 @@ class NoPsSpecialHandler : public SpecialHandler, public DVIEndPageListener protected: void dviEndPage (unsigned pageno); - private: + private: unsigned _count; // number of PS specials skipped }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NumericRanges.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NumericRanges.h new file mode 100644 index 00000000000..7d810fb2a5d --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/NumericRanges.h @@ -0,0 +1,110 @@ +/************************************************************************* +** NumericRanges.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef DVISVGM_NUMERICRANGES_H +#define DVISVGM_NUMERICRANGES_H + +#include <algorithm> +#include <list> +#include <utility> + +template <class T> +class NumericRanges +{ + public: + typedef std::pair<T,T> Range; + typedef std::list<Range> 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 <class T> +void NumericRanges<T>::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 <class T> +bool NumericRanges<T>::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.6/src/PSFilter.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSFilter.h index e2c5c092dd3..e2c5c092dd3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSFilter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSFilter.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.cpp index 9ca5ed39c27..9ca5ed39c27 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.h index c1f30598e16..2e98bf27e96 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSInterpreter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSInterpreter.h @@ -41,7 +41,7 @@ struct PSException : public MessageException struct PSActions { virtual ~PSActions () {} - virtual void applyscalevals (std::vector<double> &p) =0; + virtual void applyscalevals (std::vector<double> &p) =0; virtual void clip (std::vector<double> &p) =0; virtual void closepath (std::vector<double> &p) =0; virtual void curveto (std::vector<double> &p) =0; @@ -86,8 +86,8 @@ class PSInterpreter { enum Mode {PS_NONE, PS_RUNNING, PS_QUIT}; - public: - PSInterpreter (PSActions *actions=0); + 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);} @@ -109,7 +109,7 @@ class PSInterpreter void checkStatus (int status); void callActions (InputReader &cib); - private: + private: Ghostscript _gs; Mode _mode; ///< current execution mode PSActions *_actions; ///< actions to be performed diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.cpp index 107dac4f795..107dac4f795 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.h index db11b59f0e0..96911b921da 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPattern.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPattern.h @@ -34,8 +34,8 @@ class XMLElementNode; class PSPattern { - public: - virtual ~PSPattern () {} + public: + virtual ~PSPattern () {} virtual int psID () const {return _id;} virtual std::string svgID () const; virtual void apply (SpecialActions *actions); @@ -44,7 +44,7 @@ class PSPattern PSPattern (int id) : _id(id) {} virtual XMLElementNode* createPatternNode () const =0; - private: + private: int _id; ///< PostSCript ID of this pattern }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.cpp index c9b3b080118..c9b3b080118 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.h index bbed9640aab..3e65ac9ba4c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PSPreviewFilter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PSPreviewFilter.h @@ -30,7 +30,7 @@ struct SpecialActions; class PSPreviewFilter : public PSFilter { - public: + public: PSPreviewFilter (PSInterpreter &psi); void activate (); void execute (const char *code, size_t len); @@ -45,7 +45,7 @@ class PSPreviewFilter : public PSFilter double depth () const; double width () const; - private: + private: std::string _version; ///< version string of preview package bool _active; ///< true if filter is active bool _tightpage; ///< true if tightpage option was given diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.cpp index 71650753d67..e19e679c67e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.cpp @@ -72,64 +72,16 @@ bool PageRanges::parse (string str, int max_page) { first = min(first, max_page); last = min(last, max_page); } - insert(first, last); + addRange(first, last); } return true; } -/** Adds a page range to the range collection. - * @param[in] first first page of new range - * @param[in] last last page of new range */ -void PageRanges::insert (int first, int last) { - if (first > last) - swap(first, last); - 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 = min(it->first, first); - it->second = max(it->second, last); - } - // merge adjacent ranges - if (it != _ranges.end()) { - Container::iterator l = it; - 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 = min(l->first, it->first); - l->second = max(l->second, it->second); - l_modified = true; - } - if (r != _ranges.end() && r->first <= it->second+1) { - r->first = min(r->first, it->first); - r->second = 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 = min(l->first, r->first); - l->second = max(l->second, r->second); - _ranges.erase(r); - } - } - } -} - - /** Returns the number of pages. */ -size_t PageRanges::pages () const { +size_t PageRanges::numberOfPages () const { size_t sum=0; - for (ConstIterator it=_ranges.begin(); it != _ranges.end(); ++it) + for (NumericRanges<int>::ConstIterator it=begin(); it != end(); ++it) sum += it->second - it->first + 1; return sum; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.h index 57b47b91e44..3292986226d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageRanges.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageRanges.h @@ -24,26 +24,13 @@ #include <list> #include <string> #include <utility> +#include "NumericRanges.h" -class PageRanges +class PageRanges : public NumericRanges<int> { public: - typedef std::pair<int,int> Range; - typedef std::list<Range> Container; - typedef Container::iterator Iterator; - typedef Container::const_iterator ConstIterator; - - public: bool parse (std::string str, int max_page=0); - void insert (int first, int last); - size_t pages () const; - size_t size () const {return _ranges.size();} - const Container& ranges () const {return _ranges;} - ConstIterator begin () const {return _ranges.begin();} - ConstIterator end () const {return _ranges.end();} - - private: - Container _ranges; + size_t numberOfPages () const; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.cpp index 2cc3f36512d..2cc3f36512d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.h index 77cbdbcc44d..d63079ae784 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PageSize.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PageSize.h @@ -30,8 +30,8 @@ struct PageSizeException : public MessageException class PageSize { - public: - PageSize (double w=0, double h=0) : _width(w), _height(h) {} + 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); @@ -41,7 +41,7 @@ class PageSize double heightInMM () const {return _height*25.4/72;} bool valid () const {return _width > 0 && _height > 0;} - private: + private: double _width, _height; // in PS points }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Pair.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Pair.h index 4c2d465e7c0..6183b3b97e3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Pair.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Pair.h @@ -29,14 +29,14 @@ template <typename T> class Pair { - public: - Pair (T x=0, T y=0) : _x(x), _y(y) {} + 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);} + 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;} @@ -45,14 +45,14 @@ class Pair void y (const T &yy) {_y = yy;} std::ostream& write (std::ostream &os) const {return os << '(' << _x << ',' << _y << ')';} - private: + private: T _x, _y; }; struct Pair32 : public Pair<Int32> { - Pair32 (Int32 x=0, Int32 y=0) : Pair<Int32>(x, y) {} + Pair32 (Int32 x=0, Int32 y=0) : Pair<Int32>(x, y) {} explicit Pair32 (double x, double y) : Pair<Int32>(Int32(x+0.5), Int32(y+0.5)) {} Pair32 (const Pair<Int32> &p) : Pair<Int32>(p) {} // operator Pair<Int32> () {return *this;} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.cpp index 998b8016eae..fb8e775759f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.cpp @@ -61,11 +61,11 @@ bool PdfSpecialHandler::process (const char *prefix, istream &is, SpecialActions } } else { // mapfile - string fname = ir.getString(); - if (!FontMap::instance().read(fname, modechar)) - Message::wstream(true) << "can't open map file " << fname << '\n'; + string fname = ir.getString(); + if (!FontMap::instance().read(fname, modechar)) + Message::wstream(true) << "can't open map file " << fname << '\n'; } - _maplineProcessed = true; + _maplineProcessed = true; } return true; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.h index a5391fbf141..6865a21d9be 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PdfSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PdfSpecialHandler.h @@ -25,15 +25,15 @@ class PdfSpecialHandler : public SpecialHandler { - public: + 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 + private: + bool _maplineProcessed; ///< true if a mapline or mapfile special has already been processed }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.cpp index 3e749add96b..f88010b89ed 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.cpp @@ -1,5 +1,5 @@ /************************************************************************* -** CharMap.cpp ** +** PreScanDVIReader.cpp ** ** ** ** This file is part of dvisvgm -- the DVI to SVG converter ** ** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** @@ -18,40 +18,27 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <config.h> -#include <algorithm> -#include "CharMap.h" +#include "DVIActions.h" +#include "PreScanDVIReader.h" using namespace std; -static bool is_less (const pair<UInt32,UInt32> &p1, const pair<UInt32,UInt32> &p2) { - return p1.first < p2.first; -} - - -UInt32 CharMap::operator [] (UInt32 c) const { - vector<UInt32Pair>::const_iterator it = lower_bound(_pairs.begin(), _pairs.end(), UInt32Pair(c, 0), &is_less); - return (it != _pairs.end() && it->first == c) ? it->second : 0; -} - -/** Returns true if the charmap contains an entry that maps to the given charcode */ -bool CharMap::valueExists (UInt32 c) const { - for (std::vector<UInt32Pair>::const_iterator it=_pairs.begin(); it != _pairs.end(); ++it) - if (it->second == c) - return true; - return false; +PreScanDVIReader::PreScanDVIReader (std::istream &is, DVIActions *actions) + : BasicDVIReader(is), _actions(actions), _currentPageNumber(0) +{ } -/** Swaps key and value of all entries. */ -void CharMap::invert () { - for (std::vector<UInt32Pair>::iterator it=_pairs.begin(); it != _pairs.end(); ++it) - swap(it->first, it->second); - sort(); +void PreScanDVIReader::cmdBop (int) { + _currentPageNumber++; + BasicDVIReader::cmdBop(0); } -void CharMap::sort () { - std::sort(_pairs.begin(), _pairs.end(), &is_less); +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.6/src/DvisvgmSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.h index 1c6424c6fb8..1e033e73fa6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/DvisvgmSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PreScanDVIReader.h @@ -1,5 +1,5 @@ /************************************************************************* -** DvisvgmSpecialHandler.h ** +** PreScanDVIReader.h ** ** ** ** This file is part of dvisvgm -- the DVI to SVG converter ** ** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** @@ -18,18 +18,26 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_DVISVGMSPECIALHANDLER_H -#define DVISVGM_DVISVGMSPECIALHANDLER_H +#ifndef PRESCANDVIREADER_H +#define PRESCANDVIREADER_H -#include "SpecialHandler.h" +#include "BasicDVIReader.h" -class DvisvgmSpecialHandler : public SpecialHandler +struct DVIActions; + +class PreScanDVIReader : public BasicDVIReader { - public: - const char* name () const {return "dvisvgm";} - const char* info () const {return "special set for embedding raw SVG snippets";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions *actions); + 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.6/src/Process.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.cpp index 41c3bec0daa..41c3bec0daa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Process.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Process.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.h index df2e0545049..54f4ec611c3 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Process.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Process.h @@ -25,16 +25,16 @@ class Process { - public: - Process (const std::string &cmd, const std::string ¶mstr); - bool run (std::string *out=0); + public: + Process (const std::string &cmd, const std::string ¶mstr); + bool run (std::string *out=0); - protected: - Process (const Process& orig) {} + protected: + Process (const Process& orig) {} - private: - std::string _cmd; - std::string _paramstr; + private: + std::string _cmd; + std::string _paramstr; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.cpp index f0742a36194..7c5753125fe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.cpp @@ -103,7 +103,7 @@ void PsSpecialHandler::enterBodySection () { // 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 "; - if (_actions) { + if (_actions) { float r, g, b; _actions->getColor().getRGB(r, g, b); oss << r << ' ' << g << ' ' << b << " setrgbcolor "; @@ -126,10 +126,10 @@ void PsSpecialHandler::moveToDVIPos () { 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); - } + oss << '\n' << x << ' ' << y << " moveto "; + _psi.execute(oss.str()); + _currentpoint = DPair(x, y); + } } @@ -149,11 +149,33 @@ static void exec_and_syncpos (PSInterpreter &psi, istream &is, const DPair &pos, } +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<char>(is), istreambuf_iterator<char>()); + } + 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 && *prefix != '!' && strcmp(prefix, "header=") != 0) + if (_psSection != PS_BODY) enterBodySection(); if (*prefix == '"') { @@ -163,20 +185,6 @@ bool PsSpecialHandler::process (const char *prefix, istream &is, SpecialActions _psi.execute(is); _psi.execute("\n@endspecial "); } - else if (*prefix == '!') { - if (_psSection == PS_HEADERS) { - _headerCode += "\n"; - _headerCode += string(istreambuf_iterator<char>(is), istreambuf_iterator<char>()); - } - } - else if (strcmp(prefix, "header=") == 0) { - if (_psSection == PS_HEADERS) { - // read and execute PS header file - string fname; - is >> fname; - processHeaderFile(fname.c_str()); - } - } else if (strcmp(prefix, "psfile=") == 0 || strcmp(prefix, "PSfile=") == 0) { if (_actions) { StreamInputReader in(is); @@ -367,8 +375,13 @@ void PsSpecialHandler::dviEndPage (unsigned) { _actions->bbox().lock(); } Message::mstream() << "\napplying bounding box set by preview package (version " << _previewFilter.version() << ")\n"; - if (horiz_baseline) - Message::mstream() << "width=" << XMLString(w) << "pt, " "height=" << XMLString(h) << "pt, " "depth=" << XMLString(d) << "pt\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"; } @@ -871,4 +884,3 @@ 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.6/src/PsSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.h index 8fc3d6b5ae3..03d9d8bb7d1 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/PsSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/PsSpecialHandler.h @@ -70,6 +70,7 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote 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 (); @@ -81,10 +82,10 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote void psfile (const std::string &fname, const std::map<std::string,std::string> &attr); void dviEndPage (unsigned pageno); - /// scale given value by current PS scale factors - double scale (double v) const {return v*(_sx*_cos*_cos + _sy*(1-_cos*_cos));} + /// 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<double> &p) {_sx = p[0]; _sy = p[1]; _cos = p[2];} + void applyscalevals (std::vector<double> &p) {_sx = p[0]; _sy = p[1]; _cos = p[2];} void clip (std::vector<double> &p) {clip(p, false);} void clip (std::vector<double> &p, bool evenodd); void closepath (std::vector<double> &p); @@ -122,7 +123,7 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote void translate (std::vector<double> &p); void executed (); - private: + private: PSInterpreter _psi; SpecialActions *_actions; PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package @@ -132,8 +133,8 @@ class PsSpecialHandler : public SpecialHandler, public DVIEndPageListener, prote std::string _headerCode; ///< collected literal PS header code Path _path; DPair _currentpoint; ///< current PS position in bp units - 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 _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) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.cpp index f6a46a31a86..74871a71e67 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.cpp @@ -1,5 +1,5 @@ /************************************************************************* -** CMap.cpp ** +** RangeMap.cpp ** ** ** ** This file is part of dvisvgm -- the DVI to SVG converter ** ** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** @@ -18,56 +18,29 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#include <config.h> -#include <algorithm> -#include <sstream> -#include <set> -#include <vector> -#include "CMap.h" -#include "CMapManager.h" -#include "FileFinder.h" -#include "InputReader.h" +#include "RangeMap.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; -} - - /** Tries to merge range r into this one. This is only possible if the ranges - * touch or overlap and if the assigned CIDs match at the junction points. + * 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 SegmentedCMap::Range::join (const Range &r) { +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 (decode(r._min) == r._cid) { + 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.decode(_min) == _cid) { - setMinAndAdaptCID(r._min); + if (r.valueAt(_min) == _minval) { + setMinAndAdaptValue(r._min); return true; } return false; @@ -78,142 +51,117 @@ bool SegmentedCMap::Range::join (const Range &r) { return true; } if (r._min < _min) { // left overlap only? - if (r.decode(_min) == _cid) { + if (r.valueAt(_min) == _minval) { _min = r._min; - _cid = r._cid; + _minval = r._minval; return true; } return false; } if (r._max > _max) { // right overlap only? - if (decode(r._min) == r._cid) { + if (valueAt(r._min) == r._minval) { _max = r._max; return true; } return false; } // r completely inside *this - return decode(r._min) == r._cid; + return valueAt(r._min) == r._minval; } -/** 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,out] ranges range collection to be adapted - * @param[in] it pointer to the newly inserted range */ -void SegmentedCMap::adaptNeighbors (Ranges &ranges, Ranges::iterator it) { - if (it != ranges.end()) { - // adapt left neighbor - SegmentedCMap::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 - SegmentedCMap::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->setMinAndAdaptCID(it->max()+1); - // try to merge right neighbor into *this - if (it->join(*rit)) - ranges.erase(rit); // remove merged neighbor - } - } -} - - -/** Adds a new code range. The range describes a mapping from character codes c to CIDs, where - * \f$c \in [cmin,cmax]\f$ and \f$CID(c):=cid+c-cmin\f$. - * @param[in,out] ranges collection the new range is added to - * @param[in] cmin smallest character code in the range - * @param[in] cmax largest character code in the range - * @param[in] cid CID of the smallest character code (cmin) */ -void SegmentedCMap::addRange (Ranges &ranges, UInt32 cmin, UInt32 cmax, UInt32 cid) { +/** Adds a new number range. The range describes a mapping from c to v(c), where + * c \in [cmin,cmax] and v(cmin):=vmin, v(c):=vmin+c-cmin. + * @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, cid); - if (ranges.empty()) - ranges.push_back(range); + 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(); + 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); + _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); + _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()); + 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)) { + 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->decode(cmax+1))); + 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); + it = _ranges.end(); // => append new range at end of vector + it = _ranges.insert(it, range); } - adaptNeighbors(ranges, it); // resolve overlaps + adaptNeighbors(it); // resolve overlaps } } } -/** Returns the CID for a given character code. */ -UInt32 SegmentedCMap::cid (UInt32 c) const { - int pos = lookup(_cidranges, c); - if (pos >= 0) - return _cidranges[pos].decode(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 { - int pos = lookup(_bfranges, cid); - if (pos >= 0) - return _bfranges[pos].decode(cid); - if (_basemap) - return _basemap->bfcode(cid); - return 0; +/** 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] ranges lookup value in these set of ranges * @param[in] c find range that contains this value * @return index of the range found, or -1 if range was not found */ -int SegmentedCMap::lookup (const Ranges &ranges, UInt32 c) const { +int RangeMap::lookup (UInt32 c) const { // simple binary search - int left=0, right=ranges.size()-1; + int left=0, right=_ranges.size()-1; while (left <= right) { int mid = (left+right)/2; - if (c < ranges[mid].min()) + if (c < _ranges[mid].min()) right = mid-1; - else if (c > ranges[mid].max()) + else if (c > _ranges[mid].max()) left = mid+1; else return mid; @@ -222,9 +170,19 @@ int SegmentedCMap::lookup (const Ranges &ranges, UInt32 c) const { } -void SegmentedCMap::write (ostream &os) const { - for (size_t i=0; i < _cidranges.size(); i++) { - const Range &r = _cidranges[i]; - os << '[' << r.min() << ',' << r.max() << "] => " << r.cid() << '\n'; - } +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.7/src/RangeMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.h new file mode 100644 index 00000000000..60bf071aff0 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/RangeMap.h @@ -0,0 +1,87 @@ +/************************************************************************* +** RangeMap.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef DVISVGM_RANGEMAP_H +#define DVISVGM_RANGEMAP_H + +#include <algorithm> +#include <ostream> +#include <vector> +#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<Range> 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.6/src/SVGOutputBase.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGOutputBase.h index cad892ea068..cad892ea068 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGOutputBase.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGOutputBase.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.cpp index a1f375a5f9a..2432ab42528 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.cpp @@ -376,11 +376,6 @@ void SVGTree::append (const PhysicalFont &font, const set<int> &chars, GFGlyphTr faceNode->addAttribute("descent", XMLString(font.descent())); } fontNode->append(faceNode); - - // add required missing-glyph element - XMLElementNode *missing = new XMLElementNode("missing-glyph"); - missing->addAttribute("d", ""); - fontNode->append(missing); FORALL(chars, set<int>::const_iterator, i) fontNode->append(createGlyphNode(*i, font, cb)); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.h index 541d299971c..6cd82f6ff39 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SVGTree.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SVGTree.h @@ -60,8 +60,8 @@ class SVGTree bool _changed; }; - public: - SVGTree (); + public: + SVGTree (); void reset (); void write (std::ostream &os) const {_doc.write(os);} void newPage (int pageno); @@ -72,7 +72,7 @@ class SVGTree void appendToRoot (XMLNode *node) {_root->append(node);} void appendChar (int c, double x, double y, const Font &font); void appendFontStyles (const std::set<const Font*> &fonts); - void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *cb=0); + void append (const PhysicalFont &font, const std::set<int> &chars, GFGlyphTracer::Callback *cb=0); void pushContextElement (XMLElementNode *node); void popContextElement (); void setBBox (const BoundingBox &bbox); @@ -87,16 +87,16 @@ class SVGTree 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; ///< should style elements and class attributes be used to reference fonts? - static bool CREATE_USE_ELEMENTS; ///< allow generation of <use/> elements? + public: + static bool USE_FONTS; ///< if true, create font references and don't draw paths directly + static bool CREATE_STYLE; ///< should style elements and class attributes be used to reference fonts? + static bool CREATE_USE_ELEMENTS; ///< allow generation of <use/> elements? static double ZOOM_FACTOR; ///< factor applied to width/height attribute protected: void newTextNode (double x, double y); - private: + private: XMLDocument _doc; XMLElementNode *_root, *_page, *_text, *_span, *_defs; bool _xchanged, _ychanged; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.cpp index 6e91a05442d..6e91a05442d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.h index dfece9963e4..fa69e4129ed 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SignalHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SignalHandler.h @@ -29,22 +29,22 @@ struct SignalException : public std::exception { class SignalHandler { - public: - ~SignalHandler (); - static SignalHandler& instance (); - bool start (); - void stop (); - void check (); + public: + ~SignalHandler (); + static SignalHandler& instance (); + bool start (); + void stop (); + void check (); void trigger (bool notify); - bool active () const {return _active;} + bool active () const {return _active;} - protected: - SignalHandler () : _active(false) {} - static void callback (int signal); + 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 + 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.6/src/SpecialActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialActions.h index e7b4503d148..0222a977955 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialActions.h @@ -53,19 +53,21 @@ struct SpecialActions 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;} + virtual int getDVIStackDepth () const {return 0;} }; -class SpecialEmptyActions : public SpecialActions +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 finishLine () {} void setColor (const Color &color) {} void setBgColor (const Color &color) {} Color getColor () const {return Color::BLACK;} @@ -81,11 +83,12 @@ class SpecialEmptyActions : public SpecialActions 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.6/src/SpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialHandler.h index b11bab4782c..c9779836106 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialHandler.h @@ -36,6 +36,13 @@ struct SpecialException : public MessageException }; +struct DVIPreprocessingListener +{ + virtual ~DVIPreprocessingListener () {} + virtual void dviPreprocessingFinished () =0; +}; + + struct DVIEndPageListener { virtual ~DVIEndPageListener () {} @@ -59,6 +66,7 @@ struct SpecialHandler 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; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.cpp index 86aca42cd02..9c9b95f62ad 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.cpp @@ -35,6 +35,12 @@ SpecialManager::~SpecialManager () { } +SpecialManager& SpecialManager::instance() { + static SpecialManager sm; + return sm; +} + + /** Remove all registered handlers. */ void SpecialManager::unregisterHandlers () { FORALL(_pool, vector<SpecialHandler*>::iterator, it) @@ -55,6 +61,8 @@ void SpecialManager::registerHandler (SpecialHandler *handler) { _pool.push_back(handler); for (const char **p=handler->prefixes(); *p; ++p) _handlers[*p] = handler; + if (DVIPreprocessingListener *listener = dynamic_cast<DVIPreprocessingListener*>(handler)) + _preprocListeners.push_back(listener); if (DVIEndPageListener *listener = dynamic_cast<DVIEndPageListener*>(handler)) _endPageListeners.push_back(listener); if (DVIPositionListener *listener = dynamic_cast<DVIPositionListener*>(handler)) @@ -111,6 +119,14 @@ static string extract_prefix (istream &is) { } +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 @@ -118,25 +134,21 @@ static string extract_prefix (istream &is) { * @param[in] listener object that wants to be notified about the processing state * @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, Listener *listener) const { +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)) { - if (listener) - listener->beginSpecial(prefix.c_str()); handler->setDviScaleFactor(dvi2bp); success = handler->process(prefix.c_str(), iss, actions); - if (listener) - listener->endSpecial(prefix.c_str()); } return success; } -void SpecialManager::leavePSHeaderSection () const { - if (PsSpecialHandler *pshandler = dynamic_cast<PsSpecialHandler*>(findHandler("!"))) - pshandler->enterBodySection(); +void SpecialManager::notifyPreprocessingFinished () const { + FORALL(_preprocListeners, vector<DVIPreprocessingListener*>::const_iterator, it) + (*it)->dviPreprocessingFinished(); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.h index a0cdd26ac91..2ea14da992b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/SpecialManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/SpecialManager.h @@ -31,40 +31,34 @@ struct SpecialActions; class SpecialManager { - public: - struct Listener - { - virtual ~Listener () {} - virtual void beginSpecial (const char *prefix)=0; - virtual void endSpecial (const char *prefix)=0; - }; - private: typedef std::vector<SpecialHandler*> HandlerPool; typedef std::map<std::string,SpecialHandler*> HandlerMap; typedef HandlerMap::iterator Iterator; typedef HandlerMap::const_iterator ConstIterator; - public: - SpecialManager () {} - virtual ~SpecialManager (); + public: + ~SpecialManager (); + static SpecialManager& instance (); void registerHandler (SpecialHandler *handler); void registerHandlers (SpecialHandler **handlers, const char *ignorelist); void unregisterHandlers (); - bool process (const std::string &special, double dvi2bp, SpecialActions *actions, Listener *listener=0) const; + 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; - void leavePSHeaderSection () const; protected: + SpecialManager () {} SpecialManager (const SpecialManager &) {} - void operator = (const SpecialManager &) {} SpecialHandler* findHandler (const std::string &prefix) const; - private: + private: HandlerPool _pool; ///< stores pointers to all handlers HandlerMap _handlers; ///< pointers to handlers for corresponding prefixes + std::vector<DVIPreprocessingListener*> _preprocListeners; std::vector<DVIEndPageListener*> _endPageListeners; std::vector<DVIPositionListener*> _positionListeners; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.cpp index 1464b9fdcf6..35a1cb1a583 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.cpp @@ -25,11 +25,6 @@ using namespace std; -StreamReader::StreamReader (istream &s) - : _is(&s) -{ -} - istream& StreamReader::replaceStream (istream &in) { istream &ret = *_is; @@ -143,7 +138,7 @@ string StreamReader::readString (int length, CRC32 &crc32) { vector<UInt8>& StreamReader::readBytes (int n, vector<UInt8> &bytes) { if (n > 0) - in().read((char*)&bytes[0], n); + _is->read((char*)&bytes[0], n); return bytes; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.h index a35bae2d91f..82679254cdc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamReader.h @@ -31,9 +31,12 @@ class CRC32; class StreamReader { - public: - StreamReader (std::istream &s); + 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); @@ -45,14 +48,17 @@ class StreamReader std::string readString (int length, CRC32 &crc32); std::vector<UInt8>& readBytes (int n, std::vector<UInt8> &bytes); std::vector<UInt8>& readBytes (int n, std::vector<UInt8> &bytes, CRC32 &crc32); - int readByte () {return _is->get();} + int readByte () {return _is->get();} int readByte (CRC32 &crc32); - void seek (std::istream::streampos pos, std::ios::seekdir dir) {_is->seekg(pos, dir);} + 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& in () {return *_is;} + std::istream& getInputStream () {return *_is;} - private: + private: std::istream *_is; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.cpp index 203a1788f87..203a1788f87 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.h index 05999c48fb5..f3ba391b044 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/StreamWriter.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/StreamWriter.h @@ -29,9 +29,9 @@ class CRC32; class StreamWriter { - public: - StreamWriter (std::ostream &os) : _os(os) {} - virtual ~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); @@ -39,7 +39,7 @@ class StreamWriter void writeSigned (Int32 val, int n, CRC32 &crc32); void writeString (const std::string &str, CRC32 &crc32, bool finalZero=false); - private: + private: std::ostream &_os; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.cpp index 1ac23a66139..c37cd7e7eb6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.cpp @@ -72,11 +72,11 @@ SubfontDefinition::~SubfontDefinition () { * @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<string,SubfontDefinition*> SFDMap; - static SFDMap sfdMap; - SFDMap::iterator it = sfdMap.find(name); - if (it != sfdMap.end()) - return it->second; + typedef map<string,SubfontDefinition*> 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); @@ -88,30 +88,30 @@ SubfontDefinition* SubfontDefinition::lookup (const std::string &name) { /** 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); + 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; + 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<Subfont*> &sfs) const { - for (ConstIterator it=_subfonts.begin(); it != _subfonts.end(); ++it) - sfs.push_back(it->second); - return sfs.size(); + for (ConstIterator it=_subfonts.begin(); it != _subfonts.end(); ++it) + sfs.push_back(it->second); + return sfs.size(); } ////////////////////////////////////////////////////////////////////// Subfont::~Subfont () { - delete [] _mapping; + delete [] _mapping; } @@ -128,7 +128,7 @@ Subfont::~Subfont () { * 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 + if (_mapping) // if there's already a mapping assigned, we're finished here return true; if (const char *p = _sfd.path()) { ifstream is(p); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.h index 03ce75c3e99..eafa683e30b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Subfont.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Subfont.h @@ -40,7 +40,7 @@ class SubfontDefinition typedef std::map<std::string, Subfont*> Subfonts; typedef Subfonts::iterator Iterator; typedef Subfonts::const_iterator ConstIterator; - public: + public: ~SubfontDefinition (); static SubfontDefinition* lookup (const std::string &name); // int getIDs (std::vector<std::string> &ids) const; @@ -54,7 +54,7 @@ class SubfontDefinition SubfontDefinition (const std::string &name, const char *fpath); SubfontDefinition (const SubfontDefinition &sfd) {} - private: + private: std::string _sfname; ///< name of subfont Subfonts _subfonts; ///< all subfonts defined in the corresponding .sfd file }; @@ -63,20 +63,20 @@ class SubfontDefinition /** 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 + 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 }; @@ -86,7 +86,7 @@ class SubfontException : public MessageException 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) + SubfontException (const std::ostream &oss, const std::string &fname, int lineno=0) : MessageException(dynamic_cast<const std::ostringstream&>(oss).str()), _fname(fname), _lineno(lineno) {} virtual ~SubfontException () throw() {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.cpp index 6769f843cae..6769f843cae 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.h index 7200c93f291..7200c93f291 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/System.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/System.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.cpp index db36b7f50b6..db36b7f50b6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.h index 1f75d76cb50..a7941874b30 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TFM.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TFM.h @@ -32,7 +32,7 @@ class StreamReader; class TFM : public FontMetrics { - public: + public: // TFM (const char *fname); TFM (std::istream &is); double getDesignSize () const; @@ -52,7 +52,7 @@ class TFM : public FontMetrics virtual int charIndex (int c) const; void setCharRange (int firstchar, int lastchar) {_firstChar=firstchar; _lastChar=lastchar;} - private: + private: UInt32 _checksum; UInt16 _firstChar, _lastChar; FixWord _designSize; ///< design size of the font in TeX points (7227 pt = 254 cm) diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.cpp index e95111d196b..e95111d196b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.h index 08ac7e6300a..08ac7e6300a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/Terminal.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Terminal.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.cpp new file mode 100644 index 00000000000..7e24fd6fcf7 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.cpp @@ -0,0 +1,106 @@ +/************************************************************************* +** ToUnicodeMap.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <limits> +#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 doensn't provide unicode mappings for all + * 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<UInt32> 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<UInt32> &used_codepoints, bool ascending) { + UInt32 start = ucp; + while (!Unicode::isValidCodepoint(ucp) && used_codepoints.valueExists(ucp)) { + if (ascending) + ucp = (ucp == numeric_limits<UInt32>::max()) ? 0 : ucp+1; + else + ucp = (ucp == 0) ? numeric_limits<UInt32>::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] value 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<UInt32> &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.6/src/CharMap.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.h index 8faeffa21c1..80ad10dc874 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/CharMap.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ToUnicodeMap.h @@ -1,5 +1,5 @@ /************************************************************************* -** CharMap.h ** +** ToUnicodeMap.h ** ** ** ** This file is part of dvisvgm -- the DVI to SVG converter ** ** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** @@ -18,34 +18,21 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#ifndef DVISVGM_CHARMAP_H -#define DVISVGM_CHARMAP_H +#ifndef TOUNICODEMAP_H +#define TOUNICODEMAP_H -#include <utility> -#include <vector> -#include "types.h" +#include "NumericRanges.h" +#include "RangeMap.h" -class FontEngine; -class CharMap +/** Represents a mapping from character indexes to unicode points. */ +class ToUnicodeMap : public RangeMap { - friend class FontEngine; - typedef std::pair<UInt32, UInt32> UInt32Pair; public: - CharMap () {} - bool valueExists (UInt32 c) const; - UInt32 operator [] (UInt32 c) const; - UInt32 size () const {return _pairs.size();} - bool empty () const {return _pairs.empty();} - void clear () {return _pairs.clear();} - void invert (); + bool addMissingMappings (UInt32 maxIndex); protected: - void append (UInt32 from, UInt32 to) {_pairs.push_back(UInt32Pair(from, to));} - void sort (); - - private: - std::vector<UInt32Pair> _pairs; + bool fillRange (UInt32 minIndex, UInt32 maxIndex, UInt32 ucp, NumericRanges<UInt32> &used_ucps, bool ascending); }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.cpp index b9412f3a74d..9f4d38d6189 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.cpp @@ -89,7 +89,7 @@ void TpicSpecialHandler::drawLines (bool stroke, bool fill, double ddist, Specia if (it != _points.begin()) oss << ' '; double x = it->x()+actions->getX(); - double y = it->y()+actions->getY(); + double y = it->y()+actions->getY(); oss << XMLString(x) << ',' << XMLString(y); actions->embed(DPair(x, y)); } @@ -179,7 +179,7 @@ void TpicSpecialHandler::drawSplines (double ddist, SpecialActions *actions) { * @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] 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) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.h index 9afdf9a31fc..424721dbffc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/TpicSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/TpicSpecialHandler.h @@ -41,7 +41,7 @@ class TpicSpecialHandler : public SpecialHandler, public DVIEndPageListener void drawSplines (double ddist, SpecialActions *actions); void drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions *actions); - private: + private: double _penwidth; ///< pen width in PS point units double _fill; ///< fill intensity [0,1]; if < 0, we don't fill anything std::vector<DPair> _points; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.cpp new file mode 100644 index 00000000000..f0fdde17898 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.cpp @@ -0,0 +1,76 @@ +/************************************************************************* +** Unicode.cpp ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#include <cstddef> +#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, + 0x007f, 0x0084, + 0x0086, 0x009f, + 0x202a, 0x202e, // bidi control characters + 0xd800, 0xdfff, + 0xfdd0, 0xfdef, + }; + for (size_t i=0; i < sizeof(ranges)/sizeof(UInt32)/2; i++) + if (c >= ranges[2*i] && c <= ranges[2*i+1]) + return false; + return true; +} + + +/** Converts a unicode value to a UTF-8 byte sequence. + * @param[in] c character code + * @return utf8 seqence 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 == 0xFFFE || c == 0xFFFF) + utf8 += (c & 0xFF); + 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); + } + } + return utf8; +}
\ No newline at end of file diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.h new file mode 100644 index 00000000000..41be47749cd --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/Unicode.h @@ -0,0 +1,33 @@ +/************************************************************************* +** Unicode.h ** +** ** +** This file is part of dvisvgm -- the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + +#ifndef DVISVGM_UNICODE_H +#define DVISVGM_UNICODE_H + +#include <string> +#include "types.h" + +struct Unicode +{ + static bool isValidCodepoint (UInt32 code); + static std::string utf8 (Int32 c); +}; + +#endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFActions.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFActions.h index a8e86831fe9..a8e86831fe9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFActions.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFActions.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.cpp index eb9ed4d22ee..45d0ed7da27 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.cpp @@ -29,7 +29,7 @@ using namespace std; /** Converts a TFM fix point value to double (PS point units). */ -inline static double fix2double (FixWord fix) { +static inline double fix2double (FixWord fix) { const double pt2bp = 72/72.27; return double(fix)/(1 << 20)*pt2bp; } @@ -57,26 +57,26 @@ VFActions* VFReader::replaceActions (VFActions *a) { * @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 = in().get(); - if (!in() || opcode < 0) // at end of file - throw VFException("invalid file"); + 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 + replaceActions(0); // disable actions - if (opcode <= 241) // short character definition? + 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 + 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()); @@ -89,11 +89,11 @@ int VFReader::executeCommand (ApproveAction approve) { bool VFReader::executeAll () { - in().clear(); // reset all status bits - if (!in()) + clearStream(); // reset all status bits + if (!isStreamValid()) return false; - in().seekg(0); // move file pointer to first byte of the input stream - while (!in().eof() && executeCommand() != 248); // stop reading after post (248) + seek(0); // move file pointer to first byte of the input stream + while (!eof() && executeCommand() != 248); // stop reading after post (248) return true; } @@ -104,21 +104,21 @@ static bool is_chardef (int op) {return op < 243;} bool VFReader::executePreambleAndFontDefs () { - in().clear(); - if (!in()) + clearStream(); + if (!isStreamValid()) return false; - in().seekg(0); // move file pointer to first byte of the input stream - while (!in().eof() && executeCommand(is_pre_or_fontdef) > 242); // stop reading after last font definition + 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 () { - in().clear(); - if (!in()) + clearStream(); + if (!isStreamValid()) return false; - in().seekg(0); - while (!in().eof() && executeCommand(is_chardef) < 243); // stop reading after last char definition + seek(0); + while (!eof() && executeCommand(is_chardef) < 243); // stop reading after last char definition return true; } @@ -134,8 +134,8 @@ void VFReader::cmdPre () { _designSize = fix2double(ds); if (i != 202) throw VFException("invalid identification value in preamble"); - if (_actions) - _actions->preamble(cmt, cs, ds); + if (_actions) + _actions->preamble(cmt, cs, ds); } @@ -148,30 +148,30 @@ void VFReader::cmdPost () { void VFReader::cmdLongChar () { UInt32 pl = readUnsigned(4); // packet length (length of DVI subroutine) - if (_actions) { + 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<UInt8> *dvi = new vector<UInt8>(pl); // DVI subroutine readBytes(pl, *dvi); _actions->defineVFChar(cc, dvi); // call template method for user actions } - else - in().seekg(8+pl, ios::cur); // skip remaining char definition bytes } /** Reads and executes short_char_x command. * @param[in] pl packet length (length of DVI subroutine) */ void VFReader::cmdShortChar (int pl) { - if (_actions) { + 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<UInt8> *dvi = new vector<UInt8>(pl); // DVI subroutine readBytes(pl, *dvi); _actions->defineVFChar(cc, dvi); // call template method for user actions } - else - in().seekg(4+pl, ios::cur); // skip char definition bytes } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.h index f6d9474ccbe..f6d9474ccbe 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VFReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VFReader.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VectorStream.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VectorStream.h index 345b319c7b3..92ce8a68437 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/VectorStream.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/VectorStream.h @@ -29,7 +29,7 @@ template <typename T> struct VectorStreamBuffer : public std::streambuf { VectorStreamBuffer (std::vector<T> &source) { - setg((char*)&source[0], (char*)&source[0], (char*)&source[0]+source.size()); + setg((char*)&source[0], (char*)&source[0], (char*)&source[0]+source.size()); } }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.cpp index caee2ec7439..caee2ec7439 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.h index c3d6b928ee7..4a2dd3e5318 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLDocument.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLDocument.h @@ -25,9 +25,9 @@ class XMLDocument { - public: - XMLDocument (XMLElementNode *root=0); - ~XMLDocument (); + public: + XMLDocument (XMLElementNode *root=0); + ~XMLDocument (); void clear (); void append (XMLNode *node); void setRootNode (XMLElementNode *root); @@ -35,7 +35,7 @@ class XMLDocument std::ostream& write (std::ostream &os) const; bool emit (std::ostream& os, XMLNode *stopNode); - private: + private: std::list<XMLNode*> _nodes; XMLElementNode *_rootElement; bool _emitted; diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.cpp index 82b85b52ffd..1fb40368f19 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.cpp @@ -19,6 +19,8 @@ *************************************************************************/ #include <config.h> +#include <map> +#include <list> #include "macros.h" #include "XMLNode.h" #include "XMLString.h" @@ -51,6 +53,13 @@ XMLElementNode::~XMLElementNode () { } +void XMLElementNode::clear () { + _attributes.clear(); + FORALL(_children, ChildList::iterator, i) + (*i)->clear(); +} + + void XMLElementNode::addAttribute (const string &name, const string &value) { _attributes[name] = value; } @@ -280,6 +289,13 @@ XMLDeclarationNode::~XMLDeclarationNode () { } +void XMLDeclarationNode::clear () { + _params.clear(); + FORALL(_children, list<XMLDeclarationNode*>::iterator, i) + (*i)->clear(); +} + + /** Appends another declaration node to this one. * @param[in] child child to append, must be of type XMLDeclarationNode */ void XMLDeclarationNode::append (XMLNode *child) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.h index cd878701db9..2924e038adb 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLNode.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLNode.h @@ -33,6 +33,7 @@ struct XMLNode { virtual ~XMLNode () {} virtual XMLNode* clone () const =0; + virtual void clear () =0; virtual std::ostream& write (std::ostream &os) const =0; virtual bool emit (std::ostream &os, XMLNode *stopElement); virtual void append (XMLNode *child) {} @@ -45,10 +46,11 @@ class XMLElementNode : public XMLNode typedef std::map<std::string,std::string> AttribMap; typedef std::list<XMLNode*> ChildList; public: - XMLElementNode (const std::string &name); + XMLElementNode (const std::string &name); XMLElementNode (const XMLElementNode &node); ~XMLElementNode (); XMLNode* 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); @@ -62,8 +64,8 @@ class XMLElementNode : public XMLNode std::ostream& write (std::ostream &os) const; bool emit (std::ostream &os, XMLNode *stopElement); bool empty () const {return _children.empty();} - const std::list<XMLNode*>& children () const {return _children;} - const std::string& getName () const {return _name;} + const std::list<XMLNode*>& children () const {return _children;} + const std::string& getName () const {return _name;} private: std::string _name; // element name (<name a1="v1" .. an="vn">...</name>) @@ -78,11 +80,13 @@ class XMLTextNode : public XMLNode public: XMLTextNode (const std::string &str) : _text(str) {} XMLNode* 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; @@ -94,6 +98,7 @@ class XMLCommentNode : public XMLNode public: XMLCommentNode (const std::string &str) : _text(str) {} XMLNode* clone () const {return new XMLCommentNode(*this);} + void clear () {_text.clear();} std::ostream& write (std::ostream &os) const {return os << "<!--" << _text << "-->\n";} private: @@ -108,6 +113,7 @@ class XMLDeclarationNode : public XMLNode XMLDeclarationNode (const XMLDeclarationNode &node); ~XMLDeclarationNode (); XMLNode* clone () const {return new XMLDeclarationNode(*this);} + void clear (); void append (XMLNode *child); std::ostream& write (std::ostream &os) const; bool emit (std::ostream &os, XMLNode *stopElement); @@ -125,6 +131,7 @@ class XMLCDataNode : public XMLNode public: XMLCDataNode (const std::string &d) : _data(d) {} XMLNode* clone () const {return new XMLCDataNode(*this);} + void clear () {return _data.clear();} std::ostream& write (std::ostream &os) const; private: diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.cpp index ea4487f45bc..4911b6c6a19 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.cpp @@ -25,6 +25,7 @@ #include <sstream> #include "macros.h" #include "types.h" +#include "Unicode.h" #include "XMLString.h" using namespace std; @@ -32,36 +33,6 @@ using namespace std; int XMLString::DECIMAL_PLACES = 0; -/** Converts a unicode value to a UTF-8 byte sequence. - * @param[in] c character code - * @return utf8 seqence consisting of 1-4 bytes */ -static string to_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 == 0xFFFE || c == 0xFFFF) - utf8 += (c & 0xFF); - 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); - } - } - return utf8; -} - - static string translate (UInt32 c) { switch (c) { case '<' : return "<"; @@ -69,7 +40,7 @@ static string translate (UInt32 c) { case '"' : return """; case '\'': return "'"; } - return to_utf8(c); + return Unicode::utf8(c); } @@ -80,7 +51,7 @@ static string translate (UInt32 c) { static inline double round (double x, long n) { const long pow10[] = {10L, 100L, 1000L, 10000L, 100000L, 1000000L}; n--; - return floor(x*pow10[n]+0.5)/pow10[n]; + return floor(x*pow10[n]+0.5)/pow10[n]; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.h index ae27053a856..311d7e535b9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/XMLString.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/XMLString.h @@ -26,10 +26,10 @@ class XMLString : public std::string { - public: + public: XMLString () : std::string() {} XMLString (const char *str, bool plain=false); - XMLString (const std::string &str, bool plain=false); + XMLString (const std::string &str, bool plain=false); XMLString (int n, bool cast=true); XMLString (double x); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/dvisvgm.cpp index aafd843ecd1..1e76cf68f57 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/dvisvgm.cpp @@ -152,7 +152,7 @@ class SVGOutput : public SVGOutputBase static void show_help (const CommandLine &cmd) { cout << PACKAGE_STRING "\n\n"; cmd.help(cmd.help_arg()); - cout << "\nCopyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> \n\n"; + cout << "\nCopyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> \n\n"; } @@ -335,8 +335,7 @@ int main (int argc, char *argv[]) { if (args.list_specials_given()) { SVGOutput out; DVIToSVG dvisvg(cin, out); - if (const SpecialManager *sm = dvisvg.setProcessSpecials()) - sm->writeHandlerInfo(cout); + SpecialManager::instance().writeHandlerInfo(cout); return 0; } @@ -362,7 +361,7 @@ int main (int argc, char *argv[]) { return 1; if (args.progress_given()) { - DVIReader::COMPUTE_PAGE_LENGTH = args.progress_given(); + DVIReader::COMPUTE_PROGRESS = args.progress_given(); DVIToSVGActions::PROGRESSBAR_DELAY = args.progress_arg(); } SVGTree::CREATE_STYLE = !args.no_styles_given(); @@ -402,13 +401,13 @@ int main (int argc, char *argv[]) { 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()); - init_fontmap(args); pair<int,int> pageinfo; dvi2svg.convert(args.page_arg(), &pageinfo); Message::mstream().indent(0); diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.cpp index 2893c299891..2893c299891 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.h index 60f38c4fac7..60f38c4fac7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/gzstream.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/gzstream.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/iapi.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/iapi.h index 8e29d938d03..8e29d938d03 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/iapi.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/iapi.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ierrors.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ierrors.h index 3184341177e..3184341177e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/ierrors.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/ierrors.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/macros.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/macros.h index 73217c763e0..73217c763e0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/macros.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/macros.h diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.dtd b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.dtd new file mode 100644 index 00000000000..d8444c94c9f --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.dtd @@ -0,0 +1,51 @@ +<?xml encoding="UTF-8"?> +<!-- ********************************************************************* +** options.dtd ** +** ** +** This file is part of dvisvgm - the DVI to SVG converter ** +** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program is free software; you can redistribute it and/or ** +** modify it under the terms of the GNU General Public License as ** +** published by the Free Software Foundation; either version 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program is distributed in the hope that it will be useful, but ** +** WITHOUT ANY WARRANTY; without even the implied warranty of ** +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** +** GNU General Public License for more details. ** +** ** +** You should have received a copy of the GNU General Public License ** +** along with this program; if not, see <http://www.gnu.org/licenses/>. ** +***********************************************************************--> + +<!ELEMENT cmdline (program,options)> +<!ATTLIST cmdline + class NMTOKEN #REQUIRED> + +<!ELEMENT program (name,usage+,description)> + +<!ELEMENT options (section)+> + +<!ELEMENT name (#PCDATA)> + +<!ELEMENT usage (#PCDATA)> + +<!ELEMENT section (option)+> +<!ATTLIST section + title CDATA #REQUIRED> + +<!ELEMENT option (arg?,description)> +<!ATTLIST option + long ID #REQUIRED + short NMTOKEN #IMPLIED + if CDATA #IMPLIED> + +<!ELEMENT arg EMPTY> +<!ATTLIST arg + default NMTOKEN #IMPLIED + name CDATA #REQUIRED + optional (yes|no) #IMPLIED + type NMTOKEN #REQUIRED> + +<!ELEMENT description (#PCDATA)> diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.xml index 33ce8bd44f9..d1029f7768b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/options.xml +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/options.xml @@ -47,7 +47,7 @@ <description>set size of bounding box</description> </option> <option long="linkmark" short="L"> - <arg type="string" name="type" default="box"/> + <arg type="string" name="style" default="box"/> <description>select how to mark hyperlinked areas</description> </option> <option long="output" short="o"> diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/psdefs.cpp b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/psdefs.cpp index 4edce3af1d8..4edce3af1d8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/psdefs.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/psdefs.cpp diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/types.h b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/types.h index 306a0ab4e26..1e1daef928c 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-1.6/src/types.h +++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/src/types.h @@ -22,23 +22,23 @@ #define DVISVGM_TYPES_H namespace internal { - template<unsigned BYTES> - class ERROR_inttype_not_available - { - ERROR_inttype_not_available(); - }; + template<unsigned BYTES> + class ERROR_inttype_not_available + { + ERROR_inttype_not_available(); + }; - template<bool FIRST, typename A, typename B> - struct select - { - typedef A T; - }; + template<bool FIRST, typename A, typename B> + struct select + { + typedef A T; + }; - template<typename A, typename B> - struct select<false, A, B> - { - typedef B T; - }; + template<typename A, typename B> + struct select<false, A, B> + { + typedef B T; + }; } @@ -46,11 +46,11 @@ namespace internal { template<unsigned BYTES, bool SIGNED> struct int_t { - typedef typename internal::select<sizeof(signed char) == BYTES, signed char, - typename internal::select<sizeof(signed short) == BYTES, signed short, - typename internal::select<sizeof(signed int) == BYTES, signed int, - typename internal::select<sizeof(signed long) == BYTES, signed long, - typename internal::select<sizeof(signed long long) == BYTES, signed long long, + typedef typename internal::select<sizeof(signed char) == BYTES, signed char, + typename internal::select<sizeof(signed short) == BYTES, signed short, + typename internal::select<sizeof(signed int) == BYTES, signed int, + typename internal::select<sizeof(signed long) == BYTES, signed long, + typename internal::select<sizeof(signed long long) == BYTES, signed long long, internal::ERROR_inttype_not_available<BYTES> >::T>::T>::T>::T>::T T; }; diff --git a/Build/source/texk/dvisvgm/version.ac b/Build/source/texk/dvisvgm/version.ac index b5d62c1a71b..8a58a3a8c3c 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.6]) +m4_define([dvisvgm_version], [1.7]) |