From cab09cb4646d0bb8668586d56821eeb70498dbb6 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 9 Feb 2018 05:18:14 +0000 Subject: dvisvgm 2.3.2 git-svn-id: svn://tug.org/texlive/trunk@46577 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/README | 2 +- Build/source/texk/dvisvgm/ChangeLog | 4 ++ Build/source/texk/dvisvgm/TLpatches/ChangeLog | 6 ++ .../texk/dvisvgm/TLpatches/patch-08-makefiles | 12 ++-- .../texk/dvisvgm/TLpatches/patch-16-gserrornames | 10 --- Build/source/texk/dvisvgm/configure | 22 +++---- Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am | 2 +- Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in | 2 +- Build/source/texk/dvisvgm/dvisvgm-src/NEWS | 6 ++ Build/source/texk/dvisvgm/dvisvgm-src/configure.ac | 4 +- .../source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 | 6 +- Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp | 4 +- .../texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp | 6 +- .../texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp | 36 +++++------ .../texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp | 5 +- .../texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp | 20 +++--- .../texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp | 4 +- .../dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp | 16 +++-- .../dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp | 4 +- Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp | 21 ++++--- Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp | 11 ++-- .../texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp | 1 - .../texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp | 17 ++++-- .../texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp | 68 +++++++++++++++++++-- .../texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp | 6 +- .../dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp | 2 +- .../texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp | 3 +- .../texk/dvisvgm/dvisvgm-src/src/options.xml | 20 +++--- .../texk/dvisvgm/dvisvgm-src/src/version.hpp | 2 +- .../dvisvgm/dvisvgm-src/tests/JFMReaderTest.cpp | 20 +++--- .../dvisvgm/dvisvgm-src/tests/RangeMapTest.cpp | 56 +++++++++++------ .../dvisvgm/dvisvgm-src/tests/ToUnicodeMapTest.cpp | 8 +-- .../dvisvgm/dvisvgm-src/tests/data/frktest.dvi | Bin 0 -> 2072 bytes .../texk/dvisvgm/dvisvgm-src/tests/data/sample.dvi | Bin 0 -> 1320 bytes .../dvisvgm/dvisvgm-src/tests/data/sample_v2.dvi | Bin 0 -> 1016 bytes .../dvisvgm/dvisvgm-src/tests/data/sample_v3.dvi | Bin 0 -> 256 bytes Build/source/texk/dvisvgm/version.ac | 2 +- 37 files changed, 253 insertions(+), 155 deletions(-) delete mode 100644 Build/source/texk/dvisvgm/TLpatches/patch-16-gserrornames create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/tests/data/frktest.dvi create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/tests/data/sample.dvi create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/tests/data/sample_v2.dvi create mode 100644 Build/source/texk/dvisvgm/dvisvgm-src/tests/data/sample_v3.dvi diff --git a/Build/source/texk/README b/Build/source/texk/README index 45c582b8cba..9d7d64d0f4b 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -59,7 +59,7 @@ dvipos - maintained here, by us dvipsk - maintained here, by us -dvisvgm 2.3.1 - checked 13jan18 +dvisvgm 2.3.2 - checked 09feb18 http://dvisvgm.bplaced.net/Downloads gregorio 5.0.1 - checked 16apr17 diff --git a/Build/source/texk/dvisvgm/ChangeLog b/Build/source/texk/dvisvgm/ChangeLog index f0af46e4ea4..2a6f1849afd 100644 --- a/Build/source/texk/dvisvgm/ChangeLog +++ b/Build/source/texk/dvisvgm/ChangeLog @@ -1,3 +1,7 @@ +2018-02-09 Akira Kakuto + + * Import 2.3.2. + 2018-01-15 Karl Berry * Import 2.3.1 with Ghostscript.cpp patch from Martin. diff --git a/Build/source/texk/dvisvgm/TLpatches/ChangeLog b/Build/source/texk/dvisvgm/TLpatches/ChangeLog index 21c01cbdaba..1b2c676021f 100644 --- a/Build/source/texk/dvisvgm/TLpatches/ChangeLog +++ b/Build/source/texk/dvisvgm/TLpatches/ChangeLog @@ -1,3 +1,9 @@ +2018-02-09 Akira Kakuto + + * Import 2.3.2. + * patch-08-makefiles: adapt. + * patch-16-gserrornames: Remove. + 2018-01-15 Karl Berry * Import 2.3.1. diff --git a/Build/source/texk/dvisvgm/TLpatches/patch-08-makefiles b/Build/source/texk/dvisvgm/TLpatches/patch-08-makefiles index b9d0894fbdc..7c031bcf9d0 100644 --- a/Build/source/texk/dvisvgm/TLpatches/patch-08-makefiles +++ b/Build/source/texk/dvisvgm/TLpatches/patch-08-makefiles @@ -1,6 +1,6 @@ -diff -u2r dvisvgm-2.3.1/Makefile.am dvisvgm-src/Makefile.am ---- dvisvgm-2.3.1/Makefile.am 2018-01-02 01:09:10.000000000 -0800 -+++ dvisvgm-src/Makefile.am 2018-01-15 15:21:16.671504747 -0800 +diff -u2r dvisvgm-2.3.2/Makefile.am dvisvgm-src/Makefile.am +--- dvisvgm-2.3.2/Makefile.am Tue Jan 02 18:32:38 2018 ++++ dvisvgm-src/Makefile.am Fri Feb 09 13:20:34 2018 @@ -6,5 +6,5 @@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = COPYING @@ -8,9 +8,9 @@ diff -u2r dvisvgm-2.3.1/Makefile.am dvisvgm-src/Makefile.am +SUBDIRS = libs src #not for TL: tests doc ACLOCAL_AMFLAGS = -I m4 -diff -u2r dvisvgm-2.3.1/src/Makefile.am dvisvgm-src/src/Makefile.am ---- dvisvgm-2.3.1/src/Makefile.am 2018-01-02 01:09:11.000000000 -0800 -+++ dvisvgm-src/src/Makefile.am 2018-01-15 15:28:34.370204007 -0800 +diff -u2r dvisvgm-2.3.2/src/Makefile.am dvisvgm-src/src/Makefile.am +--- dvisvgm-2.3.2/src/Makefile.am Tue Jan 02 18:32:38 2018 ++++ dvisvgm-src/src/Makefile.am Fri Feb 09 13:29:22 2018 @@ -14,8 +14,5 @@ $(noinst_LIBRARIES) \ ../libs/clipper/libclipper.a \ diff --git a/Build/source/texk/dvisvgm/TLpatches/patch-16-gserrornames b/Build/source/texk/dvisvgm/TLpatches/patch-16-gserrornames deleted file mode 100644 index acdeaddddcf..00000000000 --- a/Build/source/texk/dvisvgm/TLpatches/patch-16-gserrornames +++ /dev/null @@ -1,10 +0,0 @@ -diff -u2r dvisvgm-2.3.1/src/Ghostscript.cpp dvisvgm-src/src/Ghostscript.cpp ---- dvisvgm-2.3.1/src/Ghostscript.cpp 2018-01-02 01:09:11.000000000 -0800 -+++ dvisvgm-src/src/Ghostscript.cpp 2018-01-15 15:57:09.114619987 -0800 -@@ -347,5 +347,5 @@ - return error_names[code-1]; - #else -- if (auto error_names = LOAD_SYMBOL(gs_error_names)) -+ if (auto error_names = loadSymbol("gs_error_names")) - return error_names[code-1]; - return nullptr; diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure index 4d5b6492e87..3b1b0436964 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) 2.3.1. +# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 2.3.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvisvgm (TeX Live)' PACKAGE_TARNAME='dvisvgm--tex-live-' -PACKAGE_VERSION='2.3.1' -PACKAGE_STRING='dvisvgm (TeX Live) 2.3.1' +PACKAGE_VERSION='2.3.2' +PACKAGE_STRING='dvisvgm (TeX Live) 2.3.2' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1375,7 +1375,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) 2.3.1 to adapt to many kinds of systems. +\`configure' configures dvisvgm (TeX Live) 2.3.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1446,7 +1446,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvisvgm (TeX Live) 2.3.1:";; + short | recursive ) echo "Configuration of dvisvgm (TeX Live) 2.3.2:";; 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 2.3.1 +dvisvgm (TeX Live) configure 2.3.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2449,7 +2449,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 2.3.1, which was +It was created by dvisvgm (TeX Live) $as_me 2.3.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -8188,7 +8188,7 @@ fi # Define the identity of the package. PACKAGE='dvisvgm--tex-live-' - VERSION='2.3.1' + VERSION='2.3.2' cat >>confdefs.h <<_ACEOF @@ -20189,7 +20189,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -dvisvgm (TeX Live) config.lt 2.3.1 +dvisvgm (TeX Live) config.lt 2.3.2 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -23580,7 +23580,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 2.3.1, which was +This file was extended by dvisvgm (TeX Live) $as_me 2.3.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23646,7 +23646,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 2.3.1 +dvisvgm (TeX Live) config.status 2.3.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am index e428c70ea9a..1aedd13864d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.am @@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = COPYING -SUBDIRS = libs src #TL: tests doc +SUBDIRS = libs src #not for TL: tests doc ACLOCAL_AMFLAGS = -I m4 if CODE_COVERAGE_ENABLED diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in index 7a65cd6148c..8db55229142 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in @@ -340,7 +340,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = COPYING -SUBDIRS = libs src #TL: tests doc +SUBDIRS = libs src #not for TL: tests doc ACLOCAL_AMFLAGS = -I m4 @CODE_COVERAGE_ENABLED_TRUE@lcov_dir = $(top_builddir)/lcov @CODE_COVERAGE_ENABLED_TRUE@lcov_file = $(lcov_dir)/lcov.info diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS index 8840de7f6f4..9a967bdb7cf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS +++ b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS @@ -1,3 +1,9 @@ +dvisvgm-2.3.2 (2018-02-08) +- prevent the creation of redundant tspan elements +- added support for new JFM format (patch by Hironobu Yamashita) +- fixed build error occurred if GS development files were missing +- fixed a potential memory issue regarding option --cache + dvisvgm-2.3.1 (2018-01-12) - fixed the width of characters slanted by a mapfile entry (GH bug #82) - if ttfautohint fails for a font, dvisvgm now uses the unhinted font and diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac index 8c52510ca24..af57575779f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac +++ b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac @@ -4,8 +4,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([dvisvgm],[2.3.1],[martin.gieseking@uos.de]) -DATE="January 2018" +AC_INIT([dvisvgm],[2.3.2],[martin.gieseking@uos.de]) +DATE="February 2018" AC_CONFIG_SRCDIR(src) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 index 875b32cf4dc..9fa5ad15a01 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 @@ -2,12 +2,12 @@ .\" Title: dvisvgm .\" Author: Martin Gieseking .\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 01/12/2018 +.\" Date: 02/08/2018 .\" Manual: dvisvgm Manual -.\" Source: dvisvgm 2.3.1 +.\" Source: dvisvgm 2.3.2 .\" Language: English .\" -.TH "DVISVGM" "1" "01/12/2018" "dvisvgm 2\&.3\&.1" "dvisvgm Manual" +.TH "DVISVGM" "1" "02/08/2018" "dvisvgm 2\&.3\&.2" "dvisvgm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp index 86a76e9bfea..4fbceb14ed2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/CMap.hpp @@ -97,8 +97,8 @@ class SegmentedCMap : public CMap void write (std::ostream &os) const; bool vertical () const override {return _vertical;} bool mapsToCID () const override {return _mapsToCID;} - size_t numCIDRanges () const {return _cidranges.size();} - size_t numBFRanges () const {return _bfranges.size();} + size_t numCIDRanges () const {return _cidranges.numRanges();} + size_t numBFRanges () const {return _bfranges.numRanges();} std::string getROString () const override; private: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp index 8361e7dccce..182a7c3f4c4 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIActions.hpp @@ -27,14 +27,14 @@ class BoundingBox; class Font; -struct DVIActions{ +struct DVIActions { virtual ~DVIActions () =default; virtual void reset () {} virtual void setChar (double x, double y, unsigned c, bool vertical, const Font &f) {} virtual void setRule (double x, double y, double height, double width) {} virtual void setTextOrientation (bool vertical) {} - virtual void moveToX (double x) {} - virtual void moveToY (double y) {} + virtual void moveToX (double x, bool forceSVGMove) {} + virtual void moveToY (double y, bool forceSVGMove) {} virtual void setFont (int num, const Font &font) {} virtual void special (const std::string &s, double dvi2bp, bool preprocessing=false) {} virtual void beginPage (unsigned pageno, const std::vector &c) {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp index ff0237109f0..d3aab868cc2 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.cpp @@ -283,7 +283,7 @@ void DVIReader::cmdSetChar0 (int c) { Font *font = FontManager::instance().getFont(_currFontNum); dviSetChar0(c, font); // template method that may trigger further actions putVFChar(font, c); // further character processing if current font is a virtual font - moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0); + moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0, MoveMode::SETCHAR); } @@ -300,7 +300,7 @@ void DVIReader::cmdSetChar (int len) { Font *font = FontManager::instance().getFont(_currFontNum); dviSetChar(c, font); // template method that may trigger further actions putVFChar(font, c); // further character processing if current font is a virtual font - moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0); + moveRight(font->charWidth(c)*font->scaleFactor()*_mag/1000.0, MoveMode::SETCHAR); } @@ -330,7 +330,7 @@ void DVIReader::cmdSetRule (int) { double height = _dvi2bp*readSigned(4); double width = _dvi2bp*readSigned(4); dviSetRule(height, width); - moveRight(width); + moveRight(width, MoveMode::CHANGEPOS); } @@ -347,7 +347,7 @@ void DVIReader::cmdPutRule (int) { } -void DVIReader::moveRight (double dx) { +void DVIReader::moveRight (double dx, MoveMode) { switch (_dviState.d) { case WritingMode::LR: _dviState.h += dx; break; case WritingMode::TB: _dviState.v += dx; break; @@ -356,7 +356,7 @@ void DVIReader::moveRight (double dx) { } -void DVIReader::moveDown (double dy) { +void DVIReader::moveDown (double dy, MoveMode) { switch (_dviState.d) { case WritingMode::LR: _dviState.v += dy; break; case WritingMode::TB: _dviState.h -= dy; break; @@ -367,29 +367,29 @@ void DVIReader::moveDown (double dy) { void DVIReader::cmdRight (int len) { double dx = _dvi2bp*readSigned(len); - moveRight(dx); + moveRight(dx, MoveMode::CHANGEPOS); dviRight(dx); } void DVIReader::cmdDown (int len) { double dy = _dvi2bp*readSigned(len); - moveDown(dy); + moveDown(dy, MoveMode::CHANGEPOS); dviDown(dy); } void DVIReader::cmdNop (int) {dviNop();} -void DVIReader::cmdX0 (int) {moveRight(_dviState.x); dviX0();} -void DVIReader::cmdY0 (int) {moveDown(_dviState.y); dviY0();} -void DVIReader::cmdW0 (int) {moveRight(_dviState.w); dviW0();} -void DVIReader::cmdZ0 (int) {moveDown(_dviState.z); dviZ0();} +void DVIReader::cmdX0 (int) {moveRight(_dviState.x, MoveMode::CHANGEPOS); dviX0();} +void DVIReader::cmdY0 (int) {moveDown(_dviState.y, MoveMode::CHANGEPOS); dviY0();} +void DVIReader::cmdW0 (int) {moveRight(_dviState.w, MoveMode::CHANGEPOS); dviW0();} +void DVIReader::cmdZ0 (int) {moveDown(_dviState.z, MoveMode::CHANGEPOS); dviZ0();} void DVIReader::cmdX (int len) { double dx = _dvi2bp*readSigned(len); _dviState.x = dx; - moveRight(dx); + moveRight(dx, MoveMode::CHANGEPOS); dviX(dx); } @@ -397,7 +397,7 @@ void DVIReader::cmdX (int len) { void DVIReader::cmdY (int len) { double dy = _dvi2bp*readSigned(len); _dviState.y = dy; - moveDown(dy); + moveDown(dy, MoveMode::CHANGEPOS); dviY(dy); } @@ -405,7 +405,7 @@ void DVIReader::cmdY (int len) { void DVIReader::cmdW (int len) { double dx = _dvi2bp*readSigned(len); _dviState.w = dx; - moveRight(dx); + moveRight(dx, MoveMode::CHANGEPOS); dviW(dx); } @@ -413,7 +413,7 @@ void DVIReader::cmdW (int len) { void DVIReader::cmdZ (int len) { double dy = _dvi2bp*readSigned(len); _dviState.z = dy; - moveDown(dy); + moveDown(dy, MoveMode::CHANGEPOS); dviZ(dy); } @@ -610,7 +610,7 @@ void DVIReader::cmdXGlyphArray (int) { dviXGlyphArray(dx, dy, glyphs, *font); else throw DVIException("missing setfont prior to xglypharray"); - moveRight(width); + moveRight(width, MoveMode::SETCHAR); } @@ -625,7 +625,7 @@ void DVIReader::cmdXGlyphString (int) { dviXGlyphString(dx, glyphs, *font); else throw DVIException("missing setfont prior to xglyphstring"); - moveRight(width); + moveRight(width, MoveMode::SETCHAR); } @@ -647,7 +647,7 @@ void DVIReader::cmdXTextAndGlyphs (int) { dviXTextAndGlyphs(x, y, chars, glyphs, *font); else throw DVIException("missing setfont prior to xtextandglyphs"); - moveRight(width); + moveRight(width, MoveMode::SETCHAR); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp index e46748e664c..a17b98a5f2d 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.hpp @@ -38,6 +38,7 @@ class DVIReader : public BasicDVIReader, public VFActions { protected: enum class WritingMode {LR=0, TB=1, BT=3}; enum class SetFontMode {SF_SHORT, SF_LONG, VF_ENTER, VF_LEAVE}; + enum class MoveMode {SETCHAR, CHANGEPOS}; struct DVIState { double h, v; ///< horizontal and vertical cursor position @@ -67,8 +68,8 @@ class DVIReader : public BasicDVIReader, public VFActions { void collectBopOffsets (); size_t numberOfPageBytes (int n) const {return _bopOffsets.size() > 1 ? _bopOffsets[n+1]-_bopOffsets[n] : 0;} void goToPostamble (); - virtual void moveRight (double dx); - virtual void moveDown (double dy); + virtual void moveRight (double dx, MoveMode mode); + virtual void moveDown (double dy, MoveMode mode); void putVFChar (Font *font, uint32_t c); double putGlyphArray (bool xonly, std::vector &dx, std::vector &dy, std::vector &glyphs); const Font* defineFont (uint32_t fontnum, const std::string &name, uint32_t cs, double ds, double ss); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp index d527ab2553d..79744656f3a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -359,24 +359,24 @@ string DVIToSVG::getSVGFilename (unsigned pageno) const { } -void DVIToSVG::moveRight (double dx) { - DVIReader::moveRight(dx); +void DVIToSVG::moveRight (double dx, MoveMode mode) { + DVIReader::moveRight(dx, mode); if (_actions) { if (dviState().d == WritingMode::LR) - _actions->moveToX(dviState().h+_tx); + _actions->moveToX(dviState().h+_tx, mode == MoveMode::CHANGEPOS); else - _actions->moveToY(dviState().v+_ty); + _actions->moveToY(dviState().v+_ty, mode == MoveMode::CHANGEPOS); } } -void DVIToSVG::moveDown (double dy) { - DVIReader::moveDown(dy); +void DVIToSVG::moveDown (double dy, MoveMode mode) { + DVIReader::moveDown(dy, mode); if (_actions) { if (dviState().d == WritingMode::LR) - _actions->moveToY(dviState().v+_ty); + _actions->moveToY(dviState().v+_ty, mode == MoveMode::CHANGEPOS); else - _actions->moveToX(dviState().h+_tx); + _actions->moveToX(dviState().h+_tx, mode == MoveMode::CHANGEPOS); } } @@ -437,9 +437,9 @@ void DVIToSVG::dviPutRule (double height, double width) { void DVIToSVG::dviPop () { if (_actions) { if (_prevXPos != dviState().h+_tx) - _actions->moveToX(dviState().h + _tx); + _actions->moveToX(dviState().h + _tx, true); // force setting the SVG position if (_prevYPos != dviState().v+_ty) - _actions->moveToY(dviState().v + _ty); + _actions->moveToY(dviState().v + _ty, true); // force setting the SVG position if (_prevWritingMode != dviState().d) _actions->setTextOrientation(dviState().d != WritingMode::LR); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp index 5385188f370..5b5c619be02 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.hpp @@ -58,8 +58,8 @@ class DVIToSVG : public DVIReader { void enterBeginPage (unsigned pageno, const std::vector &c); void leaveEndPage (unsigned pageno); void embedFonts (XMLElementNode *svgElement); - void moveRight (double dx) override; - void moveDown (double dy) override; + void moveRight (double dx, MoveMode mode) override; + void moveDown (double dy, MoveMode mode) override; void dviPost (uint16_t stdepth, uint16_t pages, uint32_t pw, uint32_t ph, uint32_t mag, uint32_t num, uint32_t den, uint32_t lbopofs) override; void dviBop (const std::vector &c, int32_t prevBopOffset) override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp index ef377e7266b..511b6b04c1a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.cpp @@ -49,15 +49,23 @@ void DVIToSVGActions::reset() { } -void DVIToSVGActions::moveToX (double x) { +/** Change current horizontal position. + * @param[in] x new horizontal position + * @param[in] forceSVGMove if true, creates an explicit position change in the SVG tree */ +void DVIToSVGActions::moveToX (double x, bool forceSVGMove) { SpecialManager::instance().notifyPositionChange(getX(), getY(), *this); - _svg.setX(x); + if (forceSVGMove) + _svg.setX(x); } -void DVIToSVGActions::moveToY (double y) { +/** Change current vertical position. + * @param[in] y new vertical position + * @param[in] forceSVGMove if true, creates an explicit position change in the SVG tree */ +void DVIToSVGActions::moveToY (double y, bool forceSVGMove) { SpecialManager::instance().notifyPositionChange(getX(), getY(), *this); - _svg.setY(y); + if (forceSVGMove) + _svg.setY(y); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp index 0712f6cd1e0..8b3ef317759 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVGActions.hpp @@ -60,8 +60,8 @@ class DVIToSVGActions : public DVIActions, public SpecialActions { void pushContextElement (std::unique_ptr &&node) override {_svg.pushContextElement(std::move(node));} void popContextElement () override {_svg.popContextElement();} void setTextOrientation(bool vertical) override {_svg.setVertical(vertical);} - void moveToX (double x) override; - void moveToY (double y) override; + void moveToX (double x, bool forceSVGMove) override; + void moveToY (double y, bool forceSVGMove) override; void setFont (int num, const Font &font) override; void special (const std::string &spc, double dvi2bp, bool preprocessing=false) override; void beginPage (unsigned pageno, const std::vector &c) override; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp index 2291ca83ec1..05fec0e7c84 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -66,10 +66,12 @@ JFM::JFM (istream &is) { void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int ni) { // determine smallest charcode with chartype > 0 - uint16_t minchar=0xFFFF, maxchar=0; + uint32_t minchar=0xFFFFFFFF, maxchar=0; for (int i=0; i < nt; i++) { - uint16_t c = (uint16_t)reader.readUnsigned(2); - uint16_t t = (uint16_t)reader.readUnsigned(2); + // support new JFM spec by texjporg + uint32_t c = reader.readUnsigned(2); + c += 0x10000 * reader.readUnsigned(1); + uint8_t t = uint8_t(reader.readUnsigned(1)); if (t > 0) { minchar = min(minchar, c); maxchar = max(maxchar, c); @@ -78,12 +80,13 @@ void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int // build charcode to chartype map if (minchar <= maxchar) { _minchar = minchar; - _charTypeTable.resize(maxchar-minchar+1); - memset(&_charTypeTable[0], 0, nt*sizeof(uint16_t)); + _charTypeTable.resize(maxchar-minchar+1, 0); reader.seek(-nt*4, ios::cur); for (int i=0; i < nt; i++) { - uint16_t c = (uint16_t)reader.readUnsigned(2); - uint16_t t = (uint16_t)reader.readUnsigned(2); + // support new JFM spec by texjporg + uint32_t c = reader.readUnsigned(2); + c += 0x10000 * reader.readUnsigned(1); + uint8_t t = uint8_t(reader.readUnsigned(1)); if (c >= minchar) _charTypeTable[c-minchar] = t; } @@ -93,8 +96,8 @@ void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int int JFM::charIndex (int c) const { - uint16_t chartype = 0; - if (!_charTypeTable.empty() && c >= _minchar && size_t(c) < _minchar+_charTypeTable.size()) + uint8_t chartype = 0; + if (!_charTypeTable.empty() && uint32_t(c) >= _minchar && uint32_t(c) < _minchar+_charTypeTable.size()) chartype = _charTypeTable[c-_minchar]; return TFM::charIndex(chartype); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp index 908ad7a1c14..ba5b5ba876a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.hpp @@ -25,22 +25,21 @@ #include "TFM.hpp" -class JFM : public TFM -{ +class JFM : public TFM { public: JFM (std::istream &is); bool verticalLayout () const override {return _vertical;} - uint16_t minChar () const {return _minchar;} - uint16_t maxChar () const {return static_cast(_minchar+_charTypeTable.size()-1);} + uint32_t minChar () const {return _minchar;} + uint32_t maxChar () const {return static_cast(_minchar+_charTypeTable.size()-1);} protected: void readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int ni); int charIndex (int c) const override; private: - uint16_t _minchar; ///< character code of first entry in character type table + uint32_t _minchar; ///< character code of first entry in character type table bool _vertical; ///< true if metrics refer to vertical text layout - std::vector _charTypeTable; + std::vector _charTypeTable; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp index d22cc45f690..bce560c1dee 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MiKTeXCom.cpp @@ -18,7 +18,6 @@ ** along with this program; if not, see . ** *************************************************************************/ -#include #include #include #include "MessageException.hpp" diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp index 24b76362bd5..c96aa1029bf 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.cpp @@ -125,11 +125,11 @@ void RangeMap::addRange (uint32_t cmin, uint32_t cmax, uint32_t vmin) { void RangeMap::adaptNeighbors (Ranges::iterator it) { if (it != _ranges.end()) { // adapt left neighbor - if (it != _ranges.begin() && it->min() <= (it-1)->max()) { - Ranges::iterator lit = it-1; // points to 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) // 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); } @@ -176,6 +176,15 @@ uint32_t RangeMap::valueAt (uint32_t c) const { } +/** Returns the number of values mapped. */ +size_t RangeMap::numValues () const { + size_t count=0; + for (const Range &range : _ranges) + count += range.max()-range.min()+1; + return count; +} + + ostream& RangeMap::Range::write (ostream& os) const { return os << '[' << _min << ',' << _max << "] => " << _minval; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp index 70291696f66..4ae5c0c1ed0 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/RangeMap.hpp @@ -27,10 +27,8 @@ class RangeMap { - class Range - { + class Range { friend class RangeMap; - public: Range () : _min(0), _max(0), _minval(0) {} @@ -44,6 +42,7 @@ class RangeMap { uint32_t minval () const {return _minval;} uint32_t maxval () const {return valueAt(_max);} uint32_t valueAt (uint32_t c) const {return c-_min+_minval;} + uint32_t numKeys () const {return _max-_min+1;} bool operator < (const Range &r) const {return _min < r._min;} std::ostream& write (std::ostream &os) const; @@ -60,13 +59,70 @@ class RangeMap { using Ranges = std::vector; + class Iterator { + friend class RangeMap; + public: + void operator ++ () { + if (_currentKey < _rangeIterator->max()) + ++_currentKey; + else { + if (++_rangeIterator != _rangeMap._ranges.end()) + _currentKey = _rangeIterator->min(); + } + } + + void operator -- () { + if (_currentKey > _rangeIterator->min()) + --_currentKey; + else { + if (_rangeIterator != _rangeMap._ranges.begin()) + _currentKey = (--_rangeIterator)->max(); + } + } + + std::pair operator * () const { + return std::pair(_currentKey, _rangeMap.valueAt(_currentKey)); + } + + bool operator == (const Iterator &it) const { + bool ret = (_rangeIterator == it._rangeIterator); + if (ret && _rangeIterator != _rangeMap._ranges.end()) + ret = (_currentKey == it._currentKey); + return ret; + } + + bool operator != (const Iterator &it) const { + bool ret = (_rangeIterator != it._rangeIterator); + if (!ret && _rangeIterator != _rangeMap._ranges.end()) + ret = _currentKey != it._currentKey; + return ret; + } + + protected: + Iterator (const RangeMap &rangeMap, Ranges::const_iterator it) : _rangeMap(rangeMap), _rangeIterator(it), _currentKey() { + if (_rangeIterator != _rangeMap._ranges.end()) + _currentKey = _rangeIterator->min(); + } + + private: + const RangeMap &_rangeMap; + Ranges::const_iterator _rangeIterator; + uint32_t _currentKey; + }; + public: void addRange (uint32_t first, uint32_t last, uint32_t cid); bool valueExists (uint32_t c) const {return lookup(c) >= 0;} uint32_t valueAt (uint32_t c) const; - size_t size () const {return _ranges.size();} - bool empty () const {return _ranges.empty();} - void clear () {_ranges.clear();} + uint32_t minKey () const {return _ranges.empty() ? 0 : _ranges.front().min();} + uint32_t maxKey () const {return _ranges.empty() ? 0 : _ranges.back().max();} + size_t numRanges () const {return _ranges.size();} + size_t numValues () const; + bool empty () const {return _ranges.empty();} + void clear () {_ranges.clear();} + const Range& getRange (size_t n) const {return _ranges[n];} + Iterator begin () const {return Iterator(*this, _ranges.begin());} + Iterator end () const {return Iterator(*this, _ranges.end());} std::ostream& write (std::ostream &os) const; protected: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp index 1e405d94a28..dff9c923fad 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ToUnicodeMap.cpp @@ -36,17 +36,17 @@ bool ToUnicodeMap::addMissingMappings (uint32_t maxIndex) { bool success=true; // collect Unicode points already in assigned NumericRanges codepoints; - for (size_t i=0; i < size() && success; i++) + for (size_t i=0; i < numRanges() && 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++) + for (size_t i=0; i < numRanges()-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); + success = fillRange(rangeAt(numRanges()-1).max()+1, maxIndex, rangeAt(numRanges()-1).maxval()+1, codepoints, true); } return success; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 7f007697395..9b5baf9ef12 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -262,7 +262,7 @@ static double bit_sequence_to_gray (const string &hexstr) { setbits += bitset(val).count(); totalbits += 4*digitcount; } - return 1.0-double(setbits)/double(totalbits); + return totalbits == 0 ? 1.0 : 1.0-double(setbits)/double(totalbits); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp index 2a8e6d60425..89f698d3f37 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -117,7 +117,8 @@ static bool set_cache_dir (const CommandLine &args) { if (args.cacheOpt.given() && args.cacheOpt.value().empty()) { cout << "cache directory: " << (PhysicalFont::CACHE_PATH ? PhysicalFont::CACHE_PATH : "(none)") << '\n'; try { - FontCache::fontinfo(PhysicalFont::CACHE_PATH, cout, true); + if (PhysicalFont::CACHE_PATH) + FontCache::fontinfo(PhysicalFont::CACHE_PATH, cout, true); } catch (StreamReaderException &e) { Message::wstream(true) << "failed reading cache data\n"; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml index 39659844307..7613f44fb30 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/options.xml @@ -24,7 +24,7 @@ [options] dvifile -E [options] epsfile - This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG. + This program converts DVI files, as created by TeX/LaTeX, to\nthe XML-based scalable vector graphics format SVG. Copyright (C) 2005-2018 Martin Gieseking <martin.gieseking@uos.de> @@ -134,13 +134,13 @@ set/print path of cache directory - - - + + @@ -156,7 +156,7 @@ don't process [selected] specials @@ -172,7 +172,7 @@ print supported special sets and exit