diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-14 22:48:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-14 22:48:04 +0000 |
commit | e0a02aebbac49c8d152f346b11bd80cb38f004fb (patch) | |
tree | 661a02c72e07938f9ddace5f5be60936e814dbb1 /Build | |
parent | ef81d1d0a6b7da53018c6dacf8662f6d7ce7ee4b (diff) |
lcdf-typetools 2.79
git-svn-id: svn://tug.org/texlive/trunk@13743 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
35 files changed, 378 insertions, 96 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README index 5ae7c5e1159..bf2c6596120 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -64,9 +64,9 @@ kpathsea - maintained here by Karl Berry, Akira Kakuto, ... lacheck - ? -lcdf-typetools - checked 13apr09 +lcdf-typetools - checked 15jun09 http://www.lcdf.org/type/ - http://www.lcdf.org/type/lcdf-typetools-2.78.tar.gz + http://www.lcdf.org/type/lcdf-typetools-2.79.tar.gz m4 - maintained here, part of our build diff --git a/Build/source/texk/lcdf-typetools/Makefile.am b/Build/source/texk/lcdf-typetools/Makefile.am index e74e6d2c33a..b4a728296ef 100644 --- a/Build/source/texk/lcdf-typetools/Makefile.am +++ b/Build/source/texk/lcdf-typetools/Makefile.am @@ -28,6 +28,7 @@ EXTRA_DIST = \ include/lcdf/error.hh \ include/lcdf/filename.hh \ include/lcdf/globmatch.hh \ + include/lcdf/hashcode.hh \ include/lcdf/hashmap.hh include/lcdf/hashmap.cc \ include/lcdf/inttypes.h \ include/lcdf/landmark.hh \ @@ -69,6 +70,7 @@ EXTRA_DIST = \ include/efont/t1unparser.hh \ include/efont/ttfcs.hh \ include/efont/ttfhead.hh \ + include/efont/ttfkern.hh \ glyphlist.txt \ texglyphlist.txt \ 7t.enc diff --git a/Build/source/texk/lcdf-typetools/Makefile.in b/Build/source/texk/lcdf-typetools/Makefile.in index f4b384241ad..25bf825da8c 100644 --- a/Build/source/texk/lcdf-typetools/Makefile.in +++ b/Build/source/texk/lcdf-typetools/Makefile.in @@ -280,28 +280,29 @@ DIST_SUBDIRS = liblcdf libefont cfftot1 mmafm mmpfb otfinfo otftotfm t1dotlessj EXTRA_DIST = ONEWS lcdf-typetools.spec include/lcdf/bezier.hh \ include/lcdf/clp.h include/lcdf/error.hh \ include/lcdf/filename.hh include/lcdf/globmatch.hh \ - include/lcdf/hashmap.hh include/lcdf/hashmap.cc \ - include/lcdf/inttypes.h include/lcdf/landmark.hh \ - include/lcdf/md5.h include/lcdf/permstr.hh \ - include/lcdf/point.hh include/lcdf/slurper.hh \ - include/lcdf/straccum.hh include/lcdf/string.hh \ - include/lcdf/strtonum.h include/lcdf/transform.hh \ - include/lcdf/vector.hh include/lcdf/vector.cc \ - include/efont/afm.hh include/efont/afmparse.hh \ - include/efont/afmw.hh include/efont/amfm.hh \ - include/efont/cff.hh include/efont/encoding.hh \ - include/efont/findmet.hh include/efont/metrics.hh \ - include/efont/otf.hh include/efont/otfcmap.hh \ - include/efont/otfdata.hh include/efont/otfgpos.hh \ - include/efont/otfgsub.hh include/efont/otfname.hh \ - include/efont/otfos2.hh include/efont/otfpost.hh \ - include/efont/pairop.hh include/efont/psres.hh \ - include/efont/t1bounds.hh include/efont/t1cs.hh \ - include/efont/t1csgen.hh include/efont/t1font.hh \ - include/efont/t1interp.hh include/efont/t1item.hh \ - include/efont/t1mm.hh include/efont/t1rw.hh \ - include/efont/t1unparser.hh include/efont/ttfcs.hh \ - include/efont/ttfhead.hh glyphlist.txt texglyphlist.txt 7t.enc \ + include/lcdf/hashcode.hh include/lcdf/hashmap.hh \ + include/lcdf/hashmap.cc include/lcdf/inttypes.h \ + include/lcdf/landmark.hh include/lcdf/md5.h \ + include/lcdf/permstr.hh include/lcdf/point.hh \ + include/lcdf/slurper.hh include/lcdf/straccum.hh \ + include/lcdf/string.hh include/lcdf/strtonum.h \ + include/lcdf/transform.hh include/lcdf/vector.hh \ + include/lcdf/vector.cc include/efont/afm.hh \ + include/efont/afmparse.hh include/efont/afmw.hh \ + include/efont/amfm.hh include/efont/cff.hh \ + include/efont/encoding.hh include/efont/findmet.hh \ + include/efont/metrics.hh include/efont/otf.hh \ + include/efont/otfcmap.hh include/efont/otfdata.hh \ + include/efont/otfgpos.hh include/efont/otfgsub.hh \ + include/efont/otfname.hh include/efont/otfos2.hh \ + include/efont/otfpost.hh include/efont/pairop.hh \ + include/efont/psres.hh include/efont/t1bounds.hh \ + include/efont/t1cs.hh include/efont/t1csgen.hh \ + include/efont/t1font.hh include/efont/t1interp.hh \ + include/efont/t1item.hh include/efont/t1mm.hh \ + include/efont/t1rw.hh include/efont/t1unparser.hh \ + include/efont/ttfcs.hh include/efont/ttfhead.hh \ + include/efont/ttfkern.hh glyphlist.txt texglyphlist.txt 7t.enc \ Makefile.am.orig configure.ac.orig all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/Build/source/texk/lcdf-typetools/NEWS b/Build/source/texk/lcdf-typetools/NEWS index 487a38baaa3..c2d8abc825e 100644 --- a/Build/source/texk/lcdf-typetools/NEWS +++ b/Build/source/texk/lcdf-typetools/NEWS @@ -5,6 +5,19 @@ Version 2.76-rc1 2.Mar.2009 * Adapt to new TeX Live build scheme. +Version 2.79 12.Jun.2009 + +* otftotfm: Use TrueType "kern" tables to satisfy the "-fkern" feature if + GPOS information isn't available. Requested by Nico Schlömer. + +* ttftotype42: Split very large non-glyf tables, as well as very large glyf + tables. Requested by Mark DeVries. + +* otfinfo: The -T option dumps a table's contents to standard out. + +* Introduce and use a consistent hashcode_t type. Reported by Karl Berry. + + Version 2.78 6.Apr.2009 * t1lint: Report warnings when a font charstring command has too many diff --git a/Build/source/texk/lcdf-typetools/README b/Build/source/texk/lcdf-typetools/README index 3a4b457fadb..0eafa76d80e 100644 --- a/Build/source/texk/lcdf-typetools/README +++ b/Build/source/texk/lcdf-typetools/README @@ -1,4 +1,4 @@ -LCDF-TYPETOOLS 2.78 +LCDF-TYPETOOLS 2.79 =================== USAGE diff --git a/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 b/Build/source/texk/lcdf-typetools/cfftot1/cfftot1.1 index 376aebf807b..8a6e9a4dbb5 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/configure b/Build/source/texk/lcdf-typetools/configure index 60280ff7985..93550d12982 100755 --- a/Build/source/texk/lcdf-typetools/configure +++ b/Build/source/texk/lcdf-typetools/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for LCDF typetools 2.78. +# Generated by GNU Autoconf 2.63 for LCDF typetools 2.79. # # Report bugs to <tex-k@tug.org>. # @@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='LCDF typetools' PACKAGE_TARNAME='lcdf-typetools' -PACKAGE_VERSION='2.78' -PACKAGE_STRING='LCDF typetools 2.78' +PACKAGE_VERSION='2.79' +PACKAGE_STRING='LCDF typetools 2.79' PACKAGE_BUGREPORT='tex-k@tug.org' ac_unique_file="NEWS" @@ -1514,7 +1514,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 LCDF typetools 2.78 to adapt to many kinds of systems. +\`configure' configures LCDF typetools 2.79 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1584,7 +1584,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of LCDF typetools 2.78:";; + short | recursive ) echo "Configuration of LCDF typetools 2.79:";; esac cat <<\_ACEOF @@ -1713,7 +1713,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -LCDF typetools configure 2.78 +LCDF typetools configure 2.79 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1727,7 +1727,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 LCDF typetools $as_me 2.78, which was +It was created by LCDF typetools $as_me 2.79, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -6972,7 +6972,7 @@ fi # Define the identity of the package. PACKAGE='lcdf-typetools' - VERSION='2.78' + VERSION='2.79' cat >>confdefs.h <<_ACEOF @@ -18416,7 +18416,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -LCDF typetools config.lt 2.78 +LCDF typetools config.lt 2.79 configured by $0, generated by GNU Autoconf 2.63. Copyright (C) 2008 Free Software Foundation, Inc. @@ -23594,7 +23594,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by LCDF typetools $as_me 2.78, which was +This file was extended by LCDF typetools $as_me 2.79, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23657,7 +23657,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -LCDF typetools config.status 2.78 +LCDF typetools config.status 2.79 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/Build/source/texk/lcdf-typetools/configure.ac b/Build/source/texk/lcdf-typetools/configure.ac index b2a9c1943d1..e149f840280 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. -AC_INIT([LCDF typetools], [2.78], [tex-k@tug.org]) +AC_INIT([LCDF typetools], [2.79], [tex-k@tug.org]) AC_PREREQ([2.63]) AC_CONFIG_SRCDIR([NEWS]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/lcdf-typetools/include/efont/otf.hh b/Build/source/texk/lcdf-typetools/include/efont/otf.hh index 3c699c2143b..816206f63ba 100644 --- a/Build/source/texk/lcdf-typetools/include/efont/otf.hh +++ b/Build/source/texk/lcdf-typetools/include/efont/otf.hh @@ -2,6 +2,7 @@ #ifndef EFONT_OTF_HH #define EFONT_OTF_HH #include <efont/otfdata.hh> +#include <lcdf/hashcode.hh> class ErrorHandler; namespace Efont { namespace OpenType { class Post; @@ -13,8 +14,8 @@ class Tag { public: Tag() : _tag(0U) { } explicit Tag(uint32_t tag) : _tag(tag) { } - Tag(const char*); - Tag(const String&); + Tag(const char *name); + Tag(const String &name); // default destructor bool null() const { return _tag == 0; } @@ -52,9 +53,10 @@ class Font { public: int length() const { return _str.length(); } int ntables() const; - String table(Tag) const; - uint32_t table_checksum(Tag) const; - Tag table_tag(int) const; + bool has_table(Tag tag) const; + String table(Tag tag) const; + uint32_t table_checksum(Tag tag) const; + Tag table_tag(int i) const; static uint32_t checksum(const uint8_t *, const uint8_t *); static uint32_t checksum(const String &); @@ -377,7 +379,7 @@ inline bool GlyphSet::operator[](Glyph g) const }} -inline unsigned hashcode(Efont::OpenType::Tag t) +inline hashcode_t hashcode(Efont::OpenType::Tag t) { return t.value(); } diff --git a/Build/source/texk/lcdf-typetools/include/efont/otfgpos.hh b/Build/source/texk/lcdf-typetools/include/efont/otfgpos.hh index 689795ff390..4a23f2453e2 100644 --- a/Build/source/texk/lcdf-typetools/include/efont/otfgpos.hh +++ b/Build/source/texk/lcdf-typetools/include/efont/otfgpos.hh @@ -95,6 +95,7 @@ struct Position { inline Position(Glyph, uint16_t format, const Data &); inline Position(uint16_t format, const Data &); inline Position(Glyph, const Position &); + inline Position(Glyph g, int pdx, int pdy, int adx, int ady); bool empty() const { return pdx == 0 && pdy == 0 && adx == 0 && ady == 0; } operator bool() const { return !empty(); } bool h_empty() const { return pdx == 0 && pdy == 0 && adx == 0; } @@ -199,6 +200,11 @@ inline Position::Position(Glyph g_, const Position &p) { } +inline Position::Position(Glyph g_, int pdx_, int pdy_, int adx_, int ady_) + : g(g_), pdx(pdx_), pdy(pdy_), adx(adx_), ady(ady_) +{ +} + inline Positioning::Positioning(const Position &left) : _left(left) { diff --git a/Build/source/texk/lcdf-typetools/include/efont/ttfkern.hh b/Build/source/texk/lcdf-typetools/include/efont/ttfkern.hh new file mode 100644 index 00000000000..717a72b6912 --- /dev/null +++ b/Build/source/texk/lcdf-typetools/include/efont/ttfkern.hh @@ -0,0 +1,42 @@ +// -*- related-file-name: "../../libefont/ttfkern.cc" -*- +#ifndef EFONT_TTFKERN_HH +#define EFONT_TTFKERN_HH +#include <efont/otfgpos.hh> +namespace Efont { namespace OpenType { + +class KernTable { public: + + KernTable(const Data &, ErrorHandler * = 0) throw (Error); + // default destructor + + bool ok() const { return _error >= 0; } + + bool unparse_automatics(Vector<Positioning> &, ErrorHandler * = 0) const; + + private: + + Data _d; + int _version; + int _error; + + enum { + COV_V0_HORIZONTAL = 0x0001, COV_V0_MINIMUM = 0x0002, + COV_V0_CROSS_STREAM = 0x0004, COV_V0_OVERRIDE = 0x0008, + COV_V0_FORMAT = 0xFF00, COV_V0_FORMAT0 = 0x0000, + COV_V1_VERTICAL = 0x8000, COV_V1_CROSS_STREAM = 0x4000, + COV_V1_VARIATION = 0x2000, + COV_V1_FORMAT = 0x00FF, COV_V1_FORMAT0 = 0x0000 + }; + + inline uint32_t ntables() const { + return _version == 0 ? _d.u16(2) : _d.u32(4); + } + inline uint32_t first_offset() const { + return _version == 0 ? 4 : 8; + } + inline Data subtable(uint32_t &off) const throw (Error); + +}; + +}} +#endif diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/hashcode.hh b/Build/source/texk/lcdf-typetools/include/lcdf/hashcode.hh new file mode 100644 index 00000000000..53a0e428989 --- /dev/null +++ b/Build/source/texk/lcdf-typetools/include/lcdf/hashcode.hh @@ -0,0 +1,31 @@ +#ifndef LCDF_HASHCODE_HH +#define LCDF_HASHCODE_HH +#include <stddef.h> + +typedef size_t hashcode_t; ///< Typical type for a hashcode() value. + +inline hashcode_t +hashcode(int x) +{ + return static_cast<hashcode_t>(x); +} + +inline hashcode_t +hashcode(unsigned x) +{ + return static_cast<hashcode_t>(x); +} + +inline hashcode_t +hashcode(long x) +{ + return static_cast<hashcode_t>(x); +} + +inline hashcode_t +hashcode(unsigned long x) +{ + return static_cast<hashcode_t>(x); +} + +#endif diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh index be016da52bc..3d4179e5b5f 100644 --- a/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh +++ b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh @@ -1,6 +1,7 @@ #ifndef LCDF_HASHMAP_HH #define LCDF_HASHMAP_HH #include <assert.h> +#include <lcdf/hashcode.hh> // K AND V REQUIREMENTS: // @@ -10,8 +11,9 @@ // and no k with (bool)k == false is stored. // K & K::operator=(const K &) // k1 == k2 -// unsigned hashcode(const K &) +// hashcode_t hashcode(const K &) // If hashcode(k1) != hashcode(k2), then k1 != k2. +// Actually any unsigned integer type may be used. // // V::V() // V & V::operator=(const V &) @@ -19,30 +21,6 @@ template <class K, class V> class _HashMap_const_iterator; template <class K, class V> class _HashMap_iterator; -inline unsigned -hashcode(int i) -{ - return static_cast<unsigned>(i); -} - -inline unsigned -hashcode(unsigned u) -{ - return u; -} - -inline unsigned -hashcode(long l) -{ - return static_cast<unsigned>(l); -} - -inline unsigned -hashcode(unsigned long ul) -{ - return static_cast<unsigned long>(ul); -} - template <class K, class V> class HashMap { public: @@ -54,6 +32,7 @@ class HashMap { public: int size() const { return _n; } bool empty() const { return _n == 0; } int capacity() const { return _capacity; } + const V &default_value() const { return _default_value; } void set_default_value(const V &v) { _default_value = v; } typedef _HashMap_const_iterator<K, V> const_iterator; @@ -144,7 +123,7 @@ inline int HashMap<K, V>::bucket(const K &key) const { assert(key); - unsigned hc = hashcode(key); + hashcode_t hc = hashcode(key); int i = hc & (_capacity - 1); int j = ((hc >> 6) & (_capacity - 1)) | 1; diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh b/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh index 4e82e1f3ff6..684878ed464 100644 --- a/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh +++ b/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh @@ -6,6 +6,7 @@ #include <stdarg.h> #include <string.h> #include <lcdf/inttypes.h> +#include <lcdf/hashcode.hh> class PermString; inline bool operator==(PermString a, PermString b); inline bool operator!=(PermString a, PermString b); @@ -180,7 +181,7 @@ inline PermString PermString::decapsule(Capsule c) return PermString(c); } -inline size_t hashcode(PermString s) +inline hashcode_t hashcode(PermString s) { return (uintptr_t) s.c_str(); } diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/string.hh b/Build/source/texk/lcdf-typetools/include/lcdf/string.hh index 6ef0308cd02..00883a7265f 100644 --- a/Build/source/texk/lcdf-typetools/include/lcdf/string.hh +++ b/Build/source/texk/lcdf-typetools/include/lcdf/string.hh @@ -1,6 +1,7 @@ // -*- related-file-name: "../../liblcdf/string.cc" -*- #ifndef LCDF_STRING_HH #define LCDF_STRING_HH +#include <lcdf/hashcode.hh> #ifdef HAVE_PERMSTRING # include <lcdf/permstr.hh> #endif @@ -243,11 +244,11 @@ class String { public: * @invariant If end1 - begin1 == end2 - begin2 and memcmp(begin1, begin2, * end1 - begin1) == 0, then hashcode(begin1, end1) == hashcode(begin2, * end2). */ - static unsigned hashcode(const char *begin, const char *end); + static hashcode_t hashcode(const char *begin, const char *end); /** @overload */ - static inline unsigned hashcode(const unsigned char *begin, - const unsigned char *end) { + static inline hashcode_t hashcode(const unsigned char *begin, + const unsigned char *end) { return hashcode(reinterpret_cast<const char *>(begin), reinterpret_cast<const char *>(end)); } @@ -258,7 +259,7 @@ class String { public: * "SuperFastHash." * * @invariant If s1 == s2, then s1.hashcode() == s2.hashcode(). */ - inline unsigned hashcode() const { + inline hashcode_t hashcode() const { return length() ? hashcode(begin(), end()) : 0; } @@ -782,7 +783,7 @@ inline String operator+(PermString a, PermString b) { #endif -inline unsigned hashcode(const String &str) { +inline hashcode_t hashcode(const String &str) { return str.hashcode(); } diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools.spec b/Build/source/texk/lcdf-typetools/lcdf-typetools.spec index e2342b2451f..24ce1fa1aa6 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.78 +Version: 2.79 Copyright: GPL Vendor: Little Cambridgeport Design Factory <http://www.lcdf.org/> Group: Utilities/Printing diff --git a/Build/source/texk/lcdf-typetools/libefont/Makefile.am b/Build/source/texk/lcdf-typetools/libefont/Makefile.am index f77822b366e..45b97ca269b 100644 --- a/Build/source/texk/lcdf-typetools/libefont/Makefile.am +++ b/Build/source/texk/lcdf-typetools/libefont/Makefile.am @@ -32,7 +32,8 @@ libefont_a_SOURCES = \ t1rw.cc \ t1unparser.cc \ ttfcs.cc \ - ttfhead.cc + ttfhead.cc \ + ttfkern.cc libefont_a_LIBADD = @TEMPLATE_OBJS@ CLEANFILES = @TEMPLATE_OBJS@ diff --git a/Build/source/texk/lcdf-typetools/libefont/Makefile.in b/Build/source/texk/lcdf-typetools/libefont/Makefile.in index b1d6e0387a6..bd09100c383 100644 --- a/Build/source/texk/lcdf-typetools/libefont/Makefile.in +++ b/Build/source/texk/lcdf-typetools/libefont/Makefile.in @@ -67,7 +67,7 @@ am_libefont_a_OBJECTS = afm.$(OBJEXT) afmparse.$(OBJEXT) \ t1csgen.$(OBJEXT) t1interp.$(OBJEXT) t1item.$(OBJEXT) \ t1font.$(OBJEXT) t1fontskel.$(OBJEXT) t1mm.$(OBJEXT) \ t1rw.$(OBJEXT) t1unparser.$(OBJEXT) ttfcs.$(OBJEXT) \ - ttfhead.$(OBJEXT) + ttfhead.$(OBJEXT) ttfkern.$(OBJEXT) libefont_a_OBJECTS = $(am_libefont_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp @@ -242,7 +242,8 @@ libefont_a_SOURCES = \ t1rw.cc \ t1unparser.cc \ ttfcs.cc \ - ttfhead.cc + ttfhead.cc \ + ttfkern.cc libefont_a_LIBADD = @TEMPLATE_OBJS@ CLEANFILES = @TEMPLATE_OBJS@ @@ -326,6 +327,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1unparser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttfcs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttfhead.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttfkern.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/Build/source/texk/lcdf-typetools/libefont/otf.cc b/Build/source/texk/lcdf-typetools/libefont/otf.cc index e7dede80891..947d0de3466 100644 --- a/Build/source/texk/lcdf-typetools/libefont/otf.cc +++ b/Build/source/texk/lcdf-typetools/libefont/otf.cc @@ -132,6 +132,15 @@ Font::table(Tag tag) const return String(); } +bool +Font::has_table(Tag tag) const +{ + const uint8_t *entry = 0; + if (error() >= 0) + entry = tag.table_entry(data() + HEADER_SIZE, USHORT_AT(data() + 4), TABLE_DIR_ENTRY_SIZE); + return entry != 0; +} + uint32_t Font::table_checksum(Tag tag) const { diff --git a/Build/source/texk/lcdf-typetools/libefont/ttfkern.cc b/Build/source/texk/lcdf-typetools/libefont/ttfkern.cc new file mode 100644 index 00000000000..edf10732537 --- /dev/null +++ b/Build/source/texk/lcdf-typetools/libefont/ttfkern.cc @@ -0,0 +1,116 @@ +// -*- related-file-name: "../include/efont/ttfkern.hh" -*- + +/* ttfkern.{cc,hh} -- TrueType kern table + * + * Copyright (c) 2009 Eddie Kohler + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. This program is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <efont/ttfkern.hh> +#include <lcdf/error.hh> +#include <lcdf/straccum.hh> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <algorithm> + +namespace Efont { namespace OpenType { + +inline Data +KernTable::subtable(uint32_t &off_in_out) const throw (Error) +{ + uint32_t off = off_in_out, len; + if (_version == 0) { + if (_d.u16(off) != 0) + throw new Format("kern subtable"); + len = _d.u16(off + 2); + } else + len = _d.u32(off); + if (len < 6 || off + len > (uint32_t) _d.length()) + throw new Bounds(); + off_in_out = off + len; + return _d.substring(off, len); +} + +KernTable::KernTable(const Data &d, ErrorHandler *) throw (Error) + : _d(d), _error(-1) +{ + // USHORT Version + // USHORT nTables + if (d.length() == 0) + throw BlankTable("kern"); + + uint32_t ntables, off; + if (d.u16(0) == 0) { + ntables = d.u16(2); + _version = 0; + off = 4; + } else if (d.u16(0) == 1) { + ntables = d.u32(4); + _version = 1; + off = 8; + } else + throw Format("kern"); + + for (uint32_t i = 0; i < ntables; ++i) + (void) subtable(off); + + _error = 0; +} + +bool +KernTable::unparse_automatics(Vector<Positioning> &v, ErrorHandler *errh) const +{ + uint32_t ntables = this->ntables(); + uint32_t off = first_offset(); + int success = 0; + if (_error < 0) + return false; + + for (uint16_t i = 0; i < ntables; ++i) { + Data subt = _d.subtable(off); + uint16_t coverage = subt.u16(4); + + if (_version == 0) { + if ((coverage & COV_V0_HORIZONTAL) == 0 + || (coverage & (COV_V0_MINIMUM | COV_V0_CROSS_STREAM + | COV_V0_OVERRIDE)) != 0 + || (coverage & COV_V0_FORMAT) != COV_V0_FORMAT0) + continue; + } else { + if ((coverage & (COV_V1_VERTICAL | COV_V1_CROSS_STREAM + | COV_V1_VARIATION)) != 0 + || (coverage & COV_V1_FORMAT) != COV_V1_FORMAT0) + continue; + } + + try { + uint32_t off = (_version ? 16 : 14); + uint16_t npairs = subt.u16(off - 8); + for (uint16_t j = 0; j < npairs; ++j, off += 6) { + v.push_back(Positioning(Position(subt.u16(off), 0, 0, subt.s16(off + 4), 0), + Position(subt.u16(off + 2), 0, 0, 0, 0))); + ++success; + } + } catch (Error e) { + if (errh) + errh->warning("%s, continuing", e.description.c_str()); + } + } + + return success > 0; +} + +}} + +#include <lcdf/vector.cc> diff --git a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.am b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.am index 4059860d0cc..bae23d0ad08 100644 --- a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.am +++ b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.am @@ -39,3 +39,5 @@ srclinks: ln -sf ../../../liblcdf/include/lcdf/$$i.hh include/lcdf/$$i.hh ; done cd $(top_srcdir); for i in inttypes; do \ ln -sf ../../../liblcdf/include/lcdf/$$i.h include/lcdf/$$i.h ; done + cd $(top_srcdir); for i in hashcode; do \ + ln -sf ../../../liblcdf/include/lcdf/$$i.hh include/lcdf/$$i.hh ; done diff --git a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in index fa6758f0eb3..d09f27a8fd2 100644 --- a/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in +++ b/Build/source/texk/lcdf-typetools/liblcdf/Makefile.in @@ -563,6 +563,8 @@ srclinks: ln -sf ../../../liblcdf/include/lcdf/$$i.hh include/lcdf/$$i.hh ; done cd $(top_srcdir); for i in inttypes; do \ ln -sf ../../../liblcdf/include/lcdf/$$i.h include/lcdf/$$i.h ; done + cd $(top_srcdir); for i in hashcode; do \ + ln -sf ../../../liblcdf/include/lcdf/$$i.hh include/lcdf/$$i.hh ; done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/Build/source/texk/lcdf-typetools/liblcdf/string.cc b/Build/source/texk/lcdf-typetools/liblcdf/string.cc index 6ba05536f25..0acbddd214a 100644 --- a/Build/source/texk/lcdf-typetools/liblcdf/string.cc +++ b/Build/source/texk/lcdf-typetools/liblcdf/string.cc @@ -531,7 +531,7 @@ String::printable() const return *this; } -uint32_t +hashcode_t String::hashcode(const char *begin, const char *end) { if (end <= begin) @@ -612,7 +612,7 @@ String::hashcode(const char *begin, const char *end) #if 0 // 11.Apr.2008 -- This old hash function was swapped out in favor of // SuperFastHash, above. -size_t +hashcode_t String::hashcode() const { int l = length(); diff --git a/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 b/Build/source/texk/lcdf-typetools/mmafm/mmafm.1 index 572d8ddad0e..304c2750d86 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 b/Build/source/texk/lcdf-typetools/mmpfb/mmpfb.1 index c2cada0bee8..9ad0fdadc12 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.1 index 2218976d976..5d13b8c1df9 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. @@ -138,6 +138,11 @@ Print the size and name of every OpenType table in the font. For example: \&... .fi ' +.Sp +.TP 5 +.BR \-T ", " \-\-dump\-table \fItable\fR +Print the contents of the font's OpenType table \fItable\fR. +' .PD ' ' diff --git a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc index 69340a2d9ac..ee1a1320039 100644 --- a/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc +++ b/Build/source/texk/lcdf-typetools/otfinfo/otfinfo.cc @@ -54,6 +54,7 @@ using namespace Efont; #define TABLES_OPT 326 #define QUERY_FAMILY_OPT 327 #define INFO_OPT 328 +#define DUMP_TABLE_OPT 329 const Clp_Option options[] = { @@ -69,6 +70,7 @@ const Clp_Option options[] = { { "info", 'i', INFO_OPT, 0, 0 }, { "glyphs", 'g', QUERY_GLYPHS_OPT, 0, 0 }, { "tables", 't', TABLES_OPT, 0, 0 }, + { "dump-table", 'T', DUMP_TABLE_OPT, Clp_ValString, 0 }, { "help", 'h', HELP_OPT, 0, 0 }, { "version", 0, VERSION_OPT, 0, 0 }, @@ -117,6 +119,7 @@ Query options:\n\ -i, --info Report font%,s names and designer/vendor info.\n\ -g, --glyphs Report font%,s glyph names.\n\ -t, --tables Report font%,s OpenType tables.\n\ + -T, --dump-table NAME Output font%,s %<NAME%> table.\n\ \n\ Other options:\n\ --script=SCRIPT[.LANG] Set script used for --features [latn].\n\ @@ -445,6 +448,24 @@ do_tables(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_er } } +static void +do_dump_table(const OpenType::Font &otf, OpenType::Tag tag, ErrorHandler *errh) +{ + int before_nerrors = errh->nerrors(); + try { + if (otf.has_table(tag)) { + String s = otf.table(tag); + int written = fwrite(s.data(), 1, s.length(), stdout); + if (written != s.length()) + errh->error("%s", strerror(errno)); + } else + errh->message("no %<%s%> table", tag.text().c_str()); + } catch (OpenType::Error) { + if (errh->nerrors() == before_nerrors) + errh->message("corrupted tables"); + } +} + int main(int argc, char *argv[]) { @@ -454,6 +475,7 @@ main(int argc, char *argv[]) ErrorHandler *errh = ErrorHandler::static_initialize(new FileErrorHandler(stderr, String(program_name) + ": ")); Vector<const char *> input_files; + OpenType::Tag dump_table; int query = 0; while (1) { @@ -494,6 +516,14 @@ main(int argc, char *argv[]) query = opt; break; + case DUMP_TABLE_OPT: + if (query) + usage_error(errh, "supply exactly one query type option"); + if (!(dump_table = OpenType::Tag(clp->vstr))) + usage_error(errh, "bad table name"); + query = opt; + break; + case QUIET_OPT: if (clp->negated) errh = ErrorHandler::default_handler(); @@ -575,6 +605,8 @@ particular purpose.\n"); do_query_font_version(otf, &cerrh, result_errh); else if (query == TABLES_OPT) do_tables(otf, &cerrh, result_errh); + else if (query == DUMP_TABLE_OPT) + do_dump_table(otf, dump_table, &cerrh); else if (query == INFO_OPT) do_info(otf, &cerrh, result_errh); } diff --git a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.1 index 5915060fb35..1d46a440063 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. @@ -1314,7 +1314,9 @@ translating regular "s" to long "s". Supported. .TP 5 .IR kern ", Kerning" Adjusts the space between characters (pair kerning). Generally supported, -and you should probably turn it on. +and you should probably turn it on. As a special case, "\fB\-f\fRkern" can +also read kerning information from the "kern" table in conventional +TrueType fonts. .TP 5 .IR liga ", Standard Ligatures" Activates common ligatures, such as "f_f", "f_i", "f_f_j", and (in some diff --git a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc index 88d520a948a..7c89622e9f2 100644 --- a/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc +++ b/Build/source/texk/lcdf-typetools/otftotfm/otftotfm.cc @@ -25,6 +25,7 @@ #include <efont/otfcmap.hh> #include <efont/otfname.hh> #include <efont/otfgsub.hh> +#include <efont/ttfkern.hh> #include "glyphfilter.hh" #include "metrics.hh" #include "dvipsencoding.hh" @@ -1202,8 +1203,8 @@ output_metrics(Metrics &metrics, const String &ps_name, int boundary_char, enum { F_GSUB_TRY = 1, F_GSUB_PART = 2, F_GSUB_ALL = 4, F_GPOS_TRY = 8, F_GPOS_PART = 16, F_GPOS_ALL = 32, - X_UNUSED = 0, X_BOTH_NONE = 1, X_GSUB_NONE = 2, X_GSUB_PART = 3, - X_GPOS_NONE = 4, X_GPOS_PART = 5, X_COUNT }; + X_UNUSED = 0, X_BOTH_NONE = 1, X_GSUB_NONE = 2, + X_GSUB_PART = 3, X_GPOS_NONE = 4, X_GPOS_PART = 5, X_COUNT }; static const char * const x_messages[] = { "% ignored, not supported by font", @@ -1221,7 +1222,7 @@ report_underused_features(const HashMap<uint32_t, int> &feature_usage, ErrorHand for (int i = 0; i < interesting_features.size(); i++) { OpenType::Tag f = interesting_features[i]; int fu = feature_usage[f.value()]; - String ftext = "'" + f.text() + "'"; + String ftext = errh->format("%<%s%>", f.text().c_str()); if (fu == 0) x[X_UNUSED].push_back(ftext); else if ((fu & (F_GSUB_TRY | F_GPOS_TRY)) == fu) @@ -1360,6 +1361,19 @@ do_gpos(Metrics& metrics, const OpenType::Font& otf, HashMap<uint32_t, int>& fea } static void +do_kern(Metrics& metrics, const OpenType::Font& otf, HashMap<uint32_t, int>& feature_usage, ErrorHandler* errh) +{ + OpenType::KernTable kern(otf.table("kern"), errh); + Vector<OpenType::Positioning> poss; + bool understood = kern.unparse_automatics(poss, errh); + int nunderstood = metrics.apply(poss); + + // mark as used + int d = (understood && nunderstood == poss.size() ? F_GPOS_ALL : (nunderstood ? F_GPOS_PART : 0)) + F_GPOS_TRY; + feature_usage.find_force(OpenType::Tag("kern").value()) |= d; +} + +static void do_math_spacing(Metrics &metrics, const FontInfo &finfo, const DvipsEncoding &dvipsenc) { @@ -1458,7 +1472,17 @@ do_file(const String &otf_filename, const OpenType::Font &otf, try { do_gpos(metrics, otf, feature_usage, errh); } catch (OpenType::BlankTable) { - // nada + // special case: if no GPOS and "kern" requested, look in "kern" table + if (std::find(interesting_features.begin(), interesting_features.end(), + OpenType::Tag("kern")) != interesting_features.end()) { + try { + do_kern(metrics, otf, feature_usage, errh); + } catch (OpenType::BlankTable) { + // nada + } catch (OpenType::Error e) { + errh->warning("kern %<%s%> error, continuing", e.description.c_str()); + } + } } catch (OpenType::Error e) { errh->warning("GPOS %<%s%> error, continuing", e.description.c_str()); } diff --git a/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 b/Build/source/texk/lcdf-typetools/t1dotlessj/t1dotlessj.1 index 10ffc560bb2..09070402604 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 b/Build/source/texk/lcdf-typetools/t1lint/t1lint.1 index 16aaf20f506..f9cf60d9ebe 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 b/Build/source/texk/lcdf-typetools/t1reencode/t1reencode.1 index 7c4c967e208..42b8f005cd9 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 b/Build/source/texk/lcdf-typetools/t1testpage/t1testpage.1 index c038b26eff4..c4bff5b8c52 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 b/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.1 index f2d6326e15a..74f6c2ebae4 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.78 +.ds V 2.79 .de M .BR "\\$1" "(\\$2)\\$3" .. diff --git a/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.cc b/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.cc index edb635cf67c..79b7f91894e 100644 --- a/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.cc +++ b/Build/source/texk/lcdf-typetools/ttftotype42/ttftotype42.cc @@ -136,6 +136,15 @@ fprint_sfnts(FILE *f, const String &data, bool glyf, const OpenType::Font &font) } fprint_sfnts(f, data.substring(first_offset), false, font); return; + } else if (data.length() >= 65535) { + for (int offset = 0; offset < data.length(); ) { + int next_offset = offset + 65534; + if (next_offset > data.length()) + next_offset = data.length(); + fprint_sfnts(f, data.substring(offset, next_offset - offset), false, font); + offset = next_offset; + } + return; } fputc('<', f); |