summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-08 03:01:54 +0000
committerNorbert Preining <norbert@preining.info>2024-03-08 03:01:54 +0000
commit0eba0875b1bcc4a022360ed72a29a81e041cd467 (patch)
treef13d24b9b87f5b08056e445eb7c206d9a3a902a8 /dviware/dvisvgm/src
parentdc177b2cd4ed993d65860adc66d256969c1bb6ad (diff)
CTAN sync 202403080301
Diffstat (limited to 'dviware/dvisvgm/src')
-rw-r--r--dviware/dvisvgm/src/BasicDVIReader.cpp8
-rw-r--r--dviware/dvisvgm/src/BasicDVIReader.hpp4
-rw-r--r--dviware/dvisvgm/src/DVIReader.cpp14
-rw-r--r--dviware/dvisvgm/src/DVIReader.hpp2
-rw-r--r--dviware/dvisvgm/src/DVIToSVG.cpp30
-rw-r--r--dviware/dvisvgm/src/Font.cpp2
-rw-r--r--dviware/dvisvgm/src/Font.hpp2
-rw-r--r--dviware/dvisvgm/src/FontManager.cpp2
-rw-r--r--dviware/dvisvgm/src/FontManager.hpp2
-rw-r--r--dviware/dvisvgm/src/GFReader.cpp2
-rw-r--r--dviware/dvisvgm/src/Makefile.am55
-rw-r--r--dviware/dvisvgm/src/Makefile.in97
-rw-r--r--dviware/dvisvgm/src/NoPsSpecialHandler.cpp2
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandlerProxy.cpp85
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandlerProxy.hpp39
-rw-r--r--dviware/dvisvgm/src/SpecialManager.cpp30
-rw-r--r--dviware/dvisvgm/src/SpecialManager.hpp2
-rw-r--r--dviware/dvisvgm/src/StreamReader.cpp8
-rw-r--r--dviware/dvisvgm/src/StreamReader.hpp1
-rw-r--r--dviware/dvisvgm/src/VFActions.hpp5
-rw-r--r--dviware/dvisvgm/src/VFReader.cpp16
-rw-r--r--dviware/dvisvgm/src/VectorStream.hpp84
-rw-r--r--dviware/dvisvgm/src/fonts/Makefile.in1
-rw-r--r--dviware/dvisvgm/src/optimizer/Makefile.in6
-rw-r--r--dviware/dvisvgm/src/psdefs.cpp276
-rw-r--r--dviware/dvisvgm/src/ttf/Makefile.in6
26 files changed, 442 insertions, 339 deletions
diff --git a/dviware/dvisvgm/src/BasicDVIReader.cpp b/dviware/dvisvgm/src/BasicDVIReader.cpp
index f87cbcbf3f..a6ae7495c4 100644
--- a/dviware/dvisvgm/src/BasicDVIReader.cpp
+++ b/dviware/dvisvgm/src/BasicDVIReader.cpp
@@ -81,7 +81,7 @@ int BasicDVIReader::evalCommand (CommandHandler &handler, int &param) {
const int opcode = readByte();
if (!isStreamValid() || opcode < 0) // at end of file
- throw InvalidDVIFileException("invalid DVI file");
+ throw DVIPrematureEOFException();
int num_param_bytes = 0;
param = -1;
@@ -163,7 +163,7 @@ void BasicDVIReader::executePreamble () {
return;
}
}
- throw DVIException("invalid DVI file");
+ throw DVIException("invalid DVI file (missing preamble)");
}
@@ -171,7 +171,7 @@ void BasicDVIReader::executePreamble () {
void BasicDVIReader::goToPostamble () {
clearStream();
if (!isStreamValid())
- throw DVIException("invalid DVI file");
+ throw DVIException("invalid DVI file (missing postamble)");
seek(-1, ios::end); // stream pointer to last byte
int count=0;
@@ -198,7 +198,7 @@ void BasicDVIReader::executePostamble () {
void BasicDVIReader::executePostPost () {
clearStream(); // reset all status bits
if (!isStreamValid())
- throw DVIException("invalid DVI file");
+ throw DVIException("invalid DVI file (missing postpost)");
seek(-1, ios::end); // stream pointer to last byte
int count=0;
diff --git a/dviware/dvisvgm/src/BasicDVIReader.hpp b/dviware/dvisvgm/src/BasicDVIReader.hpp
index c3135cb5d5..f3976a6b92 100644
--- a/dviware/dvisvgm/src/BasicDVIReader.hpp
+++ b/dviware/dvisvgm/src/BasicDVIReader.hpp
@@ -32,8 +32,8 @@ struct DVIException : public MessageException {
};
-struct InvalidDVIFileException : public DVIException {
- explicit InvalidDVIFileException (const std::string &msg) : DVIException(msg) {}
+struct DVIPrematureEOFException : public DVIException {
+ explicit DVIPrematureEOFException () : DVIException("premature end of DVI stream") {}
};
diff --git a/dviware/dvisvgm/src/DVIReader.cpp b/dviware/dvisvgm/src/DVIReader.cpp
index b7c08bc139..01501f29b0 100644
--- a/dviware/dvisvgm/src/DVIReader.cpp
+++ b/dviware/dvisvgm/src/DVIReader.cpp
@@ -20,6 +20,7 @@
#include <algorithm>
#include <sstream>
+#include <vectorstream.hpp>
#include "Color.hpp"
#include "DVIActions.hpp"
#include "DVIReader.hpp"
@@ -27,7 +28,6 @@
#include "FontManager.hpp"
#include "HashFunction.hpp"
#include "utility.hpp"
-#include "VectorStream.hpp"
using namespace std;
@@ -49,7 +49,7 @@ void DVIReader::executeAll () {
try {
opcode = executeCommand();
}
- catch (const InvalidDVIFileException &e) {
+ catch (const DVIPrematureEOFException &e) {
// end of stream reached
opcode = -1;
}
@@ -64,7 +64,7 @@ void DVIReader::executeAll () {
bool DVIReader::executePage (unsigned n) {
clearStream(); // reset all status bits
if (!isStreamValid())
- throw DVIException("invalid DVI file");
+ throw DVIException("invalid DVI file (page "+to_string(n)+" not found");
if (n < 1 || n > numberOfPages())
return false;
@@ -204,7 +204,7 @@ void DVIReader::cmdPop (int) {
void DVIReader::putVFChar (Font *font, uint32_t c) {
if (auto vf = font_cast<VirtualFont*>(font)) { // is current font a virtual font?
FontManager &fm = FontManager::instance();
- const vector<uint8_t> *dvi = vf->getDVI(c); // try to get DVI snippet that represents character c
+ const auto *dvi = vf->getDVI(c); // try to get DVI snippet that represents character c
Font *firstFont = fm.vfFirstFont(vf);
if (!dvi) {
const FontMetrics *ffm = firstFont ? firstFont->getMetrics() : nullptr;
@@ -222,8 +222,8 @@ void DVIReader::putVFChar (Font *font, uint32_t c) {
_dvi2bp = vf->scaledSize()/(1 << 20);
DVIState savedState = _dviState; // save current cursor position
_dviState.x = _dviState.y = _dviState.w = _dviState.z = 0;
- VectorInputStream<uint8_t> vis(*dvi);
- istream &is = replaceStream(vis);
+ ivectorstream<vector<char>> vis(*dvi);
+ auto &is = replaceStream(vis);
try {
executeAll(); // execute DVI fragment
}
@@ -534,7 +534,7 @@ void DVIReader::defineVFFont (uint32_t fontnum, const string &path, const string
/** This template method is called by the VFReader after reading a character definition from a VF file.
* @param[in] c character number
* @param[in] dvi DVI fragment describing the character */
-void DVIReader::defineVFChar (uint32_t c, vector<uint8_t> &&dvi) {
+void DVIReader::defineVFChar (uint32_t c, vector<char> &&dvi) {
FontManager::instance().assignVFChar(c, std::move(dvi));
}
diff --git a/dviware/dvisvgm/src/DVIReader.hpp b/dviware/dvisvgm/src/DVIReader.hpp
index ffab16c5a8..b221960cb6 100644
--- a/dviware/dvisvgm/src/DVIReader.hpp
+++ b/dviware/dvisvgm/src/DVIReader.hpp
@@ -77,7 +77,7 @@ class DVIReader : public BasicDVIReader, public VFActions {
// VFAction methods
void defineVFFont (uint32_t fontnum, const std::string &path, const std::string &name, uint32_t checksum, double dsize, double ssize) override;
- void defineVFChar (uint32_t c, std::vector<uint8_t> &&dvi) override;
+ void defineVFChar (uint32_t c, std::vector<char> &&dvi) override;
// The following template methods provide higher-level access to the DVI commands.
// In contrast to their cmdXXX pendants, they don't require any handling of the input stream.
diff --git a/dviware/dvisvgm/src/DVIToSVG.cpp b/dviware/dvisvgm/src/DVIToSVG.cpp
index b4340a89fe..a1da593d08 100644
--- a/dviware/dvisvgm/src/DVIToSVG.cpp
+++ b/dviware/dvisvgm/src/DVIToSVG.cpp
@@ -54,13 +54,8 @@
#include "HtmlSpecialHandler.hpp"
#include "PapersizeSpecialHandler.hpp"
#include "PdfSpecialHandler.hpp"
+#include "PsSpecialHandlerProxy.hpp"
#include "TpicSpecialHandler.hpp"
-#ifndef HAVE_LIBGS
- #include "NoPsSpecialHandler.hpp"
-#endif
-#ifndef DISABLE_GS
- #include "PsSpecialHandler.hpp"
-#endif
///////////////////////////////////
@@ -423,28 +418,9 @@ void DVIToSVG::setProcessSpecials (const char *ignorelist, bool pswarning) {
SpecialManager::registerHandler<EmSpecialHandler>(ignoredHandlerName); // handles emTeX specials
SpecialManager::registerHandler<HtmlSpecialHandler>(ignoredHandlerName); // handles hyperref specials
SpecialManager::registerHandler<PapersizeSpecialHandler>(ignoredHandlerName); // handles papersize special
- SpecialManager::registerHandler<PdfSpecialHandler>(ignoredHandlerName); // handles pdf specials
+ SpecialManager::registerHandler<PdfSpecialHandler>(ignoredHandlerName);
SpecialManager::registerHandler<TpicSpecialHandler>(ignoredHandlerName); // handles tpic specials
- if (find(ignoredHandlerName.begin(), ignoredHandlerName.end(), PsSpecialHandler::handlerName()) == ignoredHandlerName.end()) {
-#ifndef DISABLE_GS
- if (Ghostscript().available())
- SpecialManager::registerHandler<PsSpecialHandler>(ignoredHandlerName); // handles PostScript specials
- else
-#endif
- {
-#ifndef HAVE_LIBGS
- // dummy PS special handler that only prints warning messages
- SpecialManager::registerHandler<NoPsSpecialHandler>(ignoredHandlerName);
- if (pswarning) {
-#ifdef DISABLE_GS
- Message::wstream() << "processing of PostScript specials has been disabled permanently\n";
-#else
- Message::wstream() << "processing of PostScript specials is disabled (Ghostscript not found)\n";
-#endif
- }
-#endif
- }
- }
+ SpecialManager::registerHandler(util::make_unique<PsSpecialHandlerProxy>(pswarning), ignoredHandlerName);
}
}
diff --git a/dviware/dvisvgm/src/Font.cpp b/dviware/dvisvgm/src/Font.cpp
index 42737d364a..56b4c635b0 100644
--- a/dviware/dvisvgm/src/Font.cpp
+++ b/dviware/dvisvgm/src/Font.cpp
@@ -725,7 +725,7 @@ void VirtualFontImpl::assignChar (uint32_t c, DVIVector &&dvi) {
/** Returns the DVI sippet that describes a given character of the virtual font.
* @param[in] c character code
* @return pointer to vector of DVI commands, or 0 if character doesn't exist */
-const vector<uint8_t>* VirtualFontImpl::getDVI (int c) const {
+const VirtualFont::DVIVector* VirtualFontImpl::getDVI (int c) const {
auto it = _charDefs.find(c);
return (it == _charDefs.end() ? nullptr : &it->second);
}
diff --git a/dviware/dvisvgm/src/Font.hpp b/dviware/dvisvgm/src/Font.hpp
index 84c19e512e..c8a2e340a9 100644
--- a/dviware/dvisvgm/src/Font.hpp
+++ b/dviware/dvisvgm/src/Font.hpp
@@ -162,7 +162,7 @@ class PhysicalFont : public virtual Font {
class VirtualFont : public virtual Font {
friend class FontManager;
public:
- using DVIVector = std::vector<uint8_t>;
+ using DVIVector = std::vector<char>;
public:
static std::unique_ptr<Font> create (const std::string &name, uint32_t checksum, double dsize, double ssize);
diff --git a/dviware/dvisvgm/src/FontManager.cpp b/dviware/dvisvgm/src/FontManager.cpp
index 1020617178..2a5778326a 100644
--- a/dviware/dvisvgm/src/FontManager.cpp
+++ b/dviware/dvisvgm/src/FontManager.cpp
@@ -377,7 +377,7 @@ void FontManager::leaveVF () {
/** Assigns a sequence of DVI commands to a char code.
* @param[in] c character code
* @param[in] dvi DVI commands that describe character c */
-void FontManager::assignVFChar (int c, vector<uint8_t> &&dvi) {
+void FontManager::assignVFChar (int c, vector<char> &&dvi) {
if (!_vfStack.empty())
_vfStack.top()->assignChar(c, std::move(dvi));
}
diff --git a/dviware/dvisvgm/src/FontManager.hpp b/dviware/dvisvgm/src/FontManager.hpp
index 3b051a3835..a2deb89d95 100644
--- a/dviware/dvisvgm/src/FontManager.hpp
+++ b/dviware/dvisvgm/src/FontManager.hpp
@@ -72,7 +72,7 @@ class FontManager {
Font* vfFirstFont (const VirtualFont *vf) const;
void enterVF (VirtualFont *vf);
void leaveVF ();
- void assignVFChar (int c, std::vector<uint8_t> &&dvi);
+ void assignVFChar (int c, std::vector<char> &&dvi);
void addUsedChar (const Font &font, int c);
void resetUsedChars ();
CharMap& getUsedChars () {return _usedChars;}
diff --git a/dviware/dvisvgm/src/GFReader.cpp b/dviware/dvisvgm/src/GFReader.cpp
index 6b2c6aa388..6584d06849 100644
--- a/dviware/dvisvgm/src/GFReader.cpp
+++ b/dviware/dvisvgm/src/GFReader.cpp
@@ -158,7 +158,7 @@ bool GFReader::executePostamble () {
throw GFException("invalid identification byte in postpost");
_in.seekg(-5, ios::cur); // now on postpost
if (_in.get() != 249)
- throw GFException("invalid GF file");
+ throw GFException("invalid GF file (missing postpost)");
uint32_t q = readUnsigned(4); // pointer to begin of postamble
_in.seekg(q); // now on begin of postamble
while (executeCommand() != 249); // execute all commands until postpost is reached
diff --git a/dviware/dvisvgm/src/Makefile.am b/dviware/dvisvgm/src/Makefile.am
index f0689f30d1..f1888535c7 100644
--- a/dviware/dvisvgm/src/Makefile.am
+++ b/dviware/dvisvgm/src/Makefile.am
@@ -17,10 +17,8 @@ dvisvgm_LDADD = \
$(noinst_LTLIBRARIES) \
../libs/clipper/libclipper.a \
../libs/md5/libmd5.a \
- $(FREETYPE_LIBS) \
$(POTRACE_LIBS) \
- $(XXHASH_LIBS) \
- $(ZLIB_LIBS)
+ $(XXHASH_LIBS)
if ENABLE_WOFF
SUBDIRS += ttf
@@ -28,7 +26,19 @@ SUBDIRS += ttf
dvisvgm_LDADD += \
$(WOFF2_LIBS) \
$(BROTLI_LIBS)
-endif
+endif ENABLE_WOFF
+
+if TEXLIVE_BUILD
+dvisvgm_LDADD += \
+ $(KPATHSEA_LIBS) \
+ $(FREETYPE2_LIBS) \
+ $(ZLIB_LIBS) \
+ $(LIBGS_LIBS)
+else
+dvisvgm_LDADD += \
+ $(FREETYPE_LIBS) \
+ $(ZLIB_LIBS)
+endif !TEXLIVE_BUILD
dvisvgm_DEPENDENCIES = $(noinst_LTLIBRARIES)
@@ -123,6 +133,7 @@ libdvisvgm_la_SOURCES = \
PSPattern.hpp PSPattern.cpp \
PSPreviewHandler.hpp PSPreviewHandler.cpp \
PsSpecialHandler.hpp PsSpecialHandler.cpp \
+ PsSpecialHandlerProxy.hpp PsSpecialHandlerProxy.cpp \
RangeMap.hpp RangeMap.cpp \
ShadingPatch.hpp ShadingPatch.cpp \
SignalHandler.hpp SignalHandler.cpp \
@@ -151,7 +162,6 @@ libdvisvgm_la_SOURCES = \
Unicode.hpp Unicode.cpp \
utility.hpp utility.cpp \
VectorIterator.hpp \
- VectorStream.hpp \
VFActions.hpp \
VFReader.hpp VFReader.cpp \
windows.hpp \
@@ -170,27 +180,37 @@ endif
EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp
-if !TEXLIVE_BUILD
-WARNING_CFLAGS = -Wall
-WARNING_CXXFLAGS = -Wall -Wnon-virtual-dtor
-endif
-
AM_CFLAGS = $(WARNING_CFLAGS) \
$(ZLIB_CFLAGS) \
$(CODE_COVERAGE_CFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS) \
+ -I$(dvisvgm_srcdir)/libs/boost \
-I$(dvisvgm_srcdir)/libs/clipper \
- -I$(dvisvgm_srcdir)/libs/variant/include \
- $(KPSE_CFLAGS) \
- $(FREETYPE_CFLAGS) \
- $(ZLIB_CFLAGS) \
- $(CODE_COVERAGE_CFLAGS)
+ -I$(dvisvgm_srcdir)/libs/variant/include
AM_CXXFLAGS += \
$(POTRACE_CFLAGS) \
$(XXHASH_CFLAGS)
+if TEXLIVE_BUILD
+AM_CXXFLAGS += \
+ $(KPATHSEA_INCLUDES) \
+ $(POTRACE_INCLUDES) \
+ $(FREETYPE2_INCLUDES) \
+ $(ZLIB_INCLUDES) \
+ $(CODE_COVERAGE_CFLAGS)
+if WIN32
+AM_CXXFLAGS += -DTEXLIVEWIN32
+endif WIN32
+else
+AM_CXXFLAGS += \
+ $(KPSE_CFLAGS) \
+ $(FREETYPE_CFLAGS) \
+ $(ZLIB_CFLAGS) \
+ $(CODE_COVERAGE_CFLAGS)
+endif !TEXLIVE_BUILD
+
AM_LDFLAGS = \
$(KPSE_LIBS) \
$(CODE_COVERAGE_LDFLAGS)
@@ -202,8 +222,11 @@ AM_CXXFLAGS += \
$(BROTLI_CFLAGS) \
$(WOFF2_CFLAGS)
+# TL: do not try to rebuild these source files.
+if !TEXLIVE_BUILD
AM_LDFLAGS += $(TTFAUTOHINT_LIBS)
-endif
+endif !TEXLIVE_BUILD
+endif ENABLE_WOFF
AM_CXXFLAGS += -I$(dvisvgm_srcdir)/libs/md5
diff --git a/dviware/dvisvgm/src/Makefile.in b/dviware/dvisvgm/src/Makefile.in
index 3921a77463..c22e7a1ca3 100644
--- a/dviware/dvisvgm/src/Makefile.in
+++ b/dviware/dvisvgm/src/Makefile.in
@@ -99,12 +99,38 @@ bin_PROGRAMS = dvisvgm$(EXEEXT)
@ENABLE_WOFF_TRUE@ $(WOFF2_LIBS) \
@ENABLE_WOFF_TRUE@ $(BROTLI_LIBS)
-@TEXLIVE_BUILD_TRUE@am__append_7 = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) \
+@TEXLIVE_BUILD_TRUE@am__append_7 = \
+@TEXLIVE_BUILD_TRUE@ $(KPATHSEA_LIBS) \
+@TEXLIVE_BUILD_TRUE@ $(FREETYPE2_LIBS) \
+@TEXLIVE_BUILD_TRUE@ $(ZLIB_LIBS) \
+@TEXLIVE_BUILD_TRUE@ $(LIBGS_LIBS)
+
+@TEXLIVE_BUILD_FALSE@am__append_8 = \
+@TEXLIVE_BUILD_FALSE@ $(FREETYPE_LIBS) \
+@TEXLIVE_BUILD_FALSE@ $(ZLIB_LIBS)
+
+@TEXLIVE_BUILD_TRUE@am__append_9 = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) \
@TEXLIVE_BUILD_TRUE@ $(FREETYPE2_DEPEND) $(POTRACE_DEPEND)
-@ENABLE_WOFF_TRUE@am__append_8 = ttf/libttf.la
-@ENABLE_WOFF_TRUE@am__append_9 = $(TTFAUTOHINT_CFLAGS) \
+@ENABLE_WOFF_TRUE@am__append_10 = ttf/libttf.la
+@TEXLIVE_BUILD_TRUE@am__append_11 = \
+@TEXLIVE_BUILD_TRUE@ $(KPATHSEA_INCLUDES) \
+@TEXLIVE_BUILD_TRUE@ $(POTRACE_INCLUDES) \
+@TEXLIVE_BUILD_TRUE@ $(FREETYPE2_INCLUDES) \
+@TEXLIVE_BUILD_TRUE@ $(ZLIB_INCLUDES) \
+@TEXLIVE_BUILD_TRUE@ $(CODE_COVERAGE_CFLAGS)
+
+@TEXLIVE_BUILD_TRUE@@WIN32_TRUE@am__append_12 = -DTEXLIVEWIN32
+@TEXLIVE_BUILD_FALSE@am__append_13 = \
+@TEXLIVE_BUILD_FALSE@ $(KPSE_CFLAGS) \
+@TEXLIVE_BUILD_FALSE@ $(FREETYPE_CFLAGS) \
+@TEXLIVE_BUILD_FALSE@ $(ZLIB_CFLAGS) \
+@TEXLIVE_BUILD_FALSE@ $(CODE_COVERAGE_CFLAGS)
+
+@ENABLE_WOFF_TRUE@am__append_14 = $(TTFAUTOHINT_CFLAGS) \
@ENABLE_WOFF_TRUE@ $(BROTLI_CFLAGS) $(WOFF2_CFLAGS)
-@ENABLE_WOFF_TRUE@am__append_10 = $(TTFAUTOHINT_LIBS)
+
+# TL: do not try to rebuild these source files.
+@ENABLE_WOFF_TRUE@@TEXLIVE_BUILD_FALSE@am__append_15 = $(TTFAUTOHINT_LIBS)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
@@ -130,7 +156,7 @@ am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdvisvgm_la_DEPENDENCIES = fonts/libbase14fonts.la \
- optimizer/liboptimizer.la $(am__append_8)
+ optimizer/liboptimizer.la $(am__append_10)
am_libdvisvgm_la_OBJECTS = BasicDVIReader.lo Bezier.lo \
BgColorSpecialHandler.lo Bitmap.lo BoundingBox.lo \
Calculator.lo CharMapID.lo CLCommandLine.lo CMap.lo \
@@ -150,12 +176,12 @@ am_libdvisvgm_la_OBJECTS = BasicDVIReader.lo Bezier.lo \
PDFParser.lo PdfSpecialHandler.lo PDFToSVG.lo \
PreScanDVIReader.lo Process.lo psdefs.lo PSInterpreter.lo \
PSPattern.lo PSPreviewHandler.lo PsSpecialHandler.lo \
- RangeMap.lo ShadingPatch.lo SignalHandler.lo SourceInput.lo \
- SpecialActions.lo SpecialManager.lo StreamReader.lo \
- StreamWriter.lo Subfont.lo SVGCharHandler.lo \
- SVGCharHandlerFactory.lo SVGCharPathHandler.lo \
- SVGCharTspanTextHandler.lo SVGElement.lo SVGOutput.lo \
- SVGSingleCharTextHandler.lo SVGTree.lo System.lo \
+ PsSpecialHandlerProxy.lo RangeMap.lo ShadingPatch.lo \
+ SignalHandler.lo SourceInput.lo SpecialActions.lo \
+ SpecialManager.lo StreamReader.lo StreamWriter.lo Subfont.lo \
+ SVGCharHandler.lo SVGCharHandlerFactory.lo \
+ SVGCharPathHandler.lo SVGCharTspanTextHandler.lo SVGElement.lo \
+ SVGOutput.lo SVGSingleCharTextHandler.lo SVGTree.lo System.lo \
TensorProductPatch.lo Terminal.lo TFM.lo ToUnicodeMap.lo \
TpicSpecialHandler.lo TriangularPatch.lo Unicode.lo utility.lo \
VFReader.lo XMLDocument.lo XMLNode.lo XMLParser.lo \
@@ -167,11 +193,14 @@ am__v_lt_0 = --silent
am__v_lt_1 =
am_dvisvgm_OBJECTS = dvisvgm.$(OBJEXT)
dvisvgm_OBJECTS = $(am_dvisvgm_OBJECTS)
-am__DEPENDENCIES_1 =
-am__DEPENDENCIES_2 = $(am__append_4)
-am__DEPENDENCIES_3 = $(am__append_2)
-@ENABLE_WOFF_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) \
-@ENABLE_WOFF_TRUE@ $(am__DEPENDENCIES_3)
+am__DEPENDENCIES_1 = $(am__append_4)
+am__DEPENDENCIES_2 = $(am__append_2)
+@ENABLE_WOFF_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) \
+@ENABLE_WOFF_TRUE@ $(am__DEPENDENCIES_2)
+am__DEPENDENCIES_4 =
+@TEXLIVE_BUILD_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_4)
+@TEXLIVE_BUILD_FALSE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_4) \
+@TEXLIVE_BUILD_FALSE@ $(am__DEPENDENCIES_4)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -223,7 +252,8 @@ am__depfiles_remade = ./$(DEPDIR)/BasicDVIReader.Plo \
./$(DEPDIR)/PapersizeSpecialHandler.Plo \
./$(DEPDIR)/PathClipper.Plo ./$(DEPDIR)/PdfSpecialHandler.Plo \
./$(DEPDIR)/PreScanDVIReader.Plo ./$(DEPDIR)/Process.Plo \
- ./$(DEPDIR)/PsSpecialHandler.Plo ./$(DEPDIR)/RangeMap.Plo \
+ ./$(DEPDIR)/PsSpecialHandler.Plo \
+ ./$(DEPDIR)/PsSpecialHandlerProxy.Plo ./$(DEPDIR)/RangeMap.Plo \
./$(DEPDIR)/SVGCharHandler.Plo \
./$(DEPDIR)/SVGCharHandlerFactory.Plo \
./$(DEPDIR)/SVGCharPathHandler.Plo \
@@ -353,7 +383,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CPPFLAGS = @AM_CPPFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AM_LDFLAGS = $(KPSE_LIBS) $(CODE_COVERAGE_LDFLAGS) $(am__append_10)
+AM_LDFLAGS = $(KPSE_LIBS) $(CODE_COVERAGE_LDFLAGS) $(am__append_15)
AR = @AR@
ASCIIDOC = @ASCIIDOC@
AUTOCONF = @AUTOCONF@
@@ -370,7 +400,6 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
@@ -513,14 +542,15 @@ dvisvgm_SOURCES = \
CommandLine.hpp \
dvisvgm.cpp
-@HAVE_POTRACE_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
-@HAVE_POTRACE_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
+@TEXLIVE_BUILD_TRUE@POTRACE_CFLAGS = $(POTRACE_INCLUDES)
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
@HAVE_XXHASH_FALSE@XXHASH_CFLAGS = -I$(dvisvgm_srcdir)/libs/xxHash
@HAVE_XXHASH_FALSE@XXHASH_LIBS = ../libs/xxHash/libxxhash.a
dvisvgm_LDADD = $(noinst_LTLIBRARIES) ../libs/clipper/libclipper.a \
- ../libs/md5/libmd5.a $(FREETYPE_LIBS) $(POTRACE_LIBS) \
- $(XXHASH_LIBS) $(ZLIB_LIBS) $(am__append_6)
-dvisvgm_DEPENDENCIES = $(noinst_LTLIBRARIES) $(am__append_7)
+ ../libs/md5/libmd5.a $(POTRACE_LIBS) $(XXHASH_LIBS) \
+ $(am__append_6) $(am__append_7) $(am__append_8)
+dvisvgm_DEPENDENCIES = $(noinst_LTLIBRARIES) $(am__append_9)
libdvisvgm_la_SOURCES = \
AGLTable.hpp \
BasicDVIReader.hpp BasicDVIReader.cpp \
@@ -607,6 +637,7 @@ libdvisvgm_la_SOURCES = \
PSPattern.hpp PSPattern.cpp \
PSPreviewHandler.hpp PSPreviewHandler.cpp \
PsSpecialHandler.hpp PsSpecialHandler.cpp \
+ PsSpecialHandlerProxy.hpp PsSpecialHandlerProxy.cpp \
RangeMap.hpp RangeMap.cpp \
ShadingPatch.hpp ShadingPatch.cpp \
SignalHandler.hpp SignalHandler.cpp \
@@ -635,7 +666,6 @@ libdvisvgm_la_SOURCES = \
Unicode.hpp Unicode.cpp \
utility.hpp utility.cpp \
VectorIterator.hpp \
- VectorStream.hpp \
VFActions.hpp \
VFReader.hpp VFReader.cpp \
windows.hpp \
@@ -647,19 +677,17 @@ libdvisvgm_la_SOURCES = \
ZLibOutputStream.hpp
libdvisvgm_la_LIBADD = fonts/libbase14fonts.la \
- optimizer/liboptimizer.la $(am__append_8)
+ optimizer/liboptimizer.la $(am__append_10)
EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp
-@TEXLIVE_BUILD_FALSE@WARNING_CFLAGS = -Wall
-@TEXLIVE_BUILD_FALSE@WARNING_CXXFLAGS = -Wall -Wnon-virtual-dtor
AM_CFLAGS = $(WARNING_CFLAGS) \
$(ZLIB_CFLAGS) \
$(CODE_COVERAGE_CFLAGS)
-AM_CXXFLAGS = $(WARNING_CXXFLAGS) -I$(dvisvgm_srcdir)/libs/clipper \
- -I$(dvisvgm_srcdir)/libs/variant/include $(KPSE_CFLAGS) \
- $(FREETYPE_CFLAGS) $(ZLIB_CFLAGS) $(CODE_COVERAGE_CFLAGS) \
- $(POTRACE_CFLAGS) $(XXHASH_CFLAGS) $(am__append_9) \
- -I$(dvisvgm_srcdir)/libs/md5
+AM_CXXFLAGS = $(WARNING_CXXFLAGS) -I$(dvisvgm_srcdir)/libs/boost \
+ -I$(dvisvgm_srcdir)/libs/clipper \
+ -I$(dvisvgm_srcdir)/libs/variant/include $(POTRACE_CFLAGS) \
+ $(XXHASH_CFLAGS) $(am__append_11) $(am__append_12) \
+ $(am__append_13) $(am__append_14) -I$(dvisvgm_srcdir)/libs/md5
CLEANFILES = *.gcda *.gcno
all: all-recursive
@@ -838,6 +866,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PreScanDVIReader.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Process.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsSpecialHandler.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsSpecialHandlerProxy.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RangeMap.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandler.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SVGCharHandlerFactory.Plo@am__quote@ # am--include-marker
@@ -1176,6 +1205,7 @@ distclean: distclean-recursive
-rm -f ./$(DEPDIR)/PreScanDVIReader.Plo
-rm -f ./$(DEPDIR)/Process.Plo
-rm -f ./$(DEPDIR)/PsSpecialHandler.Plo
+ -rm -f ./$(DEPDIR)/PsSpecialHandlerProxy.Plo
-rm -f ./$(DEPDIR)/RangeMap.Plo
-rm -f ./$(DEPDIR)/SVGCharHandler.Plo
-rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Plo
@@ -1321,6 +1351,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f ./$(DEPDIR)/PreScanDVIReader.Plo
-rm -f ./$(DEPDIR)/Process.Plo
-rm -f ./$(DEPDIR)/PsSpecialHandler.Plo
+ -rm -f ./$(DEPDIR)/PsSpecialHandlerProxy.Plo
-rm -f ./$(DEPDIR)/RangeMap.Plo
-rm -f ./$(DEPDIR)/SVGCharHandler.Plo
-rm -f ./$(DEPDIR)/SVGCharHandlerFactory.Plo
diff --git a/dviware/dvisvgm/src/NoPsSpecialHandler.cpp b/dviware/dvisvgm/src/NoPsSpecialHandler.cpp
index 65f098eb35..3d8e6a3500 100644
--- a/dviware/dvisvgm/src/NoPsSpecialHandler.cpp
+++ b/dviware/dvisvgm/src/NoPsSpecialHandler.cpp
@@ -40,6 +40,6 @@ void NoPsSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) {
vector<const char*> NoPsSpecialHandler::prefixes () const {
- vector<const char*> pfx {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\""};
+ vector<const char*> pfx {"header=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", "pst:", "PST:"};
return pfx;
}
diff --git a/dviware/dvisvgm/src/PsSpecialHandlerProxy.cpp b/dviware/dvisvgm/src/PsSpecialHandlerProxy.cpp
new file mode 100644
index 0000000000..d13cc124ae
--- /dev/null
+++ b/dviware/dvisvgm/src/PsSpecialHandlerProxy.cpp
@@ -0,0 +1,85 @@
+/*************************************************************************
+** PsSpecialHandlerProxy.cpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2024 Martin Gieseking <martin.gieseking@uos.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 <memory>
+#include "Message.hpp"
+#ifndef DISABLE_GS
+ #include "PsSpecialHandler.hpp"
+#endif
+#ifndef HAVE_LIBGS
+ #include "NoPsSpecialHandler.hpp"
+#endif
+#include "PsSpecialHandlerProxy.hpp"
+#include "SpecialManager.hpp"
+#include "utility.hpp"
+
+using namespace std;
+
+inline unique_ptr<SpecialHandler> createPsSpecialHandler () {
+#ifndef DISABLE_GS
+#ifndef HAVE_LIBGS
+ if (Ghostscript().available())
+#endif
+ return util::make_unique<PsSpecialHandler>();
+#endif
+#ifndef HAVE_LIBGS
+ return util::make_unique<NoPsSpecialHandler>();
+#endif
+}
+
+
+/** Replaces this handler proxy with the actual PS special handler. */
+SpecialHandler* PsSpecialHandlerProxy::replaceHandler () {
+ auto psSpecialHandler = createPsSpecialHandler();
+ if (_pswarning) {
+#ifdef DISABLE_GS
+ Message::wstream() << "processing of PostScript specials was permanently disabled\n";
+#else
+ if (!psSpecialHandler->name())
+ Message::wstream() << "processing of PostScript specials is disabled (Ghostscript not found)\n";
+#endif
+ }
+ SpecialHandler *handlerPtr = psSpecialHandler.get();
+ SpecialManager::instance().unregisterHandler(this);
+ SpecialManager::instance().registerHandler(std::move(psSpecialHandler));
+ return handlerPtr;
+}
+
+
+void PsSpecialHandlerProxy::preprocess (const string &prefix, istream &is, SpecialActions &actions) {
+ replaceHandler()->preprocess(prefix, is, actions);
+}
+
+
+bool PsSpecialHandlerProxy::process (const string &prefix, istream &is, SpecialActions &actions) {
+ return replaceHandler()->process(prefix, is, actions);
+}
+
+
+const char* PsSpecialHandlerProxy::info() const {
+ return createPsSpecialHandler()->info();
+}
+
+
+vector<const char *> PsSpecialHandlerProxy::prefixes() const {
+ vector<const char*> pfx {"header=", "pdffile=", "psfile=", "PSfile=", "ps:", "ps::", "!", "\"", "pst:", "PST:"};
+ return pfx;
+}
diff --git a/dviware/dvisvgm/src/PsSpecialHandlerProxy.hpp b/dviware/dvisvgm/src/PsSpecialHandlerProxy.hpp
new file mode 100644
index 0000000000..f2a1b3ab13
--- /dev/null
+++ b/dviware/dvisvgm/src/PsSpecialHandlerProxy.hpp
@@ -0,0 +1,39 @@
+/*************************************************************************
+** PsSpecialHandlerProxy.hpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2024 Martin Gieseking <martin.gieseking@uos.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/>. **
+*************************************************************************/
+
+#pragma once
+
+#include "SpecialHandler.hpp"
+
+class PsSpecialHandlerProxy : public SpecialHandler {
+ public:
+ explicit PsSpecialHandlerProxy (bool pswarning) : _pswarning(pswarning) {}
+ void preprocess (const std::string &prefix, std::istream &is, SpecialActions &actions) override;
+ bool process (const std::string &prefix, std::istream &is, SpecialActions &actions) override;
+ const char* name () const override {return "ps";}
+ const char* info () const override;
+ std::vector<const char*> prefixes () const override;
+
+ protected:
+ SpecialHandler* replaceHandler ();
+
+ private:
+ bool _pswarning;
+};
diff --git a/dviware/dvisvgm/src/SpecialManager.cpp b/dviware/dvisvgm/src/SpecialManager.cpp
index 21f70c4af2..175f3c54fb 100644
--- a/dviware/dvisvgm/src/SpecialManager.cpp
+++ b/dviware/dvisvgm/src/SpecialManager.cpp
@@ -56,6 +56,13 @@ void SpecialManager::registerHandler (unique_ptr<SpecialHandler> handler) {
}
+void SpecialManager::registerHandler (unique_ptr<SpecialHandler> handler, const vector<string> &ignoredHandlerNames) {
+ const char *name = handler->name();
+ if (!name || find(ignoredHandlerNames.begin(), ignoredHandlerNames.end(), string(name)) == ignoredHandlerNames.end())
+ instance().registerHandler(std::move(handler));
+}
+
+
/** Registers several special handlers at once.
* If ignorelist == 0, all given handlers are registered. To exclude selected sets of
* specials, the corresponding names can be given separated by non alpha-numeric characters,
@@ -77,6 +84,21 @@ void SpecialManager::registerHandlers (vector<unique_ptr<SpecialHandler>> &handl
}
+/** Removes a handler and the corresponding prefixes. */
+void SpecialManager::unregisterHandler (SpecialHandler *handler) {
+ if (handler) {
+ auto it = find_if(_handlerPool.begin(), _handlerPool.end(), [=](unique_ptr<SpecialHandler> &h) {
+ return h.get() == handler;
+ });
+ if (it != _handlerPool.end()) {
+ for (const char *prefix : handler->prefixes())
+ _handlersByPrefix.erase(prefix);
+ _handlerPool.erase(it);
+ }
+ }
+}
+
+
/** Looks for a handler responsible for a given special prefix.
* @param[in] prefix the special prefix, e.g. "color" or "em"
* @return in case of success: pointer to handler, 0 otherwise */
@@ -170,10 +192,10 @@ void SpecialManager::writeHandlerInfo (ostream &os) const {
if (handler->name())
sortmap[handler->name()] = handler.get();
for (const auto &strhandlerpair : sortmap) {
- os << setw(10) << left << strhandlerpair.second->name() << ' ';
- if (strhandlerpair.second->info())
- os << strhandlerpair.second->info();
- os << endl;
+ if (const char *info = strhandlerpair.second->info()) {
+ os << setw(10) << left << strhandlerpair.second->name() << ' ';
+ os << info << '\n';
+ }
}
os.flags(osflags); // restore format flags
}
diff --git a/dviware/dvisvgm/src/SpecialManager.hpp b/dviware/dvisvgm/src/SpecialManager.hpp
index b4eb95c991..00cc3ebc6b 100644
--- a/dviware/dvisvgm/src/SpecialManager.hpp
+++ b/dviware/dvisvgm/src/SpecialManager.hpp
@@ -48,8 +48,10 @@ class SpecialManager {
instance().registerHandler(util::make_unique<Handler>());
}
+ static void registerHandler (std::unique_ptr<SpecialHandler> handler, const std::vector<std::string> &ignoredHandlerNames);
void registerHandler (std::unique_ptr<SpecialHandler> handler);
void registerHandlers (std::vector<std::unique_ptr<SpecialHandler>> &handlers, const char *ignorelist);
+ void unregisterHandler (SpecialHandler *handler);
void unregisterHandlers ();
void preprocess (const std::string &special, SpecialActions &actions) const;
bool process (const std::string &special, double dvi2bp, SpecialActions &actions) const;
diff --git a/dviware/dvisvgm/src/StreamReader.cpp b/dviware/dvisvgm/src/StreamReader.cpp
index 93d4045248..5fcdd8d808 100644
--- a/dviware/dvisvgm/src/StreamReader.cpp
+++ b/dviware/dvisvgm/src/StreamReader.cpp
@@ -146,6 +146,14 @@ vector<uint8_t> StreamReader::readBytes (int n, HashFunction &hashfunc) {
}
+vector<char> StreamReader::readBytesAsChars (int n) {
+ vector<char> chars(n);
+ if (n > 0)
+ _is->read(chars.data(), n);
+ return chars;
+}
+
+
int StreamReader::readByte (HashFunction &hashfunc) {
int ret = readByte();
if (ret >= 0) {
diff --git a/dviware/dvisvgm/src/StreamReader.hpp b/dviware/dvisvgm/src/StreamReader.hpp
index c5d06d4a3b..70f05a5c77 100644
--- a/dviware/dvisvgm/src/StreamReader.hpp
+++ b/dviware/dvisvgm/src/StreamReader.hpp
@@ -46,6 +46,7 @@ class StreamReader {
std::string readString (int length, HashFunction &hashfunc);
std::vector<uint8_t> readBytes (int n);
std::vector<uint8_t> readBytes (int n, HashFunction &hash);
+ std::vector<char> readBytesAsChars (int n);
int readByte () {return _is->get();}
int readByte (HashFunction &hashfunc);
void seek (std::streampos pos, std::ios::seekdir dir) {_is->seekg(pos, dir);}
diff --git a/dviware/dvisvgm/src/VFActions.hpp b/dviware/dvisvgm/src/VFActions.hpp
index 2c8d6e47cc..dc62329359 100644
--- a/dviware/dvisvgm/src/VFActions.hpp
+++ b/dviware/dvisvgm/src/VFActions.hpp
@@ -25,13 +25,12 @@
#include <vector>
-struct VFActions
-{
+struct VFActions {
virtual ~VFActions () =default;
virtual void vfPreamble (const std::string &comment, uint32_t checksum, double dsize) {}
virtual void vfPostamble () {}
virtual void defineVFFont (uint32_t fontnum, const std::string &path, const std::string &name, uint32_t checksum, double dsize, double ssize) {}
- virtual void defineVFChar (uint32_t c, std::vector<uint8_t> &&dvi) {}
+ virtual void defineVFChar (uint32_t c, std::vector<char> &&dvi) {}
};
#endif
diff --git a/dviware/dvisvgm/src/VFReader.cpp b/dviware/dvisvgm/src/VFReader.cpp
index bf126039e4..5ca91ced3d 100644
--- a/dviware/dvisvgm/src/VFReader.cpp
+++ b/dviware/dvisvgm/src/VFReader.cpp
@@ -126,13 +126,13 @@ void VFReader::cmdPost () {
void VFReader::cmdLongChar () {
- uint32_t pl = readUnsigned(4); // packet length (length of DVI subroutine)
+ uint32_t pl = readUnsigned(4); // packet length (length of DVI subroutine)
if (!_actions)
- seek(8+pl, ios::cur); // skip remaining char definition bytes
+ seek(8+pl, ios::cur); // skip remaining char definition bytes
else {
- uint32_t cc = readUnsigned(4); // character code
- readUnsigned(4); // equals character width from corresponding TFM file
- auto dvi = readBytes(pl); // DVI subroutine
+ uint32_t cc = readUnsigned(4); // character code
+ readUnsigned(4); // equals character width from corresponding TFM file
+ auto dvi = readBytesAsChars(pl); // DVI subroutine
_actions->defineVFChar(cc, std::move(dvi)); // call template method for user actions
}
}
@@ -144,9 +144,9 @@ void VFReader::cmdShortChar (int pl) {
if (!_actions)
seek(4+pl, ios::cur); // skip char definition bytes
else {
- uint32_t cc = readUnsigned(1); // character code
- readUnsigned(3); // character width from corresponding TFM file
- auto dvi = readBytes(pl); // DVI subroutine
+ uint32_t cc = readUnsigned(1); // character code
+ readUnsigned(3); // character width from corresponding TFM file
+ auto dvi = readBytesAsChars(pl); // DVI subroutine
_actions->defineVFChar(cc, std::move(dvi)); // call template method for user actions
}
}
diff --git a/dviware/dvisvgm/src/VectorStream.hpp b/dviware/dvisvgm/src/VectorStream.hpp
deleted file mode 100644
index 1018994400..0000000000
--- a/dviware/dvisvgm/src/VectorStream.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
-** VectorStream.hpp **
-** **
-** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2024 Martin Gieseking <martin.gieseking@uos.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 VECTORSTREAM_HPP
-#define VECTORSTREAM_HPP
-
-#include <istream>
-#include <vector>
-
-template <typename T>
-class VectorStreamBuffer : public std::streambuf {
- public:
- explicit VectorStreamBuffer (const std::vector<T> &v) {
- if (!v.empty()) {
- _begin = _curr = &v[0];
- _end = &v[0]+v.size();
- }
- }
-
- protected:
- int_type underflow () override {
- return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr);
- }
-
- int_type uflow() override {
- return _curr == _end ? traits_type::eof() : traits_type::to_int_type(*_curr++);
- }
-
- std::streamsize showmanyc () override {return _end-_curr;}
-
- int_type pbackfail (int_type c) override {
- if (_curr == _begin || (c != traits_type::eof() && c != _curr[-1]))
- return traits_type::eof();
- return traits_type::to_int_type(*--_curr);
- }
-
- pos_type seekoff (off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which=std::ios_base::in) override {
- switch (dir) {
- case std::ios_base::cur:
- _curr += off; break;
- case std::ios_base::beg:
- _curr = _begin+off; break;
- case std::ios_base::end:
- _curr = _end-off; break;
- default:
- break;
- }
- return _curr-_begin;
- }
-
- private:
- const T *_begin=nullptr;
- const T *_end=nullptr;
- const T *_curr=nullptr;
-};
-
-
-template <typename T>
-class VectorInputStream : public std::istream {
- public:
- explicit VectorInputStream (const std::vector<T> &source) : std::istream(&_buf), _buf(source) {}
-
- private:
- VectorStreamBuffer<T> _buf;
-};
-
-#endif
diff --git a/dviware/dvisvgm/src/fonts/Makefile.in b/dviware/dvisvgm/src/fonts/Makefile.in
index 8d96f5387c..d3c01d3e18 100644
--- a/dviware/dvisvgm/src/fonts/Makefile.in
+++ b/dviware/dvisvgm/src/fonts/Makefile.in
@@ -238,7 +238,6 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
diff --git a/dviware/dvisvgm/src/optimizer/Makefile.in b/dviware/dvisvgm/src/optimizer/Makefile.in
index cc979ed0bd..1924232ddc 100644
--- a/dviware/dvisvgm/src/optimizer/Makefile.in
+++ b/dviware/dvisvgm/src/optimizer/Makefile.in
@@ -231,7 +231,6 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
@@ -381,8 +380,9 @@ liboptimizer_la_SOURCES = \
TransformSimplifier.hpp TransformSimplifier.cpp \
WSNodeRemover.hpp WSNodeRemover.cpp
-@HAVE_POTRACE_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
-@HAVE_POTRACE_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
+@TEXLIVE_BUILD_TRUE@POTRACE_CFLAGS = $(POTRACE_INCLUDES)
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
@HAVE_XXHASH_FALSE@XXHASH_CFLAGS = -I$(dvisvgm_srcdir)/libs/xxHash
@HAVE_XXHASH_FALSE@XXHASH_LIBS = ../libs/xxHash/libxxhash.a
AM_CXXFLAGS = -I$(dvisvgm_srcdir)/libs/variant/include $(XXHASH_CFLAGS)
diff --git a/dviware/dvisvgm/src/psdefs.cpp b/dviware/dvisvgm/src/psdefs.cpp
index bba86bee7c..3b955a9558 100644
--- a/dviware/dvisvgm/src/psdefs.cpp
+++ b/dviware/dvisvgm/src/psdefs.cpp
@@ -24,141 +24,143 @@ const char *PSInterpreter::PSDEFS =
"<</Install{matrix setmatrix}/HWResolution[72 72]/PageSize[10000 10000]/Imaging"
"BBox null>>setpagedevice/@dodraw true store/@GD globaldict def/@SD systemdict "
"def/@UD userdict def @GD/@nulldev false put @GD/@patcnt 0 put true setglobal @"
-"SD/:save @SD/save get put @SD/:restore @SD/restore get put @SD/:gsave @SD/gsav"
-"e get put @SD/:grestore @SD/grestore get put @SD/:grestoreall @SD/grestoreall "
-"get put @SD/:newpath @SD/newpath get put @SD/:stroke @SD/stroke get put @SD/:f"
-"ill @SD/fill get put @SD/:eofill @SD/eofill get put @SD/:clip @SD/clip get put"
-" @SD/:eoclip @SD/eoclip get put @SD/:charpath @SD/charpath get put @SD/:show @"
-"SD/show get put @SD/:stringwidth @SD/stringwidth get put @SD/:nulldevice @SD/n"
-"ulldevice get put @SD/:image @SD/image get put @SD/:colorimage @SD/colorimage "
-"get put @SD/.setopacityalpha known not{@SD/.setopacityalpha{pop}put}if @SD/.se"
-"tshapealpha known not{@SD/.setshapealpha{pop}put}if @SD/.setblendmode known no"
-"t{@SD/.setblendmode{pop}put}if @SD/prseq{-1 1{-1 roll =only( )print}for(\\n)pr"
-"int}put @SD/prcmd{( )exch(\\ndvi.)3{print}repeat prseq}put @SD/cvxall{{cvx}for"
-"all}put @SD/defpr{[exch/copy cvx @SD 4 index[/get/exec]cvxall 5 index 3 index "
-"dup length string cvs/prcmd cvx]cvx bind def}put @SD/querypos{{currentpoint}st"
-"opped{$error/newerror false put}{2(querypos)prcmd}ifelse}put @SD/applyscaleval"
-"s{1 0 dtransform exch dup mul exch dup mul add sqrt 0 1 dtransform exch dup mu"
-"l exch dup mul add sqrt 1 0 dtransform dup mul exch dup dup mul 3 -1 roll add "
-"dup 0 eq{pop}{sqrt div}ifelse 3(applyscalevals)prcmd}put @SD/prpath{{2(moveto)"
-"prcmd}{2(lineto)prcmd}{6(curveto)prcmd}{0(closepath)prcmd}pathforall}put @SD/n"
-"ulldevice{@GD/@nulldev true put :nulldevice 1 1(setnulldevice)prcmd}put @SD/ch"
-"arpath{/@dodraw false store :charpath/@dodraw true store}put @SD/stringwidth{/"
-"@dodraw false store :stringwidth/@dodraw true store}put @SD/show{@dodraw @GD/@"
-"nulldev get not and{dup :gsave currentpoint 2{50 mul exch}repeat :newpath move"
-"to 50 50/scale sysexec true charpath fill :grestore/@dodraw false store :show/"
-"@dodraw true store}{:show}ifelse}put @SD/varxyshow{dup 0 ge{<</chr 3 -1 roll s"
-"tring/prc 5 -1 roll/arr 7 -1 roll/str 9 -1 roll/idx 0>>begin 0 chr length str "
-"length 1 sub{str exch chr length getinterval/chr exch store :gsave chr show :g"
-"restore currentpoint prc moveto/idx idx 1 add store}for end}{pop pop show}ifel"
-"se}put @SD/xyshow{dup dup type/arraytype eq exch length 0 gt and{dup length 2 "
-"idiv 2 index length exch idiv}{-1}ifelse{exch arr idx 2 mul get add exch arr i"
-"dx 2 mul 1 add get add}exch varxyshow}put @SD/xshow{dup dup type/arraytype eq "
-"exch length 0 gt and{dup length 2 index length exch idiv}{-1}ifelse{exch arr i"
-"dx get add exch}exch varxyshow}put @SD/yshow{dup dup type/arraytype eq exch le"
-"ngth 0 gt and{dup length 2 index length exch idiv}{-1}ifelse{arr idx get add}e"
-"xch varxyshow}put @SD/awidthshow{{1 string dup 0 5 index put :gsave show :gres"
-"tore pop 0 rmoveto 3 index eq{4 index 4 index rmoveto}if 1 index 1 index rmove"
-"to}exch cshow 5{pop}repeat}put @SD/widthshow{0 0 3 -1 roll awidthshow}put @SD/"
-"ashow{0 0 0 6 3 roll awidthshow}put @SD/newpath{:newpath 1 1(newpath)prcmd}put"
-" @SD/stroke{@dodraw @GD/@nulldev get not and{prcolor 0 1(newpath)prcmd prpath "
-"0(stroke)prcmd :newpath}{:stroke}ifelse}put @SD/fill{@dodraw @GD/@nulldev get "
-"not and{prcolor 0 1(newpath)prcmd prpath 0(fill)prcmd :newpath}{:fill}ifelse}p"
-"ut @SD/eofill{@dodraw @GD/@nulldev get not and{prcolor 0 1(newpath)prcmd prpat"
-"h 0(eofill)prcmd :newpath}{:eofill}ifelse}put/.fillstroke{:gsave fill :grestor"
-"e .swapcolors stroke .swapcolors}bind def/.eofillstroke{:gsave eofill :grestor"
-"e .swapcolors stroke .swapcolors}bind def @SD/clip{:clip @GD/@nulldev get not{"
-"0 1(newpath)prcmd prpath 0(clip)prcmd}if}put @SD/eoclip{:eoclip @GD/@nulldev g"
-"et not{0 1(newpath)prcmd prpath 0(eoclip)prcmd}if}put @SD/shfill{begin current"
-"dict/ShadingType known currentdict/ColorSpace known and currentdict/DataSource"
-" known and currentdict/Function known not and ShadingType 4 ge{DataSource type"
-"/arraytype eq{<</DeviceGray 1/DeviceRGB 3/DeviceCMYK 4/bgknown currentdict/Bac"
-"kground known/bbknown currentdict/BBox known>>begin currentdict ColorSpace kno"
-"wn{ShadingType ColorSpace load bgknown{1 Background aload pop}{0}ifelse bbknow"
-"n{1 BBox aload pop}{0}ifelse ShadingType 5 eq{VerticesPerRow}if DataSource alo"
-"ad length 4 add bgknown{ColorSpace load add}if bbknown{4 add}if ShadingType 5 "
-"eq{1 add}if(shfill)prcmd}if end}if}if end}put @SD/image{dup type/dicttype eq{d"
-"up}{<</Width 6 index/Height 7 index/colorimg false>>}ifelse @execimg}put @SD/c"
-"olorimage{<<2 index{/Width 2 index 8 add index/Height 4 index 9 add index}{/Wi"
-"dth 8 index/Height 9 index}ifelse/colorimg true>>@execimg}put/@imgbase(./)def/"
-"@imgdevice(jpeg)def/@execimg{@GD/@imgcnt 2 copy .knownget{1 add}{1}ifelse put "
-"begin<</imgdev null/imgid @GD/@imgcnt get/ispng @imgdevice 0 3 getinterval(png"
-")eq dup/suffix exch{(.png)}{(.jpg)}ifelse/colorimg currentdict/colorimg .known"
-"get dup{pop}if/colordev 1 index currentcolorspace dup length 1 ne exch 0 get/D"
-"eviceGray ne or or>>begin @imgdevice(png)ne @imgdevice(jpeg)ne and{@imgdevice "
-"cvn}{colordev{ispng{/png16m}{/jpeg}ifelse}{ispng{/pnggray}{/jpeggray}ifelse}if"
-"else}ifelse dup devicedict exch known{:gsave/imgdev exch finddevice def mark/O"
-"utputFile @imgbase imgid 20 string cvs strconcat suffix strconcat/PageSize[Wid"
-"th Height]/UseFastColor true ispng{@imgdevice(pngmonod)eq{/MinFeatureSize wher"
-"e{pop/MinFeatureSize MinFeatureSize}if}if}{/JPEGQ where{pop/JPEGQ JPEGQ}if}ife"
-"lse imgdev putdeviceprops setdevice[Width 0 0 Height neg 0 Height]/setmatrix s"
-"ysexec colorimg{:colorimage}{:image}ifelse/copypage sysexec mark/OutputFile()i"
-"mgdev putdeviceprops pop :grestore imgid Width Height 3(image)prcmd}{pop color"
-"img{:colorimage}{:image}ifelse}ifelse end end}def/@rect{4 -2 roll moveto exch "
-"dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def/@rectcc{4 -"
-"2 roll moveto 2 copy 0 lt exch 0 lt xor{dup 0 exch rlineto exch 0 rlineto neg "
-"0 exch rlineto}{exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto}ifelse cl"
-"osepath}bind def @SD/rectclip{:newpath dup type/arraytype eq{aload length 4 id"
-"iv{@rectcc}repeat}{@rectcc}ifelse clip :newpath}put @SD/rectfill{:gsave :newpa"
-"th dup type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse fi"
-"ll :grestore}put @SD/rectstroke{gsave :newpath dup type/arraytype eq{aload len"
-"gth 4 idiv{@rect}repeat}{@rect}ifelse stroke grestore}put false setglobal @SD "
-"readonly pop/initclip 0 defpr/clippath 0 defpr/sysexec{@SD exch get exec}def/a"
-"dddot{dup length 1 add string dup 0 46 put dup 3 -1 roll 1 exch putinterval}de"
-"f/setlinewidth{dup/setlinewidth sysexec 1(setlinewidth)prcmd}def/setlinecap 1 "
-"defpr/setlinejoin 1 defpr/setmiterlimit 1 defpr/setdash{mark 3 1 roll 2 copy/s"
-"etdash sysexec exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}d"
-"ef/@setpagedevice{pop<<>>/setpagedevice sysexec matrix setmatrix newpath 0(set"
-"pagedevice)prcmd}def/@checknulldev{@GD/@nulldev get{currentpagedevice maxlengt"
-"h 0 ne{@GD/@nulldev false put 0 1(setnulldevice)prcmd}if}if}def/prcolor{curren"
-"tcolorspace @setcolorspace currentrgbcolor 3(setrgbcolor)prcmd}def/printgstate"
-"{@dodraw @GD/@nulldev get not and{matrix currentmatrix aload pop 6(setmatrix)p"
-"rcmd applyscalevals currentlinewidth 1(setlinewidth)prcmd currentlinecap 1(set"
-"linecap)prcmd currentlinejoin 1(setlinejoin)prcmd currentmiterlimit 1(setmiter"
-"limit)prcmd revision dup 952 lt{pop}{.currentblendmode .setblendmode 952 eq{.c"
-"urrentopacityalpha .setopacityalpha .currentshapealpha .setshapealpha}{.curren"
-"talphaisshape{1}{0}ifelse 1(setalphaisshape)prcmd .currentstrokeconstantalpha "
-"1(setstrokeconstantalpha)prcmd .currentfillconstantalpha 1(setfillconstantalph"
-"a)prcmd}ifelse}ifelse prcolor currentdash mark 3 1 roll exch aload length 1 ad"
-"d -1 roll counttomark(setdash)prcmd pop}if}def/strconcat{exch dup length 2 ind"
-"ex length add string dup dup 4 2 roll copy length 4 -1 roll putinterval}def/se"
-"tgstate{/setgstate sysexec printgstate}def/save{@UD begin/@saveID vmstatus pop"
-" pop def end :save @saveID 1(save)prcmd}def/restore{:restore @checknulldev pri"
-"ntgstate @UD/@saveID known{@UD begin @saveID end}{0}ifelse 1(restore)prcmd}def"
-"/gsave 0 defpr/grestore{:grestore @checknulldev printgstate 0(grestore)prcmd}d"
-"ef/grestoreall{:grestoreall @checknulldev setstate 0(grestoreall)prcmd}def/rot"
-"ate{dup type/arraytype ne @dodraw and{dup 1(rotate)prcmd}if/rotate sysexec app"
-"lyscalevals}def/scale{dup type/arraytype ne @dodraw and{2 copy 2(scale)prcmd}i"
-"f/scale sysexec applyscalevals}def/translate{dup type/arraytype ne @dodraw and"
-"{2 copy 2(translate)prcmd}if/translate sysexec}def/setmatrix{dup/setmatrix sys"
-"exec @dodraw{aload pop 6(setmatrix)prcmd applyscalevals}{pop}ifelse}def/initma"
-"trix{matrix setmatrix}def/concat{matrix currentmatrix matrix concatmatrix setm"
-"atrix}def/makepattern{gsave<</mx 3 -1 roll>>begin<</XUID[1000000 @patcnt]>>cop"
-"y mx/makepattern sysexec dup begin PatternType 2 lt{PatternType @patcnt BBox a"
-"load pop XStep YStep PaintType mx aload pop 15(makepattern)prcmd :newpath matr"
-"ix setmatrix dup PaintProc 0 1(makepattern)prcmd @GD/@patcnt @patcnt 1 add put"
-"}if end end grestore}def/setpattern{dup begin PatternType end 1 eq{begin Paint"
-"Type 1 eq{XUID aload pop exch pop 1}{:gsave[currentcolorspace aload length -1 "
-"roll pop]/setcolorspace sysexec/setcolor sysexec XUID aload pop exch pop curre"
-"ntrgbcolor :grestore 4}ifelse(setpattern)prcmd currentcolorspace 0 get/Pattern"
-" ne{[/Pattern currentcolorspace]/setcolorspace sysexec}if currentcolorspace @s"
-"etcolorspace end}{/setpattern sysexec}ifelse}def/setcolor{dup type/dicttype eq"
-"{setpattern}{/setcolor sysexec/currentrgbcolor sysexec setrgbcolor}ifelse}def/"
-"setcolorspace{dup/setcolorspace sysexec @setcolorspace}def/@setcolorspace{dup "
-"type/arraytype eq{0 get}if/Pattern eq{1}{0}ifelse 1(setcolorspace)prcmd}def/se"
-"tgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3 defpr/setrgbcolor 3 defpr/.se"
-"talphaisshape{@SD/.setalphaisshape known{dup/.setalphaisshape sysexec}if{1}{0}"
-"ifelse 1(setalphaisshape)prcmd}bind def/.setfillconstantalpha{@SD/.setfillcons"
-"tantalpha known{dup/.setfillconstantalpha sysexec}if 1(setfillconstantalpha)pr"
-"cmd}bind def/.setstrokeconstantalpha{@SD/.setstrokeconstantalpha known{dup/.se"
-"tstrokeconstantalpha sysexec}if 1(setstrokeconstantalpha)prcmd}bind def/.setop"
-"acityalpha{false .setalphaisshape dup .setfillconstantalpha .setstrokeconstant"
-"alpha}bind def/.setshapealpha{true .setalphaisshape dup .setfillconstantalpha "
-".setstrokeconstantalpha}bind def/.setblendmode{dup/.setblendmode sysexec<</Nor"
-"mal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3/SoftLight 4/HardLight 5/Color"
-"Dodge 6/ColorBurn 7/Darken 8/Lighten 9/Difference 10/Exclusion 11/Hue 12/Satur"
-"ation 13/Color 14/Luminosity 15/CompatibleOverprint 16>>exch get 1(setblendmod"
-"e)prcmd}def/@pdfpagecount{(r)file runpdfbegin pdfpagecount runpdfend}def/@pdfp"
-"agebox{(r)file runpdfbegin dup dup 1 lt exch pdfpagecount gt or{pop}{pdfgetpag"
-"e/MediaBox pget pop aload pop}ifelse runpdfend}def DELAYBIND{.bindnow}if ";
+"SD/:setpagedevice @SD/setpagedevice get put @SD/:save @SD/save get put @SD/:re"
+"store @SD/restore get put @SD/:gsave @SD/gsave get put @SD/:grestore @SD/grest"
+"ore get put @SD/:grestoreall @SD/grestoreall get put @SD/:newpath @SD/newpath "
+"get put @SD/:stroke @SD/stroke get put @SD/:fill @SD/fill get put @SD/:eofill "
+"@SD/eofill get put @SD/:clip @SD/clip get put @SD/:eoclip @SD/eoclip get put @"
+"SD/:charpath @SD/charpath get put @SD/:show @SD/show get put @SD/:stringwidth "
+"@SD/stringwidth get put @SD/:nulldevice @SD/nulldevice get put @SD/:image @SD/"
+"image get put @SD/:colorimage @SD/colorimage get put @SD/.setopacityalpha know"
+"n not{@SD/.setopacityalpha{pop}put}if @SD/.setshapealpha known not{@SD/.setsha"
+"pealpha{pop}put}if @SD/.setblendmode known not{@SD/.setblendmode{pop}put}if @S"
+"D/prseq{[exch 1 add 1 roll]{=only( )print}forall(\\n)print}put @SD/prcmd{( )ex"
+"ch(\\ndvi.)3{print}repeat prseq}put @SD/cvxall{{cvx}forall}put @SD/defpr{[exch"
+"/copy cvx @SD 4 index[/get/exec]cvxall 5 index 3 index dup length string cvs/p"
+"rcmd cvx]cvx bind def}put @SD/querypos{{currentpoint}stopped{$error/newerror f"
+"alse put}{2(querypos)prcmd}ifelse}put @SD/applyscalevals{1 0 dtransform exch d"
+"up mul exch dup mul add sqrt 0 1 dtransform exch dup mul exch dup mul add sqrt"
+" 1 0 dtransform dup mul exch dup dup mul 3 -1 roll add dup 0 eq{pop}{sqrt div}"
+"ifelse 3(applyscalevals)prcmd}put @SD/prpath{{2(moveto)prcmd}{2(lineto)prcmd}{"
+"6(curveto)prcmd}{0(closepath)prcmd}pathforall}put @SD/nulldevice{@GD/@nulldev "
+"true put :nulldevice 1 1(setnulldevice)prcmd}put @SD/charpath{/@dodraw false s"
+"tore :charpath/@dodraw true store}put @SD/stringwidth{/@dodraw false store :st"
+"ringwidth/@dodraw true store}put @SD/show{@dodraw @GD/@nulldev get not and{dup"
+" :gsave currentpoint 2{50 mul exch}repeat :newpath moveto 50 50/scale sysexec "
+"true charpath fill :grestore/@dodraw false store :show/@dodraw true store}{:sh"
+"ow}ifelse}put @SD/varxyshow{dup 0 ge{<</chr 3 -1 roll string/prc 5 -1 roll/arr"
+" 7 -1 roll/str 9 -1 roll/idx 0>>begin 0 chr length str length 1 sub{str exch c"
+"hr length getinterval/chr exch store :gsave chr show :grestore currentpoint pr"
+"c moveto/idx idx 1 add store}for end}{pop pop show}ifelse}put @SD/xyshow{dup d"
+"up type/arraytype eq exch length 0 gt and{dup length 2 idiv 2 index length exc"
+"h idiv}{-1}ifelse{exch arr idx 2 mul get add exch arr idx 2 mul 1 add get add}"
+"exch varxyshow}put @SD/xshow{dup dup type/arraytype eq exch length 0 gt and{du"
+"p length 2 index length exch idiv}{-1}ifelse{exch arr idx get add exch}exch va"
+"rxyshow}put @SD/yshow{dup dup type/arraytype eq exch length 0 gt and{dup lengt"
+"h 2 index length exch idiv}{-1}ifelse{arr idx get add}exch varxyshow}put @SD/a"
+"widthshow{{1 string dup 0 5 index put :gsave show :grestore pop 0 rmoveto 3 in"
+"dex eq{4 index 4 index rmoveto}if 1 index 1 index rmoveto}exch cshow 5{pop}rep"
+"eat}put @SD/widthshow{0 0 3 -1 roll awidthshow}put @SD/ashow{0 0 0 6 3 roll aw"
+"idthshow}put @SD/newpath{:newpath 1 1(newpath)prcmd}put @SD/stroke{@dodraw @GD"
+"/@nulldev get not and{prcolor 0 1(newpath)prcmd prpath 0(stroke)prcmd :newpath"
+"}{:stroke}ifelse}put @SD/fill{@dodraw @GD/@nulldev get not and{prcolor 0 1(new"
+"path)prcmd prpath 0(fill)prcmd :newpath}{:fill}ifelse}put @SD/eofill{@dodraw @"
+"GD/@nulldev get not and{prcolor 0 1(newpath)prcmd prpath 0(eofill)prcmd :newpa"
+"th}{:eofill}ifelse}put/.fillstroke{:gsave fill :grestore .swapcolors stroke .s"
+"wapcolors}bind def/.eofillstroke{:gsave eofill :grestore .swapcolors stroke .s"
+"wapcolors}bind def @SD/clip{:clip @GD/@nulldev get not{0 1(newpath)prcmd prpat"
+"h 0(clip)prcmd}if}put @SD/eoclip{:eoclip @GD/@nulldev get not{0 1(newpath)prcm"
+"d prpath 0(eoclip)prcmd}if}put @SD/shfill{begin currentdict/ShadingType known "
+"currentdict/ColorSpace known and currentdict/DataSource known and currentdict/"
+"Function known not and ShadingType 4 ge{DataSource type/arraytype eq{<</Device"
+"Gray 1/DeviceRGB 3/DeviceCMYK 4/bgknown currentdict/Background known/bbknown c"
+"urrentdict/BBox known>>begin currentdict ColorSpace known{ShadingType ColorSpa"
+"ce load bgknown{1 Background aload pop}{0}ifelse bbknown{1 BBox aload pop}{0}i"
+"felse ShadingType 5 eq{VerticesPerRow}if DataSource aload length 4 add bgknown"
+"{ColorSpace load add}if bbknown{4 add}if ShadingType 5 eq{1 add}if(shfill)prcm"
+"d}if end}if}if end}put @SD/image{dup type/dicttype eq{dup}{<</Width 6 index/He"
+"ight 7 index/colorimg false>>}ifelse @execimg}put @SD/colorimage{<<2 index{/Wi"
+"dth 2 index 8 add index/Height 4 index 9 add index}{/Width 8 index/Height 9 in"
+"dex}ifelse/colorimg true>>@execimg}put/@imgbase(./)def/@imgdevice(jpeg)def/@ex"
+"ecimg{@GD/@imgcnt 2 copy .knownget{1 add}{1}ifelse put begin<</imgid @GD/@imgc"
+"nt get/ispng @imgdevice 0 3 getinterval(png)eq dup/suffix exch{(.png)}{(.jpg)}"
+"ifelse/colorimg currentdict/colorimg .knownget dup{pop}if/colordev 1 index cur"
+"rentcolorspace dup length 1 ne exch 0 get/DeviceGray ne or or>>begin @imgdevic"
+"e(png)ne @imgdevice(jpeg)ne and{@imgdevice cvn}{colordev{ispng{/png16m}{/jpeg}"
+"ifelse}{ispng{/pnggray}{/jpeggray}ifelse}ifelse}ifelse devicedict exch known{:"
+"gsave matrix currentmatrix/currentcolorspace sysexec<</OutputDevice @imgdevice"
+"/OutputFile @imgbase imgid 20 string cvs strconcat suffix strconcat/PageSize[W"
+"idth Height]/UseFastColor true ispng{@imgdevice(pngmonod)eq{/MinFeatureSize wh"
+"ere{pop/MinFeatureSize MinFeatureSize}if}if}{/JPEGQ where{pop/JPEGQ JPEGQ}if}i"
+"felse>>:setpagedevice/setcolorspace sysexec/setmatrix sysexec[Width 0 0 Height"
+" neg 0 Height]/setmatrix sysexec colorimg{:colorimage}{:image}ifelse/copypage "
+"sysexec<</OutputDevice @imgdevice/OutputFile()>>:setpagedevice :grestore imgid"
+" Width Height 3(image)prcmd}{pop colorimg{:colorimage}{:image}ifelse}ifelse en"
+"d end}def/@rect{4 -2 roll moveto exch dup 0 rlineto exch 0 exch rlineto neg 0 "
+"rlineto closepath}bind def/@rectcc{4 -2 roll moveto 2 copy 0 lt exch 0 lt xor{"
+"dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}{exch dup 0 rlineto exch "
+"0 exch rlineto neg 0 rlineto}ifelse closepath}bind def @SD/rectclip{:newpath d"
+"up type/arraytype eq{aload length 4 idiv{@rectcc}repeat}{@rectcc}ifelse clip :"
+"newpath}put @SD/rectfill{:gsave :newpath dup type/arraytype eq{aload length 4 "
+"idiv{@rectcc}repeat}{@rectcc}ifelse fill :grestore}put @SD/rectstroke{gsave :n"
+"ewpath dup type/arraytype eq{aload length 4 idiv{@rect}repeat}{@rect}ifelse st"
+"roke grestore}put false setglobal @SD readonly pop/initclip 0 defpr/clippath 0"
+" defpr/sysexec{@SD exch get exec}def/adddot{dup length 1 add string dup 0 46 p"
+"ut dup 3 -1 roll 1 exch putinterval}def/setlinewidth{dup/setlinewidth sysexec "
+"1(setlinewidth)prcmd}def/setlinecap 1 defpr/setlinejoin 1 defpr/setmiterlimit "
+"1 defpr/setdash{mark 3 1 roll 2 copy/setdash sysexec exch aload length 1 add -"
+"1 roll counttomark(setdash)prcmd pop}def/@setpagedevice{pop<<>>:setpagedevice "
+"matrix setmatrix newpath 0(setpagedevice)prcmd}def/@checknulldev{@GD/@nulldev "
+"get{currentpagedevice maxlength 0 ne{@GD/@nulldev false put 0 1(setnulldevice)"
+"prcmd}if}if}def/prcolor{currentcolorspace @setcolorspace currentrgbcolor 3(set"
+"rgbcolor)prcmd}def/printgstate{@dodraw @GD/@nulldev get not and{matrix current"
+"matrix aload pop 6(setmatrix)prcmd applyscalevals currentlinewidth 1(setlinewi"
+"dth)prcmd currentlinecap 1(setlinecap)prcmd currentlinejoin 1(setlinejoin)prcm"
+"d currentmiterlimit 1(setmiterlimit)prcmd revision dup 952 lt{pop}{.currentble"
+"ndmode .setblendmode 952 eq{.currentopacityalpha .setopacityalpha .currentshap"
+"ealpha .setshapealpha}{.currentalphaisshape{1}{0}ifelse 1(setalphaisshape)prcm"
+"d .currentstrokeconstantalpha 1(setstrokeconstantalpha)prcmd .currentfillconst"
+"antalpha 1(setfillconstantalpha)prcmd}ifelse}ifelse prcolor currentdash mark 3"
+" 1 roll exch aload length 1 add -1 roll counttomark(setdash)prcmd pop}if}def/s"
+"trconcat{exch dup length 2 index length add string dup dup 4 2 roll copy lengt"
+"h 4 -1 roll putinterval}def/setgstate{/setgstate sysexec printgstate}def/save{"
+"@UD begin/@saveID vmstatus pop pop def end :save @saveID 1(save)prcmd}def/rest"
+"ore{:restore @checknulldev printgstate @UD/@saveID known{@UD begin @saveID end"
+"}{0}ifelse 1(restore)prcmd}def/gsave 0 defpr/grestore{:grestore @checknulldev "
+"printgstate 0(grestore)prcmd}def/grestoreall{:grestoreall @checknulldev setsta"
+"te 0(grestoreall)prcmd}def/rotate{dup type/arraytype ne @dodraw and{dup 1(rota"
+"te)prcmd}if/rotate sysexec applyscalevals}def/scale{dup type/arraytype ne @dod"
+"raw and{2 copy 2(scale)prcmd}if/scale sysexec applyscalevals}def/translate{dup"
+" type/arraytype ne @dodraw and{2 copy 2(translate)prcmd}if/translate sysexec}d"
+"ef/setmatrix{dup/setmatrix sysexec @dodraw{aload pop 6(setmatrix)prcmd applysc"
+"alevals}{pop}ifelse}def/initmatrix{matrix setmatrix}def/concat{matrix currentm"
+"atrix matrix concatmatrix setmatrix}def/makepattern{gsave<</mx 3 -1 roll>>begi"
+"n<</XUID[1000000 @patcnt]>>copy mx/makepattern sysexec dup begin PatternType 2"
+" lt{PatternType @patcnt BBox aload pop XStep YStep PaintType mx aload pop 15(m"
+"akepattern)prcmd :newpath matrix setmatrix dup PaintProc 0 1(makepattern)prcmd"
+" @GD/@patcnt @patcnt 1 add put}if end end grestore}def/setpattern{dup begin Pa"
+"tternType end 1 eq{begin PaintType 1 eq{XUID aload pop exch pop 1}{:gsave[curr"
+"entcolorspace aload length -1 roll pop]/setcolorspace sysexec/setcolor sysexec"
+" XUID aload pop exch pop currentrgbcolor :grestore 4}ifelse(setpattern)prcmd c"
+"urrentcolorspace 0 get/Pattern ne{[/Pattern currentcolorspace]/setcolorspace s"
+"ysexec}if currentcolorspace @setcolorspace end}{/setpattern sysexec}ifelse}def"
+"/setcolor{dup type/dicttype eq{setpattern}{/setcolor sysexec/currentrgbcolor s"
+"ysexec setrgbcolor}ifelse}def/setcolorspace{dup/setcolorspace sysexec @setcolo"
+"rspace}def/@setcolorspace{dup type/arraytype eq{0 get}if/Pattern eq{1}{0}ifels"
+"e 1(setcolorspace)prcmd}def/setgray 1 defpr/setcmykcolor 4 defpr/sethsbcolor 3"
+" defpr/setrgbcolor 3 defpr/.setalphaisshape{@SD/.setalphaisshape known{dup/.se"
+"talphaisshape sysexec}if{1}{0}ifelse 1(setalphaisshape)prcmd}bind def/.setfill"
+"constantalpha{@SD/.setfillconstantalpha known{dup/.setfillconstantalpha sysexe"
+"c}if 1(setfillconstantalpha)prcmd}bind def/.setstrokeconstantalpha{@SD/.setstr"
+"okeconstantalpha known{dup/.setstrokeconstantalpha sysexec}if 1(setstrokeconst"
+"antalpha)prcmd}bind def/.setopacityalpha{false .setalphaisshape dup .setfillco"
+"nstantalpha .setstrokeconstantalpha}bind def/.setshapealpha{true .setalphaissh"
+"ape dup .setfillconstantalpha .setstrokeconstantalpha}bind def/.setblendmode{d"
+"up/.setblendmode sysexec<</Normal 0/Compatible 0/Multiply 1/Screen 2/Overlay 3"
+"/SoftLight 4/HardLight 5/ColorDodge 6/ColorBurn 7/Darken 8/Lighten 9/Differenc"
+"e 10/Exclusion 11/Hue 12/Saturation 13/Color 14/Luminosity 15/CompatibleOverpr"
+"int 16>>exch get 1(setblendmode)prcmd}def/@pdfpagecount{(r)file runpdfbegin pd"
+"fpagecount runpdfend}def/@pdfpagebox{(r)file runpdfbegin dup dup 1 lt exch pdf"
+"pagecount gt or{pop}{pdfgetpage/MediaBox pget pop aload pop}ifelse runpdfend}d"
+"ef DELAYBIND{.bindnow}if ";
diff --git a/dviware/dvisvgm/src/ttf/Makefile.in b/dviware/dvisvgm/src/ttf/Makefile.in
index 33746f9d1f..6afc37d944 100644
--- a/dviware/dvisvgm/src/ttf/Makefile.in
+++ b/dviware/dvisvgm/src/ttf/Makefile.in
@@ -232,7 +232,6 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
@@ -387,8 +386,9 @@ libttf_la_SOURCES = \
VheaTable.hpp VheaTable.cpp \
VmtxTable.hpp VmtxTable.cpp
-@HAVE_POTRACE_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
-@HAVE_POTRACE_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_CFLAGS = -I$(dvisvgm_srcdir)/libs/potrace
+@TEXLIVE_BUILD_TRUE@POTRACE_CFLAGS = $(POTRACE_INCLUDES)
+@HAVE_POTRACE_FALSE@@TEXLIVE_BUILD_FALSE@POTRACE_LIBS = ../libs/potrace/libpotrace.a
@HAVE_XXHASH_FALSE@XXHASH_CFLAGS = -I$(dvisvgm_srcdir)/libs/xxHash
@HAVE_XXHASH_FALSE@XXHASH_LIBS = ../libs/xxHash/libxxhash.a
AM_CXXFLAGS = \