diff options
Diffstat (limited to 'Build/source/texk/lcdf-typetools')
44 files changed, 391 insertions, 140 deletions
diff --git a/Build/source/texk/lcdf-typetools/Makefile.in b/Build/source/texk/lcdf-typetools/Makefile.in index 8701aca6ccf..b9084113b4c 100644 --- a/Build/source/texk/lcdf-typetools/Makefile.in +++ b/Build/source/texk/lcdf-typetools/Makefile.in @@ -58,7 +58,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/NEWS b/Build/source/texk/lcdf-typetools/NEWS index 7f217d8a3e7..d8325b4f72a 100644 --- a/Build/source/texk/lcdf-typetools/NEWS +++ b/Build/source/texk/lcdf-typetools/NEWS @@ -1,5 +1,20 @@ LCDF Typetools NEWS +Version 2.90 3.Jun.2011 + +* Correct crash on glyph names that start with a dot. Marc van Dongen + report. + + +Version 2.89 2.Jun.2011 + +* Better handle combinations of fonts and options that would create so many + substitutions that otftotfm would run out of memory. Marc van Dongen + report. + +* Thanks to Peter Breitenlohner. + + Version 2.88 8.Mar.2011 * Warning reduction. diff --git a/Build/source/texk/lcdf-typetools/README b/Build/source/texk/lcdf-typetools/README index b1b67bfab8c..0b339042a0e 100644 --- a/Build/source/texk/lcdf-typetools/README +++ b/Build/source/texk/lcdf-typetools/README @@ -1,4 +1,4 @@ -LCDF-TYPETOOLS 2.88 +LCDF-TYPETOOLS 2.90 =================== USAGE diff --git a/Build/source/texk/lcdf-typetools/cfftot1/Makefile.in b/Build/source/texk/lcdf-typetools/cfftot1/Makefile.in index 9000e2c79cc..9d463fa77aa 100644 --- a/Build/source/texk/lcdf-typetools/cfftot1/Makefile.in +++ b/Build/source/texk/lcdf-typetools/cfftot1/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 b/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 index d6f6f9f7980..c6a45f80e86 100644 --- a/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 +++ b/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/cfftot1/maket1font.cc b/Build/source/texk/lcdf-typetools/cfftot1/maket1font.cc index 44541d5e208..16249696f03 100644 --- a/Build/source/texk/lcdf-typetools/cfftot1/maket1font.cc +++ b/Build/source/texk/lcdf-typetools/cfftot1/maket1font.cc @@ -42,7 +42,7 @@ class MakeType1CharstringInterp : public Type1CharstringGenInterp { public: bool type2_command(int, const uint8_t *, int *); - String landmark() const; + String landmark(ErrorHandler *errh) const; class Subr; @@ -159,10 +159,10 @@ MakeType1CharstringInterp::~MakeType1CharstringInterp() } String -MakeType1CharstringInterp::landmark() const +MakeType1CharstringInterp::landmark(ErrorHandler *errh) const { if (_cur_glyph >= 0 && _cur_glyph < program()->nglyphs()) - return String("glyph '") + program()->glyph_name(_cur_glyph) + "'"; + return errh->format("glyph %<%s%>", program()->glyph_name(_cur_glyph).c_str()); else return String(); } @@ -406,7 +406,7 @@ MakeType1CharstringInterp::run(const CharstringContext &g, Type1Charstring &out, Type1CharstringGenInterp::run(g, out); if (Type1CharstringGenInterp::bad_flex() && !_flex_message) { - errh->lwarning(landmark(), "complex flex hint replaced with curves"); + errh->lwarning(landmark(errh), "complex flex hint replaced with curves"); errh->message("(This Type 2 format font contains flex hints prohibited by Type 1.\nI%,ve safely replaced them with ordinary curves.)"); _flex_message = true; } diff --git a/Build/source/texk/lcdf-typetools/configure b/Build/source/texk/lcdf-typetools/configure index 5410039e0f6..f735fcd7317 100755 --- a/Build/source/texk/lcdf-typetools/configure +++ b/Build/source/texk/lcdf-typetools/configure @@ -764,7 +764,6 @@ with_sysroot enable_libtool_lock enable_largefile enable_compiler_warnings -with_gnu_ld enable_cxx_runtime_hack enable_cfftot1 enable_mmafm @@ -777,8 +776,6 @@ enable_t1rawafm enable_t1reencode enable_t1testpage enable_ttftotype42 -enable_cfftot1 -enable_ttftotype42 enable_updmap with_kpathsea with_system_kpathsea @@ -795,12 +792,8 @@ LDFLAGS LIBS CPPFLAGS CPP -CPPFLAGS CXX CXXFLAGS -LDFLAGS -LIBS -CPPFLAGS CCC CXXCPP' @@ -19834,11 +19827,9 @@ shell_expand () { test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -shell_expand datadir - cat >>confdefs.h <<_ACEOF -#define SHAREDIR "$datadir/lcdf-typetools" +#define SHAREDIR "/nonesuch" _ACEOF diff --git a/Build/source/texk/lcdf-typetools/configure.ac b/Build/source/texk/lcdf-typetools/configure.ac index 48d8032cb32..6224717dc85 100644 --- a/Build/source/texk/lcdf-typetools/configure.ac +++ b/Build/source/texk/lcdf-typetools/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl Adapted for TeX Live. -m4_define([lcdf_typetools_version], [2.88])[]dnl using unmodified lcdf-typetools source tree +m4_include([version.ac])[] dnl define lcdf_typetools_version AC_INIT([LCDF typetools for TeX Live], lcdf_typetools_version, [tex-k@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([NEWS]) @@ -331,9 +331,7 @@ dnl Preset $prefix and $exec_prefix. test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -shell_expand datadir - -AC_DEFINE_UNQUOTED(SHAREDIR, "$datadir/lcdf-typetools", [Data directory.]) +AC_DEFINE_UNQUOTED(SHAREDIR, "/nonesuch", [Data directory.]) dnl diff --git a/Build/source/texk/lcdf-typetools/configure.ac.orig b/Build/source/texk/lcdf-typetools/configure.ac.orig index 3c393b80563..c3fd4494eae 100644 --- a/Build/source/texk/lcdf-typetools/configure.ac.orig +++ b/Build/source/texk/lcdf-typetools/configure.ac.orig @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([lcdf-typetools], [2.88]) +AC_INIT([lcdf-typetools], [2.90]) AC_CONFIG_SRCDIR([NEWS]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER([autoconf.h]) diff --git a/Build/source/texk/lcdf-typetools/include/efont/otf.hh b/Build/source/texk/lcdf-typetools/include/efont/otf.hh index 816206f63ba..88e4fbfce4d 100644 --- a/Build/source/texk/lcdf-typetools/include/efont/otf.hh +++ b/Build/source/texk/lcdf-typetools/include/efont/otf.hh @@ -140,11 +140,15 @@ class Coverage { public: Coverage() throw (); // empty coverage Coverage(Glyph first, Glyph last) throw (); // range coverage - Coverage(const String&, ErrorHandler* = 0, bool check = true) throw (); + Coverage(const Vector<bool> &gmap) throw (); // used-bytemap coverage + Coverage(const String &str, ErrorHandler *errh = 0, bool check = true) throw (); // default destructor bool ok() const throw () { return _str.length() > 0; } int size() const throw (); + bool has_fast_covers() const throw () { + return _str.length() > 0 && _str.data()[1] == T_X_BYTEMAP; + } int coverage_index(Glyph) const throw (); bool covers(Glyph g) const throw () { return coverage_index(g) >= 0; } @@ -181,14 +185,14 @@ class Coverage { public: int _pos; Glyph _value; friend class Coverage; - iterator(const String&, int); + iterator(const String &str, bool is_end); }; - iterator begin() const { return iterator(_str, 0); } - iterator end() const { return iterator(_str, _str.length()); } + iterator begin() const { return iterator(_str, false); } + iterator end() const { return iterator(_str, true); } Glyph operator[](int) const throw (); - enum { T_LIST = 1, T_RANGES = 2, + enum { T_LIST = 1, T_RANGES = 2, T_X_BYTEMAP = 3, HEADERSIZE = 4, LIST_RECSIZE = 2, RANGES_RECSIZE = 6 }; private: diff --git a/Build/source/texk/lcdf-typetools/include/efont/otfgsub.hh b/Build/source/texk/lcdf-typetools/include/efont/otfgsub.hh index bff8fc42f39..c91aabcf443 100644 --- a/Build/source/texk/lcdf-typetools/include/efont/otfgsub.hh +++ b/Build/source/texk/lcdf-typetools/include/efont/otfgsub.hh @@ -34,7 +34,8 @@ class GsubLookup { public: GsubLookup(const Data &) throw (Error); int type() const { return _type; } uint16_t flags() const { return _d.u16(2); } - bool unparse_automatics(const Gsub &, Vector<Substitution> &) const; + void mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const; + bool unparse_automatics(const Gsub &gsub, Vector<Substitution> &subs, const Coverage &limit) const; bool apply(const Glyph *, int pos, int n, Substitution &) const; enum { HEADERSIZE = 6, RECSIZE = 2, @@ -52,7 +53,8 @@ class GsubSingle { public: // default destructor Coverage coverage() const throw (); Glyph map(Glyph) const; - void unparse(Vector<Substitution> &) const; + void mark_out_glyphs(Vector<bool> &gmap) const; + void unparse(Vector<Substitution> &subs, const Coverage &limit) const; bool apply(const Glyph *, int pos, int n, Substitution &) const; enum { HEADERSIZE = 6, FORMAT2_RECSIZE = 2 }; private: @@ -64,6 +66,7 @@ class GsubMultiple { public: // default destructor Coverage coverage() const throw (); bool map(Glyph, Vector<Glyph> &) const; + void mark_out_glyphs(Vector<bool> &gmap) const; void unparse(Vector<Substitution> &, bool alternate = false) const; bool apply(const Glyph *, int pos, int n, Substitution &, bool alternate = false) const; enum { HEADERSIZE = 6, RECSIZE = 2, @@ -77,6 +80,7 @@ class GsubLigature { public: // default destructor Coverage coverage() const throw (); bool map(const Vector<Glyph> &, Glyph &, int &) const; + void mark_out_glyphs(Vector<bool> &gmap) const; void unparse(Vector<Substitution> &) const; bool apply(const Glyph *, int pos, int n, Substitution &) const; enum { HEADERSIZE = 6, RECSIZE = 2, @@ -90,11 +94,17 @@ class GsubContext { public: GsubContext(const Data &) throw (Error); // default destructor Coverage coverage() const throw (); - bool unparse(const Gsub &, Vector<Substitution> &) const; + void mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const; + bool unparse(const Gsub &gsub, Vector<Substitution> &out_subs, const Coverage &limit) const; enum { F3_HSIZE = 6, SUBRECSIZE = 4 }; private: Data _d; - static bool f3_unparse(const Data &, int nglyph, int glyphtab_offset, int nsub, int subtab_offset, const Gsub &, Vector<Substitution> &, const Substitution &prototype_sub); + static bool f3_mark_out_glyphs(const Data &data, int nsub, int subtab_offset, const Gsub &gsub, Vector<bool> &gmap); + static bool f3_unparse(const Data &data, + int nglyph, int glyphtab_offset, const Coverage &limit, + int nsub, int subtab_offset, + const Gsub &gsub, Vector<Substitution> &outsubs, + const Substitution &prototype_sub); friend class GsubChainContext; }; @@ -102,7 +112,8 @@ class GsubChainContext { public: GsubChainContext(const Data &) throw (Error); // default destructor Coverage coverage() const throw (); - bool unparse(const Gsub &, Vector<Substitution> &) const; + void mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const; + bool unparse(const Gsub &gsub, Vector<Substitution> &subs, const Coverage &limit) const; enum { F1_HEADERSIZE = 6, F1_RECSIZE = 2, F1_SRS_HSIZE = 2, F1_SRS_RSIZE = 2, F3_HSIZE = 4, F3_INPUT_HSIZE = 2, F3_LOOKAHEAD_HSIZE = 2, F3_SUBST_HSIZE = 2 }; diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/patch-03-warning b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/patch-03-warning deleted file mode 100644 index 540cc2839c2..00000000000 --- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/patch-03-warning +++ /dev/null @@ -1,14 +0,0 @@ - Avoid `uninitialized' warning (the compiler may not realize - that this actually can't happen). - -diff -ur lcdf-typetools-2.88.orig/otfinfo/otfinfo.cc lcdf-typetools-2.88/otfinfo/otfinfo.cc ---- lcdf-typetools-2.88.orig/otfinfo/otfinfo.cc 2011-01-27 18:44:40.000000000 +0100 -+++ lcdf-typetools-2.88/otfinfo/otfinfo.cc 2011-03-09 13:36:08.000000000 +0100 -@@ -140,6 +140,7 @@ - if (!filename || filename == "-") { - filename = "<stdin>"; - f = stdin; -+ f_errno = 0; - #if defined(_MSDOS) || defined(_WIN32) - // Set the file mode to binary - _setmode(_fileno(f), _O_BINARY); diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/ChangeLog b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.90-PATCHES/ChangeLog index f8518c7269b..cacdea33566 100644 --- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/ChangeLog +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.90-PATCHES/ChangeLog @@ -1,3 +1,11 @@ +2011-06-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + Import lcdf-typetools-2.90. + * version.ac: New file defining the lcdf-typetools version. + * configure.ac: Adapt. Define SHAREDIR as "/nonesuch" to avoid + useless build paths stored in the otftotfm binary. + * patch-03-warning (removed): Now distributed. + 2011-03-09 Peter Breitenlohner <peb@mppmu.mpg.de> Import lcdf-typetools-2.88. diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/TL-Changes b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.90-PATCHES/TL-Changes index eba9e2e324d..996609dcb28 100644 --- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.88-PATCHES/TL-Changes +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.90-PATCHES/TL-Changes @@ -1,5 +1,5 @@ Changes applied to the lcdf-typetools tree as obtained from: - http://www.lcdf.org/type/lcdf-typetools-2.88.tar.gz + http://www.lcdf.org/type/lcdf-typetools-2.90.tar.gz Removed: depcomp diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools.spec b/Build/source/texk/lcdf-typetools/lcdf-typetools.spec index fd0ac262e85..3f2e6b6e437 100644 --- a/Build/source/texk/lcdf-typetools/lcdf-typetools.spec +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools.spec @@ -1,6 +1,6 @@ Summary: Programs to manipulate OpenType and multiple-master fonts Name: lcdf-typetools -Version: 2.88 +Version: 2.90 Copyright: GPL Vendor: Little Cambridgeport Design Factory <http://www.lcdf.org/> Group: Utilities/Printing diff --git a/Build/source/texk/lcdf-typetools/libefont/Makefile.in b/Build/source/texk/lcdf-typetools/libefont/Makefile.in index 080e183c149..50a2131bff7 100644 --- a/Build/source/texk/lcdf-typetools/libefont/Makefile.in +++ b/Build/source/texk/lcdf-typetools/libefont/Makefile.in @@ -47,7 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/libefont/otf.cc b/Build/source/texk/lcdf-typetools/libefont/otf.cc index 1bc5c6c6cc9..48a2eebd722 100644 --- a/Build/source/texk/lcdf-typetools/libefont/otf.cc +++ b/Build/source/texk/lcdf-typetools/libefont/otf.cc @@ -769,6 +769,32 @@ Coverage::Coverage(Glyph first, Glyph last) throw () } } +Coverage::Coverage(const Vector<bool> &gmap) throw () +{ + int end = gmap.size(); + while (end > 0 && !gmap[end - 1]) + --end; + if (end > 0) { + _str = String::make_garbage(8 + end); + _str.align(4); + uint8_t *data = _str.mutable_udata(); + memset(data, 0, 8 + end); + data[1] = 3; + + uint32_t n = 0; + const bool *it = gmap.begin(); + data += 8; + for (int i = 0; i < end; ++i, ++it, ++data) + if (*it) { + *data = 1; + ++n; + } + + n = htonl(n); + memcpy(_str.mutable_udata() + 4, &n, 4); + } +} + Coverage::Coverage(const String &str, ErrorHandler *errh, bool do_check) throw () : _str(str) { @@ -833,7 +859,9 @@ Coverage::size() const throw () else if (data[1] == T_RANGES) { data += _str.length() - RANGES_RECSIZE; return USHORT_AT(data + 4) + USHORT_AT(data + 2) - USHORT_AT(data) + 1; - } else + } else if (data[1] == T_X_BYTEMAP) + return ULONG_AT(data + 4); + else return -1; } @@ -873,6 +901,11 @@ Coverage::coverage_index(Glyph g) const throw () l = m + 1; } return -1; + } else if (data[1] == T_X_BYTEMAP) { + if (g >= 0 && g < _str.length() - 8 && data[8 + g]) + return g; + else + return -1; } else return -1; } @@ -942,17 +975,28 @@ operator&(const Coverage &a, const Coverage &b) { StringAccum sa; sa << '\000' << '\001' << '\000' << '\000'; - Coverage::iterator ai = a.begin(), bi = b.begin(); - while (ai && bi) { - if (*ai < *bi) - ai.forward_to(*bi); - else if (*ai == *bi) { - uint16_t x = *ai; - sa << (char)(x >> 8) << (char)(x & 0xFF); - ai++, bi++; - } else - bi.forward_to(*ai); + + if (b.has_fast_covers()) { + for (Coverage::iterator ai = a.begin(); ai; ++ai) + if (b.covers(*ai)) { + uint16_t x = *ai; + sa << (char)(x >> 8) << (char)(x & 0xFF); + } + + } else { + Coverage::iterator ai = a.begin(), bi = b.begin(); + while (ai && bi) { + if (*ai < *bi) + ai.forward_to(*bi); + else if (*ai == *bi) { + uint16_t x = *ai; + sa << (char)(x >> 8) << (char)(x & 0xFF); + ai++, bi++; + } else + bi.forward_to(*ai); + } } + int n = (sa.length() - 4) / 2; sa[2] = (n >> 8); sa[3] = (n & 0xFF); @@ -977,33 +1021,38 @@ operator<=(const Coverage &a, const Coverage &b) * * ************************/ -Coverage::iterator::iterator(const String &str, int pos) - : _str(str), _pos(pos), _value(0) +Coverage::iterator::iterator(const String &str, bool is_end) + : _str(str), _value(0) { // XXX assume _str has been checked + if (!_str.length()) { + _pos = 0; + return; + } // shrink _str to fit the coverage table const uint8_t *data = _str.udata(); - if (_str.length()) { - int n = USHORT_AT(data + 2); - switch (USHORT_AT(data)) { - case T_LIST: - _str = _str.substring(0, HEADERSIZE + n*LIST_RECSIZE); - break; - case T_RANGES: - _str = _str.substring(0, HEADERSIZE + n*RANGES_RECSIZE); - break; - default: - _str = String(); - break; - } - } - if (_pos >= _str.length()) - _pos = _str.length(); - else { - // now, move _pos into the coverage table - _pos = HEADERSIZE; - _value = (_pos >= _str.length() ? 0 : USHORT_AT(data + _pos)); + int n = USHORT_AT(data + 2); + switch (USHORT_AT(data)) { + case T_LIST: + _str = _str.substring(0, HEADERSIZE + n*LIST_RECSIZE); + normal_pos_setting: + _pos = is_end ? _str.length() : HEADERSIZE; + _value = _pos >= _str.length() ? 0 : USHORT_AT(data + _pos); + break; + case T_RANGES: + _str = _str.substring(0, HEADERSIZE + n*RANGES_RECSIZE); + goto normal_pos_setting; + case T_X_BYTEMAP: + for (_pos = 8; _pos < _str.length() && !data[_pos]; ++_pos) + /* do nothing */; + _value = _pos >= _str.length() ? 0 : _pos - 8; + break; + default: + _str = String(); + _pos = 0; + _value = 0; + break; } } @@ -1014,8 +1063,10 @@ Coverage::iterator::coverage_index() const assert(_pos < _str.length()); if (data[1] == T_LIST) return (_pos - HEADERSIZE) / LIST_RECSIZE; - else + else if (data[1] == T_RANGES) return USHORT_AT(data + _pos + 4) + _value - USHORT_AT(data + _pos); + else + return _pos - 8; } void @@ -1026,8 +1077,21 @@ Coverage::iterator::operator++(int) if (_pos >= len || (data[1] == T_RANGES && ++_value <= USHORT_AT(data + _pos + 2))) return; - _pos += (data[1] == T_LIST ? LIST_RECSIZE : RANGES_RECSIZE); - _value = (_pos >= len ? 0 : USHORT_AT(data + _pos)); + switch (data[1]) { + case T_LIST: + _pos += LIST_RECSIZE; + normal_pos_setting: + _value = _pos >= len ? 0 : USHORT_AT(data + _pos); + break; + case T_RANGES: + _pos += RANGES_RECSIZE; + goto normal_pos_setting; + case T_X_BYTEMAP: + for (++_pos; _pos < len && !data[_pos]; ++_pos) + /* do nothing */; + _value = _pos >= len ? 0 : _pos - 8; + break; + } } bool @@ -1067,7 +1131,8 @@ Coverage::iterator::forward_to(Glyph find) } _pos = HEADERSIZE + l * LIST_RECSIZE; _value = (_pos >= _str.length() ? 0 : USHORT_AT(data - HEADERSIZE + _pos)); - } else { // data[1] == T_RANGES + + } else if (data[1] == T_RANGES) { // check for "common" case: this or next element if (find <= USHORT_AT(data + _pos + 2)) { assert(find >= USHORT_AT(data + _pos)); @@ -1099,6 +1164,13 @@ Coverage::iterator::forward_to(Glyph find) } _pos = HEADERSIZE + l * LIST_RECSIZE; _value = (_pos >= _str.length() ? 0 : USHORT_AT(data - HEADERSIZE + _pos)); + + } else if (data[1] == T_X_BYTEMAP) { + _pos = 8 + find; + while (_pos < _str.length() && !data[_pos]) + ++_pos; + _pos = _pos >= _str.length() ? _str.length() : _pos; + _value = _pos >= _str.length() ? 0 : _pos - 8; } return find == _value; diff --git a/Build/source/texk/lcdf-typetools/libefont/otfgsub.cc b/Build/source/texk/lcdf-typetools/libefont/otfgsub.cc index dac053cca7d..7d90818d25b 100644 --- a/Build/source/texk/lcdf-typetools/libefont/otfgsub.cc +++ b/Build/source/texk/lcdf-typetools/libefont/otfgsub.cc @@ -641,15 +641,59 @@ GsubLookup::subtable(int i) const return Data(); } +void +GsubLookup::mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const +{ + int nlookup = _d.u16(4); + switch (_type) { + case L_SINGLE: + for (int i = 0; i < nlookup; i++) { + GsubSingle x(subtable(i)); // this pattern makes gcc-3.3.4 happier + x.mark_out_glyphs(gmap); + } + return; + case L_MULTIPLE: + for (int i = 0; i < nlookup; i++) { + GsubMultiple x(subtable(i)); + x.mark_out_glyphs(gmap); + } + return; + case L_ALTERNATE: + for (int i = 0; i < nlookup; i++) { + GsubMultiple x(subtable(i)); + x.mark_out_glyphs(gmap); + } + return; + case L_LIGATURE: + for (int i = 0; i < nlookup; i++) { + GsubLigature x(subtable(i)); + x.mark_out_glyphs(gmap); + } + return; + case L_CONTEXT: + for (int i = 0; i < nlookup; i++) { + GsubContext x(subtable(i)); + x.mark_out_glyphs(gsub, gmap); + } + return; + case L_CHAIN: + for (int i = 0; i < nlookup; i++) { + GsubChainContext x(subtable(i)); + x.mark_out_glyphs(gsub, gmap); + } + return; + } +} + bool -GsubLookup::unparse_automatics(const Gsub &gsub, Vector<Substitution> &v) const +GsubLookup::unparse_automatics(const Gsub &gsub, Vector<Substitution> &v, const Coverage &limit) const { int nlookup = _d.u16(4); switch (_type) { case L_SINGLE: for (int i = 0; i < nlookup; i++) { GsubSingle x(subtable(i)); // this pattern makes gcc-3.3.4 happier - x.unparse(v); + x.unparse(v, limit); } return true; case L_MULTIPLE: @@ -674,7 +718,7 @@ GsubLookup::unparse_automatics(const Gsub &gsub, Vector<Substitution> &v) const bool understood = true; for (int i = 0; i < nlookup; i++) { GsubContext x(subtable(i)); - understood &= x.unparse(gsub, v); + understood &= x.unparse(gsub, v, limit); } return understood; } @@ -682,7 +726,7 @@ GsubLookup::unparse_automatics(const Gsub &gsub, Vector<Substitution> &v) const bool understood = true; for (int i = 0; i < nlookup; i++) { GsubChainContext x(subtable(i)); - understood &= x.unparse(gsub, v); + understood &= x.unparse(gsub, v, limit); } return understood; } @@ -766,15 +810,30 @@ GsubSingle::map(Glyph g) const } void -GsubSingle::unparse(Vector<Substitution> &v) const +GsubSingle::mark_out_glyphs(Vector<bool> &gmap) const { if (_d[1] == 1) { int delta = _d.s16(4); for (Coverage::iterator i = coverage().begin(); i; i++) - v.push_back(Substitution(*i, *i + delta)); + gmap[*i + delta] = true; } else { for (Coverage::iterator i = coverage().begin(); i; i++) - v.push_back(Substitution(*i, _d.u16(HEADERSIZE + i.coverage_index()*FORMAT2_RECSIZE))); + gmap[_d.u16(HEADERSIZE + i.coverage_index()*FORMAT2_RECSIZE)] = true; + } +} + +void +GsubSingle::unparse(Vector<Substitution> &v, const Coverage &limit) const +{ + if (_d[1] == 1) { + int delta = _d.s16(4); + for (Coverage::iterator it = coverage().begin(); it; ++it) + if (limit.covers(*it)) + v.push_back(Substitution(*it, *it + delta)); + } else { + for (Coverage::iterator it = coverage().begin(); it; ++it) + if (limit.covers(*it)) + v.push_back(Substitution(*it, _d.u16(HEADERSIZE + it.coverage_index()*FORMAT2_RECSIZE))); } } @@ -832,6 +891,16 @@ GsubMultiple::map(Glyph g, Vector<Glyph> &v) const } void +GsubMultiple::mark_out_glyphs(Vector<bool> &gmap) const +{ + for (Coverage::iterator i = coverage().begin(); i; ++i) { + Data seq = _d.offset_subtable(HEADERSIZE + i.coverage_index()*RECSIZE); + for (int j = 0; j < seq.u16(0); ++j) + gmap[seq.u16(SEQ_HEADERSIZE + j*SEQ_RECSIZE)] = true; + } +} + +void GsubMultiple::unparse(Vector<Substitution> &v, bool is_alternate) const { Vector<Glyph> result; @@ -911,6 +980,20 @@ GsubLigature::map(const Vector<Glyph> &gs, Glyph &result, int &consumed) const } void +GsubLigature::mark_out_glyphs(Vector<bool> &gmap) const +{ + for (Coverage::iterator i = coverage().begin(); i; i++) { + Data ligset = _d.offset_subtable(HEADERSIZE + i.coverage_index()*RECSIZE); + int nligset = ligset.u16(0); + Vector<Glyph> components(1, *i); + for (int j = 0; j < nligset; j++) { + Data lig = ligset.offset_subtable(SET_HEADERSIZE + j*SET_RECSIZE); + gmap[lig.u16(0)] = true; + } + } +} + +void GsubLigature::unparse(Vector<Substitution> &v) const { for (Coverage::iterator i = coverage().begin(); i; i++) { @@ -988,7 +1071,30 @@ GsubContext::coverage() const throw () } bool -GsubContext::f3_unparse(const Data &data, int nglyph, int glyphtab_offset, int nsub, int subtab_offset, const Gsub &gsub, Vector<Substitution> &outsubs, const Substitution &prototype_sub) +GsubContext::f3_mark_out_glyphs(const Data &data, int nsub, int subtab_offset, const Gsub &gsub, Vector<bool> &gmap) +{ + for (int j = 0; j < nsub; ++j) { + int lookup_index = data.u16(subtab_offset + SUBRECSIZE*j + 2); + gsub.lookup(lookup_index).mark_out_glyphs(gsub, gmap); + } +} + +void +GsubContext::mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const +{ + if (_d.u16(0) != 3) // XXX + return; + int nglyph = _d.u16(2); + int nsubst = _d.u16(4); + f3_mark_out_glyphs(_d, nsubst, F3_HSIZE + nglyph*2, gsub, gmap); +} + +bool +GsubContext::f3_unparse(const Data &data, + int nglyph, int glyphtab_offset, const Coverage &limit, + int nsub, int subtab_offset, + const Gsub &gsub, Vector<Substitution> &outsubs, + const Substitution &prototype_sub) { Vector<Substitution> subs; subs.push_back(prototype_sub); @@ -998,7 +1104,7 @@ GsubContext::f3_unparse(const Data &data, int nglyph, int glyphtab_offset, int n for (int i = 0; i < nglyph; i++) { assert(!work_subs.size()); Coverage c(data.offset_subtable(glyphtab_offset + i*2)); - for (Coverage::iterator ci = c.begin(); ci; ci++) + for (Coverage::iterator ci = (c & limit).begin(); ci; ci++) for (int j = 0; j < subs.size(); j++) work_subs.push_back(subs[j].in_out_append_glyph(*ci)); subs.clear(); @@ -1030,13 +1136,13 @@ GsubContext::f3_unparse(const Data &data, int nglyph, int glyphtab_offset, int n } bool -GsubContext::unparse(const Gsub &gsub, Vector<Substitution> &v) const +GsubContext::unparse(const Gsub &gsub, Vector<Substitution> &v, const Coverage &limit) const { if (_d.u16(0) != 3) // XXX return false; int nglyph = _d.u16(2); int nsubst = _d.u16(4); - return f3_unparse(_d, nglyph, F3_HSIZE, nsubst, F3_HSIZE + nglyph*2, gsub, v, Substitution()); + return f3_unparse(_d, nglyph, F3_HSIZE, limit, nsubst, F3_HSIZE + nglyph*2, gsub, v, Substitution()); } @@ -1078,8 +1184,25 @@ GsubChainContext::coverage() const throw () return Coverage(_d.offset_subtable(input_offset + F3_INPUT_HSIZE), 0, false); } +void +GsubChainContext::mark_out_glyphs(const Gsub &gsub, Vector<bool> &gmap) const +{ + if (_d.u16(0) != 3) + return; + + int nbacktrack = _d.u16(2); + int input_offset = F3_HSIZE + nbacktrack*2; + int ninput = _d.u16(input_offset); + int lookahead_offset = input_offset + F3_INPUT_HSIZE + ninput*2; + int nlookahead = _d.u16(lookahead_offset); + int subst_offset = lookahead_offset + F3_LOOKAHEAD_HSIZE + nlookahead*2; + int nsubst = _d.u16(subst_offset); + + GsubContext::f3_mark_out_glyphs(_d, nsubst, subst_offset + F3_SUBST_HSIZE, gsub, gmap); +} + bool -GsubChainContext::unparse(const Gsub &gsub, Vector<Substitution> &v) const +GsubChainContext::unparse(const Gsub &gsub, Vector<Substitution> &v, const Coverage &limit) const { if (_d.u16(0) != 3) return false; @@ -1096,13 +1219,24 @@ GsubChainContext::unparse(const Gsub &gsub, Vector<Substitution> &v) const Vector<Coverage> lookaheadc; if (gsub.chaincontext_reverse_backtrack()) { for (int i = 0; i < nbacktrack; i++) - backtrackc.push_back(Coverage(_d.offset_subtable(F3_HSIZE + i*2))); + backtrackc.push_back(Coverage(_d.offset_subtable(F3_HSIZE + i*2)) & limit); } else { for (int i = nbacktrack - 1; i >= 0; i--) - backtrackc.push_back(Coverage(_d.offset_subtable(F3_HSIZE + i*2))); + backtrackc.push_back(Coverage(_d.offset_subtable(F3_HSIZE + i*2)) & limit); } for (int i = 0; i < nlookahead; i++) - lookaheadc.push_back(Coverage(_d.offset_subtable(lookahead_offset + F3_LOOKAHEAD_HSIZE + i*2))); + lookaheadc.push_back(Coverage(_d.offset_subtable(lookahead_offset + F3_LOOKAHEAD_HSIZE + i*2)) & limit); + + // give up if would generate too many substitutions + double n = 1; + for (int i = 0; i < nbacktrack; ++i) + n *= backtrackc[i].size(); + for (int i = 0; i < nlookahead; ++i) + n *= lookaheadc[i].size(); + for (int i = 0; i < ninput; ++i) + n *= (Coverage(_d.offset_subtable(input_offset + F3_INPUT_HSIZE + i*2)) & limit).size(); + if (n > 1000000) // arbitrary cutoff + return false; Vector<Coverage::iterator> backtracki; Vector<Coverage::iterator> lookaheadi; @@ -1124,7 +1258,7 @@ GsubChainContext::unparse(const Gsub &gsub, Vector<Substitution> &v) const for (int i = 0; i < nlookahead; i++) right_begin[i] = *lookaheadi[i]; - any |= GsubContext::f3_unparse(_d, ninput, input_offset + F3_INPUT_HSIZE, nsubst, subst_offset + F3_SUBST_HSIZE, gsub, v, s); + any |= GsubContext::f3_unparse(_d, ninput, input_offset + F3_INPUT_HSIZE, limit, nsubst, subst_offset + F3_SUBST_HSIZE, gsub, v, s); // step iterators for (int i = nlookahead - 1; i >= 0; i--) { diff --git a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in index 0e1a69ed7ab..078be1d7e31 100644 --- a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in +++ b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/mmafm/Makefile.in b/Build/source/texk/lcdf-typetools/mmafm/Makefile.in index ce2f8390509..b4d34c9cad9 100644 --- a/Build/source/texk/lcdf-typetools/mmafm/Makefile.in +++ b/Build/source/texk/lcdf-typetools/mmafm/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 b/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 index 6265b9d6cfd..a06bd93be61 100644 --- a/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 +++ b/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 @@ -1,5 +1,5 @@ .\" -*-nroff-*- -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/mmpfb/Makefile.in b/Build/source/texk/lcdf-typetools/mmpfb/Makefile.in index 508c251d1d6..8721be788ed 100644 --- a/Build/source/texk/lcdf-typetools/mmpfb/Makefile.in +++ b/Build/source/texk/lcdf-typetools/mmpfb/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 b/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 index 34c1817c23c..8a68d6d7729 100644 --- a/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 +++ b/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 @@ -1,5 +1,5 @@ .\" -*-nroff-*- -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/otfinfo/Makefile.in b/Build/source/texk/lcdf-typetools/otfinfo/Makefile.in index 286ab61db5e..c6fee1481a4 100644 --- a/Build/source/texk/lcdf-typetools/otfinfo/Makefile.in +++ b/Build/source/texk/lcdf-typetools/otfinfo/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 index 344f1f3e283..1769b600e55 100644 --- a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 +++ b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 @@ -1,5 +1,5 @@ '\"t -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc index 24bd5dd5a4f..ae16d56db52 100644 --- a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc +++ b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc @@ -136,11 +136,10 @@ String read_file(String filename, ErrorHandler *errh, bool warning = false) { FILE *f; - int f_errno; + int f_errno = 0; if (!filename || filename == "-") { filename = "<stdin>"; f = stdin; - f_errno = 0; #if defined(_MSDOS) || defined(_WIN32) // Set the file mode to binary _setmode(_fileno(f), _O_BINARY); diff --git a/Build/source/texk/lcdf-typetools/otftotfm/Makefile.in b/Build/source/texk/lcdf-typetools/otftotfm/Makefile.in index 3ea279fc8a0..fb036b9d6a3 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/Makefile.in +++ b/Build/source/texk/lcdf-typetools/otftotfm/Makefile.in @@ -52,7 +52,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.cc b/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.cc index d81a6ed913e..a3066c0c2c0 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.cc +++ b/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.cc @@ -46,7 +46,7 @@ DvipsEncoding::add_glyphlist(String text) while (s != end && isspace((unsigned char) *s)) ++s; // ignore comments - if (*s == '#') { + if (s != end && *s == '#') { skip_to_end_of_line: while (s != end && *s != '\n' && *s != '\r') ++s; @@ -128,7 +128,7 @@ DvipsEncoding::glyphname_unicode(String gn, Vector<uint32_t> &unis) // drop all characters to the right of the first dot String::iterator dot = std::find(gn.begin(), gn.end(), '.'); - if (dot < gn.end()) + if (dot > gn.begin() && dot < gn.end()) gn = gn.substring(gn.begin(), dot); // map the first component, handle later components recursively @@ -508,13 +508,13 @@ DvipsEncoding::parse_unicoding_words(Vector<String> &v, int override, ErrorHandl /* no warnings to delete a glyph */; else { for (int i = 2; i < v.size(); i++) { - if (i > 2) + if (_unicoding.size() != original_size) _unicoding.push_back(GLYPHLIST_ALTERNATIVE); if (!glyphname_unicode(v[i], _unicoding)) { errh->warning("can%,t map %<%s%> to Unicode", v[i].c_str()); - if (i == 2) + if (i == v.size() - 1 && _unicoding.size() == original_size) errh->warning("target %<%s%> will be deleted from encoding", v[0].c_str()); - else + else if (_unicoding.size() != original_size) _unicoding.pop_back(); } } @@ -718,7 +718,7 @@ DvipsEncoding::parse_unicoding(const String &unicoding_text, int override, Error } void -DvipsEncoding::bad_codepoint(int code, Metrics &metrics, Vector<String> &unencoded) +DvipsEncoding::bad_codepoint(int code, Metrics &metrics, HashMap<PermString, int> &unencoded) { for (int i = 0; i < _lig.size(); i++) { Ligature &l = _lig[i]; @@ -736,7 +736,7 @@ DvipsEncoding::bad_codepoint(int code, Metrics &metrics, Vector<String> &unencod v.push_back(Setting(Setting::RULE, 500, 500)); v.push_back(Setting(Setting::SPECIAL, String("Warning: missing glyph '") + _e[code] + "'")); metrics.encode_virtual(code, _e[code], 0, v, true); - unencoded.push_back(_e[code]); + unencoded.insert(_e[code], 1); } } } @@ -887,10 +887,13 @@ DvipsEncoding::make_metrics(Metrics &metrics, const FontInfo &finfo, Secondary * } // final pass: complain - Vector<String> unencoded; + HashMap<PermString, int> unencoded_map; for (int code = 0; code < _e.size(); code++) if (_e[code] != dot_notdef && metrics.glyph(code) <= 0) - bad_codepoint(code, metrics, unencoded); + bad_codepoint(code, metrics, unencoded_map); + Vector<String> unencoded; + for (HashMap<PermString, int>::iterator it = unencoded_map.begin(); it; ++it) + unencoded.push_back(it.key()); if (unencoded.size() == 1) { errh->warning("%<%s%> glyph not found in font", unencoded[0].c_str()); diff --git a/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.hh b/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.hh index de2561d1011..a80631c3038 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.hh +++ b/Build/source/texk/lcdf-typetools/otftotfm/dvipsencoding.hh @@ -92,7 +92,7 @@ class DvipsEncoding { public: int parse_unicoding_words(Vector<String> &, int override, ErrorHandler *); void parse_word_group(Vector<String> &, int override, int wt, ErrorHandler *); int parse_words(const String &, int override, int wt, ErrorHandler *); - void bad_codepoint(int, Metrics &, Vector<String> &); + void bad_codepoint(int, Metrics &, HashMap<PermString, int> &bad_unicodes); bool x_unicodes(PermString chname, Vector<uint32_t> &unicodes) const; String landmark(int line) const; diff --git a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 index 247f130d104..3314b3cdaad 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 +++ b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 @@ -1,5 +1,5 @@ '\"t -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc index c19d9257caf..84becc2c692 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc +++ b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc @@ -1307,18 +1307,37 @@ main_dvips_map(const String &ps_name, const FontInfo &finfo, ErrorHandler *errh) } static void -do_gsub(Metrics& metrics, const OpenType::Font& otf, DvipsEncoding& dvipsenc, bool dvipsenc_literal, HashMap<uint32_t, int>& feature_usage, const Vector<PermString>& glyph_names, ErrorHandler* errh) +do_gsub(Metrics& metrics, const OpenType::Font& otf, + DvipsEncoding& dvipsenc, bool dvipsenc_literal, + HashMap<uint32_t, int>& feature_usage, + const Vector<PermString>& glyph_names, ErrorHandler* errh) { - // apply activated GSUB features + // find activated GSUB features OpenType::Gsub gsub(otf.table("GSUB"), &otf, errh); Vector<Lookup> lookups(gsub.nlookups(), Lookup()); find_lookups(gsub.script_list(), gsub.feature_list(), lookups, errh); + + // find all characters that might result + Vector<bool> used(glyph_names.size(), false); + for (Metrics::Code c = 0; c < metrics.encoding_size(); ++c) { + Metrics::Glyph g = metrics.glyph(c); + if (g >= 0 && g < used.size()) + used[g] = true; + } + for (int i = 0; i < lookups.size(); ++i) + if (lookups[i].used) { + OpenType::GsubLookup l = gsub.lookup(i); + l.mark_out_glyphs(gsub, used); + } + OpenType::Coverage used_coverage(used); + + // apply activated GSUB features Vector<OpenType::Substitution> subs; for (int i = 0; i < lookups.size(); i++) if (lookups[i].used) { OpenType::GsubLookup l = gsub.lookup(i); subs.clear(); - bool understood = l.unparse_automatics(gsub, subs); + bool understood = l.unparse_automatics(gsub, subs, used_coverage); // check for -ffina, which should apply only at the ends of words, // and -finit, which should apply only at the beginnings. @@ -1360,7 +1379,7 @@ do_gsub(Metrics& metrics, const OpenType::Font& otf, DvipsEncoding& dvipsenc, bo if (alt_lookups[i].used) { OpenType::GsubLookup l = gsub.lookup(i); alt_subs.clear(); - (void) l.unparse_automatics(gsub, alt_subs); + (void) l.unparse_automatics(gsub, alt_subs, used_coverage); metrics.apply_alternates(alt_subs, i, *alt_lookups[i].filter, glyph_names); } altselector_features.swap(interesting_features); diff --git a/Build/source/texk/lcdf-typetools/t1dotlessj/Makefile.in b/Build/source/texk/lcdf-typetools/t1dotlessj/Makefile.in index e89affa44bb..7c9af6bab9e 100644 --- a/Build/source/texk/lcdf-typetools/t1dotlessj/Makefile.in +++ b/Build/source/texk/lcdf-typetools/t1dotlessj/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 b/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 index 8584816fa7f..13cd295da88 100644 --- a/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 +++ b/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1lint/Makefile.in b/Build/source/texk/lcdf-typetools/t1lint/Makefile.in index f090ba67fe9..03a72a8a8fe 100644 --- a/Build/source/texk/lcdf-typetools/t1lint/Makefile.in +++ b/Build/source/texk/lcdf-typetools/t1lint/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 b/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 index 1367ca41c70..428fe44b88c 100644 --- a/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 +++ b/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1rawafm/Makefile.in b/Build/source/texk/lcdf-typetools/t1rawafm/Makefile.in index 8383f708f84..eec1e49613e 100644 --- a/Build/source/texk/lcdf-typetools/t1rawafm/Makefile.in +++ b/Build/source/texk/lcdf-typetools/t1rawafm/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/t1rawafm/t1rawafm.1 b/Build/source/texk/lcdf-typetools/t1rawafm/t1rawafm.1 index 459c8a8d88c..84afb78915b 100644 --- a/Build/source/texk/lcdf-typetools/t1rawafm/t1rawafm.1 +++ b/Build/source/texk/lcdf-typetools/t1rawafm/t1rawafm.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1reencode/Makefile.in b/Build/source/texk/lcdf-typetools/t1reencode/Makefile.in index 78117b064f5..e9a3e87a4bd 100644 --- a/Build/source/texk/lcdf-typetools/t1reencode/Makefile.in +++ b/Build/source/texk/lcdf-typetools/t1reencode/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 b/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 index 5b6c2e294f5..62dc13c22df 100644 --- a/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 +++ b/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1testpage/Makefile.in b/Build/source/texk/lcdf-typetools/t1testpage/Makefile.in index b082e207fc9..cd0e6b22866 100644 --- a/Build/source/texk/lcdf-typetools/t1testpage/Makefile.in +++ b/Build/source/texk/lcdf-typetools/t1testpage/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 b/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 index 3323fc03b93..46fe5bc1ba7 100644 --- a/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 +++ b/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/ttftotype42/Makefile.in b/Build/source/texk/lcdf-typetools/ttftotype42/Makefile.in index 62d1b0aa493..c8042aec1cb 100644 --- a/Build/source/texk/lcdf-typetools/ttftotype42/Makefile.in +++ b/Build/source/texk/lcdf-typetools/ttftotype42/Makefile.in @@ -48,7 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/ac/lcdf-typetools.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 b/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 index fcaab74be29..0847b605516 100644 --- a/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 +++ b/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 @@ -1,4 +1,4 @@ -.ds V 2.88 +.ds V 2.90 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/version.ac b/Build/source/texk/lcdf-typetools/version.ac new file mode 100644 index 00000000000..87791d01e91 --- /dev/null +++ b/Build/source/texk/lcdf-typetools/version.ac @@ -0,0 +1,11 @@ +dnl +dnl Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org> +dnl +dnl This file is free software; the copyright holder +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl -------------------------------------------------------- +dnl +dnl m4-include this file to define the current lcdf-typetools version +m4_define([lcdf_typetools_version], [2.88]) |